Harryxun/stf_run huggingface dataset:
x = int(input())
y = int(input())

if (y-2*x)/2 <= x:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

import sys
x,y=map(int,input().split())
for i in range(x+1):
  if i*2+(x-i)*4==y:
    print("Yes")
    sys.exit(0)
print("No")
a = {0, 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14,
     1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51}
print(a[int(input())])

### FIXED CODE ###

a = [0, 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14,
     1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(a[int(input())])
s = input()

if(s[3] == s[4] and s[5] == s[6]):
  print("Yes")
  
else:
  print("No")

### FIXED CODE ###

s = input()

if(s[2] == s[3] and s[4] == s[5]):
  print("Yes")
 
else:
  print("No")
x = list(input())
cnt = 0
for i in x:
  if x == 'S':
    cnt += 1
  elif y == 'T':
    if cnt > 0:
      cnt -= 1
    else:
      continue
print(len(x)-cnt)

### FIXED CODE ###

x = list(input())
cnt = 0
a = 0
for i in x:
  if i == 'S':
    cnt += 1
  elif i == 'T':
    if cnt > 0:
      cnt -= 1
    else:
      a += 1
print(a+cnt)
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr
n = int(input())
a = factorization(n)
ans = 1
if len(a) == 1 and a[0]!=n:
  ans += a[1]-1
b = factorization(n-1)
chk = 1
for i in range(len(b)):
  chk *= (b[i][1]+1)
ans += chk-1
if len(a) >= 2:
  for i in range(len(a)):
    for j in range(1,a[i][1]+1):
      #print(a[i][0]**(j),int(n/(a[i][0]**(j))),int(n/(a[i][0]**(j)))%(a[i][0]**(j)))
      if int(n/(a[i][0]**(a[i][1]+1-j)))%(a[i][0]**(j)) == 1:
        ans += 1
print(ans)

### FIXED CODE ###

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])
    if arr==[]:
        arr.append([n, 1])
    return arr
  
def divisorize(n):
    ## 約数
    f = factorization(n)
    divisors = [1]
    for k in range(len(f)):
        num_divisors = len(divisors)
        for i in range(1, f[k][1] + 1):
            for j in range(num_divisors):
                divisors.append(divisors[j] * f[k][0] ** i)
    return sorted(divisors)
  
n = int(input())
ans = 0
chk = divisorize(n-1)
for i in divisorize(n)[1:]:
  m = n
  while True:
    if m == 1:
        ans += 1
        chk.append(i)
        break
    if m < i:
      break
    if m%i == 0:
      m = m//i
    else:
      m = m%i

chk = set(chk)
print(len(chk)-1)
import sys
import numpy as np
readline = sys.stdin.buffer.readline

a,b,c = map(int,readline().split())
array = np.array([a,b,c],dtype="float64")
if np.sqrt(a)+np.sqrt(b) < np.sqrt(c):
    print("Yes")
else:
    print("No")

### FIXED CODE ###

import sys
readline = sys.stdin.buffer.readline

n = int(readline())

alphabets = [chr(ord('a') + x) for x in range(26)]

def dfs(s,i):
    if len(s)==n:
        print("".join(s))
    else:
        t = min(len(set(s))+1,len(s)+1)
        for i in range(t):
            dfs(s+[alphabets[i]],i)

dfs([],0)
A, B = map(int,input().split())
if A >= 13:
    print(B)
