Problem:
 Score : 200 points    Problem Statement  Niwango created a playlist of N songs.
The title and the duration of the i -th song are s_i and t_i seconds, respectively.
It is guaranteed that s_1,\ldots,s_N are all distinct.  Niwango was doing some work while playing this playlist. (That is, all the songs were played once, in the order they appear in the playlist, without any pause in between.)
However, he fell asleep during his work, and he woke up after all the songs were played.
According to his record, it turned out that he fell asleep at the very end of the song titled X .  Find the duration of time when some song was played while Niwango was asleep.      Constraints   1 \leq N \leq 50  s_i and X are strings of length between 1 and 100 (inclusive) consisting of lowercase English letters.  s_1,\ldots,s_N are distinct.  There exists an integer i such that s_i = X .  1 \leq t_i \leq 1000  t_i is an integer.         Input  Input is given from Standard Input in the following format:  N  s_1  t_1  \vdots  s_{N}  t_N  X       Output  Print the answer.        Sample Input 1 3
dwango 2
sixth 5
prelims 25
dwango      Sample Output 1 30   While Niwango was asleep, two songs were played: sixth and prelims .  The answer is the total duration of these songs, 30 .        Sample Input 2 1
abcde 1000
abcde      Sample Output 2 0   No songs were played while Niwango was asleep.  In such a case, the total duration of songs is 0 .        Sample Input 3 15
ypnxn 279
kgjgwx 464
qquhuwq 327
rxing 549
pmuduhznoaqu 832
dagktgdarveusju 595
wunfagppcoi 200
dhavrncwfw 720
jpcmigg 658
wrczqxycivdqn 639
mcmkkbnjfeod 992
htqvkgkbhtytsz 130
twflegsjz 467
dswxxrxuzzfhkp 989
szfwtzfpnscgue 958
pmuduhznoaqu      Sample Output 3 6348

Solution (Python):
n = int(input())

s=[]
t=[]

for i in range(n):
    ss,tt = input().split()
    s.append(ss)
    t.append(tt)

x = input()

ans =0
for i in range(s.index(x)+1,n):
    ans += int(t[i])

print(ans)

Solution (Python):
n=int(input())
st=[]

for i in range(n):
	st.append(input().split())

x=input()

for j in range(n):
	if st[j][0]==x:
		k=j+1
		break
ans=0
while k < n:
	ans+=int(st[k][1])
	k+=1

print(ans)

Solution (Python):
N = int(input())
s = [0]*N
t = [0]*N
for i in range(N):
  s[i],t[i] = input().split()
X = input()

a = 0

while a == 0:
  for j in range(N):
    if s[j] == X:
      a = 1
      b = j + 1


A = 0
for n in t[b:]:
  A+= int(n)
print(A)

Solution (Python):
n = int(input())
list = []
for i in range(n):
    s, t = input().split()
    list.append([s, int(t)])
x = input()

i = 0
time = 0
while list[i][0] != x:
    i += 1
else:
    for i in range(i + 1, n):
        time += list[i][1]
        i += 1
print(time)

Solution (Python):
def solve():
    N = int(input())
    s = []
    t = []
    for i in range(N):
        add_s , add_t = input().split()
        s.append(add_s)
        t.append(int(add_t))
    check = False

    X = input()
    result = 0
    for i in range(N):
        if check:
            result += t[i]
        elif s[i] == X:
            check = True
    print(result)
solve()

Solution (Python):
N = int(input())

s = [0] * N
t = [0] * N
for i in range(N):
    s[i], t[i] = input().split()
    t[i] = int(t[i])
X = input()

X_index = s.index(X)
print(sum(t[X_index+1:]))

Solution (Python):
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from bisect import bisect_right, bisect_left
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor, gamma, log
from operator import mul
from functools import reduce


sys.setrecursionlimit(2147483647)
INF = float('INF')
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 10 ** 9 + 7


n = I()
L = []
for i in range(n):
    s, t = LS()
    t = int(t)
    L += [[s, t]]


x = S()
ret = 0
for i in range(n - 1, -1, -1):
    s, t = L[i]
    if x == s:
        break
    ret += t



print(ret)

Solution (Python):
N = int(input())
play_list = []
time_sum = 0
sleep = 0
l = 51

for i in range(N):
    for j in range(1):
        song = input().split()
        play_list.append(song)

last_song = input()

for i in range(N):
    if last_song in play_list[i][0]:
        sleep = int(play_list[i][1])
        l = i
    if i >= l:
        time_sum += int(play_list[i][1])

