Harryxun/stf_run huggingface dataset:
from fractions import gcd
N = int(input())
As = list(map(int, input().split()))

lcm = 1
mod = 10**9+7

def getprime(n):
    if not isinstance(n, int):
        raise TypeError("Input int")
    if n < 2:
        raise ValueError("N >= 2")
    prime = []
    # 約数はsqrt(N)まで調べればOK
    data = [i+1 for i in range(1,n)]
    while True:
        p = data[0]
        if p >= int(n**0.5):
            return prime+data
        prime.append(p)
        # pで割り切れないものだけを残す
        data = [d for d in data if d%p != 0]

from collections import defaultdict
def factorization(n):
    factors = defaultdict(int)
    if n == 2 or n == 3:
        factors[n] = 1
        return factors
    primes = getprime(int(n**0.5))
    for prime in primes:
        while n % prime == 0:
            factors[prime] += 1
            n //= prime
    if n != 1:
        factors[n] += 1
    return factors

d = defaultdict(int)
for a in As:
    factors = factorization(a)
    for f in factors.keys():
        d[f] = max(d[f],factors[f])

for f in d.keys():
    lcm *= f ** d[f]

ans = 0
for a in As:
    ans += lcm//a
    ans %= mod
print(ans%mod)

### FIXED CODE ###

from fractions import gcd
N = int(input())
As = list(map(int, input().split()))

lcm = 1
mod = 10**9+7

def getprime(n):
    if not isinstance(n, int):
        raise TypeError("Input int")
    if n < 2:
        raise ValueError("N >= 2")
    prime = []
    # 約数はsqrt(N)まで調べればOK
    data = [i+1 for i in range(1,n)]
    while True:
        p = data[0]
        if p >= int(n**0.5):
            return prime+data
        prime.append(p)
        # pで割り切れないものだけを残す
        data = [d for d in data if d%p != 0]

from collections import defaultdict
def factorization(n):
    factors = defaultdict(int)
    if n == 2 or n == 3:
        factors[n] = 1
        return factors
    primes = getprime(int(n**0.5))
    for prime in primes:
        while n % prime == 0:
            factors[prime] += 1
            n //= prime
            # print(factors,n)
    if n != 1:
        factors[n] += 1
    return factors

d = defaultdict(int)
factors_list = []
cnt_1 = 0
for a in As:
    if a == 1:
        cnt_1 += 1
        continue
    factors = factorization(a)
    factors_list.append(factors)
    for f in factors.keys():
        d[f] = max(d[f],factors[f])

for f in d.keys():
    lcm *= f ** d[f]
    lcm %= mod

As_inv = [pow(a,mod-2,mod) for a in As]
a = sum(As_inv)%mod



print((lcm*a)%mod)
n,x=map(int,input().split())
l=list(map(int,input().split()))
c=0
if x==9:
  exit()
for i in range(n-1):
  a=l[i]
  b=l[i+1]
  if a+b>x:
    c+=a+b-x
    if b>=a-x and a>=x:
      l[i+1]-=a+b-x
      print('処理A')
    else:
      l[i+1]=0
      l[i]-=x-b
      print('処理B')
    print(l)
print(l)
print(c)

### FIXED CODE ###

n,x=map(int,input().split())
l=list(map(int,input().split()))
c=0 
for i in range(n-1):
  a=l[i]
  b=l[i+1]
  if a+b<=x:
    continue
  c1=a+b-x
  c+=c1
  if b>=c1:
    l[i+1]-=c1
  else:
    l[i]-=c1-b
    l[i+1]=0
print(c)
A,B = map(int,input().split())
a = format(A-1,'b')
b = format(B,'b')
if int(a) < 0:
  a = 0
le = len(b)
part = []
whole = []
for i in range(1,le+1):
  whole += [int(b[i-1])]
  df = le - len(a)
  if i <= df:
    part += [0]
  else:
    part += [int(a[i-1-df])]
p = 0
for i in range(le):
  p *= 10
  if i == le-1:
    if int(a)%4 == 1 or int(a)%4 == 2:
      p += 1
  elif part[i] == 0:
    pass
  else:
    p += 1- int(a)%2
