Harryxun/stf_run huggingface dataset:
a = 0
yama = []
pop_block = ''
while True:
	x = map(str,raw_input().split(' '))
	if x[0] = 'quit':
		break
	elif x[0] = 'push':
		yama.append(x[1])
		a += 1
		continue
	elif x[0] = 'pop':
		pop_block.append(yama[a])
		yama.remove[a]
		a -= 1
		continue
for val in yama:
print val

### FIXED CODE ###

a = 0
yama = []
pop_block = []
while True:
	x = map(str,raw_input().split(' '))
	if x[0] == 'quit':
		break
	elif x[0] == 'push':
		yama.append(x[1])
		a += 1
		continue
	elif x[0] == 'pop':
		pop_block.append(yama[a-1])
		yama.remove(yama[a-1])
		a -= 1
		continue
for val in pop_block:
	print val
N = int(input())
x = [0] * N
u = [0] * N
for i in range(N):
    x[i],u[i] = map(int, input().split())







ans = []

btc_1 = 380000.0

for i  in range(N):
    if u[i] == "JPY":
        ans.append(x[i])
    else:
        yen = ((x[i])*(btc_1))
        ans.append(yen)

print(sum(ans))


### FIXED CODE ###

a,b = map(str, input().split())

abint = int(a+b)

ans = 0

for i in range(1,1001):
    for j in range(1,1001):
        if i*j == abint and i == j:
            ans = ans + 1

if ans == 0:
    print("No")
else:
    print("Yes")
a,b = map(int, input().split())
list = []
for y in range(a+1):
  list += [y*4 + (a-y)*2]
  
if b in list:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

s = input()
list = s.split(" ")
for i in range(5):
  if int(list[i]) == 0:
    print(i+1)
def lcm(a):
    from fractions import gcd
    x = a[0]
    for i in range(1, len(a)):
        x = (x * a[i]) // gcd(x, a[i])
    return x
  
N = int(input())
lst = list(map(int, input().split()))
const = 10**9 + 7

L = lcm(lst)
answer = sum(map(lambda x: L/x % const, lst)) % const

print(answer)

### FIXED CODE ###

def lcm(a):
    from fractions import gcd
    x = a[0]
    for i in range(1, len(a)):
        x = (x * a[i]) // gcd(x, a[i])
    return x
  
N = int(input())
lst = list(map(int, input().split()))
const = 10**9 + 7

def solve(arr):
    ab = lcm(arr)
    sum = 0
    for a in arr:
        sum += ab // a
    return sum % const

answer = solve(lst)

print(int(answer))
import sys
input = sys.stdin.readline()

class WarshallFloyd:
    def __init__(self,n):
        self.v = n
        self.d = []
        for i in range(n):
            self.d.append([1e100]*n)
            self.d[i][i] = 0

    def path(self,x,y,c):
        if x == y:
            return False
        self.d[x][y] = c
        self.d[y][x] = c
        return True

    def build(self):
        for k in range(self.v):
            for i in range(self.v):
                for j in range(self.v):
                    self.d[i][j] = min(self.d[i][j], self.d[i][k] + self.d[k][j])
        return self.d

n,m,l = map(int,input().split())
wf = WarshallFloyd(n)
for i in range(m):
    a,b,c = map(int,input().split())
    wf.path(a-1,b-1,c)
d = wf.build()

wf = WarshallFloyd(n)
for i in range(1,n):
    for j in range(i):
        if d[i][j] <= l:
            wf.path(i,j,1)

ans = wf.build()

q = int(input())
for i in range(q):
    s,t = map(int,input().split())
    if ans[s-1][t-1] == 1e100:
        print(-1)
    else:
        print(ans[s-1][t-1] - 1)


### FIXED CODE ###

import sys
input = sys.stdin.readline

class WarshallFloyd:
    def __init__(self,n):
        self.v = n
        self.d = []
        for i in range(n):
            self.d.append([1e100]*n)
            self.d[i][i] = 0

    def path(self,x,y,c):
        if x == y:
            return False
        self.d[x][y] = c
        self.d[y][x] = c
        return True

    def build(self):
        for k in range(self.v):
            for i in range(self.v):
                for j in range(self.v):
                    self.d[i][j] = min(self.d[i][j], self.d[i][k] + self.d[k][j])
        return self.d

