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_1 : int ) -> int :
      var_7 = var_2 = var_3 = var_4 = var_5 = var_6 = 0
      var_8 = len ( var_0 )
      while var_5 < var_8 :
          var_3 += var_0 [ var_5 ]
          var_4 += var_0 [ var_5 ]
          while var_7 <= var_5 and var_3 > var_1 :
              var_3 -= var_0 [ var_7 ]
              var_7 += 1
          while var_2 <= var_5 and var_4 >= var_1 :
              var_4 -= var_0 [ var_2 ]
              var_2 += 1
          var_6 += var_2 - var_7
          var_5 += 1
      return var_6
  