w = 0
for i in range(le):
  w *= 10
  if i == le-1:
    if int(b)%4 == 1 or int(b)%4 == 2:
      w += 1
  elif whole[i] == 0:
    pass
  else:
    w += 1- int(b)%2
print(int(str(w),2)^int(str(p),2))


### FIXED CODE ###

a,b = map(lambda x:
          int(format(int(x),'b')),input().split())
a -= 1
A = str(a)
la = len(A)
ga = [0]*la
if a%4 == 1 or a%4 == 2:
  ga[-1] = 1
for ai in range(0,la-1):
  if A[ai] == '1' and A[-1] == '0':
    ga[ai] = 1
aa = 0
for ai in range(la):
  aa *= 2
  aa += ga[ai]
B = str(b)
lb = len(B)
gb = [0]*lb
if b%4 == 1 or b%4 == 2:
  gb[-1] = 1
for bi in range(0,lb-1):
  if B[bi] == '1' and B[-1] == '0':
    gb[bi] = 1
bb = 0
for bi in range(lb):
  bb *= 2
  bb += gb[bi]
if a < 0:
  print(bb)
else:
  print(aa^bb)
N = int(input())
A = list(map(int, input().split()))
for a in A:
  if a == 'Y':
    print('Four')
    exit()
print('Three')

### FIXED CODE ###

N = int(input())
A = input().split()
for a in A:
  if a == 'Y':
    print('Four')
    exit()
print('Three')
import math

# z ??¨ y ????±?????????????x????±?????????????
# ?????????????????°????????????e?????????????????? 10^5 ???
while True:
    e = int(input())
    if e == 0:
        break

    min_e = e
    for i in range( math.floor(pow(e, 1.0/3.0)) + 1 ):
        for j in range( math.floor(math.sqrt(e - i**3)) + 1):
            x = e - (i**3) - (j**2)
            y = j
            z = i
            # print(x)
            # print(y)
            # print(z)
            # print("")
            if ( (x + y + z) < min_e ):
                min_e = x + y + z

    print(min_e)

### FIXED CODE ###

# ??¶?´?: x + y^2 + z^3 = e
# ????????¨??§???????°???¨?????? x + y + z ????±??????????

import math

# 1. z ????±???????
# 2. y ??? ???y**2 < (e - z**3)???????????????y????????§???
# 3. x ??? e - y**2 - z**3
# ?????????e????????????????????????101???
while True:
    e = int(input())
    if e == 0:
        break

    min_e = e
    for i in range(101):
        if (e - i**3) < 0:
            break;
        z = i
        y = math.floor(math.sqrt(e - i**3))
        x = e - y**2 - z**3
        if ( (x + y + z) < min_e ):
            min_e = x + y + z

    print(min_e)
M = 100001
dp = {}
dp[100],dp[101],dp[102],dp[103],dp[104],dp[105] = 1,1,1,1,1,1
def isComb(dp,n):
	for i in range(100,106):
		for j in range(i,106):
			if n-i in dp and n-j in dp and dp[n-i]==1 and dp[n-j]==1:
				return 1
			
	return 0


for i in range(106,M):
	if isComb(dp,i):
		dp[i] = 1
	else:
		dp[i] = 0
n = int(input())
print(dp[n])


### FIXED CODE ###

M = 100001
dp = {}
dp[100],dp[101],dp[102],dp[103],dp[104],dp[105] = 1,1,1,1,1,1
def isComb(dp,n):
	for i in range(100,106):
		for j in range(i,106):
			if n-i in dp and n-j in dp and dp[n-i]==1 and dp[n-j]==1:
				return 1
			
	return 0


for i in range(106,M):
	if isComb(dp,i):
		dp[i] = 1
	else:
		dp[i] = 0
n = int(input())
if n in dp:
	print(dp[n])
else:
	print(0)
# print(dp[n])
X='abcdefghijklmnopqrstuvwxyz'*2
S=input()
k=int(input())
N=[]
for s in S:
    if s=='a':
        N.append(0)
    else:
        N.append(26-X.index(s))
