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.
collections.Counter()
collections.Counter()
Sort by
recency
|
1344 Discussions
|
Please Login in order to post a comment
I didnt use collections Counter
from collections import Counter
No_Shoes = int(input())
shoe = Counter(list(map(int,input().split())))
No_Customers = int(input())
Tsum=0
for i in range(No_Customers):
print(Tsum)
from collections import Counter X=int(input()) S=list(map(int,input().strip().split()[:X])) N=int(input()) lst=[] for i in range(0,N): lst.append(list(map(int,input().strip().split()[:2]))) C=Counter(S) ttl=0 for i in range(0,N): a,b=lst[i] if a in C and C[a]>0: ttl+=b C[a]-=1 print(ttl)
X=int(input())
S=list(map(int,input().split())) N=int(input()) li=[] for i in range(N): SP=[int(n) for n in input().split()] li.append(SP) summ=0 for i in li: if(i[0] in S): summ += i[1] S.remove(i[0]) print(summ)