Challenge - #33 - collections.Counter()

 # Enter your code here. Read input from STDIN. Print output to STDOUT


from collections import Counter

no_of_shoes = int(input())
size_lst = map(intinput().split())
no_of_customers = int(input())

shoes = Counter(size_lst)
income = 0
for i in range(no_of_customers):
    size, price = map(intinput().split())
    if shoes[size]:
        income += price
        shoes[size] -= 1

print(income)

Comments

Popular posts from this blog

Challenge - #48 - Incorrect Regex

Challenge - #52 - Set .discard(), .remove(), & .pop()

Challenge - #43 - Time Delta