题解 | #合并表记录#
合并表记录
http://www.nowcoder.com/practice/de044e89123f4a7482bd2b214a685201
n=int(input())
dic=dict()
for _ in range(n):
k,v=list(map(lambda x:int(x),input().split()))
if k in dic:
dic[k]+=v
else:
dic[k]=v
keys=sorted(dic.keys())
res=[(key,dic[key]) for key in keys]
for item in res:
k,v=item
print(k,v)