comefrom: <doocs>1679.Max Number of K-Sum Pairs_1.py
code: def maxOperations( nums: List[int], k: int) -> int:
      nums.sort()
      l, r, ans = 0, len(nums) - 1, 0
      while l < r:
          s = nums[l] + nums[r]
          if s == k:
              ans += 1
              l, r = l + 1, r - 1
          elif s > k:
              r -= 1
          else:
              l += 1
      return ans
masked: def sample_funcname ( var_0 : List [ int ] , var_3 : int ) -> int :
      var_0.sort ( )
      var_6 , var_9 , var_10 = 0 , len ( var_0 ) - 1 , 0
      while var_6 < var_9 :
          var_11 = var_0 [ var_6 ] + var_0 [ var_9 ]
          if var_11 == var_3 :
              var_10 += 1
              var_6 , var_9 = var_6 + 1 , var_9 - 1
          elif var_11 > var_3 :
              var_9 -= 1
          else :
              var_6 += 1
      return var_10
  