Harryxun/stf_run huggingface dataset:
import math

# inputList=[]
# for i in range(6):
#     inputNum = input()
#     inputList.append(inputNum)
inputa = input().split()
# inputb = input().split()

# inputa = [int(n) for n in inputa]
# inputa.sort()

a = int(inputa[0])
# b = int(inputa[1])
# c = int(inputa[2])

# x = int(inputb[0])
# y = int(inputb[1])

ans(a*2)


### FIXED CODE ###

import math

# inputList=[]
# for i in range(6):
#     inputNum = input()
#     inputList.append(inputNum)
inputa = input().split()
# inputb = input().split()

# inputa = [int(n) for n in inputa]
# inputa.sort()

a = int(inputa[0])
# b = int(inputa[1])
# c = int(inputa[2])

# x = int(inputb[0])
# y = int(inputb[1])

if a%2 == 0:
    print(a)
else:
    print(a*2)
import fractions
N,M = map(int,input().split())
S = input()
T = input()
L = (N * M) // fractions.gcd(N,M)
div_N = L // N
div_M = L // M
s = [""] * L

for ss in range(N):
  if ss == 0:
    s[0] = S[0]
    if s[0] != T[0]:
      print(-1)
      exit()
  else:
    s[ss * (div_N)] = S[ss]
#print(L)
#print(s)
#print(tag)
count = 1
while div_M < L:
  if s[div_M] != "" and s[div_M] != T[count]:
      print(-1)
      exit()
  div_M += div_M
  count += 1
print(L)




### FIXED CODE ###

import fractions
N,M = map(int,input().split())
S = input()
T = input()
G = fractions.gcd(N,M)
L = (N * M) // G
div_N = N // G
div_M = M // G

i = 0
j = 0

while i < N and j < M:
  if S[i] != T[j]:
    print(-1)
    exit()
  else:
    i += div_N
    j += div_M
print(L)
import sys

def I(): return(int(sys.stdin.readline()))
def LI(): return([int(x) for x in sys.stdin.readline().split()])


def main():
    N = I()
    S = sorted(LI(),reverse=True)

    flag = [True]*len(S)

    cur = []
    cur.append(S[0])
    flag[0] = False

    for i in range(N):
        nxt = [x for x in cur]
        j = 0

        for k in range(len(S)):
            if j >= len(cur):
                break
            elif flag[k] and S[k]<cur[j]:
                nxt.append(S[k])
                j+=1
                flag[k] = False
        if len(cur) != j:
            return("No")
        cur = sorted(nxt,reverse=True)
                                                                                                 return("Yes")

if __name__ == "__main__":
    print(main())

### FIXED CODE ###

import sys

def I(): return(int(sys.stdin.readline()))
def LI(): return([int(x) for x in sys.stdin.readline().split()])


def main():
    N = I()
    S = sorted(LI(),reverse=True)

    flag = [True]*len(S)

    cur = []
    cur.append(S[0])
    flag[0] = False

    for i in range(N):
        nxt = [x for x in cur]
        j = 0

        for k in range(len(S)):
            if j >= len(cur):
                break
            elif flag[k] and S[k]<cur[j]:
                nxt.append(S[k])
                j+=1
                flag[k] = False
        if len(cur) != j:
            return("No")
        cur = sorted(nxt,reverse=True)
    return("Yes")

if __name__ == "__main__":
    print(main())
n,m=map(int,input().split())
l={}
nedan=[]
ans=0
num=0
small=0
for i in range(n):
    kane,kazu=map(int,input().split())
    if kane in nedan:
        l[kane]+=kazu
    else:
        l[kane]=kane
    nedan.append(kane)
nedan.sort()
set(nedan)
while True:
    if num+l[nedan[small]]<m:
        ans+=nedan[small]*l[nedan[small]]
        num+=l[nedan[small]]
        small+=1
    else:
        ans+=(m-num)*nedan[small]
        break
print(ans)

### FIXED CODE ###

n,m=map(int,input().split())
l=[list(map(int,input().split())) for i in range(n)]
l.sort()
money=0
bottle=0
for i in range(n):
    if bottle+l[i][1]<=m:
        bottle+=l[i][1]
        money+=l[i][0]*l[i][1]
    else:
        money+=l[i][0]*(m-bottle)
        break
print(money)
A,B = input().split()
x = A*B
print(x)

### FIXED CODE ###

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

x = A*B

