Medal Rankings by cornchz

import os;f,n={},os.read(0,680).split()[20:]
for x in n:f[x]=[-n[i::3].count(x)for i in 0,1,2]
for a,(b,c,d)in sorted(f.items(),key=lambda(x,y):(sum(y),y)):print a,-b,-c,-d

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return top