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.
fromcollectionsimportCounterinput()# we don't need to store this inputl=list(map(int,input().split()))# conter to dict Objectcnt=Counter(l)# Initial price is zeroans=0foriinrange(int(input())):size,price=[int(i)foriininput().split()]ifcnt[size]>0:ans+=pricecnt.subtract({size:1})#subtractby1print(ans)
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 →
> Easy to do