comefrom: <doocs>0930.Binary Subarrays With Sum_1.py
code: def numSubarraysWithSum( nums: List[int], goal: int) -> int:
      i1 = i2 = s1 = s2 = j = ans = 0
      n = len(nums)
      while j < n:
          s1 += nums[j]
          s2 += nums[j]
          while i1 <= j and s1 > goal:
              s1 -= nums[i1]
              i1 += 1
          while i2 <= j and s2 >= goal:
              s2 -= nums[i2]
              i2 += 1
          ans += i2 - i1
          j += 1
      return ans
masked: def sample_funcname ( var_0 : List [ int ] , var_3 : int ) -> int :
      var_10 = var_4 = var_5 = var_6 = var_7 = var_8 = 0
      var_12 = len ( var_0 )
      while var_7 < var_12 :
          var_5 += var_0 [ var_7 ]
          var_6 += var_0 [ var_7 ]
          while var_10 <= var_7 and var_5 > var_3 :
              var_5 -= var_0 [ var_10 ]
              var_10 += 1
          while var_4 <= var_7 and var_6 >= var_3 :
              var_6 -= var_0 [ var_4 ]
              var_4 += 1
          var_8 += var_4 - var_10
          var_7 += 1
      return var_8
  