comefrom: <doocs>1710.Maximum Units on a Truck_1.py
code: def maximumUnits( boxTypes: List[List[int]], truckSize: int) -> int:
      boxTypes.sort(key=lambda x: -x[1])
      ans = 0
      for a, b in boxTypes:
          a = min(a, truckSize)
          truckSize -= a
          ans += a * b
          if truckSize == 0:
              break
      return ans
masked: def sample_funcname ( var_0 : List [ List [ int ] ] , var_3 : int ) -> int :
      var_0.sort ( var_5 = lambda var_6 : - var_6 [ 1 ] )
      var_9 = 0
      for var_10 , var_11 in var_0 :
          var_10 = min ( var_10 , var_3 )
          var_3 -= var_10
          var_9 += var_10 * var_11
          if var_3 == 0 :
              break
      return var_9
  