You are viewing a single comment's thread. Return to all comments →
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)
Seems like cookies are disabled on this browser, please enable them to open this website
collections.Counter()
You are viewing a single comment's thread. Return to all comments →
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)