Harryxun/stf_run huggingface dataset:
T1,T2=map(int,input().split())
A1,A2=map(int,input().split())
B1,B2=map(int,input().split())


#A1>=B1にする
if A1>=B1:
    pass
else:
    A1,B1=B1,A1
    A2,B2=B2,A2

D1=(A1-B1)*T1#>=0
D2=(A2-B2)*T2#?

if D1==-D2:
    print("infinity")
elif D1+D2>=0:
    print("0")
else:
    diff = abs(D1+D2)#マイからこれだけ差が開く
    if D1%diff==0:
        print(D1//diff*2)
    else:
        assert 1==2


### FIXED CODE ###

from math import ceil
T1,T2=map(int,input().split())
A1,A2=map(int,input().split())
B1,B2=map(int,input().split())


#A1>=B1にする
if A1>=B1:
    pass
else:
    A1,B1=B1,A1
    A2,B2=B2,A2

D1=(A1-B1)*T1#>=0
D2=(A2-B2)*T2#?

if D1==-D2:
    print("infinity")
elif D1+D2>=0:
    print("0")
else:
    diff = abs(D1+D2)#マイからこれだけ差が開く
    if D1%diff==0:
        print(D1//diff*2)
    else:
        print(ceil(D1/diff)*2-1)
nm = list(map(int, input().split()))
if (nm[0] =< nm[1]):
    print("unsafe")
else print("safe")

### FIXED CODE ###

sw = list(map(int, input().split()))
if sw[0] <= sw[1]:
    print("unsafe")
else:
    print("safe")
h,a=def main():
    h,a=map(int,input().split())
    if h % a:
        print(h//a+1)
    else:
        print(h//a)

main()

### FIXED CODE ###

def main():
    h,a=map(int,input().split())
    if h % a:
        print(h//a+1)
    else:
        print(h//a)
 
main()
N,M = map(int,input().split())
to = [[] for i in range(N)]
From = [[] for i in range(N)]
for i in range(N-1+M):
    x, y = list(map(int,input().split()))
    to[x-1].append(y-1)
    From[y-1].append(x-1)
s = topological_sort(N, to)
s = [(s[i],i) for i in range(N)]
s.sort()
for i in range(N):
    k = -1
    I = -1
    for j in From[i]:
        if k < s[j][1]:
            k = s[j][1]
            I = j
    print(I+1)

### FIXED CODE ###

from collections import deque

def topological_sort(V, to):
    cnt = [0]*V
    for i in range(V):
        for j in to[i]:
            cnt[j] += 1
    Q = deque(i for i in range(V) if cnt[i]==0)
    res = []
    while Q:
        i = Q.popleft()
        res.append(i)
        for k in to[i]:
            cnt[k] -= 1
            if cnt[k] == 0:
                Q.append(k)
    return res

N,M = map(int,input().split())
to = [[] for i in range(N)]
From = [[] for i in range(N)]
for i in range(N-1+M):
    x, y = list(map(int,input().split()))
    to[x-1].append(y-1)
    From[y-1].append(x-1)
s = topological_sort(N, to)
s = [(s[i],i) for i in range(N)]
s.sort()
for i in range(N):
    k = -1
    I = -1
    for j in From[i]:
        if k < s[j][1]:
            k = s[j][1]
            I = j
    print(I+1)
A11,A12,A13 = map(int, input().split())
A21,A22,A23 = map(int, input().split())
A31,A32,A33 = map(int, input().split())
N = int(input())
b = []
for i in range(N):
    b.append(int(input()))

def check_bingo(bingo_card):
    bingo_cnt = 0
    bingo_list = [[0, 1, 2],
                  [3, 4, 5],
                  [6, 7, 8],
                  [0, 3, 6],
                  [1, 4, 5],
                  [2, 5, 8],
                  [0, 4, 8],
                  [2, 4, 6],]    

    for i in range(len(bingo_list)):
        for j in range(len(bingo_list[i])):
            if bingo_card[bingo_list[i][j]] == 0:
                bingo_cnt +=1
            else:
                break
        
        if bingo_cnt == 3:
            return(True)
            break
        else:
            bingo_cnt = 0
            return(False)

def main():
    bingo_card = [A11,A12,A13,A21,A22,A23,A31,A32,A33]
    cnt = 0
    for i in range(N):
        if b[i] in bingo_card:
            bingo_card[i] = 0
            cnt += 1
        else:
            pass

    if cnt <= 2:
        print('No')                
        
    elif 3 <= cnt <= 6:
        judge_bingo = check_bingo(bingo_card)
        if judge_bingo == True:
            print('Yes')
        else:
            print('No')
    else:
        print('Yes')                
    
if __name__ == "__main__":
    main()



### FIXED CODE ###

A11,A12,A13 = map(int, input().split())
A21,A22,A23 = map(int, input().split())
A31,A32,A33 = map(int, input().split())
N = int(input())
b = []
for i in range(N):
    b.append(int(input()))

def check_bingo(bingo_card):
    bingo_cnt = 0
    ret = False
    bingo_list = [[0, 1, 2],
                  [3, 4, 5],
                  [6, 7, 8],
                  [0, 3, 6],
                  [1, 4, 5],
                  [2, 5, 8],
                  [0, 4, 8],
                  [2, 4, 6],]    

    for i in range(len(bingo_list)):
        for j in range(len(bingo_list[i])):
            if bingo_card[bingo_list[i][j]] == 0:
                bingo_cnt +=1
            else:
                break
        
        if bingo_cnt == 3:
            ret = True
            break
        else:
            bingo_cnt = 0
    
    return(ret)

def main():
    bingo_card = [A11,A12,A13,A21,A22,A23,A31,A32,A33]
    cnt = 0
    for i in range(N):
        for j in range(len(bingo_card)):
            if b[i] == bingo_card[j]:
                bingo_card[j] = 0
                cnt += 1
                break
            else:
                pass

    if cnt <= 2:
        print('No')                
        
    elif 3 <= cnt <= 6:
        judge_bingo = check_bingo(bingo_card)
        if judge_bingo == True:
            print('Yes')
        else:
            print('No')
    else:
        print('Yes')                
    
if __name__ == "__main__":
    main()
#-*-coding:utf-8-*-

def main():
    n, k = map(int, input().split())
    x_list = list(map(int, input().split()))
    ans = float('inf')

    if 0 in x_list:
        k -= 1

    for i in range(n - k + 1):
        if x_list[i] >= 0 and x_list[i+k-1] >= 0:
            ans = min(ans, x_list[i+k-1])
        elif x_list[i] < 0 and x_list[i+k-1] < 0:
            ans = min(ans, -x_list[i])
        else:
            ans = min(ans, -x_list[i] * 2 + x_list[i+k-1])
    print(ans)

if __name__ == '__main__':
    main()

### FIXED CODE ###

#-*-coding:utf-8-*-

def main():
    n, k = map(int, input().split())
    x_list = list(map(int, input().split()))
    ans = float('inf')

    for i in range(n - k + 1):
        if x_list[i] >= 0 and x_list[i+k-1] >= 0:
            ans = min(ans, x_list[i+k-1])
        elif x_list[i] <= 0 and x_list[i+k-1] <= 0:
            ans = min(ans, -x_list[i])
        else:
            ans = min(ans, min(-x_list[i] * 2 + x_list[i+k-1] , -x_list[i] + x_list[i+k-1] * 2))
    print(ans)

if __name__ == '__main__':
    main()
# -*- coding: utf-8 -*-
MOD = 1000000007
N, M = map(int, input().split())
a = []
for _ in range(M):
    a.append(int(input()))


def getPatternNum(num):
    pattern = [0] * (num + 2)
    pattern[0] = 0
    for i in range(1, num + 2):
        if i == 0 or i == 1:
            pattern[i] = 1
            continue
        pattern[i] = (pattern[i - 2] + pattern[i - 1]) % MOD
    return pattern

def solve():
    # 階段の連続してる数のリスト
    stepsList = [0] * (M + 1)
    maxSteps = 0
    stepsList[0] = a[0]
    for j in range(1, M):
        stepsList[j] = a[j] - a[j - 1] - 1
        if stepsList[j] == 0:
            return 0
    stepsList[M] = N - a[M - 1]
    pattern = getPatternNum(max(stepsList) + 1)
    # こわれてるところ以外のパターンを掛ける
    # print("#", pattern)
    for k in range(len(stepsList)):
        if k == 0:
            total = pattern[stepsList[k]]
        else:
            total = (total * pattern[stepsList[k]]) % MOD
        # print("##", k, stepsList[k], pattern[stepsList[k]], total)

    return total


ans = solve()
print(ans)

### FIXED CODE ###

N, M = map(int, input().split())
a = [int(input()) for _ in range(M)]
a.sort()
a.append(10 ** 9 + 7)

memo = [None] * (N + 1)
memo[0] = 1

idx = 0
for pos in range(1, N + 1):
    if a[idx] == pos:
        memo[pos] = 0
        idx += 1
        continue
    else:
        if pos > a[idx]:
            idx += 1
        #
        if pos == 1:
            memo[1] = (memo[0]) % (10 ** 9 + 7)
        else:
            memo[pos] = (memo[pos - 2] + memo[pos - 1]) % (10 ** 9 + 7)

# print("#", memo)
print(memo[-1])
import sys
from decimal import Decimal
from fractions import Fraction

def main():

    #input_strings = sys.stdin.readlines()
    for matrix_string in input_strings:
        matrix = list(map(Fraction, list(matrix_string.split())))
        if matrix[0] == 0:
            matrix = matrix[3:] + matrix[:3]
        matrix = list(map(lambda x: x / matrix[0], matrix[:3])) + matrix[3:]
        matrix = matrix[:3] + list(map(lambda x: x[1] - matrix[3] * x[0], zip(matrix[:3], matrix[3:])))
        matrix = matrix[:3] + list(map(lambda x: x / matrix[4], matrix[3:]))
        matrix = list(map(lambda x: x[0] - matrix[1] * x[1], zip(matrix[:3], matrix[3:]))) + matrix[3:]
        matrix = list(map(float, matrix))
        matrix = list(map(Decimal, matrix))
        matrix = list(map(lambda x: x.quantize(Decimal('.001'), rounding='ROUND_HALF_UP'), matrix))
        matrix = list(map(lambda x: x + 0, matrix))

        print('%.3f %.3f' % (matrix[2], matrix[5]))
main()

### FIXED CODE ###

import sys
from decimal import Decimal
from fractions import Fraction

def main():

    input_strings = sys.stdin.readlines()
    for matrix_string in input_strings:
        matrix = list(map(Fraction, list(matrix_string.split())))
        if matrix[0] == 0:
            matrix = matrix[3:] + matrix[:3]
        matrix = list(map(lambda x: x / matrix[0], matrix[:3])) + matrix[3:]
        matrix = matrix[:3] + list(map(lambda x: x[1] - matrix[3] * x[0], zip(matrix[:3], matrix[3:])))
        matrix = matrix[:3] + list(map(lambda x: x / matrix[4], matrix[3:]))
        matrix = list(map(lambda x: x[0] - matrix[1] * x[1], zip(matrix[:3], matrix[3:]))) + matrix[3:]
        matrix = list(map(float, matrix))
        matrix = list(map(Decimal, matrix))
        matrix = list(map(lambda x: x.quantize(Decimal('.001'), rounding='ROUND_HALF_UP'), matrix))

        print('%.3f %.3f' % (matrix[2], matrix[5]))
main()
def fizz_buzz():
    c = 1
    while True:
        res = ''
        if c % 3 == 0:
            res = res + 'Fizz'
        if c % 5 == 0:
            res = res + 'Buzz'
        if res == '':
            yield str(c)
        else:
            yield res
        c += 1

while True:
    m,n = map(int,raw_input().split())
    if m == 0: break

    player = range(m)

    p = 0
    fb = fizz_buzz()
    for i in range(n):
        inp = raw_input()
        if len(player) > 1:
            if  inp != fb.next():
                del player[p] 
            else:
                p = (p+1) % len(player)

    result = str(player[0]+1)
    for pi in player[1:]:
        result += ' ' + str(pi+1)

    print result

### FIXED CODE ###

def fizz_buzz():
    c = 1
    while True:
        res = ''
        if c % 3 == 0:
            res = res + 'Fizz'
        if c % 5 == 0:
            res = res + 'Buzz'
        if res == '':
            yield str(c)
        else:
            yield res
        c += 1

while True:
    m,n = map(int,input().split())
    if m == 0: break

    player = list(range(m))

    p = 0
    fb = fizz_buzz()
    for i in range(n):
        inp = input()
        if len(player) > 1:
            if  inp != next(fb):
                del player[p] 
                p = p % len(player)
            else:
                p = (p+1) % len(player)

    result = str(player[0]+1)
    if len(player) > 1:
        for pi in player[1:]:
            result += ' ' + str(pi+1)

    print(result)
n,a,b = map(int, input().split())
value = cnt = 0
for i in range(1, n+1):
    lst = []
    lst = list(str(i))
    for num in lst:
        value += int(num)
    if a <= value <= b:
    cnt += i
    value = 0
print(cnt)

### FIXED CODE ###

n,a,b = map(int, input().split())
value = cnt = 0
for i in range(1, n+1):
    lst = []
    lst = list(str(i))
    for num in lst:
        value += int(num)
    if a <= value <= b:
    	cnt += i
    value = 0
print(cnt)
# -*- coding: utf-8 -*-
import sys

N = input()
an = input()
s = sorted(set(int(an.split())))
print(sum(s))


### FIXED CODE ###

# -*- coding: utf-8 -*-
import sys

N = input()
an = input()
s = sorted(set(map(int, an.split())))
print(s[-1] - s[0])
N, K = map(int, input().split())
A = list(map(int, input().split()))
import math
import functools
gcd = functools.reduce(math.gcd, A)
A_max = max(A)
if (A_max >= K and K % gcd == 0):
    print('POSSEBLE')
else:
    print('IMPOSSIBLE')

### FIXED CODE ###

N, K = map(int, input().split())
A = list(map(int, input().split()))
import fractions
import functools
gcd = functools.reduce(fractions.gcd, A)
A_max = max(A)
if (A_max >= K and K % gcd == 0):
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')
a,b=map(int,input())
print(int(a-b+1))

### FIXED CODE ###

a,b=map(int,input().split())
print(int(a-b+1))
n, a , b = map(int, input().split())
counter=0
for i in range(1, n+1):
    sum1 =  sum(int(x) for x in str(i))
    if(a<=sum1<=b):
        counter+=i
print(counter)

### FIXED CODE ###

a,b,c,d = map(int,input().split())
if a+b > c+d:
    print('Left')
elif a+b == c+d:
    print('Balanced')
else:
    print('Right')
n=int(input())
if n==1:
  print("Hello World")
else:
  a,b=int(input().split())
  print(a+b)

### FIXED CODE ###

n=int(input())
if n==1:
  print("Hello World")
else:
  a=int(input())
  b=int(input())
  print(a+b)
import queue
N, M = map(int, input().split())
adj = [[] for i in range(N+1)]
parent = [-1] * (N+1)
for m in range(N):
    a, b  = mpa(int, input().split())
    adj[a].append(b)
    adj[b].append(a)
q = queue.Queue()
q.put((1,0))
while(not q.empty()):
    x, p = q.get()
    if parent[x] != -1:
        continue
    parent[x] = p
    for next in adj[x]:
        if parent[next] == -1:
            q.put((next, x))
print("Yes")
for p in parent[2:]:
    print(p)


### FIXED CODE ###

import queue
N,M = map(int,input().split())
adj = [[]for i in range(N+1)]
parent = [-1] * (N+1) # -1なら未訪問
for m in range(M):
    a,b = map(int,input().split())
    adj[a].append(b)
    adj[b].append(a)
q = queue.Queue() # 自分の部屋番号、親の部屋番号
q.put((1,0)) # 部屋1の親は部屋0と考える
while(not q.empty()):
    x, p = q.get()
    if parent[x] != -1: # 訪問済み
        continue
    parent[x] = p
    for next in adj[x]:
        if parent[next] == -1: # 未訪問なら
            q.put((next,x)) # 探索候補に追加
print ('Yes') # 必ず目標は達成できる
for p in parent[2:]: # 部屋2以降の親（前の部屋）
    print(p)
n, k = map(int, input().split())
A = list(map(int, input().split()))
All = [[0]*40 for i in range(n)]
K = [0]*40
stopper = 0
sum_ = 0
B = []
b = 0

for i in range(len(A)):
    bin_a = format(A[i],'b')
    list_a = [int(i) for i in bin_a]
    All[i] = [0]*(40-len(list_a))+ list_a
    
bin_k =   format(k,'b') 
list_k = [int(i) for i in bin_k]
K = [0]*(40-len(list_k))+list_k

for i in range(40):
    for j in range(n):
        b = b + All[j][i]
    B = B + b
    
for i in range(40):
    if K[i]==1 and B[i]>= (n+1)//2:
        K[i]=0
        stopper = i
        break

if stopper!=0 and stopper<=38:
    for i in range(stopper+1,40):
        if K[i]==1 and B[i]>= (n+1)//2:
            K[i] = 0
        if K[i]==0 and B[i]< (n+1)//2:
            K[i] = 1

for i in range(n):
    for j in range(1,41):
        All[i][-j] = K[-j]^All[i][-j]
        sum_ = sum_ + All[i][-j]*(2**(j-1))

print(sum_)

### FIXED CODE ###

import numpy as np

n, k = map(int, input().split())
A = list(map(int, input().split()))
All = [[0]*41 for i in range(n)]
K = [0]*41
stopper = 0
sum_ = 0



for i in range(len(A)):
    bin_a = format(A[i],'b')
    list_a = [int(i) for i in bin_a]
    All[i] = [0]*(41-len(list_a))+ list_a
    
bin_k =   format(k,'b') 
list_k = [int(i) for i in bin_k]
K = [0]*(41-len(list_k))+list_k

b = np.cumsum(All, axis = 0)
B = b[len(b)-1]
    
for i in range(41):
    if K[i]==1 and B[i]>= (n+1)//2:
        K[i]=0
        stopper = i
        break

if stopper!=0 and stopper<=39:
    for i in range(stopper+1,41):
        if  B[i]>= (n+1)//2:
            K[i] = 0
        else:
            K[i] = 1
            
            
for i in range(41):
    if K[i]==1:
        B[i] = n-B[i]

for i in range(1,42):
    sum_ = sum_ + B[-i]*(2**(i-1))

print(sum_)
import sys

sys.setrecursionlimit(3000)

H, W = map(int, input().split())
lst = [['#'] * (W+2)]
lst += [['#'] + list(input()) + ['#'] for i in range(H)]
lst += [['#'] * (W+2)]


lst_ue = [[-1] * (W+2) for i in range(H+2)]
lst_shita = [[-1] * (W+2) for i in range(H+2)]
lst_migi = [[-1] * (W+2) for i in range(H+2)]
lst_hidari = [[-1] * (W+2) for i in range(H+2)]

# print (lst_ue)
def ue(i, j):
    if lst_ue[i][j] != -1:
        return lst_ue[i][j]
    if lst[i][j] == '#':
        lst_ue[i][j] = 0
        return 0
    else:
        lst_ue[i][j] = ue(i-1, j) + 1
        return lst_ue[i][j]


def shita(i, j):
    if lst_shita[i][j] != -1:
        return lst_shita[i][j]
    if lst[i][j] == '#':
        lst_shita[i][j] = 0
        return 0
    else:
        lst_shita[i][j] = shita(i+1, j) + 1
        return lst_shita[i][j]        


def hidari(i, j):
    if lst_hidari[i][j] != -1:
        return lst_hidari[i][j]
    if lst[i][j] == '#':
        lst_hidari[i][j] = 0
        return 0
    else:
        lst_hidari[i][j] = hidari(i, j-1) + 1
        return lst_hidari[i][j]        

def migi(i, j):
    if lst_migi[i][j] != -1:
        return lst_migi[i][j]
    if lst[i][j] == '#':
        lst_migi[i][j] = 0
        return 0
    else:
        lst_migi[i][j] = migi(i, j+1) + 1
        return lst_migi[i][j]        

ans = 0
if H < 1500 and W < 1500:
    for i in range(1,H+1):
        for j in range(1, W+1):
            if lst[i][j] != '#':
                ans = max(ans, ue(i,j)+shita(i,j)+hidari(i,j)+migi(i,j)-3)
else:
    for i in range(750,1250):
        for j in range(750, 1250):
            if lst[i][j] != '#':
                ans = max(ans, ue(i,j)+shita(i,j)+hidari(i,j)+migi(i,j)-3)
                if ans == H+W-1:
                    print (ans)
                    sys.exit()

print (ans)


### FIXED CODE ###

#上下方向の探索と左右方向の探索をまとめる
#まず表を完成させる-->全マスの探索
H, W = map(int, input().split())
lst = [['#'] * (W+2)]
lst += [['#'] + list(input()) + ['#'] for i in range(H)]
lst += [['#'] * (W+2)]


lst_ue = [[0] * (W+2) for i in range(H+2)]
lst_shita = [[0] * (W+2) for i in range(H+2)]
lst_migi = [[0] * (W+2) for i in range(H+2)]
lst_hidari = [[0] * (W+2) for i in range(H+2)]

for i in range(1, H+1):
    for j in range(1, W+1):
        lst_hidari[i][j] = 0 if lst[i][j] == '#' else 1 + lst_hidari[i][j-1]
    for j in range(W, 0, -1):
        lst_migi[i][j] = 0 if lst[i][j] == '#' else 1 + lst_migi[i][j+1]

for j in range(1, W+1):
    for i in range(1, H+1):
        lst_ue[i][j] = 0 if lst[i][j] == '#' else 1 + lst_ue[i-1][j]
    for i in range(H+1, 0, -1):
        lst_shita[i][j] = 0 if lst[i][j] == '#' else 1 + lst_shita[i+1][j]

ans = 0
for i in range(1,H+1):
    for j in range(1, W+1):
        ans = max(ans, lst_ue[i][j]+lst_shita[i][j]+lst_migi[i][j]+lst_hidari[i][j]-3)

print (ans)
# from operator import mul
# from functools import reduce

n=int(input())
a=list(map(int,input().split()))
limit=10**18

if 0 in a:
    print(0)
    exit()

# ans = 1
# ans = reduce(mul, a) #=> 1320

for i in range(a):
  ans *= a[i]
  if sum>limit:
  # if a[i] == 0:
  #   break
  # elif (ans*a[i]) > limit:
    ans = -1
    break

# if ans > limit:
#   print(-1)
# else:
  print(ans)


### FIXED CODE ###

# from operator import mul
# from functools import reduce

n=int(input())
a=list(map(int, input().split()))
# limit=10**18

# if 0 in a:
#     print(0)
#     exit()

ans = 1
# ans = reduce(mul, a) #=> 1320

for i in range(n):
  ans *= a[i]
  if ans > 10 ** 18:
  # if a[i] == 0:
  #   break
  # elif (ans*a[i]) > limit:
    ans = -1
    break

for i in range(n):
  if a[i] == 0:
      ans = 0

# if ans > limit:
#   print(-1)
# else:
print(ans)
N,M = map(int,input().split())
for i in range(M):
    a[i]=input().rstrip().split()
# 左側の島の一番大きい島の１個→に橋をたてていく
#　全て分割されたら終了
#　左側は昇順になっている？なっていなかったらそこ修正
a = [[]*2]*M
sum = 0#分割の数
hasi = [0]*(N-1)#どこの橋を壊したか
for i in range(0,M):
    c1 = int(a[M-1-i][0])
    c2 = int(a[M-1-i][1])
    f = [False]
    for m in range(c1-1,c2-1):
        if hasi[m]==1:
            f[0]=True
    if f[0]==True:
        continue
    else:
        hasi[c1-1]=1
        sum = sum+1



print(sum)   


### FIXED CODE ###

N,M = map(int,input().split())
a = list(list(map(int, input().split())) for x in range(M))

#aをbについて昇順にする。
a=sorted(a, key=lambda x: x[1])
hasi = -1#どこの橋を壊したか
sum = 0

for i in range(0,M):
    # print(c1,c2,hasi)
    if (hasi >= a[i][0])and (hasi < a[i][1]):
        continue
    else:
        hasi = a[i][1]-1
        sum = sum+1

print(sum)
import sympy
A,B = map(int,input().split())
print(1 + len(set(sympy.factorint(A).keys()) & set(sympy.factorint(B).keys())))

### FIXED CODE ###

def fact(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)

    if temp!=1:
        arr.append(temp)

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

    return arr

A,B = map(int,input().split())
print(len( (set(fact(A))|set([1])) & (set(fact(B))|set([1])) ))
N = int(input())
list1 = sorted(list(map(int, input().split())))

s = 'YES'
for i in range(N-1):
  if list[i] == list[i+1]:
    s = 'NO'
    break
print(s)

### FIXED CODE ###

N = int(input())
list1 = sorted(list(map(int, input().split())))
pre_num = None
s = 'YES'
for num in list1:
  if num == pre_num:
    s = 'NO'
    break
  pre_num = num
print(s)
N = int(input())
ds = input().split()
ds = [int(i) for i in ds]
ds.sort()
#print(ds)
#if ds[int(N/2)] == ds[int(N/2)+1]:
#  print("0")
#else:
print(ds[int(N/2)+1]-ds[int(N/2)])

### FIXED CODE ###

N = int(input())
ds = input().split()
ds = [int(i) for i in ds]
ds.sort()
#print(ds)
#if ds[int(N/2)] == ds[int(N/2)+1]:
#  print("0")
#else:
print(ds[int(N/2)]-ds[int(N/2)-1])
def main():
    x=int(input())
    cnt=0
    for i in range(1,x):
        if cnt<x:
            cnt+=i
            print(i,cnt)
        else:
            print(i,cnt)
            t=i-1
            break
    print(t)

if __name__=='__main__':
    main()

### FIXED CODE ###

def main():
    import sys
    x=int(input())
    cnt=0
    if x==1:
        print(1)
        sys.exit()
    if x==2:
        print(2)
        sys.exit()
    for i in range(1,x):
        if cnt<x:
            cnt+=i
        else:
            t=i-1
            break
    print(t)

if __name__=='__main__':
    main()
a = int(input())
PI = 3.1415926535
print("%f %f" % (a*a*PI, a*PI*2))

### FIXED CODE ###

a = float(input())
PI = 3.14159265358979323846
print("%f %f" % (a*a*PI, a*PI*2))
a,b,c,d = map(int,input().split())
turn =1
while((a<=0) or (c<=0)):
  if(turn = 1):
    c -= b
    turn = 0
  else:
    a -= d
    turn = 1
if(a<=0):
  print("No")
else:
  print("Yes")
    
  


### FIXED CODE ###

a,b,c,d = map(int,input().split())
turn =1
while((a>0) and (c>0)):
  if(turn == 1):
    c -= b
    turn = 0
  else:
    a -= d
    turn = 1
if(a<=0):
  print("No")
else:
  print("Yes")
import random
S=input()
rl=[random.randint(0,len(S))for i in range(3)]
result = ""
for j in rl:
  result = result + S[j]
print(result)


### FIXED CODE ###

import random
S=input()
r = random.randint(0,len(S)-3)
result =""
result = S[r]+S[r+1]+S[r+2]
print(result)
L = int(input())
v = (L / 3) ^ 3
print(v)

### FIXED CODE ###

L = int(input())
v = (L / 3) ** 3
print(v)
n,k=map(int,input().split())
a=list(map(int,input().split()))

#n=6
#k=727202214173249351
#a=[6, 5, 2, 5, 3, 2]

#n=4
#k=5
#a=[3,2,4,1]

if n<k:
    ai=1
    aj=set()
    aj.add(1)
    for i in range(n):
        ai=a[ai-1]
        if ai in aj:
            ic2=i
            ai2=ai
            break
        else:
            aj.add(ai)

    ai=1
    for i in range(n):
        ai=a[ai-1]
        if ai==ai2:
            ic1=i
            break

    icyc=ic2-ic1
    k2=(k-ic1)%icyc+ic1
else:
    k2=k
    
ai=1
for i in range(k2):
    ai=a[ai-1]
        
print(ai)

### FIXED CODE ###

import sys

n,k=map(int,input().split())
a=list(map(int,input().split()))

for i in range(n):
    a[i]-=1
#print(a)

if k<=n:
    b=0
    for i in range(k):
        b=a[b]
    print(b+1)
    sys.exit()
    
b=0
c=[-1]*n
c[0]=0
for i in range(n):
#   print(b,a[b])
   b=a[b]
   if c[b]>=0:
#       print("i:",i)
       break
   else:
       c[b]=i+1

ki=c[b]+1
kc=(i+1)-c[b]
k2=(k-ki)%kc+ki
#print("ki:",ki,"kc:",kc,"k2:",k2)
b=0
for i in range(k2):
    b=a[b]
print(b+1)