print(time_sum - sleep)

Solution (Python):
from itertools import accumulate
n=int(input()) 
S=[]
T=[0]*n
for i in range(n):
    s,t=input().split()
    S.append(s)
    T[i]=int(t)
x=input()
Tsum=list(accumulate(T))
print(Tsum[-1]-Tsum[S.index(x)])

Solution (Python):
def solve():
    n = int(input())
    ST = []
    ans = 0
    for _ in range(n):
        s, t = input().split()
        t = int(t)
        ans += t
        ST.append([s, t])
    X = input()
    for s, t in ST:
        ans -= t
        if s == X:
            break
    print(ans)
solve()

Solution (Python):
N = int(input())
T_arr = []
S_arr = []
count = 0
while N > 0:
    S,T = (input().split())
    T_arr.append(int(T))
    S_arr.append(S)
    N -= 1
LS = input()
print (sum(T_arr[S_arr.index(LS) + 1:]))

Solution (Python):
N = int(input())
lst = []
for _ in range(N):
  lst.append(list(input().split()))
X = input()
t = 0

for i,l in enumerate(lst):
  if l[0] == X:
    for j in range(i+1,N):
      t+=int(lst[j][1])

print(t)

Solution (Python):
n=int(input())
song=[input().split() for i in range(n)]
last=input()

import numpy as np

songs = np.array(song)
b=np.argwhere(songs==last)

c=b[0]
d=c[0]


del song[:(int(d)+1)]


x=[song[i][1] for i in range(n-(d+1))]
time=[int(i) for i in x]
print(sum(time))

Solution (Python):


n_music = int(input())
music_name = []
music_time = []
for i in range(n_music):
    si, ti = input().split()
    music_name.append(si)
    music_time.append(int(ti))

asleep_music = input()

for k in range(n_music):
    if music_name[k] == asleep_music:
        break

asleep_time = 0
for j in range(n_music):
    if j > k:
        asleep_time += music_time[j]

print(asleep_time)

Solution (Python):
n = int(input())
l = [input().split() for _ in range(n)]
f = 0
x = input()
ans = 0
for a,b in l:
  if f:
    ans += int(b)
  elif x == a:
    f = 1
print(ans)

Solution (Python):
N = int(input())
S = [None for _ in range(N)]
T = [None for _ in range(N)]

for n in range(N):
    s, t = input().split()
    S[n] = s
    T[n] = int(t)

X = input()

is_sleep = False
sleep_t = 0
for n in range(N):
    if is_sleep:
        sleep_t += T[n]
    if S[n] == X:
        is_sleep = True

print(sleep_t)

Solution (Python):
N = int(input().rstrip())
src = [list(input().split()) for _ in range(N)]
for row in src:
    row[1] = int(row[1])
X = input()

total = 0
for row in src:
  total += row[1]

awake = 0
for row in src:
    if row[0] != X:
      awake += row[1]
    else:
      awake += row[1]
      break
ans = total - awake
print(ans)

Solution (Python):
N = int(input())
s_list = []
t_list = []

for i in range(N):
  s, t = input().split()
  s_list.append(s)
  t_list.append(int(t))

x = input()

result = 0
for i in range(N):
  if s_list[i] == x:
    result = i

print(sum(t_list[result + 1::]))

Solution (Python):
n=int(input())
s=[]
t=[]

ans=0

for i in range(n):
    ss,tt=input().split()
    s.append(ss)
    t.append(int(tt))
X=input()

for i in range(s.index(X)+1,n):
    ans+=t[i]

print(ans)

Solution (Python):
N=int(raw_input())

S = ["" for i in range(N)]
T = [0 for i in range(N)]

for i in range(N):
    s = raw_input().split()
    S[i] = s[0]
    T[i] = int(s[1])



X = raw_input()

sleep = 0
time = 0
for i in range(N):
    if sleep == 1:
        time += T[i]
    elif S[i] == X:
        sleep = 1

print time

Solution (Python):
n = int(input())
s, t = [], []
for i in range(n):
    a, b = input().split()
    s += [a]
    t += [int(b)]
x = input()
i = s.index(x)
print(sum(t[i+1:]))

Solution (Python):
N = int(input())
ST = [list(input().split()) for i in range(N)]
X = input()
S = [ ST[i][0] for i in range(N)]
time = [int(ST[i][1]) for i in range(N)]


