No Idea!

  • + 0 comments

    Simple Python Solution (using counter):

    from collections import Counter
    n, m = map(int, input().split())
    arr = list(map(int, input().split()))
    A = list(set(map(int, input().split())))
    B = list(set(map(int, input().split())))
    
    counter = Counter(arr)
    ans = sum(counter[i] for i in A if i in counter) - sum(counter[i] for i in B if i in counter)
    print(ans)