Harryxun/stf_run huggingface dataset:
N, K = map(int, input().split())
A = [0] + list(map(int, input().split()))

stack = [1]
s = {1}

def dfs(a, k):
  global stack
  global s
  if k == 0:
    return a
  next_a = A[a]
  if next_a in s:
    idx = stack.index(next_a)
    n = len(stack)
    k = (k - 1)%(n - idx)
    return stack[idx + k]
  else:
    stack.append(next_a)
    s.add(next_a)
    res = dfs(next_a, k-1)
  return res

print(dfs(1, K))

### FIXED CODE ###

N, K = map(int, input().split())
A = [0] + list(map(int, input().split()))

d = {1:0}
pre_a = 0
a = 1
c = 0
while K:
    K -= 1
    next_a = A[a]
    c += 1
    if next_a in d:
        idx = d[next_a]
        n = len(d)
        K %= (n - idx)
        K += 1
        break
    else:
        d[next_a] = c
        pre_a = a
        a = next_a

while K:
    pre_a = a
    a = A[a]
    K -= 1

print(a)
n,l = map(int,input().split())

D=[]
for i in range(n):
    d = l+i
    D.append(d)

if l>-1 :
    mind = D[0]
elif l+n<0:
    mind = D[n-1]
else:
    mind = 0


