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.
`X=int(input())
a=list(map(int, input().split()))
N=int(input())
c=0
for i in range(N):
k=list(map(int, input().split()))
if k[0] in a:
c=c+k[1]
a.remove(k[0])
print(c)
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 →
`X=int(input()) a=list(map(int, input().split())) N=int(input()) c=0 for i in range(N): k=list(map(int, input().split())) if k[0] in a: c=c+k[1] a.remove(k[0]) print(c)