<doocs>2334.Subarray With Elements Greater Than Varying Threshold_1.py
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
def sample_funcname ( var_0 : List [ int ] , var_3 : int ) -> int :
    var_5 = len ( var_0 )
    var_7 = [ - 1 ] * var_5
    var_8 = [ var_5 ] * var_5
    var_9 = [ ]
    for var_11 , var_12 in enumerate ( var_0 ) :
        while var_9 and var_0 [ var_9 [ - 1 ] ] >= var_12 :
            var_9.pop ( )
        if var_9 :
            var_7 [ var_11 ] = var_9 [ - 1 ]
        var_9.append ( var_11 )
    var_9 = [ ]
    for var_11 in range ( var_5 - 1 , - 1 , - 1 ) :
        while var_9 and var_0 [ var_9 [ - 1 ] ] >= var_0 [ var_11 ] :
            var_9.pop ( )
        if var_9 :
            var_8 [ var_11 ] = var_9 [ - 1 ]
        var_9.append ( var_11 )
    for var_11 , var_12 in enumerate ( var_0 ) :
        var_16 = var_8 [ var_11 ] - var_7 [ var_11 ] - 1
        if var_12 > var_3 // var_16 :
            return var_16
    return - 1
