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.
collections.Counter()
collections.Counter()
Sort by
recency
|
1351 Discussions
|
Please Login in order to post a comment
print(earned)
from collections import Counter
X, shoe_sizes = input(), map(int, input().split())
inventory = Counter(shoe_sizes) earning = 0
for _ in range(int(input())): size, price = map(int, input().split()) if inventory[size]: inventory[size] -= 1 earning += price
print(earning)