ans = sum(D)-mind
print(ans

### FIXED CODE ###

n,l = map(int,input().split())

D=[]
for i in range(n):
    d = l+i
    D.append(d)

if l+1>0 :
    mind = min(D)
elif l+n<=0:
    mind = max(D)
else:
    mind = 0


ans = sum(D)-mind
print(ans)
# -*- coding: utf-8 -*-

rate = int(input("Enter your rate: "))

if rate < 1200:
    print("ABC")
elif rate >= 1200 and rate < 2800:
    print("ARC")
elif:
    print("AGC")

### FIXED CODE ###

r = int(input())

if r < 1200:
    print("ABC");
elif r < 2800:
    print("ARC")
else:
    print("AGC")
import math
def lcm(a, b):
    return (a*b)//math.gcd(a,b)
n = int(input())
ans = 1
for i in range(n):
    tmp = int(input())
    ans=lcm(ans,tmp)
print(ans)

### FIXED CODE ###

def gcd(a, b):
    if (b == 0):
        return a
    return gcd(b,a%b)

def lcm(a, b):
    return (a * b) // gcd(a, b)


n = int(input())
ans = 1
for i in range(n):
    tmp = int(input())
    ans = lcm(ans, tmp)
print(ans)
# coding UTF-8
# 
# problem C
# 

import pandas as pd

t = []
N, M = map(int, input().split())
for i in range(M):
    t.append(tuple(input().split(' ')))

df = pd.DataFrame(t, columns=['p', 'S'])
alist = df.groupby('p')['S'].apply(list)

print(df)
print(alist)

print(alist[0])

print(alist.apply(lambda d: d[:d.index('AC')))

c = 0
NG = 0
for i in range(M):
    try:
        k = alist[i].index('AC')
    except:
        NGtmp = alist[i].count('WA')
        NG = NG + NGtmp
    else:
        NGtmp = alist[:k].count('WA')
        c = c + 1
        NG = NG + NGtmp

print('%s %s'%(c, NG))
    



### FIXED CODE ###

import sys

readline = sys.stdin.readline

def main():
    N, M = map(int, readline().split())
    aclist = [0] * N
    wrongcount = [0] * N
    for _ in range(M):
        p, S = readline().split()
        q = int(p)-1
        if aclist[q] == 0 and S == 'WA':
            wrongcount[q] += 1
        if S == 'AC':
            aclist[q] = 1

    pena = 0
    for i in range(N):
        if aclist[i] == 1:
            pena += wrongcount[i]
    ac = sum(aclist)

    print(ac, pena)


if __name__ == "__main__":
    main()
score = [1800,1600,1400,1200,1000, 800, 600, 400]
ranks = [   1,   2,   3,   4,   5,   6,   7,   8]

x = int(input())
i = 0

while(x <= score[i]):
      i += 1

print(ranks[i])


### FIXED CODE ###

score = [1800,1600,1400,1200,1000, 800, 600, 400]
ranks = [   1,   2,   3,   4,   5,   6,   7,   8]

x = int(input())
i = 0

while(x < score[i]):
      i += 1

print(ranks[i])
n,d=map(int,input().split())
if(d>=10){
print(1)
}else{
x=2*d+1
print(int(n/x)+1)
}


### FIXED CODE ###

n,d=map(int,input().split())
x=2*d+1
if(n%x!=0):
    print(int(n/x)+1)
else:
    print(int(n/x))
from math import gcd

def lcm(a, b):
    return abs(a*b) / gcd(a, b)

a, b = map(int, input().strip().split(" "))

print(int(lcm(a, b)))

### FIXED CODE ###


def gcd(a, b):
    while b != 0:
        t = b
        b = a % b
        a = t
    return a

def lcm(a, b):
    return abs(a*b) / gcd(a, b)

a, b = map(int, input().strip().split(" "))

print(int(lcm(a, b)))
T = list(input())
 
for i in range(len(T)):
  if T[i] == "?":
    if T[i+1] == "?":
      T[i] = "P"
      T[i+1] = "D"
    elif T[i+1] == "D":
      T[i] = "P"
    else:
      T[i] = "D"
      
print("".join(T))

### FIXED CODE ###

T = list(input())
 
for i in range(len(T)):
  if T[i] == "?":
    if 1 <= i and T[i-1] == "P":
      T[i] = "D"
    elif i < len(T)-1 and T[i+1] == "?":
      T[i] = "P"
      T[i+1] = "D"
    elif i < len(T)-1 and T[i+1] == "D":
      T[i] = "P"
    else:
      T[i] = "D"
      
print("".join(T))
import heapq
n,m=map(int, input().split())
s = [list(map(int, input().split())) for i in range(n)]
q = []
ans=0

for k in range(m-1,-1,-1):
    while True:
        if s!=[]:
            #最小値を返す
            p=heapq.heappop(s)
            if p[0]+k<=m:
                #heappush(list,item) listの葉にitemを追加して小さい要素を上に持ち上げる
                heapq.heappush(q,-p[1])
            else:
                heapq.heappush(s,p)
                break
        else:
            break
        if q!=[]:
            #最小値をヒープから取り出す
            p=heapq.heappop(q)
            ans+=-p
print(ans)




### FIXED CODE ###

a,b=map(int, input().split())
print(max(a+b,a-b,a*b))
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, atan, degrees
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from bisect import bisect
import heapq
import numpy as np

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

def main():
	s = input()
	t = input()
	if len(set(s)&set(t)) != len(set(t)):
		print(-1)
		exit()

	dic = defaultdict(int)
	for i, char in enumerate(s):
		if not dic[char]:
			dic[char] = i+1

	t_num = list(t)
	for i in range(len(t)):
		t_num[i] = dic[t[i]]
	
	loop = 0
	tmp = t_num[0]
	t_num = t_num[1:]
	for n in t_num:
		if n <= tmp:
			loop += 1
		tmp = n

	print(len(s)*loop+t_num[-1])

if __name__ == '__main__':
	main()


### FIXED CODE ###

import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, atan, degrees
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from bisect import bisect, bisect_left
import heapq
import numpy as np

def input(): return sys.stdin.readline().strip()
def INt(): return int(input())
def MAP(): return map(int, input().split())
def LISt(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

def main():
	s = input()
	t = input()
	if len(set(s)&set(t)) != len(set(t)):
		print(-1)
		exit()

	dic = defaultdict(list)
	for i, char in enumerate(s):  # 文字列が出現する位置のリスト
		dic[char].append(i)
	
	loop = 0
	index = -1
	for i in range(len(t)):
		if len(dic[t[i]]) == 0:
			print(-1)
			exit()
		idx = bisect_left(dic[t[i]], index)  # リストの何個目とヒットするか
		if idx != len(dic[t[i]]):
			index = dic[t[i]][idx] + 1
		else:  # idx = |dic[t[i]]| -> もうヒットする箇所がないので次のループ
			loop += 1
			index = -1
			idx = bisect_left(dic[t[i]], index)
			index = dic[t[i]][idx] + 1

	print(len(s)*loop+index)

if __name__ == '__main__':
	main()
a, b, c = [int(i) for i in input().split()]

total = 0
for d in range(a, b + 1):
    
    if c % d == 0:
    total += 1

print(total)

### FIXED CODE ###

a, b, c = [int(i) for i in input().split()]

total = 0
for d in range(a, b + 1):
    
    if c % d == 0:
        total += 1

print(total)
N = int(input())
A = []
for _ in range(N):
    A.append(input())

B = sorted(A, reverse=True)
max_first = B[0]
max_second = B[1]

for i in range(N):
	answer = max_first
    if A[i] == max_first:
        answer = max_second
    print(answer)


### FIXED CODE ###

N = int(input())
A = []
B = []
for _ in range(N):
    temp = int(input())
    A.append(temp)
    B.append(temp)

B.sort(reverse=True)
max_first = B[0]
max_second = B[1]

for i in range(N):
    if A[i] == max_first:
        print(max_second)
    else:
        print(max_first)
a,b=map(int, input())
if (1 <= a and a <= 9) and (1<= b and b <= 9):
    print(a*b)
else:
    print(-1)


### FIXED CODE ###

a,b=map(int, input().split())
if (1 <= a and a <= 9) and (1<= b and b <= 9):
    print(a*b)
else:
    print(-1)
A = int(input())
B = int(input())

if A > 8 or  B > 8:
    print(":(")
else:
    print("Yay!")


### FIXED CODE ###

A, B = map(int, input().split())

if A > 8 or  B > 8:
    print(":(")
else:
    print("Yay!")
def bills(count, value):
    max10000 = value // 10000
    for i in range(max10000 + 1):
        max5000 = min(count - i, (value - i * 10000) // 5000)
        for j in range(max5000 + 1):
            k = (value - i * 10000 - j * 5000) // 1000
            if i + j + k == count:
                return i, j, k
    
    return -1, -1, -1

v = bills(*map(int, input().split()))
print("{} {} {}".format(*v))

### FIXED CODE ###

print(input().replace("2017", "2018"))
print(*[1,2,3,3]

### FIXED CODE ###

# 2020/01/19

n,k,s=map(int,input().split())
if s==10**9:
    rest=10**9-1
else:
    rest=10**9
ans=[s]*k+[rest]*(n-k)
print(*ans)
s = input(int())
print(s*s*s/27)

### FIXED CODE ###

s = int(input())
print(s*s*s/27)
nN = int(input())


nList = []

nTmp = int(input())
nList.append(nTmp)
nAns = 1

if (nN > 1):
  nTmp = int(input())
  if nTmp in nList:
    continue
  else:
    nList.append(nTmp)
    nAns += 1
  





print(nAns)





### FIXED CODE ###

nN = int(input())
 
nList = []
 
nTmp = int(input())
nList.append(nTmp)
nAns = 1
 
if (nN > 1):  
  for i in range(nN - 1):
    nTmp = int(input())
      
    if nTmp not in nList:
      nList.append(nTmp)
      nAns += 1
    
print(nAns)
a = list(map(int, input().split()))
a = sorted(a)
' '.join(a)

### FIXED CODE ###

a = list(map(int, input().split()))
a = sorted(a)
print('{0} {1} {2}'.format(a[0], a[1], a[2]))
a,b,c,d=map(int,input().split())
if d>c:
  euclid2,euclid1=c,d
  e1,e2=euclid1,euclid2
  while not euclid2==0:
    euclid1=euclid1%euclid2
    euclid1,euclid2=euclid2,euclid1
    cd=c*d//euclid1
if c>d:
  euclid2,euclid1=d,c
  e1,e2=euclid1,euclid2
  while not euclid2==0:
    euclid1=euclid1%euclid2
    euclid1,euclid2=euclid2,euclid1
    cd=c*d//euclid1
  
c1=(a-1)//c
c2=(b-c1*c)//c+1
d1=(a-1)//d+1
d2=(b-d1*d)//d+1
cd1=(a-1)//cd+1
cd2=(b-cd1*cd)//(c*d)+1  
print(b-a+1-c2-d2+max(0,cd2))

### FIXED CODE ###

a,b,c,d=map(int,input().split())
if d>c:
  euclid2,euclid1=c,d
  e1,e2=euclid1,euclid2
  while not euclid2==0:
    euclid1=euclid1%euclid2
    euclid1,euclid2=euclid2,euclid1
    cd=c*d//euclid1
else:
  euclid2,euclid1=d,c
  e1,e2=euclid1,euclid2
  while not euclid2==0:
    euclid1=euclid1%euclid2
    euclid1,euclid2=euclid2,euclid1
    cd=c*d//euclid1
  
c1=(a-1)//c+1
c2=(b-c1*c)//c+1
d1=(a-1)//d+1
d2=(b-d1*d)//d+1
cd1=(a-1)//cd+1
cd2=(b-cd1*cd)//cd+1  
print(b-a+1-c2-d2+cd2)
a,b,c=map(int,input().split())
if a>=k:
  print(a-k,b)
else:
  print(0,max(a+b-k,0))

### FIXED CODE ###

a,b,c=map(int,input().split())
if a >= c:
  print(a-c,b)
else:
  print(0,max(a+b-c,0))
def ans():
    def dfs(v, p, d):
        depth[v] = d
        for e, cost in tree[v]:
            if e == p:
                continue
            dfs(e, v, d + cost)
    n = int(input())
    tree = [[] for _ in range(n+1)]
    depth = [0] * 100001
    for _ in range(1,n):
        a, b, c = map(int, input().split())
        tree[a].append((b,c))
        tree[b].append((a,c))

    q, k = map(int, input().split())
    dfs(k, -1, 0)
    for _ in range(q):
        x, y = map(int, input().split())
        print(depth[x] + depth[y])

ans()

### FIXED CODE ###

import sys
sys.setrecursionlimit(1000000)
 
def ans():
    def dfs(v, p, d):
        depth[v] = d
        for e, cost in tree[v]:
            if e == p:
                continue
            dfs(e, v, d + cost)
 
    n = int(input())
    tree = [[] for _ in range(n + 1)]
    depth = [0] * (n * 2)
    for _ in range(1, n):
        a, b, c = map(int, input().split())
        tree[a].append((b, c))
        tree[b].append((a, c))
 
    q, k = map(int, input().split())
    dfs(k, -1, 0)
    for _ in range(q):
        x, y = map(int, input().split())
        print(depth[x] + depth[y])
 
 
ans()
def gcd(a,b):
	t = b
	b = a % b
	
	if b == 0:
		return t
	else:
		return gcd(t,b)
        
def lcm(a, b):
    return a * b / gcd(a, b)

n = int(input())

ans = 1
for i in range(n):
    ans = lcm(ans, int(input()))

print(ans)

### FIXED CODE ###

import fractions
        
def lcm(a, b):
    return a * b // fractions.gcd(a, b)

n = int(input())

ans = 1
for i in range(n):
    ans = lcm(ans, int(input()))

print(ans)
from operator import itemgetter
from bisect import bisect_left, bisect_right
import sys

def main():
    n = int(sys.stdin.readline())
    keys = map(lambda i:map(int,sys.stdin.readline().split())+[i],xrange(n))
    keys.sort()

    q = int(sys.stdin.readline())
    for i in xrange(q):
        x0,x1,y0,y1 = map(int,sys.stdin.readline().split())
        key_x,key_y,ids = zip(*keys)
        interval = xrange(bisect_left(key_x,x0),bisect_right(key_x,x1))
        key1 = map(lambda j:[key_x[j],key_y[j],ids[j]],interval)
        key1.sort(key=itemgetter(1))
        key_x,key_y,ids = zip(*key1)
        interval = xrange(bisect_left(key_y,y0),bisect_right(key_y,y1))
        ids = map(lambda j:ids[j],interval)
        ids.sort()
        map(lambda x: sys.stdout.write("{}\n".format(x)),ids)
        print ("")

if __name__ == "__main__":
    main()

### FIXED CODE ###

from sys import stdin,stdout
import math
from operator import itemgetter
from bisect import bisect_left, bisect_right
readline = stdin.readline
 
def main():
    n = int(input())
    keys = map(lambda i: map(int,readline().split())+[i], xrange(n))
    keys.sort()

    root = int(math.sqrt(len(keys)))
 
    low = [x for x, y, i in keys[::root]]
    high = [x for x, y, i in keys[root - 1::root]] + [float('inf')]
 
    keys = [sorted(keys[i:i+root], key=itemgetter(1)) for i in range(0,len(keys),root)]
    keys_y = map(lambda k:[y for x,y,i in k], keys)

    q = int(input())
    for i in xrange(q):
        sx,tx,sy,ty = map(int,readline().split())
        
        nums = []
        for i in range(bisect_left(high, sx), bisect_right(low, tx)):
            y = keys_y[i]
            for j in range(bisect_left(y, sy), bisect_right(y, ty)):
                if sx <= keys[i][j][0] <= tx:
                    nums.append(keys[i][j][2])
        if nums:
            nums.sort()
            map(lambda n:stdout.write("{}\n".format(n)), nums)
        print("")

if __name__ == "__main__":
    main()
dic={}
n=int(input())
d=[]
for i in range(n):
  d.append(input())
  if d[-1] in dic:
  	dic[d[-1]]+=1
  else:
    dic[d[-1]]=1
mx=max(mx,dic.values())
for k,v in sorted(dic.items(),key=lambda x:(-x[1],x[0])):
  if mx==v:
    print(k)
    	


### FIXED CODE ###

dic={}
n=int(input())
d=[]
for i in range(n):
  d.append(input())
  if d[-1] in dic:
  	dic[d[-1]]+=1
  else:
    dic[d[-1]]=1
mx=max(dic.values())
for k,v in sorted(dic.items(),key=lambda x:(-x[1],x[0])):
  if mx==v:
    print(k)
X, Y, Z, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

AB = []
t = int(K**0.5)+1
for i in range(t):
    for j in range(t):
        AB.append(A[i] + B[j])
AB.sort(reverse=True)

ABC = []
for i in range(t):
    for j in range(t):
        ABC.append(AB[i] + C[j])

ABC.sort(reverse=True)
for i in range(K):
    print(ABC[i])


### FIXED CODE ###

X, Y, Z, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

ABC = []
for i in range(X):
    for j in range(Y):
        if (i + 1) * (j + 1) > K:
            break
        for k in range(Z):
            if (i + 1) * (j + 1) * (k + 1) > K:
                break
            ABC.append(A[i] + B[j] + C[k])

ABC.sort(reverse=True)
for i in range(K):
    print(ABC[i])
S=input()
ans = 111111111;
for i in range(2,10):
    temp = abs(753 - (100 * int(S[i - 2]) + 10 * int(S[i - 1]) + int(S[i])))
    ans = min(ans, temp)
print(ans)

### FIXED CODE ###

S=input()
ans = 111111111
for i in range(2,len(S)):
    temp = abs(753 - (100 * int(S[i - 2]) + 10 * int(S[i - 1]) + int(S[i])))
    ans = min(ans, temp)
print(ans)
nm = [0,31,29,31,30,31,30,31,31,30,31,30]

while True:

    m,d = map(int,raw_input().split(" "))

    if m == 0:
        break
    nd = 0 
    for i in range(m):
       nd += nm[i]

    nd += d 
    n = nd%7
    if n == 1:
        print "Thursday"
    elif n == 2:
        print "Tryday"
    elif n == 3:
        print "Saturday"
    elif n == 4:
        print "Sunday"
    elif n == 5:
        print "Monday"
    elif n == 6:
        print "Tuesday"
    else:                                                                                                                             
        print "Wednesday"
~                                                                                                                                     
~                                                                                                                                     
~                                                                                                                                     
~                              

### FIXED CODE ###

nm = [0,31,29,31,30,31,30,31,31,30,31,30]
while True:

    m,d = map(int,raw_input().split(" "))

    if m == 0:
        break
    else:
        nd = 0
        for i in range(m):
           nd += nm[i]

        nd += d
        n = nd%7
        if n == 1:
            print "Thursday"
        elif n == 2:
            print "Friday"
        elif n == 3:
            print "Saturday"
        elif n == 4:
            print "Sunday"
        elif n == 5:
            print "Monday"
        elif n == 6:
            print "Tuesday"
        else:                                                                                                                                                                                                
            print "Wednesday"
import numpy as np
a,b,q = list(map(int, input().split()))

s  = [int(input()) for i in range(a)]
t  = [int(input()) for i in range(b)]
x  = [int(input()) for i in range(q)]

S = np.asarray(s)
T = np.asarray(t)
X = np.asarray(x)

st = np.zeros([a,b])
for i in range(a):
  for j in range(b):
    st[i][j] = abs(s[i]-t[j])

ans = np.zeros(q)
for k in range(q):
  #sを探す
  SX= np.abs(S-X[k])
  min_SX = min(SX)
  i = np.argmin(SX)
  #tを探す
  TX = np.abs(T-X[k])
  j = np.argmin(TX)
  min_TX = min(TX)
  #sが近い->そのsに近いtを探す
  ans[k] = min(min_SX + min(st[i]), min_TX + min(st.T[j]))
  print(int(ans[k]))

### FIXED CODE ###

import bisect #bisectの典型的問題
a,b,q = map(int, input().split())

s  = [int(input()) for i in range(a)]
t  = [int(input()) for i in range(b)]

INF=10**18
s=[-INF]+s+[INF] #グリッド系の問題では、配列外を探索しないように
t=[-INF]+t+[INF]
x  = [int(input()) for i in range(q)]
for i in range(q):
  xi = x[i] #xを一気に読み込まなくてもfor loopの中の方が良い
  si = bisect.bisect_right(s, xi)
  ti = bisect.bisect_right(t, xi)
  ans=INF
  
  for S in [s[si-1], s[si]]:
    for T in [t[ti-1], t[ti]]:
      SX = abs(S-xi)
      TX = abs(T-xi)
      ST = abs(S-T)
      ans = min(ans, SX+ST, TX+ST)
  print(ans)
N = int(input())
dic = {}
for i in range(1, N + 1):
    dic[i] = int(input())

routedDic = []

def NextRoute(i):
    x = dic[i]
    if x in routedDic:
        return -1
    
    routedDic.append(x)

    if x == 2:
        return len(routedDic)
    else:
        return NextRoute(x)

print(NextRoute(1))

### FIXED CODE ###

N = int(input())
lst = [int(input()) for _ in range(N)]

cnt = 0
idx = 0

while True :
    x = lst[idx]
    cnt += 1
    if x == 2:
        print(cnt)
        exit()
    idx = x - 1
    if cnt > N:
        print(-1)
        exit()
n = str(input())
for i in range(3):
    if n[i] == "1":
        n[i] = "9"
    else:
        n[i] = "1"
print(n)          

### FIXED CODE ###

n = str(input())
m = ""
for i in range(3):
    if n[i] == "1":
        m += "9"
    else:
        m += "1"
print(m)
import numpy as np


n = int(input())
p = [float(x) for x in input().split()]
dp = np.zeros((n+1,n+1))
dp[0][1] =  p[0]
dp[0][0] = 1-p[0]
for i  in range(n):
    if i<=0:
        continue
    dp[i][0] = dp[i-1][0]*(1-p[i])
    for j in range(i+1):
        dp[i][j+1] = dp[i-1][j]*p[i]
        dp[i][j+1] += dp[i-1][j+1]*(1-p[i])

k = int(n/2)+1
ans = 0
#print(dp)
for j in range(k, n+1):
    ans += dp[n-1][j]
print(ans)

### FIXED CODE ###

n = int(input())
p = [float(x) for x in input().split()]
dp = []
for i in range(n+1):
    tp = []
    for j in range(n+1):
        tp.append(0)
    dp.append(tp)
dp[0][1] =  p[0]
dp[0][0] = 1-p[0]
for i  in range(n):
    if i<=0:
        continue
    dp[i][0] = dp[i-1][0]*(1-p[i])
    for j in range(i+1):
        dp[i][j+1] = dp[i-1][j]*p[i]
        dp[i][j+1] += dp[i-1][j+1]*(1-p[i])

k = int(n/2)+1
ans = 0
#print(dp)
for j in range(k, n+1):
    ans += dp[n-1][j]
print(ans)
N, K = map(int, input().split(' '))
h_list = list(map(int, input().split(' ')))
print(sum([h>h_list for h in h_list]))

### FIXED CODE ###

N, K = map(int, input().split(' '))
h_list = list(map(int, input().split(' ')))
print(sum([h>=K for h in h_list]))
#! /usr/bin/env python
# -*- coding : utf-8 -*-
while True:
    m, f, r = map(int,input().split())
    if m + f >= 80:
        print("A")
    elif m + f >= 65 and m + f < 80:
        print("B")
    elif m + f >= 50 and m + f < 65:
        print("C")
    elif m + f >= 30 and m + f < 50:
        if r >= 50:
            print("C")
        else:
            print("D")
    elif m + f < 30:
        print("F")

### FIXED CODE ###

#! /usr/bin/env python
# -*- coding : utf-8 -*-
while True:
    m, f, r = map(int,input().split())
    if r == m == f == -1:
        break
    elif m == -1 or f == -1:
        print('F')
    elif m + f >= 80:
        print("A")
    elif m + f >= 65 and m + f < 80:
        print("B")
    elif m + f >= 50 and m + f < 65:
        print("C")
    elif m + f >= 30 and m + f < 50:
        if r >= 50:
            print("C")
        else:
            print("D")
    elif m + f < 30:
        print("F")
n = int(input())
t,a = map(int,input().split())
h = list(map(int,input().split()))
s = []

for i in range(n):
    s.append(abs(a-t+i*0.006))

print(s.index(min(s))+1)

### FIXED CODE ###

X,Y = map(int,input().split())
print(X+Y//2)