Bootstrap

华为机试——合并表记录

n=int(input())
num=[0]*100000
for i in range(n):
    index, value=map(int, input().split())
    num[index]=num[index]+value
for index in range(100000):
    if num[index]!=0:
        print(index, end=" ")
        print(num[index], end="\n")

;