ans=''
for i in range(len(S)):
    if N[i]<=k :
        k-=N[i]
        ans+='a'
    else:
        ans+=S[i]
ans=ans[:-1]+X[X.index(ans[-1])+k]

print(ans)


### FIXED CODE ###

X='abcdefghijklmnopqrstuvwxyz'*2
S=input()
k=int(input())
N=[]
for s in S:
    if s=='a':
        N.append(0)
    else:
        N.append(26-X.index(s))
ans=''
for i in range(len(S)):
    if N[i]<=k :
        k-=N[i]
        ans+='a'
    else:
        ans+=S[i]
ans=ans[:-1]+X[X.index(ans[-1])+k%26]

print(ans)
n = int(input())
a = list(map(int,input().split()))
s, ans, i = 0,0,0
while a[i] == 0 and i < n:
  ans += 2
  i += 1
ans = max(0, ans - 1)
if i == n:
  print(ans)
  exit()

if ans > 0:
  if abs(a[i]) == 1:
    ans += 1
    s = a[i] // abs(a[i])
else:
  s = a[0]

i += 1
for j in range(i,n):
  if abs(a[j]) > abs(s) and a[j] // abs(a[j]) != s // abs(s):
    s += a[j]
  else:
    s = -1 * s // abs(s)
    ans += abs(abs(a[j]) - 2)
  
  
print(ans)

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
ans1, ans2 = 0, 0
s = 0
plus = True
for i in range(n):
    if plus:
        if s + a[i] > 0:
            s += a[i]
        else:
            ans1 += abs(1 - (s + a[i]))
            s = 1
    if not plus:
        if s + a[i] < 0:
            s += a[i]
        else:
            ans1 += abs(-1 - (s + a[i]))
            s = -1
    plus = not plus

s = 0
plus = False
for i in range(n):
    if plus:
        if s + a[i] > 0:
            s += a[i]
        else:
            ans2 += abs(1 - (s + a[i]))
            s = 1
    if not plus:
        if s + a[i] < 0:
            s += a[i]
        else:
            ans2 += abs(-1 - (s + a[i]))
            s = -1
    plus = not plus
print(min(ans1, ans2))
N=int(input())
S,T=input().split()

for i in range(N):
    print(f'{S[i]}{T[i]}',end='')

### FIXED CODE ###

# coding: utf-8
# Your code here!
N=int(input())
S,T=input().split()

for i in range(N):
    print('{}{}'.format(S[i],T[i]),end='')
n = int(input())
ret = {}
for i in range(0, n):
    a = int(input())
    ret[i] = [[], []]
    for j in range(a):
        x, y = map(int, input().split())
        x -= 1
        if y == 1:
            ret[i][0].append(x)
        elif y == 0:
            ret[i][1].append(x)

dic = {}


def f(honest_p, honest_list):
    if honest_p in dic:
        return []
    dic[honest_p] = True
    # print('honest_list', honest_p, honest_list)
    if ret[honest_p][0] == []:
        return [honest_p]
    temp = [honest_p] + honest_list
    for i in honest_list:
        temp += f(i, ret[i][0])
    return temp


ans = 0
for i in range(0, n):
    dic = {}
    honest = list(set(f(i, ret[i][0])))
    # print('h', honest)
    dishonest = ret[i][1]
    for a in honest:
        for b in ret[a][1]:
            if b not in dishonest:
                dishonest.append(b)
    # print('d', dishonest)
    dishonest = list(set(dishonest))
    invalid = []
    for j in range(0, n):
        if i == j or j in honest or j in dishonest:
            continue
        val = True
        for k in ret[j][1]:
            if k in honest:
                val = False
        for k in ret[j][0]:
            if k in dishonest:
                val = False
        if not val:
            invalid.append(j)
    # print('invalid', invalid)
    import itertools
    lst = list(itertools.product([0, 1], repeat=n))
    for string in lst:
        string = list(string)
        for j in invalid:
            string[j] = 0
        # print(honest, dishonest, string)
        if not val and list(set(honest) & set(dishonest)) == []:
            # print(string)
            ans = max(ans, string.count(1))
