collections.Counter()

  • + 0 comments

    I didnt use collections Counter

    from collections import Counter
    num_shoes = int(input())
    shoe_sizes = list(map(int, input().split()))
    num_customers = int(input())
    customer_info = list()
    
    for i in range(num_customers):
        customer_info.append(list(map(int, input().split())))
    
    total = 0
    for i in range(num_customers):
            if customer_info[i][0] in shoe_sizes:
                total = total + int(customer_info[i][1])
                shoe_sizes.remove(customer_info[i][0])
    print(total)