n,m,l = map(int,input().split())
wf = WarshallFloyd(n)
for i in range(m):
    a,b,c = map(int,input().split())
    wf.path(a-1,b-1,c)
d = wf.build()

wf = WarshallFloyd(n)
for i in range(1,n):
    for j in range(i):
        if d[i][j] <= l:
            wf.path(i,j,1)

ans = wf.build()

q = int(input())
for i in range(q):
    s,t = map(int,input().split())
    if ans[s-1][t-1] == 1e100:
        print(-1)
    else:
        print(ans[s-1][t-1] - 1)
n=int(input())
b=[str(sorted(list(input()))) for i in range(n)]
count=list(collections.Counter(b).values())
count=[i for i in count if i>1]
import math
print(int(sum([math.factorial(x)/(math.factorial(x-2)*2) for x in count])))

### FIXED CODE ###

x,y = map(int,input().split())
a=x+y
b=x-y
c=x*y
print(max([a,b,c]))
N,K = map(int, input().split(' '))

cache={}
log=[]
A = list(map(lambda x:int(x)-1, input().split(' ')))

now=0

while(True):
  log.append(now)
  now=A[now]
  if(cache.get(now)):break
  cache[now]=1

loop_start=log.index(now)
loop_end=len(log)
loop=loop_end-loop_start

#print(loop_end-loop_start,loop_start)

if len(log) >loop:
  print(log[K%loop]+1)
else:
  print(log[K%loop+loop]+1)

### FIXED CODE ###

N,K = map(int, input().split(' '))

cache={}
log=[]
A = list(map(lambda x:int(x)-1, input().split(' ')))

now=0

while(True):
  log.append(now)
  cache[now]=1
  now=A[now]
  if(cache.get(now)):break

loop_start=log.index(now)
loop_end=len(log)
loop=loop_end-loop_start

if K<len(log):
  print(log[K]+1)
else:
  print(log[(K-loop_start)%loop+loop_start]+1)
import math
N,D,A=map(int,input().split())
l=[]
for i in range(N):
  k=list(map(int,input().split()))
  l.append(k)
l=l.sort()
ans=0
for i in range(N):
  h=l[i][1]
  if h<=0:continue
  d=l[i][0]+D
  time=math.ceil(h/A)
  s=set()
  for j in range(i,n):
    if abs(d-l[j][0])<=D:
      s.add(j)
    else:break
  for k in s:
    l[k][1]-=time*A
  ans+=time
print(ans)
  	

### FIXED CODE ###

import math
N,D,A=map(int,input().split())
l=[]
for i in range(N):
  k=list(map(int,input().split()))
  l.append(k)
l.sort()
S=[0]*N
ma=[0]*N
tmp=N-1
for i in reversed(range(N)):
  x=l[i][0]
  for j in reversed(range(0,tmp)):
    if abs(l[j][0]-(x-D))>D:
      ma[i]=j+1
      tmp=j+1
      break
  else:
    ma[i]=0
    tmp=0
ans=0
S[0]=math.ceil(l[0][1]/A)
for i in range(1,N):
  h=l[i][1]
  left=S[ma[i]-1] if ma[i]>0 else 0
  right=S[i-1]
  sum_=(right-left)*A
  if h<=sum_:
    S[i]=S[i-1]
    continue
  time=math.ceil((h-sum_)/A)
  S[i]=time+S[i-1]
print(S[N-1])
MOD = 10 ** 9 + 7
MAX = 10 ** 5

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

def nCr(n, r):
    return (fac[n] * modInverse[fac[r]] % MOD * modInverse[fac[n - r]] % MOD) % MOD

