collections.Counter()

  • + 0 comments

    `X=int(input()) a=list(map(int, input().split())) N=int(input()) c=0 for i in range(N): k=list(map(int, input().split())) if k[0] in a: c=c+k[1] a.remove(k[0]) print(c)