풀이 집합 요소를 사용해서 풀면 되는 간단한 문제라고 생각했으며 단순히 예시에 나온 것처럼 A-B, B-A 를 더한 값을 결과로 내기엔 시간이 더 걸릴 것 같아서 교집합을 먼저 구한 다음 각 집합의 개수에 뺀 값을 더하여 문제를 해결 import sys input = sys.stdin.readline a_ln,b_ln = map(int,input().split()) a = set(map(int,input().split())) b = set(map(int,input().split())) inter = a.intersection(b) print(a_ln+b_ln-(2*len(inter)))