comefrom: <garvit244>1090_1.py
code: def largestValsFromLabels( values, labels, num_wanted, use_limit):
      sorted_values = sorted([(i, j) for i, j in zip(values, labels)], key = lambda x : x[0]*-1)
      label_used_count = {label: 0 for label in set(labels)}
      result = 0
      for s_v in sorted_values:
          if num_wanted:
              if label_used_count[s_v[1]] < use_limit:
                  result += s_v[0]
                  label_used_count[s_v[1]] +=1
                  num_wanted -= 1
          else:
              break
      return result
masked: def sample_funcname ( var_0 , var_1 , var_2 , var_3 ) :
      var_12 = sorted ( [ ( var_5 , var_6 ) for var_5 , var_6 in zip ( var_0 , var_1 ) ] , var_8 = lambda var_9 : var_9 [ 0 ] * - 1 )
      var_15 = { var_13 : 0 for var_13 in set ( var_1 ) }
      var_16 = 0
      for var_17 in var_12 :
          if var_2 :
              if var_15 [ var_17 [ 1 ] ] < var_3 :
                  var_16 += var_17 [ 0 ]
                  var_15 [ var_17 [ 1 ] ] += 1
                  var_2 -= 1
          else :
              break
      return var_16
  