print(ans)


### FIXED CODE ###

n = int(input())
ret = {}
for i in range(0, n):
    a = int(input())
    ret[i] = [[], []]
    for j in range(a):
        x, y = map(int, input().split())
        x -= 1
        if y == 1:
            ret[i][0].append(x)
        elif y == 0:
            ret[i][1].append(x)
 
ans = 0
import itertools
lst = list(itertools.product([0, 1], repeat=n))
for s in lst:
    var = True
    for i in range(len(s)):
        if s[i] == 1:
            for j in ret[i][0]:
                if s[j] != 1:
                    var = False
                    break
            for j in ret[i][1]:
                if s[j] != 0:
                    var = False
                    break
    if var:
        # print(s)
        ans = max(ans, s.count(1))
print(ans)
import numpy as np
from numba import njit


n = int(input())
arr = np.array(list(map(int, input().split())))


n = 10**3
primes = set(range(3, n+1, 2))

for i in range(3, int(n**0.5+1)):
    primes.difference_update(range(i*2, n+1, i))
primes.add(2)


@njit
def solve(arr, primes):
    used = [False] * 1000
    ans = True
    for x in arr:
        for p in primes:
            while x % p == 0:
                if used[p]:
                    ans = False
                    return ans
                while x % p == 0:
                    x //= p
                used[p] = True
    return ans


ans1 = np.all([sum(cnt[i::i]) <= 1 for i in range(2, 10**6+1)])


if np.gcd.reduce(arr) != 1:
    print("not coprime")
elif ans1:
    print("pairwise coprime")
else:
    print("setwise coprime")

### FIXED CODE ###

import numpy as np
from numba import njit


n = int(input())
arr = np.array(list(map(int, input().split())))


n = 10**6 + 1
primes = set(range(3, n+1, 2))

for i in range(3, int(n**0.5+1)):
    primes.difference_update(range(i*2, n+1, i))
primes.add(2)


@njit
def solve(arr, primes):
    cnt = np.bincount(arr)
    for p in primes:
        if (cnt[p::p]).sum() > 1:
            return False
    else:
        return True


if np.gcd.reduce(arr) != 1:
    print("not coprime")
elif solve(arr, primes):
    print("pairwise coprime")
else:
    print("setwise coprime")
# Library
import bisect

alp = "abcdefghijklmnopqrstuvwxyz"
#

s = input()
t = input()
ss = s * 2
index = -1
cir = 0
letter = []
res = 0

for i in range(len(ss)):
    letter.append([ss[i], i])

# Sort出来る.
letter.sort()

for i in range(len(t)):
    search = [t[i], index]
    tmp_ind = bisect.bisect(letter, search)
    # print("now searching " + str(search))
    # print("find: " + str(tmp_ind))
    # print("found: " + str(letter[tmp_ind]))
    if t[i] != letter[tmp_ind][0]:
        # Not exist
        res = -1
        break
    index += (letter[tmp_ind][1] - index)
    if index >= len(s):
        cir += 1
        index -= len(s)
    # print("cir,index : " + str(cir) + " " + str(index))
    res = cir * len(s) + index + 1

print(res)


### FIXED CODE ###

# Library
import bisect

alp = "abcdefghijklmnopqrstuvwxyz"
#

s = input()
t = input()
ss = s * 2
index = -1
cir = 0
letter = []
res = 0

for i in range(len(ss)):
    letter.append([ss[i], i])

# Sort出来る.
letter.sort()

for i in range(len(t)):
    search = [t[i], index]
    tmp_ind = bisect.bisect(letter, search)
    # print("now searching " + str(search))
    # print("find: " + str(tmp_ind))
    # print("found: " + str(letter[tmp_ind]))
    if tmp_ind == len(ss):
        res = -1
        break
    if t[i] != letter[tmp_ind][0]:
        # Not exist
        res = -1
        break
    index += (letter[tmp_ind][1] - index)
    if index >= len(s):
        cir += 1
        index -= len(s)
    # print("cir,index : " + str(cir) + " " + str(index))
    res = cir * len(s) + index + 1