def modularInverse(n):
    dp = [0] * (n + 1)
    dp[0] = dp[1] = 1
    for i in range(2, n + 1):
        dp[i] = dp[MOD % i] * (MOD - MOD // i) % MOD
    return dp

fac = [1, 1]
for i in range(2, MAX + 1):
    fac.append((fac[-1] * i) % MOD)
modInverse = modularInverse(MAX)

ret = 0
for i in range(n - k + 2):
    for j in range(i + k - 1, n):
        diff = a[j] - a[i]
        between = max(0, j - i - 1)
        choose = max(0, k - 2)
        ret += (nCr(between, choose) * diff) % MOD
        ret %= MOD
print(ret)

### FIXED CODE ###

MOD = 10 ** 9 + 7

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

factorialNumInverse = [None] * (n + 1)
naturalNumInverse = [None] * (n + 1)
fact = [None] * (n + 1)

def inverseofNumber():
    naturalNumInverse[0] = naturalNumInverse[1] = 1
    for i in range(2, n + 1):
        naturalNumInverse[i] = (naturalNumInverse[MOD % i] * (MOD - MOD // i) % MOD)

def inverseofFactorial():
    factorialNumInverse[0] = factorialNumInverse[1] = 1
    for i in range(2, n + 1):
        factorialNumInverse[i] = (naturalNumInverse[i] * factorialNumInverse[i - 1]) % MOD

def factorial():
    fact[0] = 1
    for i in range(1, n + 1):
        fact[i] = (fact[i - 1] * i) % MOD

inverseofNumber()
inverseofFactorial()
factorial()

def nCk(n, k):
    ans = ((fact[n] * factorialNumInverse[k]) % MOD * factorialNumInverse[n - k]) % MOD
    return ans

def calcSum(a):
    ret = 0
    for i in range(k - 1, n):
        ret += (nCk(i, k - 1) * a[i]) % MOD
        ret %= MOD
    return ret

print((calcSum(a) - calcSum(a[::-1])) % MOD)
n, m = map(int, input().split())
li = []
seitou = 0
penalty = 0

if m == 0:
    print(0, 0)
else:
    for x in range(5):
        i, j = map(str, input().split())
        if i in li:
            pass
        else:
            if j == "WA":
                penalty += 1
            if j == "AC":
                li.append(i)
                seitou += 1

    print(seitou, penalty)

### FIXED CODE ###

n, m = input().split()
a = [False] * int(n)
b = [0] * int(n)
AC = 0
WA = 0
for i in range(int(m)):
    p, s = input().split()
    if(s == "AC" and a[int(p) - 1] == False):
        a[int(p) - 1] = True
        AC += 1
        WA += b[int(p) - 1]

    if(s == "WA" and a[int(p) - 1] == False):
        b[int(p)-1] += 1

print(AC, WA)
#FT robot
s=input()
gx,gy=map(int,input().split())
lists=list(s.split("T"))
xlist=[]
ylist=[]
if s[0]=="T":
    for i in range(len(lists)):
        if i%2==0:
            xlist.append(len(lists[i]))
        else:
            ylist.append(len(lists[i]))
elif s[0]=="F":
    for i in range(len(lists)):
        if i%2==0:
            xlist.append(len(lists[i]))
        else:
            ylist.append(len(lists[i]))
    gx-=xlist[0]
    del xlist[0]
Xsum=sum(xlist)
Ysum=sum(ylist)


if (Xsum+gx)%2!=0 or (Ysum+gy)%2!=0:
    print("No")   
else:
    gx1=(Xsum+gx)//2
    gx2=(Xsum-gx)//2
    gy1=(Ysum+gy)//2
    gy2=(Ysum-gy)//2
    dpx=[[False for i in range(Xsum+2)] for j in range(len(xlist)+2)]
    dpy=[[False for i in range(Ysum+2)] for j in range(len(ylist)+2)]
    #dpx[i][j]でi番目のカードまでを足して、値ｊを取れるか判定する
    dpx[0][0]=True
    dpy[0][0]=True
    for i in range(len(xlist)):
        for j in range(Xsum+2):
            dpx[i+1][j]=dpx[i][j-xlist[i]] or dpx[i][j]
    for i in range(len(ylist)):
        for j in range(Ysum+2):
            dpy[i+1][j]=dpy[i][j-ylist[i]] or dpy[i][j]        
    if (dpy[len(ylist)][gy1] or dpy[len(ylist)][gy2]) and (dpx[len(xlist)][gx1] or dpx[len(xlist)][gx2]):
        print("Yes")
    else:
        print("No")

### FIXED CODE ###

      #FT robot
s=input()
gx,gy=map(int,input().split())
lists=list(s.split("T"))
xlist=[]
ylist=[]
if s[0]=="T":
    for i in range(len(lists)):
        if i%2==0:
            xlist.append(len(lists[i]))
        else:
            ylist.append(len(lists[i]))
elif s[0]=="F":
    for i in range(len(lists)):
        if i%2==0:
            xlist.append(len(lists[i]))
        else:
            ylist.append(len(lists[i]))
    gx-=xlist[0]
    del xlist[0]
Xsum=sum(xlist)
Ysum=sum(ylist)


if (Xsum+gx)%2!=0 or (Ysum+gy)%2!=0:
    print("No")   
else:
    gx1=(Xsum+gx)//2
    gx2=(Xsum-gx)//2
    gy1=(Ysum+gy)//2
    gy2=(Ysum-gy)//2
    dpx=[[False for i in range(Xsum+2)] for j in range(len(xlist)+2)]
    dpy=[[False for i in range(Ysum+2)] for j in range(len(ylist)+2)]
    #dpx[i][j]でi番目のカードまでを足して、値ｊを取れるか判定する
    dpx[0][0]=True
    dpy[0][0]=True
    for i in range(len(xlist)):
        for j in range(Xsum+2):
            dpx[i+1][j]=dpx[i][j-xlist[i]] or dpx[i][j]
    for i in range(len(ylist)):
        for j in range(Ysum+2):
            dpy[i+1][j]=dpy[i][j-ylist[i]] or dpy[i][j]    
    #ここまではあってそうなことがわかった
    flag1=False
    if 0<= gy1<= Ysum:   
        if dpy[len(ylist)][gy1]:
            flag1=True
    flag2=False
    if 0<=gy2<= Ysum :
        if dpy[len(ylist)][gy2]:
            flag2=True
    flag3=False
    if 0<=gx1<= Xsum:
        if dpx[len(xlist)][gx1]:
            flag3=True
    flag4=False
    if 0<=gx2<= Xsum:
        if dpx[len(xlist)][gx2]:
            flag4=True
    if (flag1 or flag2) and (flag3 or flag4):
        print("Yes")
    else:
        print("No")
k, a, b = map(int, input().split())

if a < b - 2:
    if k > (a + 2):
        k2 = k - (a + 2)
        res = b + (b-a) + (k2//2) * (b - a) -1
        if k2 % 2 == 1:
            res += 1
else:
    res = k + 1

print(res)

### FIXED CODE ###

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

if a < b - 2 and k >= a + 1:
    k -= a - 1
    res = a
    res += (k//2) * (b - a) + (k % 2)
else:
    res = k + 1

print(res)
import sys
    
buf =[]

while True:
    text = raw_input().split()
    if text[0] == 'quit':
        break
    elif text[0] = 'push':
        buf.append(text[1])
    elif text[0] == 'pop':
        print buf[-1]
        buf.pop()

### FIXED CODE ###

import sys
    
buf =[]

while True:
    text = raw_input().split()
    if text[0] == 'quit':
        break
    elif text[0] == 'push':
        buf.append(text[1])
    elif text[0] == 'pop':
        print buf[-1]
        buf.pop()
A[max_idx] -= b


### FIXED CODE ###

input()
a=[int(x) for x in input().split()]
b=sum(a)-2*sum(a[1::2])
ans = [b]
for x in a:
    b = x*2-b
    ans.append(b)
print(*ans[:-1])
n,m=map(int,input().split())
g=[[]*for _ in range(n+1)]
for _ in range(m):
  u,v=map(int,input().split())
  g[u].append(v)
  g[v].append(u)
flag=True
for i in range(1,n+1):
  if g[i]%2==0:
    continue
  else:
    flag=False
    break
if flag==True:
  print('YES')
else:
  print('NO')

### FIXED CODE ###

n,m=map(int,input().split())
g=[[] for _ in range(n+1)]
for _ in range(m):
  u,v=map(int,input().split())
  g[u].append(v)
  g[v].append(u)
flag=True
for i in range(1,n+1):
  if len(g[i])%2==0:
    continue
  else:
    flag=False
    break
if flag==True:
  print('YES')
else:
  print('NO')
n, m = map(int, input().split())
t = [0 for i in range(n)]
for i in range(m):
    a, b = (map(str, input().split()))
    t[a-1] +=1
    t[b-1] +=1
    
for j in t:
    print(j)

### FIXED CODE ###

#ABC61B
n, m = map(int, input().split())
t = [0 for i in range(n)]
for i in range(m):
    a, b = (map(int, input().split()))
    t[a-1] +=1
    t[b-1] +=1
    
for j in t:
    print(j)
#%%
import math
A, B = map(int, input().split())
digits = int(math.log2(B)) + 1
#%%

def counter(start, end, x):
    place = 2 ** x
    if place == 1:
        return (start - end + 1) % 2

    start_group = start // place
    end_group = end // place

    start_effective, end_effective = 0,0

    if start_group % 2 == 1:
        start_effective = ( place - start % place ) % 2
    if start_group != end_group and end_group % 2 == 1:
        end_effective = ( place - end % place +1 ) % 2

    return place * ((start_effective + end_effective) % 2)

#%%
for x in range(int(math.log2(456))+1):
    print(counter(123,456,x))

#%%
if A != B:
    ans = 0
    for x in range(digits):
        ans += counter(A,B,x)

    print(ans)

else:
    print(A)

### FIXED CODE ###

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

#%%
# a finction to find F(0,x)
def XOR_0_to_x(x):

    # for all even integer n, n ^ (n+1) = 1
    xor = ((x+1) // 2) % 2

    if x % 2 == 0:
        return xor ^ x

    else:
        return xor

#%%
# F(A,B) = F(0,A-1) ^ F(0,B)
ans = XOR_0_to_x(A-1) ^ XOR_0_to_x(B)

print(ans)
input_line = input()
Line = input_line.split()
Line = [int(s) for s in Line]
#mondaisuu
N = Line[0]
#teisyutu
M = Line[1]

AC_Lists = [""]*N
# print(AC_Lists)

for i in range(M):
    input_line = input()
    Line = input_line.split()
    print(Line)
    AC_Lists[int(Line[0])-1] += Line[1][0]
    print(AC_Lists)

AC_count = 0
WA_count = 0

for s in AC_Lists:
    # print(s)
    if 'A' in s:
        AC_count += 1
        my_str = s.split("A")
        print(my_str)
        # print(len(my_str[0]))
        WA_count += len(my_str[0])
    else:
        # print(len(s))
        WA_count += len(s)
# print(AC_Lists)

print(AC_count,WA_count)


### FIXED CODE ###

input_line = input()
Line = input_line.split()
Line = [int(s) for s in Line]
#mondaisuu
N = Line[0]
#teisyutu
M = Line[1]
 
AC_Lists = [""]*N
# print(AC_Lists)
 
for i in range(M):
    input_line = input()
    Line = input_line.split()
    # print(AC_Lists[int(Line[0])-1])
    AC_Lists[int(Line[0])-1] += Line[1][0]
 
AC_count = 0
WA_count = 0
 
for s in AC_Lists:
    # print(s)
    if 'A' in s:
        AC_count += 1
        my_str = s.split("A")
        # print(my_str)
        # print(len(my_str[0]))
        WA_count += len(my_str[0])
    # else:
    #     print(len(s))
    #     WA_count += len(s)
# print(AC_Lists)
 
print(AC_count,WA_count)
N,K=map(int,input().split())

candls=list(map(int,input().split()))

distance_dict=[[x,abs(x)] for x in candls]

for x in range(0,N):
  if candls[x]>=0:
    x-=1
    break

resultlist=[]
minus=x
if K==1:
  print (min(abs(candls[minus]),abs(candls[minus+1])))
  exit()
elif minus==-1:
  print(abs(candls[K-1]))
  exit()
elif minus-K+1>=0:
  resultlist.append(abs(candls[minus-K+1]))
  for i in range(1,2*K):
    try:
      resultlist.append(abs(candls[minus+i])+abs(candls[minus-K+1+i])+min(candls[minus+i],abs(candls[minus-K+1+i])))
    except:
      break
else:
  for i in range(1,minus+2):
    try:
      resultlist.append(abs(candls[K-1+i])+abs(candls[0+i])+min(candls[K-1+i],abs(candls[0+i])))
    except:
      break
try:
  resultlist.append(candls[minus+K])
except:
  pass

print (min(resultlist))

### FIXED CODE ###

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

candls=list(map(int,input().split()))

distance_dict=[[x,abs(x)] for x in candls]

for x in range(0,N):
  if candls[x]>=0:
    x-=1
    break

resultlist=[]
minus=x
if K==1:
  print (min(abs(candls[minus]),abs(candls[minus+1])))
  exit()
elif minus==-1:
  print(abs(candls[K-1]))
  exit()
elif minus-K+1>=0:
  resultlist.append(abs(candls[minus-K+1]))
  for i in range(1,2*K):
    try:
      resultlist.append(abs(candls[minus+i])+abs(candls[minus-K+1+i])+min(candls[minus+i],abs(candls[minus-K+1+i])))
    except:
      break
else:
  for i in range(0,minus+2):
    try:
      resultlist.append(abs(candls[K-1+i])+abs(candls[0+i])+min(candls[K-1+i],abs(candls[0+i])))
    except:
      break
try:
  resultlist.append(candls[minus+K])
except:
  pass

print (min(resultlist))
X=int(input())
if x==2:
  print(2)
else:
  for i in range(X,10**6):
    for j in range(2,i):
      if i%j==0:
        break
      if j==i-1:
        print(i)
        exit()


### FIXED CODE ###

X=int(input())
if X==2:
  print(2)
else:
  for i in range(X,10**6):
    for j in range(2,i):
      if i%j==0:
        break
      if j==i-1:
        print(i)
        exit()
a = map(int,input().split())

a.sort()

print(a[0],a[1],a[2])

### FIXED CODE ###

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

a.sort()

print(a[0],a[1],a[2])
N, K = map(int,input().split())
P = list(map(int,input().split()))
C = list(map(int,input().split()))
S = []
R = -1000000001
#それぞれについての累積和の計算
for i in range(N):#このループはN個の初期マスの時のループ
    t = i  # tは現在の位置
    cnt = 0  # 累積和
    sum = []  # 累積和のリスト
    res = 0
    while True:#このループは一つの初期マスの累積和。最初のコマに戻るまで
        t = P[t]-1
        cnt += C[t]
        sum.append(cnt)
        if t == i:
            break
    #S.append(sum)
    if len(sum) >=  K:
        res = max(sum[:K])
    else:
        if sum[-1] <= 0:
            res = max(sum)
        else:
            score1 = sum[-1] * (K // len(sum) - 1) + max(sum)
            score2 = sum[-1] * (K // len(sum)) + max(sum[0:K % len(sum)])
            res = max(score1,score2)
    R = max(R,res)
print(R)


### FIXED CODE ###

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

ans = -float('inf')
for s in range(N):
    ### Step1
    S = []  # 累積和S. ただし, 初項は0ではなく1回目の移動後の得点とする.
    # 1回目の移動
    i = P[s] - 1
    S.append(C[i])
    # 2回目以降の移動. スタート地点に戻ってくるまで繰り返し.
    while i != s:
        i = P[i] - 1
        S.append(S[-1] + C[i])

    ### Step2: KとSの長に応じて場合分けして, 得点の最大値を求める.
    # 1周未満しか移動できない場合:
    if K <= len(S):
        score = max(S[:K])
    # 1周以上回ることができるが, ループを1周したときに得点が減る場合:
    elif S[-1] <= 0:
        score = max(S)
    # 1週以上回ることができ, かつループを1週するごとに得点が増える場合:
    else:
        # ループを (K // len(S) - 1)回 廻る場合:
        score1 = S[-1] * (K // len(S) - 1)
        score1 += max(S)
        # ループを (K // len(S))回 廻る場合:
        score2 = S[-1] * (K // len(S))
        r = K % len(S)
        if r != 0:
            score2 += max(0, max(S[:r]))
        # score1 と score2 の大きい方がこの場合の得点の最大値
        score = max(score1, score2)

    ans = max(ans, score)

print(ans)
a=input()
if a < 1000:
  print("ABC")
else:
  print("ABD")


### FIXED CODE ###

a=int(input())
if a < 1000:
  print("ABC")
else:
  print("ABD")
s = input()
K = int(input())
l = []
for i in range(5):
    for j in range(len(s)):
        if j + i + 1 >=  len(s):
            break
        l.append(s[j:j + i + 1])
l = sorted(set(l))
print(l[K-1])

### FIXED CODE ###

s = input()
K = int(input())
l = []
for i in range(5):
    for j in range(len(s)):
        if j + i >=  len(s):
            break
        l.append(s[j:j + i + 1])
l = sorted(set(l))
print(l[K-1])
input(12345)
data = input().split().reverse()
data.reverse()
print(' '.join(data))

### FIXED CODE ###

input()
data = input().split()
data.reverse()
print(' '.join(data))
N, A, B, C = map(int, input().split())
l = [int(input()) for i in range(N)]
INF = 10 ** 9
def dfs(cur, a, b, c):
  if cur == N:
  return abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(a, b, c) > 0 else INF
  ret0 = dfs(cur + 1, a, b, c)
  ret1 = dfs(cur + 1, a + l[cur], b, c) + 10
  ret2 = dfs(cur + 1, a, b + l[cur], c) + 10
  ret3 = dfs(cur + 1, a, b, c + l[cur]) + 10
  return min(ret0, ret1, ret2, ret3)
print(dfs(0, 0, 0, 0))

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)

N, A, B, C = map(int, input().split())
l = [int(input()) for i in range(N)]
INF = 10 ** 9
def dfs(cur, a, b, c):
  if cur == N:
    return abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(a, b, c) > 0 else INF
  ret0 = dfs(cur + 1, a, b, c)
  ret1 = dfs(cur + 1, a + l[cur], b, c) + 10
  ret2 = dfs(cur + 1, a, b + l[cur], c) + 10
  ret3 = dfs(cur + 1, a, b, c + l[cur]) + 10
  return min(ret0, ret1, ret2, ret3)
print(dfs(0, 0, 0, 0))
H,A = map(int, input().split)
if H % A == 0:
    print(H // A)
else:
    print(H // A + 1)

### FIXED CODE ###

H,A = map(int, input().split())
if H % A == 0:
    print(H // A)
else:
    print(H // A + 1)
,b,c = map(int, input().split())

ans = []

ans.append(10*a+b+c)
ans.append(10*b+a+c)
ans.append(10*c+b+a)

print(max(ans))

### FIXED CODE ###

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

ans = []

ans.append(10*a+b+c)
ans.append(10*b+c+a)
ans.append(10*c+a+b)

print(max(ans))
import math
inp = input().split()
N = int(inp[0])
K = int(inp[1])
S = 0
while N > 0:
	N = math.floor(N / K)
	S += 1

print(S)

### FIXED CODE ###

inp = input().split()
N = int(inp[0])
R = int(inp[1])
#print(N)
if N >= 10:
  print(R)
else:
  col = R + 100*(10-N)
  print(col)
import math
from functools import reduce

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

num=0
x=A[0]
for i in range(N):
    x=A[i]
    A[i]=max(A)
    num=max(num,reduce(math.gcd,A))
    A[i]=x
print(num)

### FIXED CODE ###

import fractions

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

L=[0,A[0]]
R=[0,A[-1]]
for i in range(N-1):
    #l=fractions.gcd(L[i+1],A[i+1])
    #r=fractions.gcd(R[i+1],A[N-i-2])
    L.append(fractions.gcd(L[i+1],A[i+1]))
    R.append(fractions.gcd(R[i+1],A[N-i-2]))
    #print(L[i+1],A[i+1],R[i+1],A[N-i-2])
#print(L)
#print(R)
arr=[]
for i in range(N):
    a=fractions.gcd(L[i],R[N-i-1])
    arr.append(a)
    #print(i,L[i],R[N-i-1],a,arr)
print(max(arr))