about summary refs log tree commit diff
path: root/codechef/watscore.py
blob: d45faf2035672a1bbef748abdf40f5efe24ce486 (plain) (blame)
1
2
3
4
5
#!/usr/bin/env python3
print(*(sum(dict(sorted((int(p), p in '12345678' and int(s))
                        for p, s in (input().split()
                                     for i in range(int(input()))))).values())
        for t in range(int(input()))), sep='\n')