import sys from collections import defaultdict N = int(input()) map_sc = defaultdict(int) res = 0 for _ in range(N): s,c = input().split() map_sc[(s[0:2],c)] += 1 #在字典中记录输出城市+州元组对出现的次数 # for (s,c) in map_sc.keys(): #通过> 遍历一半儿元素,防止遍历(s,c)和(c,s)计算重复 if s > c and (c,s) in map_sc.keys() : res += m...