Harryxun/stf_run huggingface dataset:
import sys
import math
ns = lambda: sys.stdin.readline().rstrip()
ni = lambda: int(ns())
nm = lambda: map(int, sys.stdin.readline().split())
nl = lambda: list(nm())
nsl = lambda: map(str, sys.stdin.readline().split())

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

n = ni()
t = ni()
if n == 1:
    print(t)
else:
    for i in range(n - 1):
        tmp = ni()
        t = lcm(t, tmp)
    print(t)


### FIXED CODE ###

import sys
import fractions
ns = lambda: sys.stdin.readline().rstrip()
ni = lambda: int(ns())
nm = lambda: map(int, sys.stdin.readline().split())
nl = lambda: list(nm())
nsl = lambda: map(str, sys.stdin.readline().split())

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

n = ni()
t = ni()
if n == 1:
    print(t)
else:
    for i in range(n - 1):
        tmp = ni()
        t = lcm(t, tmp)
    print(t)
N,M = map(int,input().split())
edges = {i:[] for i in range(1,M+1)}
for i in range(M):
    a,b = map(int,input().split())
    edges[a].append(b)
    edges[b].append(a)

#深さ優先探索
def dfs(list):
    #lst(通過点)の数がN(頂点数)と等しくなったら探索終了（成功）
    if len(list) == N:
        return 1
    else:
        x = list[-1]
        #lstの最後尾（現在地）が次に進める場所をnextとしてリスト化
        #nextに以前通った場所が入っていないか確認
        next = [n for n in edges[x] if n not in list]
        #次に進める場所がなくなったら探索終了（失敗）
        if len(next) == 0:
          return 0

        total = 0
        #再帰でさらに探索
        for n in next:
          total += dfs(list + [n])

        return total

### FIXED CODE ###

N,M = [int(a) for a in input().split()]
edges = {i:[] for i in range(1,N+1)}
for i in range(M):
  a,b = [int(a) for a in input().split()]
  edges[a].append(b)
  edges[b].append(a)

def search(lst):
  if len(lst) == N:
    return 1
  else:
    a = lst[-1]
    next = [n for n in edges[a] if n not in lst]
    if len(next) == 0:
      return 0

    tot = 0
    for n in next:
      tot += search(lst + [n])
    
    return tot


ans = search([1])

print(ans)
import numpy as np
N,D = map(int,input().split())
X =[]
cnt = 0
for i in range(N):
  X = np.vstack(X,list(map(int,input().split())))

for i in range(N-1):
    c = X[i]
    for j in range(i+1,N):
        d = X[j]
        e = c-d
        f = np.square(e)
        g = sum(f)
        h = np.sqrt(g)
        l = int(h**.5)
        if abs(l*l-h) <1e-6:
            cnt +=1

### FIXED CODE ###

N,A,B = map(int,input().split())
if N*A>=B:
  print(B)
else:
  print(N*A)
n,k=map(int,input().split())
mod=10**9+7
root=[[] for i in range(n)]
for i in range(n-1):
    a,b=map(int,input().split())
    root[a-1].append(b-1)
    root[b-1].append(a-1)
def perm(k,n):
    x=1
    if k-n+1<=0:
        return 0
    for i in range(k,k-n,-1):
        x=x*i%mod
    return x
def dfs(node,depth,prev): 
    l=len(root[node])
    d=depth
    x=1
    if l==0:
        return 1
    if l==1 and depth>1:
        return 1
    if depth>1:
        x=perm(k-d,l-1)
    else:
        x=perm(k-d,l)
    for y in root[node]:
        if y!=prev:
            x=x*dfs(y,min(depth+1,2),node)%mod
    return x%mod
count=dfs(0,1,0)*k%mod
print(count if count>0 else 0)

### FIXED CODE ###

n,k=map(int,input().split())
mod=10**9+7
import sys
sys.setrecursionlimit(10**9)
root=[[] for i in range(n)]
for i in range(n-1):
    a,b=map(int,input().split())
    root[a-1].append(b-1)
    root[b-1].append(a-1)
def perm(k,n):
    x=1
    if k-n+1<=0:
        return 0
    for i in range(k,k-n,-1):
        x=x*i%mod
    return x