print(res)
#-*- coding:utf-8 -*-
import copy
import math
from functools import reduce

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

gcd_list =[]

for i, a in enumerate(A):
    A_except_a = copy.deepcopy(A)
    A_except_a.pop(i)
    
    gcd = reduce(math.gcd, A_except_a)
    gcd_list.append(gcd)

print(max(gcd_list))

### FIXED CODE ###

import fractions
from functools import reduce

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

m1 = [0] * (N + 1)
m2 = [0] * (N + 1)
for i in range(1, N + 1):
  m1[i] = fractions.gcd(m1[i - 1], a_list[i - 1])
  m2[N - i] = fractions.gcd(m2[N - i + 1], a_list[N - i])

m = [0] * N
for i in range(N):
  m[i] = fractions.gcd(m1[i], m2[i + 1])

print(max(m))
n, m = map(int, input().split())
a = list(map(int, input().split()))
bc = []
for _ in range(m):
    b, c = map(int, input().split())
    bc.append([b, c])
a.sort()
bc.sort(reverse=True, key=lambda x: x[1])
cnt = 0
for i in range(m):
    for j in range(bc[i][0]):
        if bc[i][1] > a[cnt]:
            a[cnt] = bc[i][1]
            cnt += 1
        else:
            break
print(sum(a))


### FIXED CODE ###

n, m = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
bc = [list(map(int, input().split())) for _ in range(m)]

bc.sort(reverse=True, key=lambda x:x[1])

i = 0
for b,c in bc:
    for j in range(i, min(n, i+b)):
        if a[j]<c:
            a[j] = c
    i = i+b
print(sum(a))
import numpy as np
N, M, C = map(int, input().split())
B = np.array(list(map(int, input().split())))
A = np.empty((N, M),dtype=int)
for n in range(N):
    A[n, :] = list(map(int, input().split()))
X = np.matmul(A, B) + C
print(len(X[X>0]))

### FIXED CODE ###

import numpy as np
N, M, C = map(int, input().split())
B = np.array(list(map(int, input().split())))
A = np.empty((N, M),dtype=int)
for n in range(N):
    A[n, :] = list(map(int, input().split()))
X = np.dot(A, B) + C
print(len(X[X>0]))
K = input()
list = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(list[K])

### FIXED CODE ###

list = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
K = int(input())
if K < 32:
    print(list[K-1])
else:
    print(list[31])
if input()=='Sunny':
	print('Cloudy')
elif input()=='Rainy':
	print('Sunny')
else:
	print('Rainy')

### FIXED CODE ###

s=input()
if s=='Sunny':
	print('Cloudy')
elif s=='Rainy':
	print('Sunny')
else:
	print('Rainy')
#B
n = int(input())
a = tuple(map(int,input().split()))
flg = True
MAX = 10 ** 18
cnt = 1
result = reduce(lambda ans, x:ans * x, a)
if result > MAX:
    flg = False
        

if flg:
    print(result)
else:
    print(-1)

### FIXED CODE ###

def main():
    N = int(input())
    A = list(map(int,input(). split ()))
    if 0 in A:
        print(0)
        return
    prod = 1
    for a in A:
        prod *= a
        if prod > 1000000000000000000:
            print(-1)
            return
    print(prod)
    
main()
a = input()
j = 0
for i in range(a):
    if i%3==0:
        continue
    if i%5==0:
        continue
    else:
        j+=i
print(j)

### FIXED CODE ###

a = int(input())
j = 0
for i in range(a + 1):
    if i%3!=0 and i%5!=0:
        j+=i
