scores[i] = [id, score] means the player with number id once scored score points. Every player appears in the log at least five times, and records come in no particular order.
For each player, take their five best results, add them up and divide by 5 using integer division (drop the fraction).
Return a list of [id, average] pairs, one per player, sorted by id in increasing order.scores=[[2, 70], [4, 100], [2, 80], [4, 90], [2, 90], [4, 80], [2, 60], [4, 70], [2, 100], [4, 60], [2, 50]] → [[2, 80], [4, 80]]
Player 2 has six results; the best five are 100 + 90 + 80 + 70 + 60 = 400, and 400 // 5 = 80. Player 4 has exactly five: (100 + 90 + 80 + 70 + 60) // 5 = 80.
scores=[[9, 41], [9, 40], [9, 40], [9, 40], [9, 40]] → [[9, 40]]
The sum is 201, and integer division by 5 gives 40: the fraction is dropped.
len(scores) ≤ 1000scores[i] is a pair [id, score]id ≤ 1000score ≤ 100scores=[[2, 70], [4, 100], [2, 80], [4, 90], [2, 90], [4, 80], [2, 60], [4, 70], [2, 100], [4, 60], [2, 50]]
[[2, 80], [4, 80]]
Run checks the first 3 tests in your browser. Submit checks all 74 tests on the server, hidden ones included.