idx = S.index(X)

print(sum(time[idx+1:]))

Solution (Python):
n = int(input())
playlist = [(input().split()) for _ in range(n)]
last = input()

flag = 0
total = 0
for title, time in playlist:
  if flag == 1:
    total += int(time)
  if title == last:
    flag = 1
    
print(total)

Solution (Python):
import sys
lines = sys.stdin.readlines()
n = lines.pop(0)
e = lines.pop(-1).strip()
r = 0
s = False
for l in lines:
    l = l.strip()
    n, t = l.split(' ')
    if s:
        r += int(t)
    elif n == e:
        s = True
print(r)

Solution (Python):

N = int(input().strip())


grid = []

z = 0
flag = '0'

for i in range(N):
    array = list(map(str, input().strip().split()))
    grid.append(array)

X = input()

for s, t in grid:
    if flag == '1':
        z += int(t)
    if s == X:
        flag = '1'

print(z)

Solution (Python):
N = int(input())
playlist = []
for i in range(N):
    s, t = list(input().split())
    playlist.append([s, int(t)])
X = input()

time = 0
is_sleep = False
for s, t in playlist:
    if is_sleep:
        time += t
    if s == X:
        is_sleep = True

print(time)

Solution (Python):
n = int(input())
s_rec = []
t_rec = []
for sub_n in range(n):
    s, t = input().split()
    s_rec.append(s)
    t_rec.append(int(t))
x = input()
for i in range(n):
    if x == s_rec[i]:
        print(sum(t_rec[i+1:]))
        break

Solution (Python):
n = input()
n = int(n)
s = []
t = []
for i in range(n):
  tmp = input().split(" ")
  s.append(tmp[0])
  t.append(int(tmp[1]))

tgt = input()

nm = s.index(tgt)
print(sum(t[(nm+1): ]))

Solution (Python):
N = int(input())
T = [list(map(str, input().split())) for _ in range(N)]
X = input()

ans = 0
flag = 0
for t in T:
	if flag == 0:
		pass
	else:
		ans+=int(t[1])
		
	if t[0] == X:
		flag = 1
		
print(ans)

Solution (Python):
if __name__ == '__main__':
    _n = input()
    n = int(_n)

    songs = [("", 0)] * n
    for i in range(n):
        inp = input().split()
        songs[i] = (inp[0], int(inp[1]))

    x = input()

    start = 0

    for i in range(0, len(songs)):
        s, _ = songs[i]
        if s == x:
            start = i + 1
            break

    res = 0
    for i in range(start, len(songs)):
        _, t = songs[i]
        res += t

    print(res)

Solution (Python):
def main():
    N = int(input())
    lst = []
    for _ in range(N):
        name, time = input().split()
        lst.append((name, int(time)))
    x = input()

    total = 0
    for n, t in reversed(lst):
        if n == x:
            break
        total += t

    print(total)


if __name__ == "__main__":
    main()

Solution (Python):
import os


N = int(input())

sts = []
for i in range(N):
    s, t = input().split()
    sts.append( (i, s, int(t)))

s_ = input()

ist = [ i for i, s, t in sts if s == s_]

i = ist[0]

ans = 0
for k in range(i+1, len(sts)):
    ans += sts[k][2]

print(ans)

Solution (Python):
N = int(input())
t = list()
l= list()
for i in range(N):
  tmp = input().split(" ")
  t.append(tmp[0])
  l.append(int(tmp[1]))
d = input()
rec = 0
ans = 0
for i in range(N):
  if rec==1:
    ans += l[i]
  if t[i] == d:
    rec=1
print(ans)

Solution (Python):
import numpy as np

N, = map(int, input().split())
titles = [None] * N
total_durations = np.zeros(N+1, dtype=np.int)

for i in range(N):
	title, duration = input().split()
	duration = int(duration)
	
	titles[i] = title
	total_durations[i+1] = total_durations[i] + duration

X, = map(str, input().split())
falling_asleep_index = titles.index(X)
print(
	total_durations[N]
	- total_durations[falling_asleep_index+1])

Solution (Python):
musics = []
times = []

n = int(input())

for i in range(n):
    s, t = input().split()
    musics.append(str(s))
    times.append(int(t))

x = str(input())

sleep = musics.index(x)

ans = sum(times) - sum(times[0:sleep+1])
print(ans)

Solution (Python):
N=int(input())
Ss = []
Ts = []
for _ in range(N):
    S,T = input().split()
    Ss.append(S)
    Ts.append(int(T))