def dfs(node,depth,prev): 
    l=len(root[node])
    d=depth
    x=1
    if l==0:
        return 1
    if l==1 and depth>1:
        return 1
    if depth>1:
        x=perm(k-d,l-1)
    else:
        x=perm(k-d,l)
    for y in root[node]:
        if y!=prev:
            x=x*dfs(y,2,node)%mod
    return x%mod
count=dfs(0,1,0)*k%mod
print(count if count>0 else 0)
x,k,d = map(int, input().split())
lists = []
i = 1
 

if k*d <= x:
  answer = x - k*d
else:
  while i * d <= x and i <= d:
    if i % 2 == 0:
      answer = abs(x - i * d)
    if i % 2 == 1:
      answer = abs(i*d)
    i += 1



print(answer)

### FIXED CODE ###

x,k,d = map(int, input().split())
lists = []
x = abs(x)

step = int(x/d) 

if step >= k:
  answer = x - k * d
elif step < k:
  k_left = k - int(step)
  if k_left % 2 == 0:
    answer = x % d
  if k_left % 2 == 1:
    answer = abs(x - step * d - d)

print(answer)
def solve(n,l,dp):
    if n<=0:
        return 0
    elif n==1:
        return abs(l[n]-l[n-1])
    if dp[n]!=-1:
        return dp[n]
    dp[n]= min(abs(l[n]-l[n-1])+solve(n-1,l,dp),abs(l[n]-l[n-2])+solve(n-2,l,dp))
    return dp[n]
n=int(input())
l=[int(x) for x in input().split()]
if n==1:
    print(0)
else:
    dp=[-1]*(n+1)
    ans=solve(n-1,l,dp)
    print(ans)

### FIXED CODE ###

n=int(input())
l=[int(x) for x in input().split()]
dp=[0]*n
for i in range(n):
    if i==0:
        dp[i]=0
    elif i==1:
        dp[i]=abs(l[i]-l[i-1])
    else:
	    dp[i]=min(dp[i-1]+abs(l[i]-l[i-1]),dp[i-2]+abs(l[i]-l[i-2]))
print(dp[n-1])
input_line = input().split(' ')
days = input_line[0]
assignments = input_line[1]

input_assign = input().split(' ')

how_many_days = sum(input_assign)

len = days - how_many_days
if len < 0:
  print(-1)
else:
  print(len)

### FIXED CODE ###

input_line = input().split(' ')
input_line = list(map(int, input_line))
input_assign = input().split(' ')
input_assign = list(map(int, input_assign))

len = input_line[0] - sum(input_assign)
if len < 0:
  print(-1)
else:
  print(len)
def loadIcicle():
	icicles = []
	line = input().strip().split(" ")
	N, L = int(line[0]), int(line[1])
	while True:
		icicles.append(int(input().strip()))
		if len(icicles) == N: break
	return icicles, N, L

def calcDiff(icicles, N):
	diff_2times = [0]*N

	for idx in range(N):
		dif_right = icicles[idx+1] - icicles[idx] if idx != N-1 else -icicles[idx]
		dif_left = icicles[idx] - icicles[idx-1] if idx != 0 else icicles[idx]

		dif_right = 1 if dif_right > 0 else -1
		dif_left = 1 if dif_left > 0 else -1

		if dif_right - dif_left < 0: diff_2times[idx] = -1
		elif dif_right - dif_left > 0: diff_2times[idx] = 1
		else: diff_2times[idx] = 0

	return diff_2times

icicles, N, L = loadIcicle()
diff_2times = calcDiff(icicles, N)

time = [-1]*N
peakX = [i for i in range(N) if diff_2times[i]==-1]
for i in peakX:
	time[i] = L - icicles[i]

	isLocalMinL, isLocalMinR = False, False
	posL, posR = i, i
	while not (isLocalMinL and isLocalMinR):
		posL -= 1
		if posL < 0:
			isLocalMinL = True

		if not isLocalMinL:
			left = 0 if posL-1 < 0 else time[posL-1]
			time[posL] = (L-icicles[posL]) + max(left, time[posL+1])

			if diff_2times[posL] == 1: isLocalMinL = True

		if not isLocalMinR:
			right = 0 if posR+1 > N-1 else time[posR+1]
			time[posR] = (L-icicles[posR]) + max(time[posR-1], right)

			if diff_2times[posR] == 1: isLocalMinR = True

print(max(time))

### FIXED CODE ###

