https://school.programmers.co.kr/learn/courses/30/lessons/42889
def solution(N, stages):
answer = []
counting = 0
stages.sort()
for i in range(1, N+1):
if max(stages) < i:
answer.append([i, 0])
continue
not_clear = stages.count(i)
arrived = len(stages) - counting
counting += not_clear
answer.append([i, not_clear/arrived])
answer.sort(key=lambda x:x[1], reverse=True)
return [x[0] for x in answer]