elif if 6 <= A <= 12:
    print(B // 2)
else:
    print(0)


### FIXED CODE ###

A, B = map(int,input().split())
if A >= 13:
    print(B)
elif 6 <= A <= 12:
    print(B // 2)
else:
    print(0)
a,b=list(map(int,input().split()))

def f(a,b):
  for i in range(min(a,b),2,-1):
    if a%i==0 and b%i==0:
      max=i
      break
  re=[1,max]
  for i in range(2,max):
    if a%i==0 and b%i==0:re.append(i)
  return re

def g(n):
  for i in range(2,n):
    if n%i==0:return False
  else:return True

ans=[g(i) for i in f(a,b)]
print(ans.count(True))



### FIXED CODE ###

import math,fractions
a,b=list(map(int,input().split()))

def f(n):
    a=[1]
    while n%2==0:
        a.append(2)
        n//=2
    f=3
    while f*f<= n:
        if n%f==0:
            a.append(f)
            n//= f
        else:
            f+= 2
    if n!=1:
        a.append(n)
    return a

def g(n,r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))
 
ans=set(f(a))&set(f(b))
#print(ans)
print(len(ans))
list_cake_1 = []
list_cake_2 = []
list_cake_3 = []

while len(list_cake_1) < X:
	element = list(map(int, input().split()))
	list_cake_1.extend(element)

while len(list_cake_2) < Y:
	element = list(map(int, input().split()))
	list_cake_2.extend(element)
	
while len(list_cake_3) < Z:
	element = list(map(int, input().split()))
	list_cake_3.extend(element)

list_total = []

for i in list_cake_1:
	for j in list_cake_2:
		for k in list_cake_3:
			total_ijk = i+j+k
			list_total.append(total_ijk)
				
list_total.sort()

for i in range(1, K+1):
	print(list_total[-i])

### FIXED CODE ###

import sys

input = sys.stdin.readline

X, Y, Z, K = map(int, input().split())

list_cake_1 = list(map(int, input().split()))
list_cake_2 = list(map(int, input().split()))
list_cake_3 = list(map(int, input().split()))

list_cake_1 = sorted(list_cake_1, reverse=True)
list_cake_2 = sorted(list_cake_2, reverse=True)
list_cake_3 = sorted(list_cake_3, reverse=True)

list_total_sum = []

for i, cake_1 in enumerate(list_cake_1, 1):
	for j, cake_2 in enumerate(list_cake_2, 1):
		for k, cake_3 in enumerate(list_cake_3, 1):
			if i*j*k > K:
				break
			list_total_sum.append(cake_1 + cake_2 + cake_3)

for element in sorted(list_total_sum, reverse=True)[:K]:
	print(element)
#coding : UTF-8
x,y = input.split()
print(int(x)+int(y/2))

### FIXED CODE ###

#coding : UTF-8
x,y = map(int,input().split())
print(int(x+y/2))
X = input()

if X >= 30:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

x = int(input())
if x >= 30:
    print("Yes")
else:
    print("No")
n,k=map(int,input().split())
S=[] #[ネタ種類、おいしさ]のリスト
for i in range(n):
    S.append(list(map(int,input().split())))
S.sort(reverse=1,key=lambda x:x[1])

neta=max(S[j][0] for j in range(n)) #ネタの種類数

F=[0 for i in range(neta+1)] #ネタi種のときの美味しさの和の最大値のリスト

ma=sum(S[i][1] for i in range(k))

neta_s=len(set([S[i][0] for i in range(k)]))

F[neta_s]=ma

#print(S)
#print(F)
#print(ma)

netalist=[0 for i in range(n)] #i種類目のネタを使った個数
keseru=[] #ネタに重複がある寿司のリスト(消してもいい寿司)
for i in range(k):
    if netalist[S[i][0]]>=1 :
        keseru.append(S[i])
        
    netalist[S[i][0]]+=1

#print(keseru)
#print(netalist)

right=len(keseru)-1
left=k
i=neta_s+1
while i<=k and right>=0 :
    while netalist[S[left][0]]!=0 :
        left+=1
    netalist[S[left][0]]+=1
    F[i]=F[i-1]+S[left][1]-keseru[right][1]
    right-=1
    left+=1
    i+=1

#print(F)
for j in range(neta_s,i+1-1) :
    F[j]+=j**2

print(max(F))


### FIXED CODE ###

n,k=map(int,input().split())
S=[] #[ネタ種類、おいしさ]のリスト
for i in range(n):
    S.append(list(map(int,input().split())))
S.sort(reverse=1,key=lambda x:x[1])

netano_min=min(S[j][0] for j in range(n))
for i in range(n):
    S[i][0]-=netano_min-1

neta=max(S[j][0] for j in range(n)) #ネタの種類数

F=[0 for i in range(neta+1)] #ネタi種のときの美味しさの和の最大値のリスト

ma=sum(S[i][1] for i in range(k))

neta_s=len(set([S[i][0] for i in range(k)]))

netano_min=min(S[j][0] for j in range(n))

F[neta_s]=ma

#print(S)
#print(F)
#print(ma)

netalist=[0 for i in range(n+1)] #i種類目のネタを使った個数
keseru=[] #ネタに重複がある寿司のリスト(消してもいい寿司)
for i in range(k):
    if netalist[S[i][0]]>=1 :
        keseru.append(S[i])
        
    netalist[S[i][0]]+=1

#print(keseru)
#print(netalist)

right=len(keseru)-1
left=k
i=neta_s+1
while len(keseru)>0 and i<=k and right>=0 and left<=n-1 :
    while left<=n-1 and netalist[S[left][0]]!=0 :
        left+=1
    if left==n :
        break
    netalist[S[left][0]]+=1
    F[i]=F[i-1]+S[left][1]-keseru[right][1]
    right-=1
    left+=1
    i+=1

#print(F)
for j in range(neta_s,i+1-1) :
    F[j]+=j**2

print(max(F))
import math

input_ = input().split()

N = int(input_[0])
D = float(input_[1])

num = 0

for i in range(N):
  x_i,y_i = map(float,input().split())
  
  if(math.sqrt(x_i**2 + y_i**2p) <= D):
    num += 1
    
print(num)
  
  

### FIXED CODE ###

import math

input_ = input().split()

N = int(input_[0])
D = float(input_[1])

num = 0

for i in range(N):
  x_i,y_i = map(float,input().split())
  
  if(math.sqrt(x_i**2 + y_i**2) <= D):
    num += 1
    
print(num)
h, w = map(int, input().split())
lst = []
for i in range(h):
    lst.append(list(input()))

R = [[0]*w for _ in range(h)]
L = [[0]*w for _ in range(h)]
U = [[0]*w for _ in range(h)]
D = [[0]*w for _ in range(h)]

for i in range(h):
    for j in range(w):
        if lst[i][j] == '.':
            if j == 0:
                L[i][j] = 1
            else:
                L[i][j] = L[i][j-1] + 1
        

for i in range(h):
    for j in range(w-1, -1, -1):
        if lst[i][j] == '.':
            if j == w-1:
                R[i][j] = 1
            else:
                R[i][j] = R[i][j-1] + 1            

     
for i in range(h):
    for j in range(w):
        if lst[i][j] == '.':
            if i == 0:
                U[i][j] = 1
            else:
                U[i][j] = U[i][j-1] + 1

for i in range(h-1, -1, -1):
    for j in range(w):
        if lst[i][j] == '.':
            if i == h-1:
                D[i][j] = 1
            else:
                D[i][j] = D[i][j-1] + 1

ans = 0
x = [[0]*w for _ in range(h)]
for i in range (h):
    for j in range(w):
        x[i][j] = L[i][j] + R[i][j] + U[i][j] + D[i][j] - 3
    ans = max(ans, max(x[i])
print(ans) 

### FIXED CODE ###

h, w = map(int, input().split())
lst = []
for i in range(h):
    lst.append(list(input()))

R = [[0]*w for _ in range(h)]
L = [[0]*w for _ in range(h)]
U = [[0]*w for _ in range(h)]
D = [[0]*w for _ in range(h)]

for i in range(h):
    for j in range(w):
        if lst[i][j] == '.':
            if j == 0:
                L[i][j] = 1
            else:
                L[i][j] = L[i][j-1] + 1
        

for i in range(h):
    for j in range(w-1, -1, -1):
        if lst[i][j] == '.':
            if j == w-1:
                R[i][j] = 1
            else:
                R[i][j] = R[i][j+1] + 1            


for i in range(h):
    for j in range(w):
        if lst[i][j] == '.':
            if i == 0:
                U[i][j] = 1
            else:
                U[i][j] = U[i-1][j] + 1

for i in range(h-1, -1, -1):
    for j in range(w):
        if lst[i][j] == '.':
            if i == h-1:
                D[i][j] = 1
            else:
                D[i][j] = D[i+1][j] + 1

ans = 0
x = [[0]*w for _ in range(h)]
for i in range (h):
    for j in range(w):
        x[i][j] = L[i][j] + R[i][j] + U[i][j] + D[i][j] - 3
    ans = max(ans, max(x[i]))
print(ans)
# -*- coding: utf-8 -*-
"""
Created on Wed Nov  6 21:49:38 2019

@author: over-
"""

N=int(input())

ans=N
for i in range(1,10**12):
    if i > N: break
    if N%i == 0:
        A=(N/i-1)+(i-1)
        if A < ans:
            ans = A
            
print(int(A))

### FIXED CODE ###

# -*- coding: utf-8 -*-
"""
Created on Wed Nov  6 21:44:44 2019

@author: over-
"""

A,B=map(int,input().split())
if A<10 and B<10:
    print(A*B)
else:
    print(-1)
H, W = map(int, input().split())
S = [list(input()) for _ in range(H)]

for i in range(H):
    for j in range(W):
        count = 0
        
        if i == 0 and H != 1:
            if j == 0:
                count = [S[i][j+1], S[i+1][j], S[i+1][j+1]].count('#')
            elif j == W - 1:
                count = [S[i][j-1], S[i+1][j], S[i+1][j-1]].count('#')
            else:
                count = [S[i][j-1], S[i][j+1], S[i+1][j-1], S[i+1][j], S[i+1][j+1]].count('#')
        elif i == 0 and H == 1:
            if j == 0:
                count = [S[i][j+1]].count('#')
            elif j == W - 1:
                count = [S[i][j-1]].count('#')
            else:
                count = [S[i][j-1], S[i][j+1]].count('#')

        elif i == H - 1:
            if j == 0:
                count = [S[i][j+1], S[i-1][j], S[i-1][j+1]].count('#')
            elif j == W - 1:
                count = [S[i-1][j-1], S[i-1][j], S[i][j-1]].count('#')
            else:
                count = [S[i][j-1], S[i][j+1], S[i-1][j-1], S[i-1][j], S[i-1][j+1]].count('#')
        else:
            if j == 0:
                count = [S[i-1][j], S[i-1][j+1], S[i][j+1], S[i+1][j], S[i+1][j+1]].count('#')
            elif j == W - 1:
                count =[S[i-1][j-1], S[i-1][j], S[i][j-1], S[i+1][j-1], S[i+1][j]].count('#')
            else:
                count =[S[i-1][j-1], S[i-1][j], S[i-1][j+1], S[i][j-1], S[i][j+1], S[i+1][j-1], S[i+1][j], S[i+1][j+1]].count('#')
        if S[i][j] != '#':
            S[i][j] = str(count)
for s in S:
    print("".join(s))
            

### FIXED CODE ###

H, W = map(int, input().split())
S = [list(input()) for _ in range(H)]

for i in range(H):
    for j in range(W):
        count = 0
        search = [[i-1, j-1], [i-1, j], [i-1, j+1], [i, j-1], [i, j+1], [i+1, j-1], [i+1, j], [i+1, j+1]]
        if S[i][j] == '#':
            continue
        for k in search:
            if k[0]<0 or k[0]>=H or k[1]<0 or k[1]>=W:
                continue
            if S[k[0]][k[1]] == '#':
                count += 1
        S[i][j] = str(count)

for s in S:
    print("".join(s))
n, x, m = map(int,input().split())
lst = [0 for i in range(m)]
lst2 = [x]
i = 2
lst[x] = 1
while True:
    if (i > n):
        break
    x = x**2%m
    if (lst[x] == 0):
        lst[x] = i
        lst2.append(lst2[i - 2] + x)
        i = i + 1
    else:
        lst2.append(lst2[i - 2] + x)
        break
a = i - lst[x]
b = lst2[i - 1] - lst2[i - 1 - a]
i = i - 1
c = (n - i)//a
d = (n - i)%a
ans = lst2[i - 1] + b*c + lst2[i - 1 - a + d] - lst2[i - 1 - a]
print(ans)


### FIXED CODE ###

n, x, m = map(int,input().split())
lst = [0 for i in range(m)]
lst2 = [x]
i = 2
lst[x] = 1
c = 0
while True:
    if (i > n):
        break
    x = x**2%m
    if (lst[x] == 0):
        lst[x] = i
        lst2.append(lst2[i - 2] + x)
        i = i + 1
    else:
        lst2.append(lst2[i - 2] + x)
        c = 1
        break
if (c == 1):
    a = i - lst[x]
    b = lst2[i - 1] - lst2[i - 1 - a]

    c = (n - i)//a
    d = (n - i)%a
    ans = lst2[i - 1] + b*c + lst2[i - 1 - a + d] - lst2[i - 1 - a]
    print(ans)

else:
    print(lst2[n - 1])
# 基本は３で割ったあまり毎に変換コストを計算する.
# a[i][j] i種類目がj色に変わる時のコストと計算し、それの合計のminを取る

import numpy as np
N,C = map(int,input().split())
a = np.zeros((3,C))
D = np.array([ list(map(int,input().split()))) for i in range(C)])
c = np.array([ list(map(int,input().split()))) for i in range(N)])


