output_description: Print the area of the triangle ABC.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      |AB| |BC| |CA|
attempt: def takeSecond(elem):
      return elem[1]
  
  
  n, k = map(int, input().split())
  
  sushi = [list(map(int, input().split())) for i in range(n)]
  
  sushi.sort(key=takeSecond, reverse=True)
  
  selected = sushi[:k]
  kindset = set([item[0] for item in selected])
  
  startKindNum = len(kindset)
  
  score = startKindNum * startKindNum + sum([item[1] for item in selected])
  maxscore = score
  front_pointer = k - 1
  pointer = k
  for i in range(startKindNum + 1, min([k + 1, n + 1])):
      # remove the smallest one that does not decrease kind
      for p in range(front_pointer, -1, -1):
          item = selected[p]
          flag = False
          for idx in range(p):
              if selected[idx][0] == item[0]:
                  score -= item[1]
                  selected.remove(item)
                  front_pointer = p - 1
                  flag = True
                  break
          if flag:
              break
  
      # add the largest one that add kind
      for j in range(pointer, n):
          if sushi[j][0] not in kindset:
              selected.append(sushi[j])
              kindset.add(sushi[j][0])
              k += 1
              pointer = j + 1
              score += 2 * startKindNum + 1 + sushi[j][1]
              if score > maxscore:
                  maxscore = score
              startKindNum += 1
              break
  print(maxscore)
  
problem_description: Statement
  
  There is a right triangle ABC with ∠ABC=90°.
  
  Given the lengths of the three sides, |AB|,|BC| and |CA|, find the area of the
  right triangle ABC.
  
  It is guaranteed that the area of the triangle ABC is an integer.
samples: [{"input": "3 4 5", "output": "6\n    \n\n![tri](https://img.atcoder.jp/ghi/44c1d4cbdf4677ce3b08ca70b5ce98ea.png)\n\nThis triangle has an area of 6.\n\n* * *"}, {"input": "5 12 13", "output": "30\n    \n\nThis triangle has an area of 30.\n\n* * *"}, {"input": "45 28 53", "output": "630\n    \n\nThis triangle has an area of 630."}]