comefrom: <doocs>1838.Frequency of the Most Frequent Element_1.py
code: def maxFrequency( nums: List[int], k: int) -> int:
      nums.sort()
      ans = 1
      window = 0
      l, r, n = 0, 1, len(nums)
      while r < n:
          window += (nums[r] - nums[r - 1]) * (r - l)
          r += 1
          while window > k:
              window -= nums[r - 1] - nums[l]
              l += 1
          ans = max(ans, r - l)
      return ans
masked: def sample_funcname ( var_0 : List [ int ] , var_3 : int ) -> int :
      var_0.sort ( )
      var_6 = 1
      var_8 = 0
      var_9 , var_10 , var_12 = 0 , 1 , len ( var_0 )
      while var_10 < var_12 :
          var_8 += ( var_0 [ var_10 ] - var_0 [ var_10 - 1 ] ) * ( var_10 - var_9 )
          var_10 += 1
          while var_8 > var_3 :
              var_8 -= var_0 [ var_10 - 1 ] - var_0 [ var_9 ]
              var_9 += 1
          var_6 = max ( var_6 , var_10 - var_9 )
      return var_6
  