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.
for i in range(cus):
cus_shoe_size,price = map(int, input().split())
if shop[cus_shoe_size] > 0:
shop[cus_shoe_size] -= 1
earnings += price
print(earnings)
Cookie support is required to access HackerRank
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
no_of_shoes = int(input()) shoe_size = map(int, input().split()) cus = int(input())
earnings = 0
shop = Counter(shoe_size)
for i in range(cus): cus_shoe_size,price = map(int, input().split()) if shop[cus_shoe_size] > 0: shop[cus_shoe_size] -= 1 earnings += price print(earnings)