collections.Counter() HackerRank
from collections import Counter
no_of_shoes = int(input())
shoe_size_avaialble = list(map(int,input().split()))
available_shoes = Counter(shoe_size_avaialble)
customers = int(input())
totalprice =0
for i in range (customers):
size,price=list(map(int,input().split()))
if available_shoes[size]:
totalprice=totalprice+price
available_shoes[size] -=1
print(totalprice)
Comments
Post a Comment