def loadIcicle():
	icicles = []
	line = input().strip().split(" ")
	N, L = int(line[0]), int(line[1])
	while True:
		icicles.append(int(input().strip()))
		if len(icicles) == N: break
	return icicles, N, L

def calcDiff(icicles, N):
	diff_2times = [0]*N

	for idx in range(N):
		dif_right = icicles[idx+1] - icicles[idx] if idx != N-1 else -icicles[idx]
		dif_left = icicles[idx] - icicles[idx-1] if idx != 0 else icicles[idx]

		dif_right = 1 if dif_right > 0 else -1
		dif_left = 1 if dif_left > 0 else -1

		if dif_right - dif_left < 0: diff_2times[idx] = -1
		elif dif_right - dif_left > 0: diff_2times[idx] = 1
		else: diff_2times[idx] = 0

	return diff_2times

icicles, N, L = loadIcicle()
diff_2times = calcDiff(icicles, N)

time = [-1]*N
peakX = [i for i in range(N) if diff_2times[i]==-1]
for i in peakX:
	time[i] = L - icicles[i]

	isLocalMinL, isLocalMinR = False, False
	posL, posR = i, i
	while not (isLocalMinL and isLocalMinR):
		posL -= 1
		if posL < 0:
			isLocalMinL = True
		if not isLocalMinL:
			if time[posL] == -1:
				time[posL] = (L-icicles[posL]) + time[posL+1]
			else:
				time[posL] = (L-icicles[posL]) + max(time[posL-1], time[posL+1])

			if diff_2times[posL] == 1:
				isLocalMinL = True

		posR += 1
		if posR >= N:
			isLocalMinR = True
		if not isLocalMinR:
			if time[posR] == -1:
				time[posR] = (L-icicles[posR]) + time[posR-1]
			else:
				time[posR] = (L-icicles[posR]) + max(time[posR-1], time[posR+1])

			if diff_2times[posR] == 1:
				isLocalMinR = True

print(max(time))
n, x, y = map(int, input().split())
x = x-1
y = y-1

result = [0] * n
for i in range(n):
    for j in range(i, n, 1):
        if i == j:
            continue
        minij = min([(j - i - 1), ((x - i + 1) + (y - j) - 1)])
        result[minij] += 1
for i in range(n-1):
    print(result[i])



### FIXED CODE ###

n, x, y = map(int, input().split())
result = [0] * n
for i in range(1,n):
    for j in range(i+1, n+1):
        result[min([(j - i), (abs(i - x) + 1 + abs(j - y))])] += 1

for i in range(1,n):
    print(result[i])
import numpy as np
from functools import *
import sys
sys.setrecursionlimit(100000)
input = sys.stdin.readline


class SegmentTree:
    # 初期化処理
    # f : SegmentTreeにのせるモノイド
    # default : fに対する単位元
    def __init__(self, size, f=lambda x, y: x+y, default=0):
        self.size = 2**(size-1).bit_length()  # 簡単のため要素数Nを2冪にする
        self.default = default
        self.dat = [default]*(self.size*2)  # 要素を単位元で初期化
        self.f = f

    def update(self, i, x):
        i += self.size
        self.dat[i] = x
        while i > 0:
            i >>= 1
            self.dat[i] = self.f(self.dat[i*2], self.dat[i*2+1])

    def query(self, l, r):
        l += self.size
        r += self.size
        lres, rres = self.default, self.default
        while l < r:
            if l & 1:
                lres = self.f(lres, self.dat[l])
                l += 1

            if r & 1:
                r -= 1
                # モノイドでは可換律は保証されていないので演算の方向に注意
                rres = self.f(self.dat[r], rres)
            l >>= 1
            r >>= 1
        res = self.f(lres, rres)
        return res


def acinput():
    return list(map(int, input()[:-1].split(" ")))


N, K = acinput()

A = [int(input()) for _ in range(N)]

st = SegmentTree(N+1, f=max)

res = 0
for sa in A:
    L = max(sa-K, 0)
    R = min(sa+K, N+2)

    tmp = st.query(L, R+1)+1
    st.update(sa, tmp)
    res = max(tmp, res)

print(res)


### FIXED CODE ###