END = input()

r = 0
while Ss[-1] != END:
    r += Ts.pop()
    Ss.pop()
print(r)

Solution (Python):
def resolve():
    N = int(input())
    song_list = [input().split() for _ in range(N)]
    sleep_song = input()
    flag = False
    sleep_time = 0
    for name, time in song_list:
        if flag:
            sleep_time += int(time)
        if name == sleep_song:
            flag = True

    print(sleep_time)
resolve()

Solution (Python):
import sys
input=sys.stdin.readline
n=int(input())
k=[]
for _ in range(n):
    s,t=input().split()
    s.rstrip()
    t=int(t)
    k.append((s,t))
x=input().rstrip()
ans=0
for i in k:
    ans+=i[1]
    if i[0]==x:
        break
s=0
for i in k:
    s+=i[1]
print(s-ans)

Solution (Python):
N = int(input())
playlist = []
for i in range(N):
	playlist += input().split()
X = input()
index = playlist.index(X) + 1
ans = 0
for i in range(index+2,N*2,2):
	ans+=int(playlist[i])
print(ans)

Solution (Python):
N=int(input())
s=['']*N
t=[0]*N
for i in range(N):
    s[i],t[i]=input().split()
X=str(input())
switch=0
total=0
for i in range(N):
    if X==s[i]:
        switch=1
        total-=int(t[i])
    if switch==1:
        total+=int(t[i])
print(total)

Solution (Python):
N = int(input())
song = []
for i in range(N):
    s, t = map(str, input().split())
    song.append([s, int(t)])
X = input()
start = False
sleep = 0
for i in song:
    if start:
        sleep = sleep + i[1]
    if i[0] == X:
        start = True
print(sleep)

Solution (Python):
n = int(input())
st = [list(input().split()) for _ in range(n)]
x = input()

ans = 0
flag = False

for s,t in st:
    if flag:
        ans += int(t)
    if s == x:
        flag = True

print(ans)

Solution (Python):

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
n = int(readline())
s = []
t = []
for i in range(n):
    p,q = map(str,input().split())
    s.append(p)
    t.append(int(q))
x = input()

idx = s.index(x)

print(sum(t[idx+1:]))

Solution (Python):
n=int(input())
ss_and_ts=[input().split() for _ in range(n)]
x=input()

res=0
flg=False
for s,t in ss_and_ts:
  if flg:
    res+=int(t)
  elif x==s:
    flg=True
print(res)

Solution (Python):
n = int(input())
playlist = [[s for s in input().split()] for _ in range(n)]
x = input()

flag = False
ans = 0
for i in range(n):
    if flag:
        ans += int(playlist[i][1])
    else:
        if playlist[i][0] == x:
            flag = True

print(ans)

Solution (Python):
N = int(input())
musics = []
dict_musics = {}
for i in range(N):
  a, b = map(str,input().split())
  musics.append([a,int(b)])
  dict_musics[a] = int(b)
X = input() 

times = []
for i in range(N): times.append(musics[i][1])
print(sum(times[times.index(dict_musics[X])+1:]))

Solution (Python):
n = int(input())
s_t = list()
for i in range(n):
  s, t = input().split()
  s_t.append([s, int(t)])
x = input()

for i in range(n):
  if s_t[i][0] == x:
    print(sum(t_[1] for t_ in s_t[i+1:]))

Solution (Python):
n = int(input())

s = []
t = []
tsum = 0

for i in range(n):
    a, b = map(str, input().split())
    b = int(b)
    s = s + [a]
    t = t + [b]
    tsum += t[i]

x = input()
tinter = 0

for j in range(n):
    tinter = tinter + t[j]
    
    if s[j] == x:
        break
        
print(tsum - tinter)

Solution (Python):
from sys import stdin
n = int(stdin.readline().rstrip())
a = [stdin.readline().rstrip().split() for _ in range(n)]
x = [stdin.readline().rstrip() for _ in range(n)][0]

k = 0
for i in range(len(a)):
  name = a[i][0]
  time = a[i][1]
  if name == x:
    k = i
  else:
    pass
s = 0 
for i in range(len(a)):
  if i <= k:
    pass
  else:
    s = s + int(a[i][1])
print(s)

