Skip to content

Instantly share code, notes, and snippets.

@libert-xyz
Created August 3, 2016 15:35
Show Gist options
  • Select an option

  • Save libert-xyz/c9e835f51bdba1fc565c7c54fc8201ee to your computer and use it in GitHub Desktop.

Select an option

Save libert-xyz/c9e835f51bdba1fc565c7c54fc8201ee to your computer and use it in GitHub Desktop.
#08/3/16
#https://www.hackerrank.com/challenges/collections-counter
from collections import Counter
n = int(raw_input())
l = map(int,raw_input().split())
c = int(raw_input())
s = 0
for i in range(c):
p = map(int,raw_input().split())
index = 0
if Counter(l)[(p[0])] > 0:
s = s + p[1]
index = l.index(p[0])
l.pop(index)
print s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment