parameters: (self, A, S)
return_statement: return result
docstring: :type A: List[int]
          :type S: int
          :rtype: int
docstring_summary: :type A: List[int]
          :type S: int
          :rtype: int
docstring_tokens: : type A : List [ int ] : type S : int : rtype : int
function: def numSubarraysWithSum(self, A, S):
          """
          :type A: List[int]
          :type S: int
          :rtype: int
          """        
          count,result = 0,0
          Map = collections.defaultdict(int)
          Map[0] = 1                
          for i in range(len(A)):
              count+=A[i]
              result+=Map[count-S]
              Map[count]+=1
          return result
function_tokens: def numSubarraysWithSum ( self , A , S ) : count , result = 0 , 0 Map = collections . defaultdict ( int ) Map [ 0 ] = 1 for i in range ( len ( A ) ) : count += A [ i ] result += Map [ count - S ] Map [ count ] += 1 return result