1 class Solution: 2 def highFive(self, items: List[List[int]]) -> List[List[int]]: 3 n = len(items) 4 dic = {} 5 for item in items: 6 ids = item[0] 7 score = item[1] 8 if ids in dic: 9 dic[ids].append(score)10 else:11 dic[ids] = [score]12 result = []13 for d in dic:14 scores = sum(sorted(dic[d])[::-1][:5]) // 515 result.append([d,scores])16 return result