You are viewing a single comment's thread. Return to all comments →
from collections import Counter X = int(input()) myList = list(map(int, input().split())) shoes = dict(Counter(myList)) N = int(input()) earnings = 0 for i in range(N): size, price = map(int,input().split()) try: if shoes[size] > 0: shoes[size] -= 1 earnings += price except KeyError: pass print(earnings)
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 →