class SegmentTree:
    # 初期化処理
    # f : SegmentTreeにのせるモノイド
    # default : fに対する単位元
    def __init__(self, size, f=lambda x, y: x+y, default=0):
        self.size = 2**(size-1).bit_length()  # 簡単のため要素数Nを2冪にする
        self.default = default
        self.dat = [default]*(self.size*2)  # 要素を単位元で初期化
        self.f = f

    def update(self, i, x):
        i += self.size
        self.dat[i] = x
        while i > 0:
            i >>= 1
            self.dat[i] = self.f(self.dat[i*2], self.dat[i*2+1])

    def query(self, l, r):
        l += self.size
        r += self.size
        lres, rres = self.default, self.default
        while l < r:
            if l & 1:
                lres = self.f(lres, self.dat[l])
                l += 1

            if r & 1:
                r -= 1
                # モノイドでは可換律は保証されていないので演算の方向に注意
                rres = self.f(self.dat[r], rres)
            l >>= 1
            r >>= 1
        res = self.f(lres, rres)
        return res


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

A = [int(input()) for _ in range(N)]

st = SegmentTree(300000+10, f=max)

res = 0
for sa in A:
    L = max(sa-K, 0)
    R = min(sa+K, 300001)

    tmp = st.query(L, R+1)+1
    st.update(sa, tmp)
    res = max(tmp, res)

print(res)
N, M = map(int, input().split())
A = list(map(int, input().split()))
sum = sum(A)
flag = 0
A = sorted(A, reverse=True)
# print(sum, A)

for i in range(0, M+1):
  if A[i]<(sum/(4*M)):
    print('No')
    flag = 1
    break

if flag == 0:
  print("Yes")

### FIXED CODE ###

N, M = map(int, input().split())
A = list(map(int, input().split()))
sum = sum(A)
flag = 0
A = sorted(A, reverse=True)
# print(sum, A)

for i in range(0, M):
  if M == 0:
    break
  if A[i]<(sum/(4*M)):
    print('No')
    flag = 1
    break

if flag == 0:
  print("Yes")
import numpy as np
L, R = map(int, input().split())

LR = np.arange(L, R+1, dtype="int")
LR %= 2019
LR.sort

print(LR[0] * LR[1])


### FIXED CODE ###

L, R = map(int, input().split())

R = min(R, L + 2019)
out = 2020
for i in range(L, R):
    for j in range(i + 1, R + 1):
        out = min(out, (i * j) % 2019)

print(out)
s=input()
K=int(input())
s=list(s)
#a-z 97-122
for i in range(len(s)):
    if s[i]!='a':
        if ord(s[i])+K < 123:
            continue
        else:
            K-=(123-ord(s[i]))
            s[i]='a'
if K>0:
    asc=ord(s[-1])+K%26
    s[-1]=chr(asc)
print ("".join(s))

### FIXED CODE ###

# -*- coding: utf-8 -*-
raw = raw_input()

ans =  raw[:4]+' '+raw[4:]

print ans
from sys import stdin
from math import sqrt
input = stdin.readline

N = int(input())

ans = 0

seen = [0] * 10 ** 6

for i in range(2, int(sqrt(N)) + 1):
    tmp = i

    while N % tmp == 0:

        if seen[tmp] == 1:
            tmp *= i
            continue
        else:
            N //= tmp
            seen[tmp] = 1
            ans += 1
            tmp *= i

if N != 1 and (ans == 0 or seen[N] == 0):
    ans += 1

print(ans)


### FIXED CODE ###

from sys import stdin
from math import sqrt
input = stdin.readline
N = int(input())

s = [0] * (int(sqrt(N)) + 1)

ans = 0

for i in range(2, int(sqrt(N)) + 1):
    tmp = i

    while N % tmp == 0:
        N //= tmp
        s[tmp] += 1

for i in s:
    for j in range(10 ** 5):
        if (j * (j + 1)) // 2 > i:
            k = j
            break

    ans += k - 1

for i in range(2, int(sqrt(N)) + 1):
    if N % i == 0:
        print(ans)
        exit()

if N != 1:
    ans += 1


print(ans)
INF = 1000000
N,T,A=map(int,input().split())
T -= 1
A -= 1
G = [ [] for i in range(N) ]
DT = [ INF for _ in range(N) ]
DA = [ INF for _ in range(N) ]
for i in range(N-1):
    h1,h2=map(int,input().split())
    h1 -= 1
    h2 -= 1
    G[h1].append(h2);
    G[h2].append(h1);