print(x)
l,r = map(int,input().split())
if r-l > 2017:
  print(0)
else:
  mod_min = 2019
  for i in range(l,r+1):
    for j in range(i+1,r+1):
      mod = (i*j)%2019
      if mod <= mod_min:
        mod_min = mod
      else:
        pass
    
print(mod_min)
  

  
  

### FIXED CODE ###

l,r = map(int,input().split())
if r-l > 2017:
  print(0)
else:
  mod_min = 2019
  for i in range(l,r+1):
    for j in range(i+1,r+1):
      mod = (i*j)%2019
      if mod <= mod_min:
        mod_min = mod
      else:
        pass
  print(mod_min)
def solve(a):
	l = len(a)
	a1 = [a[2*i+1] for i in range((l+1)//2)]
	b = a.copy()
	b.sort()
	b1 = [b[2*i+1] for i in range((l+1)//2)]

	a1 = set(a1)
	b1 = set(b1)

	return len(a1 - b1)
n = int(input())
a = [int(input()) for i in range(n)]
print(solve(a))



### FIXED CODE ###

def solve(a):
	l = len(a)
	h = l//2 + l%2
	a0 = [a[2*i] for i in range(h)]
	b = a.copy()
	b.sort()
	b0 = [b[2*i] for i in range(h)]

	a0 = set(a0)
	b0 = set(b0)

	return len(a0 - b0)
n = int(input())
a = [int(input()) for i in range(n)]
print(solve(a))
K=int(input());print('ABC'(K<1200)or'ARC'(K<2800)or'AGC')

### FIXED CODE ###

K=int(input());print('ABC'*(K<1200)or'ARC'*(K<2800)or'AGC')
from queue import PriorityQueue


IA = lambda: [int(x) for x in input().split()]
IM = lambda N: [IA() for _ in range(N)]
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
ans=0
MOD = 1000000007

def dfs(u,fa,k):
    temp=k
    if(fa==0): temp-=1
    else: temp-=2
    global ans
    global MOD
    vis[u]=1
    i=0
    for  v in a[u]:
        if(vis[v]==1):continue
        ans=(ans%MOD*(temp-i)%MOD)%MOD
        
        dfs(v,u,k)
        i+=1


IA = lambda: [int(x) for x in input().split()]
IM = lambda N: [IA() for _ in range(N)]

n,k = IA()
ans=k
a=[ [] for i in range(0,n+1)]
vis=[int(0) for i in range(0,n+1)]

for i in range(0,n-1):
     u,v=IA()
     a[u].append(v)
     a[v].append(u)

dfs(1,0,k)
print(ans)






### FIXED CODE ###

from queue import PriorityQueue
import sys

sys.setrecursionlimit(10**9)

IA = lambda: [int(x) for x in input().split()]
IM = lambda N: [IA() for _ in range(N)]
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

ans=0
MOD = 1000000007

def dfs(u,fa,k):
    temp=k
    if(fa==0): temp-=1
    else: temp-=2
    global ans
    global MOD
    vis[u]=1
    i=0
    for  v in a[u]:
        if(vis[v]==1):continue
        ans=(ans%MOD*(temp-i)%MOD)%MOD
        dfs(v,u,k)
        i+=1


IA = lambda: [int(x) for x in input().split()]
IM = lambda N: [IA() for _ in range(N)]

n,k = IA()
ans=k
a=[ [] for i in range(0,n+1)]
vis=[int(0) for i in range(0,n+1)]

for i in range(0,n-1):
     u,v=IA()
     a[u].append(v)
     a[v].append(u)

dfs(1,0,k)
print(ans)
a,b = [int(x) for x in input()]
if a<b:
    print("a < b")
elif a>b:
    print("a > b")
else:
    print("a == b")

### FIXED CODE ###

a,b = [int(x) for x in input().split()]
if a<b:
    print("a < b")
elif a>b:
    print("a > b")
else:
    print("a == b")
n=int(input())
cnt=0
for i in range(2,int(n**0.5)+2):
    if n%i==0:
        expo=0
    while n%i==0:
        n//=i
        expo+=1
        j=1
    while expo-j>=0:
        cnt+=1
        expo-=j
        j+=1
if n>1:
	cnt+=1
print(cnt)


### FIXED CODE ###

n=int(input())
cnt=0
for i in range(2,int(n**0.5)+2):
    if n%i==0:
        expo=0
        while n%i==0:
            n//=i
            expo+=1
        j=1
        while expo-j>=0:
            cnt+=1
            expo-=j
            j+=1
if n>1:
    cnt+=1
print(cnt)
string = input().replace('','/')
print(eval(string))


### FIXED CODE ###

string = input().replace(' ','/')
print(eval(string))
Q=int(input())
n=10100
is_prime=[1]*(n+10)
is_prime[0]=0
is_prime[1]=0
for i in range(2,n+1):
	for j in range(i*2,n+1,i):
		if is_prime[j]==False:
			continue
		is_prime[j]=0
a=[0]*(n+10)
for i in range(2,n+1):
	if is_prime[i]%2==0:
		continue
	if is_prime[i] and is_prime[int((i+1)/2)]:
		a[i]=1
s=[0]*(n+10)		
for i in range(n):
	s[i+1]=a[i]+s[i]
for i in range(Q):
	l,r=map(int,input().split())
	print(s[r+1]-s[l])

### FIXED CODE ###

Q=int(input())
n=100000
is_prime=[1]*(n+10)
is_prime[0]=0
is_prime[1]=0
for i in range(2,n+1):
	for j in range(i*2,n+1,i):
		if is_prime[j]==False:
			continue
		is_prime[j]=0
a=[0]*(n+10)
for j in range(2,n+1):
	if is_prime[j]%2==0:
		continue
	if is_prime[j] and is_prime[int((j+1)/2)]:
		a[j]=1
s=[0]*(n+10)		
for k in range(n):
	s[k+1]=a[k]+s[k]
ans=[]
for _ in range(Q):
	l,r=map(int,input().split())
	ans.append(s[r+1]-s[l])
print(*ans,sep='\n')
N = int(input())
l = list(map(int, input().split()))
l.sort()
print(l[N/2-1]-l[N/2])

### FIXED CODE ###

N = int(input())
l = list(map(int, input().split()))
l.sort()
print(l[len(l)//2] - l[len(l)//2-1])
a, b = map(int, input().split())

need = 1
tap = a


while tap < b:
	if a == 0 or a == 1 or b < a or b == 0:
		need = 0
		break
	tap += (a - 1)
	need += 1
print (need)

### FIXED CODE ###

# 整数の入力
s = input()
t = input()

cnt = 0
if s[0] == t[0] :
	cnt += 1

if s[1] == t[1] :
	cnt += 1

if s[2] == t[2] :
	cnt += 1

print (cnt)
import bisect, collections, copy, heapq, itertools, math, string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int, sys.stdin.readline().rstrip().split())
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())

from collections import deque
from collections import Counter
import bisect
def main():
    N = I()
    A = LI()
    B = LI()
    A_cnt = Counter(A)
    B_cnt = Counter(B)
    for key in B_cnt.keys():
        x = A_cnt[key]
        if B_cnt[key] > N - x:
            print('No')
            exit()
    print('Yes')
    A_m = A_cnt.most_common()
    A_ = []
    for a_m in A_m:
        A_ += [a_m[0]] * a_m[1]
    B_m = deque(B_cnt.most_common())
    ANS = []
    for i in range(N):
        x = B_m[0][0]
        if A_[i] != x:
            ANS.append((A_[i], x))
            B_cnt[x] -= 1
            if B_cnt[x] == 0:
                B_m.popleft()
        if A_[i] == x:
            y = B_m[1][0]
            ANS.append((x, y))
            B_cnt[y] -= 1
            if B_cnt[y] == 0:
                B_m.popleft()
                B_m.popleft()
                B_m.appendleft((x, B_cnt[x]))
    ANS.sort(key=lambda tup: tup[0])
    ANS_ = []
    for ans in ANS:
        ANS_.append(ans[1])
    print(' '.join(map(str, ANS_)))

if __name__ == "__main__":
    main()



### FIXED CODE ###

import bisect, collections, copy, heapq, itertools, math, string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int, sys.stdin.readline().rstrip().split())
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())

from collections import deque
from collections import Counter
import bisect
def main():
    N = I()
    A = LI()
    B = LI()
    A_cnt = Counter(A)
    B_cnt = Counter(B)
    for key in B_cnt.keys():
        x = A_cnt[key]
        if B_cnt[key] > N - x:
            print('No')
            exit()
    print('Yes')
    A_m = A_cnt.most_common()
    A_ = []
    for a_m in A_m:
        A_ += [a_m[0]] * a_m[1]
    B_m = deque(B_cnt.most_common())
    ANS = []
    for i in range(N):
        x = B_m[0][0]
        if A_[i] != x:
            ANS.append([A_[i], x])
            B_cnt[x] -= 1
            if B_cnt[x] == 0:
                B_m.popleft()
        elif A_[i] == x:
            if len(B_m) != 1:
                B_m.popleft()
                B_m.append((x, B_cnt[x]))
                y = B_m[0][0]
                ANS.append([x, y])
                B_cnt[y] -= 1
                if B_cnt[y] == 0:
                    B_m.popleft()
            else:
                for ans in ANS:
                    if ans[0] != x and ans[1] != x:
                        ANS.append([x, ans[1]])
                        ans[1] = x
                        break

    ANS.sort(key=lambda tup: tup[0])
    ANS_ = []
    for ans in ANS:
        ANS_.append(ans[1])
    print(' '.join(map(str, ANS_)))

if __name__ == "__main__":
    main()
N, K = map(int, input().split())
x = [int(i) for i in input().split()]

time = 10 ** 20
# 0以上の最小の整数
base = 0
index = 0

for i in range(N):
    if x[i] >= 0:
        base = x[i]
        index = i
        break
else:
    index = -1

if index == 0:
        time = x[K-1]
elif index == -1:
    time = abs(x[N-K])
else:
    for i in range(max(0, index - K), min(index, N)):
        if x[i+K-1] < 0:
            time = min(abs(x[i]), time)
        elif x[i] < 0 and  x[i+K-1] >= 0:
            time = min(min(abs(x[i]), x[i+K-1]) * 2 + max(abs(x[i]), x[i+K-1]), time)
        else:
            time = min(x[i+K-1], time)

print(time

### FIXED CODE ###

# 無駄なところも数えて良いっていう考え方もある。
# 常に最適化しないといけないわけではない

N, K = map(int, input().split())
x = [int(i) for i in input().split()]

time = 10 ** 20

for i in range(N - K + 1):
    x_min = x[i]
    x_max = x[i + K - 1]
    if x_min >= 0:
        this_time = x_max
    elif x_max <= 0:
        this_time = abs(x_min)
    else:
        this_time = x_max - x_min + min(x_max, abs(x_min))

    if time > this_time:
        time = this_time

print(time)
num = int(input())
words = []
answer = 0

for i in range(num):
  words.append(sorted(list(input())))

for i in range(num):
  for j in range(num -i - 1):
    p = 0
    for k in range(10):
      if words[i][k] == words[j + 1 + i][k]:
        p += 1
      else:
        break
    if p == 10:
      answer += 1

print(answer)

### FIXED CODE ###

nums = [int(s) for s in input().split()]
a = nums[0]
b = nums[1]

box = []
box.append(a + b)
box.append(a - b)
box.append(a * b)
print(max(box))
# B problem
inp = [int(x) for x in input().rstrip('\n').split()]

bingo = inp[0:9]
b = inp[10:]

for i in b:
    for j in range(len(bingo)):
            if i == bingo[j]:
                bingo[j] = 0

true_list = list()
for i in [0, 3, 6]:
    if (bingo[i] + bingo[i+1] + bingo[i+2]) == 0:
        true_list.append(0)
for i in [0, 1, 2]:
    if (bingo[i] + bingo[i+3] + bingo[i+6]) == 0:
        true_list.append(0)
if (bingo[0] + bingo[4] + bingo[8]) == 0:
    true_list.append(0)
if (bingo[2] + bingo[4] + bingo[6]) == 0:
    true_list.append(0)

if not all(true_list):
    print('Yes')
else:
    print('No')

### FIXED CODE ###

import sys
bingo = [list(map(int, input().split())) for i in range(3)]
N = int(input())

for i in range(N):
    b = int(input())
    for j in range(len(bingo)):
      for k in range(len(bingo[j])):
            if b == bingo[j][k]:
                bingo[j][k] = 0

for i in range(len(bingo)):
    if sum(bingo[i]) == 0:
        print('Yes')
        sys.exit()
    if (bingo[0][i] + bingo[1][i] + bingo[2][i]) == 0:
        print('Yes')
        sys.exit()

for i in [0]:
  if (bingo[i][i] + bingo[i+1][i+1] + bingo[i+2][i+2]) == 0:
    print('Yes')
    sys.exit()
  if (bingo[i][i+2] + bingo[i+1][i+1] + bingo[i+2][i]) == 0:
    print('Yes')
    sys.exit()
  else:
    print("No")
a,b,c=input().split
x=a[0]+b[0]+c[0]
print(x.upper())

### FIXED CODE ###

a,b,c=input().split()
x=a[0]+b[0]+c[0]
print(x.upper())
n, m = map(int, input().split())
x = list(map(int, input().split()))
x.sort()

x_diff = [x[i+1] - x[i] for i in range(len(x)-1)]
for _ in range(n-1):
    del x_diff[x_diff.index(max(x_diff))]
    
print(sum(x_diff))

### FIXED CODE ###

N, M, *X = map(int, open(0).read().split())
X.sort()

y = sorted([X[i + 1] - X[i] for i in range(len(X) - 1)], reverse=True)
print(sum(y[N - 1:]))
import sys


def solve():
    M, D = input().split()
    ans = 0
    m, d_1, d_2 = int(M), int(D[0]), int(D[1])

    if int(M) < 4 or d_1 < 2 and d_2 < 2:
        print(0)
        sys.exit()

    for i in range(4, m+1):
        for j in range(2, d_1+1):
            for k in range(2, 10):
                if j == d_1 and k > d_2:
                    break
                if i == j * k:
                    ans += 1
    print(ans)


if __name__ == '__main__':
    solve()

### FIXED CODE ###

import sys


def solve():
    M, D = input().split()
    ans = 0
    
    if int(D) < 22:
        print(0)
        sys.exit()
    
    m, d_1, d_2 = int(M), int(D[0]), int(D[1])

    if int(M) < 4 or d_1 < 2 and d_2 < 2:
        print(0)
        sys.exit()

    for i in range(4, m+1):
        for j in range(2, d_1+1):
            for k in range(2, 10):
                if j == d_1 and k > d_2:
                    break
                if i == j * k:
                    ans += 1
    print(ans)


if __name__ == '__main__':
    solve()
s = input()
print(S[:4]+' '+S[4:])

### FIXED CODE ###

S = input()
print(S[:4]+' '+S[4:])
n,q=map(int,input().split())
box=[list(map(int,input().split())) for i in range(n-1)]
point=[list(map(int,input().split())) for i in range(q)]
tree={i+1:[] for i in range(n)}
answer=[0]*n
for x,y in box:tree[x] +=[y]

def tree_sum(tree,point_x,point_y):
    answer[point_x-1] +=point_y
    for i in tree[point_x]:
        if len(tree[i])!=0:
            tree_sum(tree,i,point_y)
        else:answer[i-1] +=point_y
    return tree
for x,y in point:
    tree_sum(tree,x,y)

print(*answer)

### FIXED CODE ###

# coding: utf-8
# Your code here!

import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline #文字列入力のときは注意

#n = int(input())
n,q = [int(i) for i in readline().split()]

g = [[] for _ in range(n)]
for i in range(n-1):
    a,b = [int(i) for i in readline().split()]
    g[a-1].append(b-1)
    g[b-1].append(a-1)

add = [0]*n
for _ in range(q):
    p,x = [int(i) for i in readline().split()]
    add[p-1] += x

ans = [0]*n
#ans[0] = add[0]

def dfs(v,p,value): #p: parent of v
    value += add[v]
    ans[v] = value
    for c in g[v]:
        if c == p: continue
        dfs(c,v,value)

dfs(0,-1,0)

#print(add)

print(*ans)
class Main:
    import math
    H = int(input())
    if H == 1:
        print(1)
    else:
        cnt = int(math.log(H, 2))
        num = 0
        for i in range(cnt+1):
            num += 2 ** i
    print(num)

### FIXED CODE ###

class Main:
    s = list(map(int, input().split()))
    h = s[0]
    a = s[1]
    cnt = 0
    if h >= a:
        while h > 0:
            h -= a
            cnt += 1

    else:
        cnt = 1
    print(cnt)
X,Y,A,B,C =  [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
C = [int(i) for i in input().split()]
A.append(0)
B.append(0)
C.append(0)
ux_1 = 0
uy_1 = 0
for i in range(X):
    ux_1 += max(max(A),max(C))
    if max(A) >= max(C):
        A.pop(A.index(max(A)))
    else:
        C.pop(C.index(max(C)))
for i in range(Y):
    uy_1 += max(max(B),max(C))
    if max(B) >= max(C):
        B.pop(B.index(max(B)))
    else:
        C.pop(C.index(max(C)))
print(ux_1+uy_1)

### FIXED CODE ###

S = str(input())
if S[2] == S[3] and S[4] == S[5]:
    print('Yes')
else:
    print('No')
import math

def prime_factorize(n):
    ret = []
    # 小さい素数から順に試し割りしていく
    for i in range(2, int(math.sqrt(n))+1):
        if n % i != 0:
            continue
        e = 0
        while n % i == 0:
            e += 1
            n //= i
        ret += [(i, e)]

    if n != 1:
        ret += [(n, 1)]

    return ret


def calc():
    MOD, MAX_V = int(10**9+7), 1000
    table = [ [0]*MAX_V for _ in range(MAX_V) ]
    table[0][0] = 1
    for i in range(1, MAX_V):
        table[i][0] = 1
        for j in range(1, MAX_V):
            table[i][j] = (table[i-1][j-1] + table[i-1][j]) % MOD
    return table


def main():
    N, M = map(int, input().split())
    v = prime_factorize(M)

    table = calc()
    ans = 1

    for i in v:
        ans *= int(table[N+i[1]-1][i[1]])
    
    print (ans)

main()


### FIXED CODE ###

import math

def prime_factorize(n):
    ret = []
    # 小さい素数から順に試し割りしていく
    for i in range(2, int(math.sqrt(n))+1):
        if n % i != 0:
            continue
        e = 0
        while n % i == 0:
            e += 1
            n //= i
        ret += [(i, e)]

    if n != 1:
        ret += [(n, 1)]

    return ret


def extgcd(a, b):
    x,y, u,v = 0,1, 1,0
    while a != 0:
        q, r = b//a, b%a
        m, n = x-u*q, y-v*q
        b,a, x,y, u,v = a,r, u,v, m,n
        g = b
    return x, y, g


def modinv(a, m):
    x, y, g = extgcd(a, m)
    if g != 1:
        print ("[+]Inverse does not exist.")
    else:
        return ((m + x) % m) % m


def calc_comb(n, k, mod):
    if k > n-k:
        return calc_comb(n, n-k, mod)

    ans_mul, ans_div = 1, 1

    for i in range(k):
        ans_mul *= (n-i)
        ans_div *= (i+1)
        ans_mul %= mod
        ans_div %= mod

    return (ans_mul * modinv(ans_div, mod) % mod)


def main():
    N, M = map(int, input().split())
    v = prime_factorize(M)
    MOD = int(10**9+7)
    ans = 1

    for i in v:
        ans *= calc_comb(N+i[1]-1, i[1], MOD)
        ans %= MOD
    print (ans)

main()
import numpy as np

N,K = map(int,input().split())
a = np.matrix(np.zeros((N,N)))
for k,v in enumerate(map(int,input().split())):
    v -= 1
    a[k,v] = 1

b = np.matrix(np.zeros(N))
b[0,0] = 1

o = [0] * 63

def bi(x):
    i = 0
    while x != 0:
        o[i] = x%2
        x //= 2
        i += 1

bi(K)

for i in range(63):
    if i:
        a = a * a
    if o[i]:
        b = b * a

for i in range(N):
    if b[0,i]:
        print(i+1)

### FIXED CODE ###

N,K = map(int,input().split())
A = list(map(int,input().split()))
for i in range(N):
    A[i] -= 1

P = [-1]*N
P[0] = 0

cnt = 0
NOW = 0
while True:
    NOW = A[NOW]
    cnt += 1
    if P[NOW] == -1:
        P[NOW] = cnt
        if cnt == K:
            print(NOW+1)
            exit()
    else:
        L = cnt - P[NOW]
        for i in range(P[NOW],P[NOW]+L):
            if K % L != i % L:
                continue
            for k,v in enumerate(P):
                if v == i:
                    print(k+1)
                    exit()
A, B, K = map(int, input().split())
n = max(A, B)
list1 =[]
count = 0
for i in range(1, n):
  if A % i == 0 and B % i == 0:
    list1.append(i)
list1 = list1[::-1]
print(list1[K-1])

### FIXED CODE ###

A, B, K = map(int, input().split())
n = min(A, B)
list1 =[]
for i in range(1, n+1):
  if A % i == 0 and B % i == 0:
    list1.append(i)
list1 = list1[::-1]
print(list1[K-1])