for i in range(N):
    for j in range(N):
        a[(i+j)%3] += D[c[i][j]-1]

sum_arr = []
for C1 in range(C):
    for C2 in range(C):
        for C3 in range(C):
            if C1 != C2 and C2 != C3 and C3 != C1:
                sum_arr.append(a[0][C1]+a[1][C2]+a[2][C3])

print(int(min(l)))


### FIXED CODE ###

# 基本は３で割ったあまり毎に変換コストを計算する.
# a[i][j] i種類目がj色に変わる時のコストと計算し、それの合計のminを取る

import numpy as np
N,C = map(int,input().split())
a = np.zeros((3,C))
D = np.array([ list(map(int,input().split())) for i in range(C)])
c = np.array([ list(map(int,input().split())) for i in range(N)])


for i in range(N):
    for j in range(N):
        a[(i+j)%3] += D[c[i][j]-1]

sum_arr = []
for C1 in range(C):
    for C2 in range(C):
        for C3 in range(C):
            if C1 != C2 and C2 != C3 and C3 != C1:
                sum_arr.append(a[0][C1]+a[1][C2]+a[2][C3])

print(int(min(sum_arr)))
n,w=map(int,input().split())
weight=[]
value=[]
for i in range(n):
    q,r=map(int,input().split())
    weight.append(q)
    value.append(r)