print(j)
a,b=map(int,input().split())
print(["Possible","Impossible"][a%3==b%3 and a%3==1 or a%3==2]

### FIXED CODE ###

a,b=map(int,input().split())
print(["Possible","Impossible"][a%3==b%3 and (a%3==1 or a%3==2)])
n=int(input())
a=int(input())
print(['Yes','No'][(n-a)%500>0]

### FIXED CODE ###

n=int(input())
a=int(input())
print(['Yes','No'][n%500>a])
from collections import deque

N = int(input())
A = deque(sorted([int(input()) for i in range(N)]))
B = A.copy()
ans = deque([A.popleft()])
while A:
    if A:
        ans.appendleft(A.pop())
    if A:
        ans.append(A.pop())
    if A:
        ans.appendleft(A.popleft())
    if A:
        ans.append(A.popleft())
res_1 = 0
ans = list(ans)
for i in range(N - 1):
    res_1 += abs(ans[i] - ans[i + 1])
ans = deque([B.pop()])
while B:
    if B:
        ans.appendleft(B.popleft())
    if B:
        ans.append(B.popleft())
    if B:
        ans.appendleft(B.pop())
    if B:
        ans.append(B.pop())
res_2 = 0
ans = list(ans)
for i in range(N - 1):
    res_2 += abs(ans[i] - ans[i + 1])
print(max(res_1, res_2))


### FIXED CODE ###

from collections import deque
import copy
N = int(input())
A = deque(sorted([int(input()) for i in range(N)]))
B = copy.copy(A)
ans = deque([A.popleft()])
while A:
    if A:
        ans.appendleft(A.pop())
    if A:
        ans.append(A.pop())
    if A:
        ans.appendleft(A.popleft())
    if A:
        ans.append(A.popleft())
res_1 = 0
ans = list(ans)
for i in range(N - 1):
    res_1 += abs(ans[i] - ans[i + 1])
ans = deque([B.pop()])
while B:
    if B:
        ans.appendleft(B.popleft())
    if B:
        ans.append(B.popleft())
    if B:
        ans.appendleft(B.pop())
    if B:
        ans.append(B.pop())
res_2 = 0
ans = list(ans)
for i in range(N - 1):
    res_2 += abs(ans[i] - ans[i + 1])
print(max(res_1, res_2))
def dfs(a, b):  

    visited[a] = 1 
    b += 1
    start[a] = b  
    dfs_order.append(a)  
      
    for it in adj[a]:  
        if not visited[it]:  
            b = dfs(it, b)  
       
    endd[a] = b 
    return b 
  
n, q  = map(int, input().split())
start = [None] * (n+1) 
endd = [None] * (n+1)
dfs_order = []  
adj = [[] for i in range(n+1)]  
visited = [False] * (n+1)
for i in range(n-1):
    a, b = map(int, input().split())
    adj[a-1].append(b-1)

dfs(0, 0)  

subtree = [[] for _ in range(n+1)]
for i in range(n):  
    subtree[i].append(i)  
    if start[i] != endd[i]:   
        for j in range(start[i]+1, endd[i]+1):  
            subtree[i].append(dfs_order[j-1])   

ans = [0]*(n)

for i in range(q):
    p, x = map(int, input().split())
    for j in subtree[p-1]:
        ans[j] += x

print(*ans)



### FIXED CODE ###

import sys
input = sys.stdin.readline
N, Q = map(int, input().split())

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

xs = [0]*N
for _ in range(Q):
    p, x = map(int, input().split())
    xs[p-1] += x

ans = [0]*N
ans[0] = xs[0]
visited = [0]*N
stack = [0]
while stack:
    v = stack.pop()
    visited[v] = 1
    for to in es[v]:
        if visited[to]:
            continue
        stack.append(to)
        ans[to] = ans[v] + xs[to]

print(*ans)
from collections import Counter
n = int(input())
XY = [list(map(int,input().split())) for _ in range(n)]
XY.sort(key=lambda x: x[0], reverse=True)
dXY = Counter([])
for i in range(n-1):
    for j in range(i+1,n):
        dXY += Counter([str(XY[i][0]-XY[j][0])+'_'+str(XY[i][1]-XY[j][1])])
print(n-dXY.most_common()[0][1])

### FIXED CODE ###

from collections import Counter
n = int(input())
XY = [list(map(int,input().split())) for _ in range(n)]
dXY = Counter([])
for i in range(n):
    for j in range(n):
        if i!=j:
            dXY += Counter([str(XY[i][0]-XY[j][0])+'_'+str(XY[i][1]-XY[j][1])])
if n==1:
    print(1)
else:
    print(n-dXY.most_common()[0][1])
N = int(input())
S = {}
for i in range(N):
    s = input()
    if s in S:
        S[s] += 1
    else:
        S[s] = 1
sorted_S = sorted(S.items(), key=lambda x: x[1], reverse=True)
a = []
count = -1
for s in sorted_S:
    if count == -1:
        a.append(s)
        count = sorted_S[s]
    elif count == sorted_S[s]:
        a.append(s)
    else:
        break
sorted_a = sorted(a)
for s in sorted_a:
    print(s)

### FIXED CODE ###

N = int(input())
S = {}
for i in range(N):
    s = input()
    if s in S:
        S[s] += 1
    else:
        S[s] = 1
sorted_S = sorted(S.items(), key=lambda x: x[1], reverse=True)
a = []
count = -1
for s in sorted_S:
    if count == -1:
        a.append(s[0])
        count = s[1]
    elif count == s[1]:
        a.append(s[0])
    else:
        break
sorted_a = sorted(a)
for s in sorted_a:
    print(s)
N = int(input())
H = list(map(int, input().split()))
tmp = 0
s = 0
for i in range(N-1):
  if H[i] >= H[i+1]:
    tmp += 1
    s = max(x, tmp)
  else:
    tmp = 0
    
print(s)

### FIXED CODE ###

N = int(input())
H = list(map(int, input().split()))
tmp = 0
s = 0
for i in range(N-1):
  if H[i] >= H[i+1]:
    tmp += 1
    s = max(s, tmp)
  else:
    tmp = 0
    
print(s)
N = int(input())
A = list(map(int, input().split()))

s=0
for i in A:
  s += 1/A
print(1/s)


### FIXED CODE ###

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

s=0
for i in A:
  s += 1/i
print(1/s)
a = long(input())
j = 0
for i in range(a):
    if i%3==0:
        continue
    if i%5==0:
        continue
    else:
        j+=i
print(j)

### FIXED CODE ###

a = int(input())
j = 0
for i in range(a + 1):
    if i%3!=0 and i%5!=0:
        j+=i
print(j)
n = int(input())
b = 1
a = list(map(int,input().split()))
if 0 in a:
    print(0)
else:
    for i in range(n):
        b *= int(a[i])
    b *= a[n]
    if b > 10**18:
       print(-1)
       break
    print(b)    

### FIXED CODE ###

n = int(input())
b = 1
a = list(map(int,input().split()))
if 0 in a:
    print(0)
else:
    for i in range(n):
        b *= a[i]
        if b > 10**18:
            print(-1)
            break
    if b <=10**18:
        print(b)
def main():
  X,N = list(map(int, input().split()))
  if N==0: return
  #forbidden elements
  P = list(map(int, input().split()))
  #allowed elements
  Q = set([i for i in range(1,100+1)])
  for p in P:
    Q.remove(p)
  Q = sorted(Q)
  # distance from X
  D = [abs(q-X) for q in Q]
  # find smallest minimizer
  minD = min(D)
  for d,q in zip(D,Q):
    if d==min(D):
      break
  return q
    
main()

### FIXED CODE ###

def main():
  X,N = list(map(int, input().split()))
  P = list(map(int, input().split()))
  #allowed elements
  Q = set([i for i in range(0,101+1)])
  for p in P:
    Q.remove(p)
  Q = sorted(Q)
  # distance from X
  D = [abs(q-X) for q in Q]
  # find smallest minimizer
  minD = min(D)
  for d,q in zip(D,Q):
    if d==minD:
      break
  print(q)
    
if __name__=='__main__':
  main()
import math
from functools import reduce
def gcd(*numbers):
    return reduce(math.gcd, numbers)

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

ans = gcd(*a)
print(ans) 



### FIXED CODE ###

from fractions import gcd

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

ans = a[0]
for i in a:
    ans = gcd(i, ans)

print(ans)
a=int(input())
b=int(input())
c=(a*b)%2
if c=0:
  print("Even")
else:
  print("Odd")

### FIXED CODE ###

a, b=map(int, input().split())
c=(a*b)%2
if c==0:
  print("Even")
else:
  print("Odd")