Harryxun/stf_run huggingface dataset:
from collections import defaultdict

N,K = map(int,input().split())
A = list(map(int,input().split()))

loop = N
pos = 0
oto = defaultdict(int)
ind = 0
tej = []
for i in range(N):
    pos = A[pos] - 1
    tej.append(pos+1)
    if oto[pos] == 1:
        ind = A.index(pos+1)
        loop = i - ind + 1
        break
    oto[pos] = 1

##print("loop",loop,"ind",ind)
##print(tej)
if K <= ind:
    print(tej[K])
else:
    print(tej[K%loop+ind])

### FIXED CODE ###

from collections import defaultdict,deque

N,K = map(int,input().split())
A = list(map(int,input().split()))

loop = N
pos = 0
oto = defaultdict(int)
ind = 0
tej = deque([])
for i in range(N):
    pos = A[pos] - 1
    tej.append(pos+1)
    if oto[pos] == 1:
        ind = tej.index(pos+1)
        loop = i - ind 
        break
    oto[pos] = 1
K -= 1
##print("loop",loop,"ind",ind)
##print(tej)
if K <= ind:
    print(tej[K])
else:
    print(tej[(K-ind)%loop+ind])
n.k=map(int,input().split())
ar=list(map(int,input().split()))
ar.sort()
ans=0
for i in ar:
  if(k==0):
    break
  ans+=i
  k-=1
print(ans)

### FIXED CODE ###

n,k=map(int,input().split())
ar=list(map(int,input().split()))
ar.sort()
ans=0
for i in ar:
  if(k==0):
    break
  ans+=i
  k-=1
print(ans)
n.a.b = map(int,input().split())
print(min(n*a,b))

### FIXED CODE ###

n,a,b = map(int,input().split())
print(min(n*a,b))
import sys
readline = sys.stdin.readline

class Node:
    def __init__(self, sigma, depth):
        self.end = False
        self.child = [None] * sigma
        self.depth = depth
    def __setitem__(self, i, x):
        self.child[i] = x
    def __getitem__(self, i):
        return self.child[i]

class Trie():
    def __init__(self, sigma):
        self.sigma = sigma
        self.root = Node(sigma, 0)
    
    def add(self, S):
        vn = self.root
        for cs in S:
            if vn[cs] is None:
                vn[cs] = Node(sigma, vn.depth + 1)
            vn = vn[cs]
        vn.end = True

ans = 0

N, L = map(int, readline().split())

Tr = Trie(2)

for _ in range(N):
    S = list(map(int, readline().strip()))
    Tr.add(S)

cnt = 0
stack = [Tr.root]
while stack:
    vn = stack.pop()
    for i in range(2):
        if vn[i] is None:
            r = L - vn.depth
            cnt ^= -r&r
        else:
            stack.append(vn[i])

print('Alice' if cnt else 'Bob')

### FIXED CODE ###

import sys
readline = sys.stdin.readline

class Node:
    def __init__(self, sigma, depth):
        self.end = False
        self.child = [None] * sigma
        self.depth = depth
    def __setitem__(self, i, x):
        self.child[i] = x
    def __getitem__(self, i):
        return self.child[i]

sigma = 2
root = Node(sigma, 0)
def add_trie(S):
    vn = root
    for cs in S:
        if vn[cs] is None:
            vn[cs] = Node(sigma, vn.depth + 1)
        vn = vn[cs]
    vn.end = True

ans = 0

N, L = map(int, readline().split())

for _ in range(N):
    S = list(map(int, readline().strip()))
    add_trie(S)

cnt = 0
stack = [root]
while stack:
    vn = stack.pop()
    for i in range(2):
        if vn[i] is None:
            r = L - vn.depth
            cnt ^= -r&r
        else:
            stack.append(vn[i])

print('Alice' if cnt else 'Bob')
N, K = map(int,input().split())
H = input().split()
H_i = [int(h) for h in H]