dp=[[-1] for _ in range(10100) for _ in range(110)]

for i in range(n):
    for j in range(w):
        if j-weight[i]>=0:
            dp[i+1][j]=max(dp[i+1][j],dp[i][j-weight[i]]+value[i])
        dp[i+1][j]=max(dp[i+1][j],dp[i][j])

print(dp[n-1][w-1])

### FIXED CODE ###

n,w=map(int,input().split())
weight=[]
value=[]
for i in range(n):
    q,r=map(int,input().split())
    weight.append(q)
    value.append(r)

dp=[[0 for i in range(100111)] for j in range(111)]

for i in range(0,n):
    for sum_w in range(0,w+1):
        if sum_w-weight[i]>=0:
            dp[i+1][sum_w]=max(dp[i+1][sum_w],dp[i][sum_w-weight[i]]+value[i])
        dp[i+1][sum_w]=max(dp[i][sum_w],dp[i+1][sum_w])

print(dp[n][w])
for i in rang(1,10):
??for j in range(1,10):
????print "%dx%d=%d"%(i,j,i*j)

### FIXED CODE ###

for i in range(1,10):
    for j in range(1,10):
       print("{0}x{1}={2}".format(i,j,i*j))
import bisect
import math
from scipy.misc import comb

N,A,B=map(int,input().split())
List=list(map(int,input().split()))
List = sorted(List, reverse=True)

