Skip to content

Instantly share code, notes, and snippets.

@abhinavkorpal
Created April 6, 2017 13:28
Show Gist options
  • Save abhinavkorpal/b41e6fdb4f9251d046a786006f25be90 to your computer and use it in GitHub Desktop.
Save abhinavkorpal/b41e6fdb4f9251d046a786006f25be90 to your computer and use it in GitHub Desktop.
collections.Counter()
n = input()
boots = map(int, raw_input().split())
orders = [map(int, raw_input().split()) for _ in range(input())]
result = 0
for i in orders:
if i[0] in boots:
result += i[1]
boots.remove(i[0])
print result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment