You are viewing a single comment's thread. Return to all comments →
from collections import Counter x = input() shoeList = list(input().split()) shoeListOrg = Counter(shoeList) N = int(input()) price = list() for i in range(N): sizeAndPrice = list(input().split()) for key in shoeListOrg: if key == sizeAndPrice[0]: if shoeListOrg[key] != 0: price.append(int(sizeAndPrice[1])) shoeListOrg[key] = shoeListOrg[key] - 1 else: pass print(sum(price))
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 →