print(sum(h>K for h in H_i)

### FIXED CODE ###

N, K = map(int,input().split())
H = input().split()
H_i = [int(h) for h in H]

print(sum(h>=K for h in H_i))
A, op, B = input().split()
if op == "+" :
   input (int(A) + int(B))
if op == "-" :
   input (int(A) - int(B))
input()

### FIXED CODE ###

A, op, B = map(str,input().split())
if op == "+" :
   print(int(A) + int(B))
else :
   print(int(A) - int(B))
A, B = map(int, input().split())
print(max(A+B, A=B, A*B))

### FIXED CODE ###

A, B = map(int, input().split())
 
add = A + B
sub = A - B
mui = A * B
 
print(max(add, sub, mui))
a = int(input())
b = int(input())
c = int(input())

print('b,a,c')

### FIXED CODE ###

a,b,c = map(int,input().split())

print(c,a,b)
def nCr(n,r):
    nk = 1
    nrk = 1
    rk = 1
    for i in range (n):
        nk *= i + 1
    for i in range (n-r):
        nrk *= i + 1
    for i in range (r):
        rk *= i + 1
    return int(nk/(nrk*rk))
 
N,K = map(int,input().split())
mod =(10**9)+7
for i in range(K):
    com1 = nCr(N - K + 1, i+1)
    com2 = nCr(K-1,i)
    print((com1*com2)%mod)

### FIXED CODE ###

def nCr(n,r):
    com = 1
    for i in range (1,r+1):
        com =com*(n+1-i)//i
    return com
N,K = map(int,input().split())
mod = (10**9)+7
for i in range(1,K+1):
    com1 = nCr(N - K + 1, i)
    com2 = nCr(K-1,i-1)
    print((com1*com2)%mod)
MB_TLE = 0
MB_WA = 0
MB_RE = o
MB_AC = 0
n=int(input())
for i in range (n):
    ch = input ()
    if (ch =="TLE")
     MB_TLE += 1
    if (ch =="WA")
     MB_WA += 1
    if (ch =="RE")
     MB_RE += 1
    if (ch =="AC")
     MB_AC += 1
print('TLE x ',MB_TLE)
print('WA x ',MB_WA)
print('RE x ',MB_RE)
print('AC x ',MB_AC)


### FIXED CODE ###

MB_AC = 0
MB_WA = 0
MB_TLE = 0
MB_RE = 0
n = int(input())
for i in range (n):
    ch = input ()
    if (ch =="AC") :
     MB_TLE += 1
    if (ch =="WA") :
     MB_WA += 1
    if (ch =="TLE") : 
     MB_RE += 1
    if (ch =="RE") :
     MB_AC += 1
print('AC x ',MB_TLE)
print('WA x ',MB_WA)
print('TLE x ',MB_RE)
print('RE x ',MB_AC)
H,W = map(int,input().split())
mat = []
for i in range(H):
    a = list(input())
    mat.append(a)

def search(y,x):
    if mat[y][x] == '#':
        y2 = [0,0,1,-1]
        x2 = [1,-1,0,0]
        for i in range(4):
            if 0<=y+y2[i]<=H-1 and 0<=x+x2[i]<=W-1:
                if mat[y+y2[i]][x+x2[i]] == '#':
                    return True
        return False
    
    return True
ans = 'Yes'
for i in range(H):
    for j in range(W):
        if ans == 'No':
            break
        if search(j,i):
            continue
        else:
            ans = 'No'
            break
print(ans)

### FIXED CODE ###

H,W = map(int,input().split())
mat = []
for i in range(H):
    a = list(input())
    mat.append(a)

def search(y,x):
    if mat[y][x] == '#':
        y2 = [0,0,1,-1]
        x2 = [1,-1,0,0]
        for i in range(4):
            if 0<=y+y2[i]<=H-1 and 0<=x+x2[i]<=W-1:
                if mat[y+y2[i]][x+x2[i]] == '#':
                    return True
        return False
    
    return True
ans = 'Yes'
for i in range(H):
    for j in range(W):
        if ans == 'No':
            break
        if search(i,j):
            continue
        else:
            ans = 'No'
            break
print(ans)
A = input()
char = [0 for _ in range(26)]

for i in range(len(A)):
    char[ord(A[i])-96] += 1

ans = 1

for i in range(25):
    for j in range(i+1,26):
        ans += char[i]*char[j]

print(ans)

### FIXED CODE ###

A = input()
char = [0 for _ in range(26)]

for i in range(len(A)):
    char[ord(A[i])-97] += 1

ans = 1

for i in range(25):
    for j in range(i+1,26):
        ans += char[i]*char[j]

print(ans)
A, B = input().split()
a = int(A)
ans = 0

for i in range(a - 1):
    ans += i

print(ans)


### FIXED CODE ###

N=int(input())

if N < 1000:
    print("ABC")
else:
    print("ABD")
import sys
sys.setrecursionlimit(2147483647)
input=sys.stdin.readline

def main():
  n = int(input())
  a = list(map(int, input().split(' ')))
  a.sort()
  a_max = a[-1]
  b = 0
  db = [0] * a_max
  for i in range(1, n-1):
    if a[i] != a[i+1] and a[i] != a[i-1]:
      db[a[i]-1] = 1
  if n == 1 or a[0] != a[1]:
    db[a[0]] = 1
  if n > 1 and a[-1] != a[-2]:
    db[-1] = 1
  for i in a:
    t = 2
    while(i * t <= a_max):
      db[i*t-1] = 0
      t += 1
  print(sum(db))
  

if __name__=='__main__':
  main()

### FIXED CODE ###

import sys
sys.setrecursionlimit(2147483647)
input=sys.stdin.readline

def main():
  n = int(input())
  a = list(map(int, input().split(' ')))
  a.sort()
  a_max = a[-1]
  b = 0
  db = [0] * a_max
  for i in range(1, n-1):
    if a[i] != a[i+1] and a[i] != a[i-1]:
      db[a[i]-1] = 1
  if n == 1 or a[0] != a[1]:
    db[a[0]-1] = 1
  if n > 1 and a[-1] != a[-2]:
    db[-1] = 1
  for i in a:
    t = 2
    while(i * t <= a_max):
      db[i*t-1] = 0
      t += 1
  print(sum(db))
  

if __name__=='__main__':
  main()
n,k = list(map(int,input().split()))
A = list(map(int,input().split()))

if k == 1:exit(print(A[0]))
t = 0
dp = [-1] * n
dp[0] = 0
for i in range(1,k+1):
  t = A[t]-1
  if dp[t] != -1:break
  dp[t] = i
if k == 2:
  exit(print(t+1))
l = i - dp[t]
K = (k-dp[t])%l + dp[t]

for i in range(n):
  if dp[i] == K:exit(print(i+1))



### FIXED CODE ###

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

if k == 1:exit(print(A[0]))
t = 0
dp = [-1] * n
dp[0] = 0
flg = 0
for i in range(1,k+1):
  t = A[t]-1
  if dp[t] != -1:
    flg = 1
    break
  dp[t] = i
if flg == 0:
  exit(print(t+1))
elif k == 2:
  exit(print(t+1))

l = i - dp[t]
K = (k-dp[t])%l + dp[t]

for i in range(n):
  if dp[i] == K:exit(print(i+1))
N = int(input())
ls = []
flag = True
for n in range(0, N):
  char = raw_input()
  if n == 0:
    ls.append(char)
  else:
    if char in ls:
      flag = False
    else:
      ls.append(char)
if flag == True:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

a, b = map(int, input().split())
for c in range(1, 4):
  if a*b*c % 2 == 1:
    print('Yes')
    break
  else:
    if c == 3:
      print('No')
N, K = map(int, input().split())
A = list(map(int, input().split()))

# imos法して，もう一回同じことを行う
# K回のシミューレション，途中で全てがKになったら打ち切る
for _ in range(K):
    new = [0] * N
    imos = [0] * N
    for i, a in enumerate(A):  # 0-indexにしても問題ない
        imos[max(0, i-a)] += 1
        if i+a+1 <= N-1:  # 右端まで照らすなら，終端は管理しない
            imos[i+a+1] -= 1
    for i in range(N):
        new = new[i-1] + imos[i]
    # Aを上書き
    A = new
    if sum(A) == N*N:
        break
print(*A)
    

### FIXED CODE ###

N, K = map(int, input().split())
A = list(map(int, input().split()))

# imos法して，もう一回同じことを行う
# K回のシミューレション，途中で全てがKになったら打ち切る
for _ in range(K):
    new = [0] * N
    imos = [0] * N
    for i, a in enumerate(A):  # 0-indexにしても問題ない
        imos[max(0, i-a)] += 1
        if i+a+1 <= N-1:  # 右端まで照らすなら，終端は管理しない
            imos[i+a+1] -= 1
    for i in range(N):
        new[i] = new[i-1] + imos[i]
    # Aを上書き
    A = new
    if sum(A) == N*N:
        break
print(*A)
S = input()
T = input()

ret = 0
for s, t in zip(S, T):
  is s == t:
    ret += 1
    
print(ret)

### FIXED CODE ###

S = input()
T = input()

ret = 0
for s, t in zip(S, T):
  if s == t:
    ret += 1
    
print(ret)
K,S=map(int,input().split())
sum=0
count=0
for i in range(K+1):
    sum+=i
    a=sum
    L=S-sum
    #print(L)
    LL=min(L,K)
    for j in range(LL+1):
        sum+=j
        if S-sum>=0 and S-sum<=K :
            count+=1
            #print(str(i)+" "+str(j))
        sum=a #jを足す前に戻す
    sum=0
print(count)            

### FIXED CODE ###

s=input()
l=len(s)
s_list=list(s)
for i in range(l):
    if s_list[i]==",":
        s_list[i]=" "
new="".join(s_list)
print(new)
N, K = list(map(int,input().split()))
ab = [list(map(int, input().split())) for _ in range(N - 1)]
MOD = 1000000007
if N == 1:
    print(K)
    exit()

tree = [[] for _ in range(N)]

for i in range(N - 1):
    tree[ab[i][0] - 1].append(ab[i][1] - 1)
    tree[ab[i][1] - 1].append(ab[i][0] - 1)


ans = K * (K - 1) % MOD

def f(x, y):
    global ans
    count = 2
    for i in range(len(tree[y])):
        if tree[y][i] != x:
            f(y, tree[y][i])
            ans = ans * (K - count) % MOD
            count += 1


first = 0
for i in range(N):
    if len(tree[i]) == 1:
        first = i
        break
f(first, tree[first][0])


print(ans)



### FIXED CODE ###

import sys
sys.setrecursionlimit(1000000000)
N, K = list(map(int,input().split()))
ab = [list(map(int, input().split())) for _ in range(N - 1)]
MOD = 1000000007
if N == 1:
    print(K)
    exit()

tree = [[] for _ in range(N)]

for i in range(N - 1):
    tree[ab[i][0] - 1].append(ab[i][1] - 1)
    tree[ab[i][1] - 1].append(ab[i][0] - 1)


ans = K * (K - 1) % MOD

def f(x, y):
    global ans
    count = 2
    for i in range(len(tree[y])):
        if tree[y][i] != x:
            f(y, tree[y][i])
            ans = ans * (K - count) % MOD
            count += 1


first = 0
for i in range(N):
    if len(tree[i]) == 1:
        first = i
        break
f(first, tree[first][0])


print(ans)
n = input()
lst = list(map(int,input().split())
for i in range(n):
    key = lst[i]
    j = i-1
    while j >= 0 and lst[j] > key:
        lst[j+1] = lst[j]
        j -= 1
    lst[j+1] = key
    print(' '.join(map(str,lst)))

### FIXED CODE ###

n = int(input())
lst = list(map(int,input().split()))
for i in range(n):
    key = lst[i]
    j = i-1
    while j >= 0 and lst[j] > key:
        lst[j+1] = lst[j]
        j -= 1
    lst[j+1] = key
    print(' '.join(map(str,lst)))
w=list(input())
for i in range(len(w)):
  del w[-1]
  del w[-1]
  if w[0:len(w)/2]==w[len(w)/2:len(w)]:
    print(len(w))
    break
  
  

### FIXED CODE ###

w=list(input())
for i in range(len(w)):
  del w[-1]
  del w[-1]
  if w[0:len(w)//2]==w[len(w)//2:len(w)]:
    print(len(w))
    break
s=list(input())
print(s[0]+str(len(s-2))+s[-1])

### FIXED CODE ###

s=list(input())
print(s[0]+str(len(s)-2)+s[-1])
import math
A, B = map(int, input().split())
print(A * B // (math.gcd(A,B)))

### FIXED CODE ###

import fractions
A, B = map(int, input().split())
print (int(A * B // (fractions.gcd(A,B))))
S, T = imput().split(" ")
print(T+S)

### FIXED CODE ###

S,T=input().split(' ')
print(T+S)
a, b, c, d = map(int, input())
sign = "+-"
for i in range(2):
    for j in range(2):
        for k in range(2):
            if eval(a+sign[i]+b+sign[j]+c+sign[k]+d) == 7:
                print(str(a+sign[i]+b+sign[j]+c+sign[k]+d)+"=7")

### FIXED CODE ###

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

a, b, c, d = map(str, input())

sign = "+-"
for i in range(2):
    for j in range(2):
        for k in range(2):
            if int(eval(a+sign[i]+b+sign[j]+c+sign[k]+d)) == 7:
                print(str(a+sign[i]+b+sign[j]+c+sign[k]+d) + "=7")
                exit()
A, B = map(int,input().split())
con,out = 0,1
for out < B:
  out = out -1
  out = out + A
  con += 1
print(con)
  

### FIXED CODE ###

import math
A,B = map(int,input().split())
print(1+math.ceil((B-A)/(A-1)))
count=0
def merge(A, left, mid, right):
    global count
    n1=mid - left
    n2=right - mid
    L=[i for i in range(n1+1)]
    R=[i for i in range(n2+1)]
    for i in range(n1):
        L[i] = A[left+i]
    for i in range(n2):
        R[i] = A[mid+i]
    L[n1] = 1000000
    R[n2] = 1000000
    i=0
    j=0
    for k in range(left,right):
        if L[i] <= R[j]:
            A[k] = L[i]
            i = i + 1
            count+=1
        else:
            A[k] = R[j]
            j = j + 1
            count+=1
def merge_sort(A, left, right):
    if left+1 < right:
        mid=(left+right)//2
        merge_sort(A, left, mid)
        merge_sort(A, mid, right)
        merge(A, left, mid, right) 

if __name__ == "__main__":
    n=int(input())
    A=list(map(int,input().split()))
    merge_sort(A,0,n)
    for i,j in enumerate(A):
        if i == n-1:
            print(j)
        else:
            print(j,end=" ")
    print(count)


### FIXED CODE ###

count=0
def merge(A, left, mid, right):
    global count
    L=A[left:mid]+[2**32]
    R=A[mid:right]+[2**32]
    i=0
    j=0
    for k in range(left,right):
        if L[i] <= R[j]:
            A[k] = L[i]
            i += 1
        else:
            A[k] = R[j]
            j += 1
        count+=1
def merge_sort(A, left, right):
    if left+1 < right:
        mid=(left+right)//2
        merge_sort(A, left, mid)
        merge_sort(A, mid, right)
        merge(A, left, mid, right) 

if __name__ == "__main__":
    n=int(input())
    A=list(map(int,input().split()))
    merge_sort(A,0,n)
    print(*A)
    print(count)
def readInt():
    return list(map(int, input().split()))

n, m = readInt()

root = [-1] * n

def r(x):
    # print("root[x]=",root[x])
    if root[x] < 0:
        # print("r(x)=",x)
        return x
    else:
        root[x] = r(root[x])
        # print(root[x])
        return root[x]

def unite(x, y):
    x = r(x)
    y = r(y)
    if x == y:
        return
    root[x] += root[y]
    root[y] = x
    # print(root)

def size(x):
    x = r(x)
    # print(x, root[x])
    return -root[x]

for i in range(m):
    x, y = readInt()
    x -= 1
    y -= 1
    unite(x, y)

max_size = 0

for i in range(n):
    max_size = max(max_size, size(i))

print(max_size)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**9)

def readInt():
    return list(map(int, input().split()))

n, m = readInt()

root = [-1] * n

def r(x):
    # print("root[x]=",root[x])
    if root[x] < 0:
        # print("r(x)=",x)
        return x
    else:
        root[x] = r(root[x])
        # print(root[x])
        return root[x]

def unite(x, y):
    x = r(x)
    y = r(y)
    if x == y:
        return
    root[x] += root[y]
    root[y] = x
    # print(root)

def size(x):
    x = r(x)
    # print(x, root[x])
    return -root[x]

for i in range(m):
    x, y = readInt()
    x -= 1
    y -= 1
    unite(x, y)

max_size = 0

for i in range(n):
    max_size = max(max_size, size(i))

print(max_size)
h, w = map(int, input().split())
ans = 0
for i in range(h):
	a = imput()
	ans += a.count("#")
if ans == h + w - 1:
	print("Possible")
else:
	print("Impossible")

### FIXED CODE ###

h, w = map(int, input().split())
ans = 0
for i in range(h):
	a = input()
	ans += a.count("#")
if ans == h + w - 1:
	print("Possible")
else:
	print("Impossible")
t = ['01','10']
s = input()

def count_removal(c):
  is_01 = c.count(t[0])
  is_10 = c.count(t[1])
  if is_01 >= is_10 and is_01 > 0:
    return count_removal(c.replace(t[0], '')) + c.count(t[0]) * 2
  elif is_01 < is_10 and is_10 > 0:
    return count_removal(c.replace(t[1], '')) + c.count(t[1]) * 2
  else:
    return 0

print(count_removal(s))

### FIXED CODE ###

s = input()

if s.count('1') > 0 and s.count('0') > 0:
  print(min(s.count('1'), s.count('0')) * 2)
else:
  print(0)
import math

a,b,C=map(int,input().split())
C2=math.radians(C)
sin=math.sin(C2)
cos=math.cos(C2)
S = 0.5*a*b*sin
L = a+b+(math.sqrt((a**2+b**2)-(2*a*b*cos)))
H = (a*b*sin/2)(a/2)
print("{0:.8f}".format(S))
print("{0:.8f}".format(L))
print("{0:.8f}".format(H))

### FIXED CODE ###

import math

a,b,C=map(int,input().split())
C2=math.radians(C)
sin=math.sin(C2)
cos=math.cos(C2)
S = 0.5*a*b*sin
L = a+b+(math.sqrt((a**2+b**2)-(2*a*b*cos)))
H = (a*b*sin/2)/(a/2)
print("{0:.8f}".format(S))
print("{0:.8f}".format(L))
print("{0:.8f}".format(H))
def solve(string):
    n, *a = map(int, string.split())
    a = sorted(a)
    ans = [a[0]]
    for _a in a[1:]:
        for b in ans:
            if _a % b == 0:
                break
        else:
            ans.append(_a)
    return str(len(ans) - (a[0] == a[1]))


if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read().strip()))


### FIXED CODE ###

import numpy as np
from collections import Counter


def solve(string):
    n, *a = map(int, string.split())
    table = np.array([True] * (10**6 + 1))
    for _a in a:
        if table[_a]:
            table[2*_a::_a]=False
    i = np.array([k for k,v in Counter(a).items() if v==1],dtype=np.int)
    return str(table[i].sum())


if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read().strip()))
import sys
input = sys.stdin.buffer.readline
import sympy

def main():
    N = int(input())
    M = 100000
    def sieve(n):
        is_prime = [True for _ in range(n+1)]
        is_prime[0] = False

        for i in range(2, n+1):
            if is_prime[i-1]:
                j = 2 * i
                while j <= n:
                    is_prime[j-1] = False
                    j += i
        return is_prime
    prime = sieve(M)
    alike = [0]
    for i in range(1,M+1,2):
        if (prime[i-1] and prime[(i+1)//2-1]):
            alike.append(alike[-1]+1)
        else:
            alike.append(alike[-1])
            
    for i in range(N):
        l,r = map(int,input().split())
        l = (l+1)//2
        r = (r+1)//2
        print(alike[r]-alike[l-1])
    
    
if __name__ == "__main__":
    main()

### FIXED CODE ###

import sys
input = sys.stdin.buffer.readline

def main():
    N = int(input())
    M = 100000
    def sieve(n):
        is_prime = [True for _ in range(n+1)]
        is_prime[0] = False

        for i in range(2, n+1):
            if is_prime[i-1]:
                j = 2 * i
                while j <= n:
                    is_prime[j-1] = False
                    j += i
        return is_prime
    prime = sieve(M)
    alike = [0]
    for i in range(1,M+1,2):
        if (prime[i-1] and prime[(i+1)//2-1]):
            alike.append(alike[-1]+1)
        else:
            alike.append(alike[-1])
            
    for i in range(N):
        l,r = map(int,input().split())
        l = (l+1)//2
        r = (r+1)//2
        print(alike[r]-alike[l-1])
    
    
if __name__ == "__main__":
    main()
S = int(input())
W = int(input())
if W >= S:
    print('unsafe')
else:
    print('safe')

### FIXED CODE ###

S,W = input().split()
if int(W) >= int(S):
    print('unsafe')
else:
    print('safe')
N = int(input())
A = list(map(int, input().split()))

count = 0

def dfs(x, y):
    global count
    if x >= N or y >= N:
        return
    
    if (A[x]+A[y]) == y-x:
        count += 1

    if x+1 >= N and y+1 >= N:
        return
        
    if y+1 >= N:
        dfs(x+1, x+2)
    else:
        dfs(x, y+1)


dfs(0, 1)
print(count)


### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))

count = 0

def solve():
    from collections import Counter
    cc=Counter()
    ans=0
    for i,val in enumerate(A,1):
        if i-val>0:
            ans+=cc[i-val]
        cc[i+val]+=1
    print(ans)
    
def dfs(x, y):
    global count
    if x >= N or y >= N:
        return
    
    if (A[x]+A[y]) == y-x:
        count += 1

    if x+1 >= N and y+1 >= N:
        return
        
    if y+1 >= N:
        dfs(x+1, x+2)
    else:
        dfs(x, y+1)


#dfs(0, 1)
#print(count)
solve()
d,n=map(int,input().split())
if d==0 and n!=100:
    print(n)
elif d==0 and n==100:
    print(101)
elif d==1 :
    print(n*100)
elif d==1 and n=100:
    print(10100)
elif d==2 and n!=100:
    print(n*10000)
elif d==2 and n==100:
    print(1010000)

### FIXED CODE ###

d,n=map(int,input().split())
if d==0 and n!=100:
    print(n)
elif d==0 and n==100:
    print(101)
elif d==1 and n!=100:
    print(n*100)
elif d==1 and n==100:
    print(10100)
elif d==2 and n!=100:
    print(n*10000)
elif d==2 and n==100:
    print(1010000)
n = int(input())

data = [int(s) for s in input().split()]
count = 0
for i in range(n):
  if (i+!)!= data[i]:
    count += 1
if count<= 2:
  print("YES")
else:
  print("NO")
    
  
"""
mx = max(data)
mn = min(data)

if (mx == n-1 and mn == 0) or 
  for i in range(1,n-1):
    if data[i] < data[i+1]:
      continue
    else:
      print("No")
      exit()
"""      


### FIXED CODE ###

n = int(input())

data = [int(s) for s in input().split()]
count = 0
for i in range(n):
  if (i+1)!= data[i]:
    count += 1
if count<= 2:
  print("YES")
else:
  print("NO")
    
  
"""
mx = max(data)
mn = min(data)

if (mx == n-1 and mn == 0) or 
  for i in range(1,n-1):
    if data[i] < data[i+1]:
      continue
    else:
      print("No")
      exit()
"""
s = input()
k = int(input())
c = len(s)
a = []
for i in range(5):
  b = [s[j:i+j+1] for j in range(c-i-1)]
  b = list(set(b))
  a = a + b
a.sort()
print(a[k-1])

### FIXED CODE ###

s = input()
k = int(input())
c = len(s)
d = 0
a = []
if c < 5:
  d = c
else:
  d = 5
for i in range(d):
  b = [s[j:i+j+1] for j in range(c-i)]
  b = list(set(b))
  a = a + b
a.sort()
print(a[k-1])