def DFS_T( v, d ):
    for nv in G[v]:
        if DT[nv] != INF:
            continue
        DT[nv] = d + 1
        DFS_T(nv, d + 1)

def DFS_A( v, d ):
    for nv in G[v]:
        if DA[nv] != INF:
            continue
        DA[nv] = d + 1
        DFS_A(nv, d+1)

DT[T] = 0
DA[A] = 0
DFS_T(T,0)
DFS_A(A,0)
max_da = 0
for i in range(N):
    #print(i, " T:", DT[i], " A:", DA[i])
    if DA[i] - DT[i] >= 1 :
        max_da = max(DA[i]-1, max_da)
print(max_da)



### FIXED CODE ###

from collections import deque

INF = 1000000
N,T,A=map(int,input().split())
T -= 1
A -= 1
G = [ [] for i in range(N) ]
DT = [ INF for _ in range(N) ]
DA = [ INF for _ in range(N) ]
for i in range(N-1):
    h1,h2=map(int,input().split())
    h1 -= 1
    h2 -= 1
    G[h1].append(h2);
    G[h2].append(h1);

DT[T] = 0
DA[A] = 0

q = deque()

# BFS
q.append(T)
while len(q) > 0:
    v = q.popleft()
    for nv in G[v]:
        if DT[nv] == INF:
            DT[nv] = DT[v] + 1
            q.append(nv)

q.clear()
q.append(A)
while len(q) > 0:
    v = q.popleft()
    for nv in G[v]:
        if DA[nv] == INF:
            DA[nv] = DA[v] + 1
            q.append(nv)

max_da = 0
for i in range(N):
    #print(i, " T:", DT[i], " A:", DA[i])
    if DA[i] - DT[i] >= 1 :
        max_da = max(DA[i], max_da)
print(max_da-1)
N = int(input())
S = input()
S = S[::-1]

cnt = 0
# for i in range(1,N-1):
#     for j in range(i+1,N):
#         if S[i-1] != S[j-1]:
#             for k in range(j+1,N+1):
#                 if S[i-1]!=S[k-1] and S[j-1]!=S[k-1] and j-i!=k-j:
#                     cnt += 1
for i in range(1,N-1):
    for j in range(i+1,N):
        k = 2*j-i
        if S[i-1]==S[k-1] or S[j-1]==S[k-1] :
            cnt += 1


print(N-cnt)

### FIXED CODE ###



N = int(input())
S = input()
S = S[::-1]

cnt = S.count('B')*S.count('G')*S.count('R')

for i in range(N-2):
    for j in range(i,N-1):
        k = 2*j-i
        if  k<=N-1:
            if S[i]!=S[j] and S[i]!=S[k] and S[j]!=S[k] :
                cnt -= 1


print(cnt)
n = int(input().split())
an = list(map(int, input().split()))
print(max(an) - min(an))

### FIXED CODE ###

n = int(input())
an = list(map(int, input().split()))
print(max(an) - min(an))
import numpy as np
#import pdb

N = int(input())
tmp = input().split(' ')

A = []
for i in range(N):
    A.append(int(tmp[i]))

A = np.asarray(A)

z = np.asarray([x for x in range(N)])
A = A - z

b_ceil = np.ceil(np.median(A)).astype(np.int32)
b_floor = np.floor(np.median(A)).astype(np.int32)

A_ceil = A - b_ceil
A_ceil = np.absolute(A_ceil)
A_floor = A - b_floor
A_floor = np.absolute(A_floor)

#pdb.set_trace()
print(np.min((A_ceil.sum(), A_floor.sum())).astype(np.uint32))

### FIXED CODE ###

N = int(input())
if N % 2 == 0:
    print(N)
else:
    print(N * 2)
import math
n = int(input())
lis = []
cou = 0
ans = 0
li = list(map(int,input().split()))
for i in range(n):
    if li[i] >= 3200:
        cou += 1
    else:
        if math.floor(li[i] / 400) not in lis:
            ans += 1
print(ans,min(8,ans + cou))

### FIXED CODE ###

n = int(input())
s = input()
cnt = [0, 0]
add = [0, 0]
ans = ''
for i in range(n):
    if s[i] == ')':
        cnt[0] += 1
        if cnt[0] > cnt[1]:
            add[1] += 1
            cnt[1] += 1
    else:
        cnt[1] += 1

print('(' * add[1] + s + ')'*(cnt[1] -cnt[0]))
h,w = [int(_) for _ in input().split()]
board = [ list(input())  for _ in range(h)]

goodx = [False] * w
goody = [False] * h

for i in range(w):
  for j in range(h):
    print("i ={}, j ={}".format(i,j))
    if board[i][j] == '#':
      goodx[i] = True
      goody[j] = True

for i in range(w):
  if goodx[i]:
    for j in range(h):
      if goody[j]:
        print(board[i][j], end='')
    print("")

### FIXED CODE ###

h,w = [int(_) for _ in input().split()]
board = [ list(input())  for _ in range(h)]

goodx = [False] * h
goody = [False] * w

for i in range(h):
  for j in range(w):
#    print("i={}\tj={}\tboard={}".format(i,j,board[i][j]))
    if board[i][j] == '#':
      goodx[i] = True
      goody[j] = True

for i in range(h):
  if goodx[i]:
    for j in range(w):
      if goody[j]:
        print(board[i][j], end='')
    print("")
n = int(input())

if (n % 10 = 2) | (n % 10 = 4) | (n % 10 = 5) | (n % 10 = 7) | (n % 10 = 9):
  print("hon")

elif (n % 10 = 0) | (n % 10 = 1) | (n % 10 = 6) | (n % 10 = 8):
  print("pon")

else:
  print("bon")

### FIXED CODE ###

n = int(input())
 
if (n % 10 == 2) | (n % 10 == 4) | (n % 10 == 5) | (n % 10 == 7) | (n % 10 == 9):
  print("hon")
 
elif (n % 10 == 0) | (n % 10 == 1) | (n % 10 == 6) | (n % 10 == 8):
  print("pon")
 
else:
  print("bon")
import math
n=int(input())
X=list(map(int,input().split()))
x=X[0]
for i in range(1,n):
    x=math.gcd(x,X[i])

if x!=1:
    print(x)
else:
    print(1)

### FIXED CODE ###

n=int(input())
X=list(map(int,input().split()))
x=X[0]
def gcd(a,b):
    while b:
        a,b=b,a%b
    return a


for i in range(1,n):
    x=gcd(x,X[i])
if x!=1:
    print(x)
else:
    print(1)
n = int(input())
a = list(map(int,input().split()))

ans = 1
for i in range(len(a)):
	if ans > 10**18:
    	print(-1)
        exit()
    else:
    	ans *= a[i]
if ans > 10**18:
	print(-1)
    exit()
print(ans)

### FIXED CODE ###

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

for i in range(len(a)):
    if a[i] == 0:
        print(0)
        exit()

ans = 1
for i in range(len(a)):
  ans *= a[i]
  if ans > 10**18:
    print(-1)
    exit()

print(ans)
a,b = int(input().split())
print(max([a+b,a-b,a*b]))

### FIXED CODE ###

a,b=(int(x) for x in input().split())
print(max([a+b,a-b,a*b]))
import bisect
N, M = map(int, input().split())
start_to_middle = []
middle_to_end = []
for i in range(M):
    a, b = map(int, input().split())
    if a == 1:
        start_to_middle.append(b)
    elif b == N:
        middle_to_end.append(a)
if not len(start_to_middle) or not len(middle_to_end):
    print('IMPOSSIBLE')
    exit()
middle_to_end.sort()
for middle in start_to_middle:
    idx = bisect.bisect_left(middle_to_end, middle)
    if middle_to_end[idx] == middle:
        print('POSSIBLE')
        exit()

print('IMPOSSIBLE')


### FIXED CODE ###

N , M = map(int,input().split())
graph = [[] for _ in range(N)]
for _ in range(M):
    a , b = map(int,input().split())
    graph[a - 1].append(b - 1)
    graph[b - 1].append(a - 1)

for node0 in graph[0]:
    for node1 in graph[node0]:
        if node1 == N - 1:
            print("POSSIBLE")
            exit()
print("IMPOSSIBLE")
N = int(input())
list_S = [input() for i in range(N) ]
list_S.sort()
list_a = []
a = 0
while a < N :
    list_a.append(list_S.count(list_S[a]))
    a += list_S.count(list_S[a])
newlist_a = sorted(list_a,reverse=True)
n = newlist_a.count(newlist_a[0])
ans = ""
if n == 1:
    t = 0
    for i in range(list_a.index(newlist_a[0])):
        t += list_a[i]
    ans = list_S[t+1]
else:
    if newlist_a[0]==1:
        for i in range(len(list_S)):
            ans += list_S[i]
            ans += "\n"
    else:            
        list_t = []
        for i,x in enumerate(list_a):
            if x == newlist_a[0]:
                list_t.append(sum(list_a[0:i]))
                ans += list_S[list_t[i-1]]
                ans += "\n"
print(ans)


### FIXED CODE ###

import collections

N = int(input())
S = [input() for i in range(N)]
c =collections.Counter(S)
C = c.most_common()
list_C = []
for i in range(len(c)):
    list_C.append(C[i][1])
m = 1
for i in range(len(list_C)-1):
    if list_C[i]==list_C[i+1]:
        m += 1
    else:
        break
ans= []
for i in range(m):
    ans.append(C[i][0])
ans = sorted(ans)
for i in range(len(ans)):
    print(ans[i])
import collections
n = int(input())
d = list(map(int, input().split()))
if d[0] != 0:
  print(0)
else:
  del d[0]
  c = collections.Counter(d)
  ll = len(c)
  ans = 1
  fl = False
  for i in range(1, ll+1):
    if c[i] == 0:
      print(0)
      fl = True
      break
    else:
      if i != 1:
        ans *= c[i-1]**c[i]

if not fl:
  print(ans%998244353)

### FIXED CODE ###

import collections
n = int(input())
d = list(map(int, input().split()))
fl = False
if d[0] != 0:
  fl = True
  print(0)
else:
  del d[0]
  c = collections.Counter(d)
  ll = len(c)
  ans = 1
  for i in range(1, ll+1):
    if c[i] == 0:
      print(0)
      fl = True
      break
    else:
      if i != 1:
        ans *= c[i-1]**c[i]

if not fl:
  print(ans%998244353)
from itertools import combinations
n, k = map(int, input().split())
*A, = map(int, input().split())
print(sorted(x*y for x, y in combinations(A, 2))[k])   

### FIXED CODE ###

n = list(map(int, reversed(list(input()))))
a , b = 0, 9999
for x in n:
    a, b = min(a+x, b+x), min(a+10-x+1, b+10-x-1)
print(min(a, b))
input_nums = input().split()

diff_hour = input_nums(2) - input_nums(0)
diff_hour_to_min = diff_hour * 60

diff_min = input_nums(3) - input_nums(1)

total_wake_min = diff_hour_to_min + diff_min

print(total_wake_min - input_nums(4))

### FIXED CODE ###

input_str = input().split()

input_nums=[]

for i in range(5):
    input_nums.append(int(input_str[i]))


diff_hour = input_nums[2] - input_nums[0]
diff_hour_to_min = diff_hour * 60
 
diff_min = input_nums[3] - input_nums[1]

total_wake_min = diff_hour_to_min + diff_min

print(total_wake_min - input_nums[4])
# -*- coding: utf-8 -*-
# Input
list = [int(a) for a in input().split()]

#ソート
list.sort()
print

if list[0] > list[1] + 1:
    num = list[0] * 2 - 1
else:
    mum = sum(list)

print(num)


### FIXED CODE ###

# -*- coding: utf-8 -*-
# Input
list = [int(a) for a in input().split()]

#ソート
list.sort()

num = 0
if list[1] > list[0] + 1:
    num = list[1] * 2 - 1
else:
    num = sum(list)

print(num)
import math
N, K=map(int, input().split())
A=list(map(int, input().split()))
i=1
j=10**9
while True:
    k=(i+j)//2
    if sum([math.ceil(a/k)-1 for a in A])<=K:
        if sum([math.ceil(a/(k-1))-1 for a in A])>K:
            print(k)
            break
        else:
            j=k-1
    else:
        i=k+1

### FIXED CODE ###

import math
N, K=map(int, input().split())
A=list(map(int, input().split()))
i=1
j=10**9
while True:
    k=(i+j)//2
    if k>0 and sum([math.ceil(a/k)-1 for a in A])<=K:
        if k==1 or sum([math.ceil(a/(k-1))-1 for a in A])>K:
            print(k)
            break
        else:
            j=k-1
    else:
        i=k+1