Solution (Python):
def main():
    N = int(input())
    n = 1
    slist = []
    tlist = []
    while n <= N:
        s,t = input().split()
        s_n = str(s)
        t_n = int(t)
        slist.append(s_n)
        tlist.append(t_n)
        n += 1
    X = str(input())
    x = slist.index(X)
    sec = 0
    if x+1 < len(tlist):
        for i in range(x+1,len(tlist)):
            sec += tlist[i]
    print(sec)



if __name__ == '__main__':
    main()

Solution (Python):
n=int(input())
s=[0]*n
t=['0']*n
c=0
for i in range(n):
    s[i],t[i]=input().split()
    t[i]=int(t[i])
x=input()
a=s.index(x)
for i in range(a+1,n):
    c+=t[i]
print(c)

Solution (Python):

N = input()


Song_List = []
for i in range (int(N)):
    Song_List.append(list(input().split()))

X = input()
ans = 0
for i in range(int(N)):
    if Song_List[i][0] == X:
        if i < int(N):
            for i in range(i,int(N)-1):
                ans +=int(Song_List[i+1][1])
        else:
            continue
    else:
        continue
print(ans)

Solution (Python):
N = int(input())
ST = [input().split() for _ in range(N)]
X = input()

flag = False
ans = 0
for s, t in ST:
  if flag:
    ans += int(t)
  elif s == X:
    flag = True

print(ans)

Solution (Python):
N = int(input())
S=[]
T=[]
for _ in range(N):
    s,t=input().split()
    S.append(s)
    T.append(int(t))
X=input()
index = S.index(X)
print(sum(T[index+1:]))

Solution (Python):
N = int(input())
music_list = [input().split() for i in range(N)]
X = input()


ans = 0
flag = False
for i in music_list:
    if i[0] == X:
        flag = True
    elif flag:
        ans += int(i[1])
print(ans)

Solution (Python):
n = int(input())
s = []
t = []
for i in range(n):
    l = input().split()
    s.append((l[0]))
    t.append(int(l[1]))
x = input()
ans=0
for i in range(s.index(x)+1,n):
    ans += t[i]
print(ans)

Solution (Python):
t=int(input())
p=t
a,b=[],[]
while(t):
  n, m =map(str, input().split())
  a.append(n)
  b.append(m)
  t-=1
s=str(input())
m,ans=0,0
m=a.index(s)
for i in range(m+1,p):
    ans+=int(b[i])
print(ans)

Solution (Python):
N = int(input())

s = []
t = []

for i in range(N):
    s_i, t_i = input().split()
    s.append(s_i)
    t.append(int(t_i))

X = input()

total = 0
flag = 0

for i in range(N):
    if flag == 1:
        total += t[i]
    if s[i] == X:
        flag = 1

print(total)

Solution (Python):
n = int(input())

grid = []
for i in range(n+1):
  grid.append(input())

b = grid[-1]
flag = True
work_time = 0
total_time = 0

for i in grid:
  if i == b:
    break
  c,d = i.split()
  total_time += int(d)
  if c == b:
    work_time += int(d)
    flag = False
  if flag:
    work_time += int(d)

print(str(total_time - work_time))

Solution (Python):


n = int(input())
s_list = []
t_list = []

for i in range(n):
    s,T = map(str,input().split())
    t = int(T)

    s_list.append(s)
    t_list.append(t)

x = input()
inemuri = False
inemuri_t = 0

for j in range(n):
    if inemuri:
        inemuri_t += t_list[j]
    
    if x == s_list[j]:
        inemuri = True

print(inemuri_t)

Solution (Python):
n = int(input())
lst = []

for i in range(n):
  a, b = input().split()
  b = int(b)
  lst.append([a, b])
x = input()
sum_time = 0
flag = False
for i in lst:
  if flag:
    sum_time += i[1]
  if i[0] == x:
    flag = True
print(sum_time)

Solution (Python):
N = int(input())

st_list = []
for i in range(N):
  s, t = input().split()
  t = int(t)
  st_list.append([s, t])

X = input()

for i in range(N):
  if X == st_list[i][0]:
    j = i
    break

ans = 0
for i in range(j + 1, N):
  ans = ans + st_list[i][1]

print(ans)

Solution (Python):
number_of_music=int(input())
music_counter=0
music_dict={}
dict_counter=number_of_music
while dict_counter > 0:
  music_counter+=1
  input_string=input().split()
  music_dict[music_counter]={input_string[0]:input_string[1]}
  dict_counter-=1
start_music=input()