mini = List[A-1]
ans = 0

if List[A-1] != List[A]:
  ans = sum(List[:A])/A
  print(ans)
  print(1)

else:
  num = List.count(List[A-1])
  List = sorted(List)
  num2 = N - bisect.bisect_right(List,List[A-1])
  List = sorted(List, reverse=True)
  
  if List[0] != List[A-1]:
    B = A
  for i in range(B-A+1):
    n = num
    kosuu = A + i - num2
    ans  = int(ans + math.factorial(n) // (math.factorial(n - kosuu) * math.factorial(kosuu)))
  
  ave = int(sum(List[:A])/A)
  print(ave)
  print(ans)

### FIXED CODE ###

import bisect
import math
from scipy.misc import comb

N,A,B=map(int,input().split())
List=list(map(int,input().split()))
List = sorted(List, reverse=True)

mini = List[A-1]
ans = 0

if List[A-1] != List[A]:
  ans = sum(List[:A])/A
  print(ans)
  print(1)

else:
  num = List.count(List[A-1])
  List = sorted(List)
  num2 = N - bisect.bisect_right(List,mini)
  List = sorted(List, reverse=True)
  
  if List[0] != List[A-1]:
    B = A
  for i in range(B-A+1):
    n = num
    kosuu = A + i - num2
    ans  = int(ans + comb(n, kosuu, exact=True))
  
  ave = int(sum(List[:A])/A)
  print(ave)
  print(ans)
N,M = map(int,input().split())
ans = [0 for nomean in range(N)]

for i in range(M):
	f,t = map(int,input().split())
	ans[f] += 1
	ans[t] += 1
	
for a in ans:
	print(a)

### FIXED CODE ###

N,M = map(int,input().split())
ans = [0 for nomean in range(N)]

for i in range(M):
	f,t = map(int,input().split())
	ans[f-1] += 1
	ans[t-1] += 1
	
for a in ans:
	print(a)
n,x=input().split()
L = list(input().split())
d = 0
i = 0
while d <= int(x) and i<int(n):
    d+=int(L[i])
    i+=1
if d > x:
    print(i)
else:
    print(i+1)


### FIXED CODE ###

n, m = map(int, input().split())
l = [int(x) for x in input().split()]
answ = 1
h = 0
for k in l:
  h += k
  if h > m:
    break
  else:
    answ += 1
print(answ)
import sys
DBG =  not True
R = 1000000007
n = int(input())
c = []
for i in range(n):
    c.append(int(input()))
tot = 1
s = [0] * n
for i in range(n):
    if i > 0 and c[i] == c[i-1]:
        continue
    x = s[c[i]]
    tot = (tot + x) % R
    s[c[i]] = tot
    if DBG:
        print("i {} sci {} tot {} newt {}".format(i,x,s[c[i]],tot))
        print(s)
print(tot)


### FIXED CODE ###

import sys
DBG =  not True
R = 1000000007
MAXN = 200000
n = int(input())
c = []
for i in range(n):
    c.append(int(input()))
tot = 1
s = [0] * (MAXN+1)
for i in range(n):
    if i > 0 and c[i] == c[i-1]:
        continue
    x = s[c[i]]
    tot = (tot + x) % R
    s[c[i]] = tot
    if DBG:
        print("i {} sci {} tot {} newt {}".format(i,x,s[c[i]],tot))
        print(s)
print(tot)
import sys
sys.setrecursionlimit(200000)

n = int(input())
h = list(map(int, input().split()))
 
dp = []
for i in range(n):
    dp.append(-1)
 
 
def flog(m):
    if dp[m] != -1:
        return dp[m]
    if m == 0:
        dp[m] = 0
        return 0
    if m == 1:

### FIXED CODE ###

n = int(input())
h = list(map(int, input().split()))
 
dp = []
for i in range(n):
	dp.append(int(0))
dp[0] = 0
dp[1] = abs(h[0]-h[1])
 
for j in range(2,n):
	dp[j] = min(dp[j-1] + abs(h[j-1] - h[j]),dp[j-2] + abs(h[j-2] - h[j]))
  
print(dp[n-1])
S=input()
T=input()

if T[:-1]==S:
	print("Yes")
    exit()

print("No")

### FIXED CODE ###

a= [input() for i in range(2)]
S=a[0]
T=a[1]

def CK(S,T):

    m=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
    for a in range(len(m)):
        Sa=S+m[a]
        if(T == Sa):
            return True
            break
        else:
            a=a+1

reslt=CK(S,T)
# print(reslt)

if(reslt==True):
    print("Yes")
else:
    print("No")
N,X = map(int,input().split())
L = [int(i) for i in input().split()]
D = 0
for i in range(N+2) :
    D = L[i]+D
#    print(i,D)
    if D>X :
        print(i+1)
        exit()

print(N)

### FIXED CODE ###

N,X = map(int,input().split())
L = [int(i) for i in input().split()]
D = 0
for i in range(N) :
    D = L[i]+D
 #   print(i,D)
    if D>X :
        print(i+1)
        exit()

print(N+1)
from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under


n,k=map(int,input().split())
mod=10**9+7

red=n-k
sep=red+1


for i in range(1,k+1):
    blue=k-i
    ans=cmb(i+blue-1,blue)*cmb(sep,i)%mod
    print(ans)

### FIXED CODE ###

from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under


n,k=map(int,input().split())
mod=10**9+7

red=n-k
sep=red+1


for i in range(1,1+k):
    if i>sep:
        print(0)
        continue
    blue=k-i
    ans=cmb(i+blue-1,blue)*cmb(sep,i)%mod
    print(ans)
x=int(input())
n=int((2*int(input()))**0.5)
if n*(n-1)<2*x<=n*(n+1):
    print(n)
elif (n-1)*(n-2)<2*x<=n*(n-1):
    print(n-1)
else:
    print(n+1)

### FIXED CODE ###

x=int(input())
n=int((2*x)**0.5)
if n*(n-1)<2*x<=n*(n+1):
    print(n)
elif (n-1)*(n-2)<2*x<=n*(n-1):
    print(n-1)
else:
    print(n+1)
S=input()
n=len(S)
ans=0
f=S[0]
for bit in range(1<<(n-1)):
  for i in range(n-1):
    if bit & (1<<i):
      f+="+"
    f+=s[i+1]
  ans+=sum(map(int,f.split("+")))
print(ans)

      	
  


### FIXED CODE ###

S=input()
n=len(S)
ans=0

for bit in range(1<<(n-1)):
  f=S[0]
  for i in range(n-1):
    if bit & (1<<i):
      f+="+"
    f+=S[i+1]
  ans+=sum(map(int,f.split("+")))
print(ans)
d = input().rstrip()
d_list = d.split(" ")
t_list = []
for i in range(int(d_list[1])):
    t_list.append(str(input().rstrip()))


def solution(t_list):
    t_list.sort()
    ans_str = ""
    for i in t_list:
        ans_str += i
    return ans_str
    
def main():
    print(solution(t_list))
    
if __name__ == '__main__':
    main()

### FIXED CODE ###

import sys
t_list = []
for i in sys.stdin.readlines():
    t_list.append(i.rstrip())
t_list.pop(0)

def solution(t_list):
    t_list.sort()
    ans_str = ""
    for i in t_list:
        ans_str += i
    return ans_str
    
def main():
    print(solution(t_list))
    
if __name__ == '__main__':
    main()
n, k = map(int, input().split())
A = list(map(int, input().split()))
A = [-1] + A
memo = [1]
def func(i, town=1):
    global memo
    arrival = A[town]
    memo.append(arrival)
    if memo.count(arrival) == 2:
        return memo
    return func(i+1, A[town])

table = func(0, 1)
index = table.index(table[-1])
r = (k - index) % (len(table)-1 - index)
print(table[index+r])

### FIXED CODE ###

n, k = map(int, input().split())
A = list(map(int, input().split()))
A = [-1] + A
memo = []
loop = []
visit = [0]*n
town = 1
while visit[town-1] < 2:
    if visit[town-1] == 0:
        memo.append(town)
    else:
        loop.append(town)
    visit[town-1] += 1
    town = A[town]
outlier = len(memo) - len(loop) 
T = len(loop)
if k <= outlier:
    print(memo[k])
else:
    print(loop[(k-outlier) % T])