collections.Counter()

  • + 0 comments

    without using counter

    X=int(input()) shoe_sizes=list(map(int,input().split())) N=int(input()) sum=0 for i in range(N): details=list(map(int,input().split())) if details[0] in shoe_sizes: sum=sum+details[1] shoe_sizes.remove(details[0]) print(sum)