counter_start=0
music_counter=0
dict_counter=number_of_music
while dict_counter > 0:
  music_counter+=1
  for key,value in music_dict[music_counter].items():
    if key==start_music:
      counter_start=music_counter
      break
  dict_counter-=1
result=0
dict_counter=number_of_music
while dict_counter > 0 and counter_start < number_of_music:
  counter_start+=1
  for key,value in music_dict[counter_start].items():
    result+=int(value)
  dict_counter-=1
print (result)

Solution (Python):
N = int(input())
s_list=[]
t_list=[]
for i in range(N):
    s, t = input().split()
    s_list.append(s)
    t_list.append(int(t))
X = str(input())

u = t_list[s_list.index(X)+1:]
s = 0
for i in range(len(u)):
    s = s + u[i]
print(s)

Solution (Python):
def main():
    N = int(input())
    music = []
    m_time = []
    for _ in range(N):
        a, b = input().split()
        music.append(a)
        m_time.append(int(b))
    X = input()
    ans = 0
    for i, a in enumerate(music):
        if a == X:
            for j in range(i+1, N):
                ans += m_time[j]
    print(ans)
main()

Solution (Python):
n = int(input())
song = []
for i in range(n):
    song.append(input().split(" "))
all_song = song.copy()
x = input()
last = 1
time = 0
num = len(song)
for song in song:
    if last == num:
        break
    if song[0] == x:
        for song in all_song[last:]:
            time += int(song[1])
        break
    last += 1
print(time)

Solution (Python):
inpl = lambda: list(map(int,input().split()))
N = int(input())
st = []
for i in range(N):
    k = input().split()
    st.append((k[0],int(k[1])))
X = input()
i = 0
while st[i][0] != X:
    i += 1
ans = 0
for j in range(i+1,N):
    ans += st[j][1]
print(ans)

Solution (Python):
n = int(input())
l = {}
for i in range(0,n):
    
    line = input()
    l[i] = line.strip().split()
x = str(input())
time = 0

for i in range(0,n):
    if l[i][0] == x:
        l.pop(i)
        break
    l.pop(i)

for i in l:
    time += int((l[i][1]))

print (time)

Solution (Python):
N = int(input())
playlist = list()
for i in range(N):
    s, t = input().split()
    playlist.append([s, int(t)])
X = input()


total = 0
found = False
for s, t in playlist:
    if found:
        total += t
    if s == X:
        found = True
print(total)

Solution (Python):



a = int(input())
l = [list(input().split()) for i in range(a)]
b = input()
c = 0
ll = []

for _,i in enumerate(l):
  if b == i[0]:
    c += 1
    break
  c += 1

del l[0:c]
for i in l:
    ll.append(i[1])

lll = [int(s) for s in ll]
print(sum(lll))

Solution (Python):
import numpy as np

n = int(input())
playlist = []
for i in range(n):
  s, t = input().split()
  playlist.append([s, int(t)])
x = input()

arr = np.array(playlist)
position = tuple(nd[0] for nd in np.where(arr == x))[0]

arr_num = arr[:, 1].astype(int)

if position - 1 == n:
  print(0)
else:
  print(arr_num[position + 1:].sum())

Solution (Python):
N = int(input())
playlist = []
playtime = []
for n in range(N):
  hoge = input().split()
  playlist.append(hoge[0])
  playtime.append(int(hoge[1]))
X = input()
print(sum(playtime[playlist.index(X)+1:]))

Solution (Python):
N=int(input())
S=[]
T=[]
for i in range(N):
  s,t=input().split()
  S.append(str(s))
  T.append(int(t))
X=str(input())

triger=0
j=0
A=0
for i in S:
  if triger==1:
    A+=T[j]
  if i==X:
    triger=1
  j+=1
print(A)

Solution (Python):
N=int(input())
S=[0]*N
T=[0]*N
for i in range(N):
    S[i],T[i]=input().split()
    T[i]=int(T[i])
X=str(input())
count=0
for i in S:
    count+=1
    if(X==i):
        break
    else:
        pass
print(sum(T[count:N]))

Solution (Python):

def main():
    n = int(input())
    s = []
    t = []
    for _ in range(n):
        s_i, t_i = input().split()
        s.append(s_i)
        t.append(int(t_i))
    x = input()
    print(sum(t[s.index(x) + 1:]))
if __name__ == "__main__":
    main()

Solution (Python):
import sys


