import sys n = int(input()) dic = {} for i in range(n): key,value = map(int,input().split()) #数值转换 #dic[key] = dic.get(key,0) + value if key not in dic.keys(): #若从来没出现过,新增 dic[key] = value else: #若出现过,求和 dic[key] += value for each in sor...