We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
import collections
numShoes = int(raw_input())
shoes = collections.Counter(map(int, raw_input().split()))
numCust = int(raw_input())
income = 0
for i in range(numCust):
size, price = map(int, raw_input().split())
if shoes[size]:
income += price
shoes[size] -= 1
print income
collections.Counter()
You are viewing a single comment's thread. Return to all comments →