def main():
    n = int(input())
    s = []
    t = []
    for i in range(n):
        tmp = input().split()
        if len(tmp):
            s.append(str(tmp[0]))
            t.append(int(tmp[1]))
    x = input()
    tmp = s.index(x.replace("\n", ""))
    res = 0
    for i in range(tmp+1, n):
        res += t[i]
    print(res)


if __name__ == '__main__':
    input = sys.stdin.readline
    main()

Solution (Python):
N=int(input())
S=[]
T=[]
for i in range(1,N+1):
    s, t=input().split()
    S.append(s)
    T.append(t)
X=input()
T = [int(n) for n in T]

for i in range(N):
    if S[i] == X:
        if i == N:
            c=0
        else:
            c=sum(T[i+1:N+1])
            break

print(c)

Solution (Python):
n=int(input())
t=[""]*n
sec=[0]*n
for k in range(n):
  s=input().split()
  t[k]=s[0]
  sec[k]=int(s[1])
x=input()
p=t.index(x)
a=0
if p!=n:
  for l in range(p+1,n):
    a+=sec[l]
print(str(a))

Solution (Python):
import numpy as np

def solve_a():
    
    N = int(input())

    
    list_S = []
    list_T = []

    for i in range(N):
        s, t = input().split()
        list_S.append(s)
        list_T.append(int(t))
    
    sentense = input()

    idx = list_S.index(sentense)

    sum_time = 0
    for i in range(idx + 1, N):
        sum_time = sum_time + list_T[i]

    print(sum_time)

def main():
    solve_a()

if __name__ == "__main__":
    main()

Solution (Python):
t=int(input())
name=[]
time=[]
for _ in range(t):
  args=list(input().split())
  name.append(args[0])
  time.append(int(args[1]))
s=input()
ind=name.index(s)
print(sum(time[ind+1:]))

Solution (Python):

n = int(input())
ts, tt = list(input().split())
s = [ts]
t = [int(tt)]
for i in range(1, n):
    ts, tt = list(input().split())
    s.append(ts)
    t.append(t[i-1] + int(tt))
x = input()

ans = 0
for i in range(n-1):
    if s[i] == x:
        ans = t[n-1] - t[i]
        break

print(ans)

Solution (Python):
n = int(input())
s = []
t = []
for i in range(n):

    a = input().split(' ')
    _s = a[0]
    _t = int(a[1])

    s.append(_s)
    t.append(_t)

x = input()

idx_last = s.index(x)

playedsongs = sum(t[idx_last + 1:])

print(playedsongs)

Solution (Python):
N=input()
name=[]
sec=[]
for i in range(int(N)):
  p=input()
  plist=p.split(" ")
  name.append(plist[0])
  sec.append(plist[1])
X=input()
flag=0
sec_total=0
for i in range(int(N)):
  if(flag==1):
    sec_total+=int(sec[i])
  if(X==name[i]):
    flag=1
print(sec_total)

Solution (Python):
a = int(input())
b = []
c = 0
y = ""
for i in range(a):
    b.append(input().split(' '))
    
x = input()

for i,j in b:
    if y == "x":
        c = c + int(j)
    
    
    if str(x) == str(i):
        y = "x"
print(c)

Solution (Python):
N = int(input())
s = []
t = []
for _ in range(N):
  st = input().split()
  s.append(st[0])
  t.append(int(st[1]))
X = input()
index = s.index(X)
print(sum(t[index+1:]))

Solution (Python):
n = int(input())
li = list(range(n))
lis = list(range(n))
for i in range(n):
    s_i, t_i = map(str, input().split())
    li[i] = s_i
    lis[i] = int(t_i)
x = input()
counter = 0
while x != li[counter]:
    counter = counter+1
    i = counter+1
counter=counter+1
su = 0
while counter != n:
    su = su+lis[counter]
    counter=counter+1
print(su)

Solution (Python):
N = int(input())
s = [0] * N
t = [0] * N
for i in range(N):
  s[i],t[i] = input().split()
X = input()
flg = 0
sum = 0
for i in range(N):
  if (s[i] == X) & (flg == 0):
    flg = 1
  elif flg == 1:
    sum += int(t[i])
print(sum)

Solution (Python):


from collections import OrderedDict

n = int(input())
dic = OrderedDict()

for i in range(n):
    l,d = list(map(str,input().split()))
    dic[l] = d

a = str(input())

flag = False
time = 0

for key,value in dic.items():
    if flag == False:
        if key == a:
            flag = True
    else:
        time += int(value)

print(time)

