comefrom: <doocs>2334.Subarray With Elements Greater Than Varying Threshold_1.py
code: def validSubarraySize( nums: List[int], threshold: int) -> int:
      n = len(nums)
      left = [-1] * n
      right = [n] * n
      stk = []
      for i, v in enumerate(nums):
          while stk and nums[stk[-1]] >= v:
              stk.pop()
          if stk:
              left[i] = stk[-1]
          stk.append(i)
      stk = []
      for i in range(n - 1, -1, -1):
          while stk and nums[stk[-1]] >= nums[i]:
              stk.pop()
          if stk:
              right[i] = stk[-1]
          stk.append(i)
      for i, v in enumerate(nums):
          k = right[i] - left[i] - 1
          if v > threshold // k:
              return k
      return -1
masked: def sample_funcname ( var_0 : List [ int ] , var_1 : int ) -> int :
      var_2 = len ( var_0 )
      var_3 = [ - 1 ] * var_2
      var_4 = [ var_2 ] * var_2
      var_5 = [ ]
      for var_6 , var_7 in enumerate ( var_0 ) :
          while var_5 and var_0 [ var_5 [ - 1 ] ] >= var_7 :
              var_5.pop ( )
          if var_5 :
              var_3 [ var_6 ] = var_5 [ - 1 ]
          var_5.append ( var_6 )
      var_5 = [ ]
      for var_6 in range ( var_2 - 1 , - 1 , - 1 ) :
          while var_5 and var_0 [ var_5 [ - 1 ] ] >= var_0 [ var_6 ] :
              var_5.pop ( )
          if var_5 :
              var_4 [ var_6 ] = var_5 [ - 1 ]
          var_5.append ( var_6 )
      for var_6 , var_7 in enumerate ( var_0 ) :
          var_8 = var_4 [ var_6 ] - var_3 [ var_6 ] - 1
          if var_7 > var_1 // var_8 :
              return var_8
      return - 1
  