Solution (Python):
n = int(input())
s = [0]*n
t = [0]*n
for i in range(n):
  s[i], t[i] = map(str, input().split())
t = [int(s) for s in t]
x = input()

total_t = sum(t)
end = s.index(x)
total_ex = sum(t[0:end+1])

print(total_t - total_ex)

Solution (Python):
in1 = int(input())
in2 = [input().strip().rsplit(" ") for i in range(in1)]
in3 = input()
time = 0 

in2a = list(zip(*in2))

inde = in2a[0].index(in3)

for times in range(inde+1, in1):
    time += int(in2[times][1])
print(time)

Solution (Python):
N=int(input())
S=[]
M=[]
for i in range(N):
  s,m=map(str,input().split())
  S+=[s]
  M+=[int(m)]
A=str(input())

answer=sum(M)
for i in range(N):
  answer -=M[i]
  if S[i]==A:
    print(answer)
    exit()
print(0)

Solution (Python):
n=int(input())
s=[]
t=[]
for i in range(n):
    li=input().split()
    s.append(li[0])
    y=int(li[1])
    t.append(y)
x=input()
flg=False
ans=0
for j in range(n):
    if flg:
        ans+=t[j]
    if s[j]==x:
        flg=True
print(ans)

Solution (Python):
N = int(input())
A = [[x for x in input().split()] for i in range(N)]
X = input()
B = [i[0] for i in A]
C = [i[1] for i in A]

ans = 0
for i in C[B.index(X)+1:]:
  ans += int(i)
print(ans)

Solution (Python):
n=int(input())
l=[]
for _ in range(n):
    l.append(input().split())
x=input()
ll=list(l[i][0] for i in range(n))
lll=list(int(l[i][1]) for i in range(n))
k=ll.index(x)
print(sum(lll[k+1:n]))

Solution (Python):
n = int(input())
ls = []
lt = []
for i in range(n):
    s,t =input().split()
    lt.append(int(t))
    ls.append(s)
x = input()
del lt[:ls.index(x)+1]
print(sum(lt))

Solution (Python):
n = int(input())
s_t = list(list(input().split()) for _ in range(n))
x = input()

for r in s_t:
    r[1] = int(r[1])

sum = 0
wk = 0
for i in range(n):
    sum += s_t[i][1]
    if x == s_t[i][0]:
        wk = sum
print(sum - wk)

Solution (Python):
n = int(input())
s = []
t = []

for i in range(n):
	tmp = input().split()
	s.append(tmp[0])
	t.append(int(tmp[1]))
x = input()

for i in range(n):
	if s[i] == x :
		a = i+1
		break

ans = 0
if a != n:
	for i in range(a, n):
		ans += t[i]
else:
	ans = 0

print(ans)

Solution (Python):


N=int(input())
s_title=[]
time=[]
for i in range(N):
    s,t=input().split()
    s_title.append(s)
    time.append(int(t))
    


X=input()


sleep=0
for j in range(len(s_title)):
  if X == s_title[j]:
    sleep = j
    
    break

sum = 0
for k in range(sleep+1, N):
  sum = sum + time[k]

print(sum)

Solution (Python):
N = int(input())
s = []
t = []
for i in range (N):
  inin = input().split()
  s.append(str(inin[0]))
  t.append(int(inin[1]))
X = str(input())

k = False
Ans = 0
for i in range(N):
  if k == True:
    Ans += t[i]
  if s[i] == X:
    k = True
    
print(Ans)

Solution (Python):
N = int(input())
song = []
for i in range(N):
    s, t = map(str, input().split())
    song.append([s, int(t)])
X = input()
start = False
sleep = 0
for i in song:
    if start:
        sleep = sleep + i[1]
    if i[0] == X:
        start = True
print(sleep)

Solution (Python):
N = int(input())
song = [0] * N
time = [0] * N
for i in range(N):
    song[i], time[i] = map(str, input().split())
time = [int (t) for t in time]
X = input()
res = 0
Sleep = song.index(X)
Played = time[Sleep+1::]
for time in Played:
    res = res + time
print(res)

Solution (Python):
import math
import itertools
import fractions
import heapq
import collections
import bisect
import sys

sys.setrecursionlimit(10**9)
mod = 998244353
inf = 10**20

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()

n = I()
s = []
t = []
for i in range(n):
    S,T = LS()
    s.append(S)
    t.append(int(T))
x = input()

idx = s.index(x)
if idx==n-1:
    print(0)
    exit()
print(sum(t[idx+1:]))