Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

import numpy as np

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

for i in range(k):
    tmp_arr = np.zeros(n, np.int64)
    for i, x in enumerate(arr):
        tmp_arr[max(0, i - x):min(n, i + x + 1)] += 1
    arr = tmp_arr
    if np.where(arr == n)[0].shape[0] == n:
        break

print(*arr)

### FIXED CODE ###

from itertools import accumulate
import sys

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

for cnt in range(k):
    tmp = [0] * (n + 2)
    for i in range(n):
        power = arr[i]
        left = max(0, i - power + 1)
        right = min(n + 1, i + power + 2)
        tmp[left] += 1
        tmp[right] -= 1
    arr = list(accumulate(tmp))[1:-1]
    if cnt > 40:
        arr = [n] * n
        print(*arr)
        sys.exit()

print(*arr)
### BUGGY CODE ###

X, Y, Z, K = map(int,input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
sum = 0
ans = []
ans2 = []

for i in range(X):
    for j in range(Y):
        sum = A[i] + B[j]
        ans.append(sum)
ans.sort(reverse=True)

for i in range(min(K,len(ans))):
    for j in range(Z):
        sum = ans[i] + C[j]
        ans2.append(sum)
ans2.sort(reverse=True)

for l in range(K):
    print(ans2[l])

### FIXED CODE ###

X, Y, Z, K = map(int,input().split())
A = sorted(list(map(int, input().split())),reverse=True)
B = sorted(list(map(int, input().split())),reverse=True)
C = sorted(list(map(int, input().split())),reverse=True)

ans = []

for i in range(X):
    for j in range(Y):
        if (i+1)*(j+1) > K:
            break
        for t in range(Z):
            if (i+1)*(j+1)*(t+1) > K:
                break
            ans.append(A[i]+B[j]+C[t])
ans.sort(reverse=True)

for l in range(K):
    print(ans[l])
### BUGGY CODE ###

import itertools
N = int(input())
L = list(map(int, input().split()))
S = 0
for c in itertools.combinations(L, 2):
  S += c[0] * c[1]
print(S % (10 ** 9+7))

### FIXED CODE ###

k = 10 ** 9 + 7
N = int(input())
L = list(map(int, input().split()))
S = sum(L) ** 2
for i in L:
  S -= i ** 2

print( (S // 2) % k)
### BUGGY CODE ###

import sys
input = sys.stdin.readline

n = int(input())
a = [int(i) for i in input().split()]
l = []

for i in range(1,n+1):
  z = a.index(i)
  l.append(z+1)
  
print(*l)


### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
List = [0]*N
 
 
for i, a in enumerate(A):
  List[int(a)-1] = str(i+1)
 
  
print(" ".join(List))
### BUGGY CODE ###

s = str(input())
K = int(input())
ls = len(s)
l = []
for i in range(ls):
  for j in range(i+1,ls+1):
    l.append(s[i:j])
l = list(set(l))
l = sorted(l)
print(l[K-1])

### FIXED CODE ###

from bisect import *
s = str(input())
K = int(input())
ls = len(s)
l = []
for i in range(ls):
  for j in range(i+1,i+K+2):
    l.append(s[i:j])

l = list(set(l))
l = sorted(l)
print(l[K-1])
### BUGGY CODE ###

import sys
fastinput = sys.stdin.readline
N,D,A = [int(i) for i in fastinput().split()]
preXH = [[int(i) for i in fastinput().split()] for j in range(N)]
preXH.sort()
XH = [[x,h//A + bool(h%A)] for x,h in preXH]
X = [x for x,h in XH]+[100000000000000000]
Diff = [X[m+1]-X[m] for m in range(N)]
reach = []
count = 0
l = X[0]
r = X[0]+2*D
for m in range(1,N+1):
    while r<X[m]:#l一個すすめる
        reach.append(m-1)
        r += Diff[count]
        count += 1

ans = 0
DP = [0]*N#ダメイジの合計
for n,d in enumerate(DP):
    if d<XH[n][1]:#殺しきれてない
        bonu = XH[n][1]-d
        ans += bonu
        for m in range(n,reach[n]+1):
            DP[m] += bonu
print(ans)

### FIXED CODE ###

import sys
fastinput = sys.stdin.readline
N,D,A = [int(i) for i in fastinput().split()]
preXH = [[int(i) for i in fastinput().split()] for j in range(N)]
preXH.sort()
XH = [[x,h//A + bool(h%A)] for x,h in preXH]
X = [x for x,h in XH]+[100000000000000000]
Diff = [X[m+1]-X[m] for m in range(N)]
reach = []
count = 0
l = X[0]
r = X[0]+2*D
for m in range(1,N+1):
    while r<X[m]:#l一個すすめる
        reach.append(m-1)
        r += Diff[count]
        count += 1

damage = 0
ans = 0
DIFF = [0]*N#ダメイジのdiff
for n,d in enumerate(DIFF):
    damage += d
    if damage<XH[n][1]:#殺しきれてない
        bonu = XH[n][1]-damage
        damage += bonu
        ans += bonu
        if reach[n]<N-1:DIFF[reach[n]+1] -= bonu
print(ans)
### BUGGY CODE ###

import sys
n = int(input())
le = 0
ri = n-1
print(0)
sys.stdout.flush()
s = input()
if s == "Male":
    ls = "Male"
elif s == "Female":
    ls = "Female"
else:
    exit()

while ri > le + 1:
    m = (ri+le)//2
    print(m)
    sys.stdout.flush()
    s = input()
    if (m-le)%2:
        if s == ls:
            ri = m
        else:
            le = m
            ls = s
    else:
        if s == ls:
            le = m
            ls = s
        else:
            ri = m
print(le)
sys.stdout.flush()
exit()


### FIXED CODE ###

import sys
n = int(input())
le = 0
ri = n
print(0)
sys.stdout.flush()
s = input()
if s == "Male":
    ls = "Male"
elif s == "Female":
    ls = "Female"
else:
    exit()

while ri > le + 1:
    m = (ri+le)//2
    print(m)
    sys.stdout.flush()
    s = input()
    if s == "Vacant":
        exit()
    if (m-le)%2:
        if s == ls:
            ri = m
        else:
            le = m
            ls = s
    else:
        if s == ls:
            le = m
            ls = s
        else:
            ri = m
print(le)
sys.stdout.flush()
exit()
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10**6)
N = int(input())
S = input()

count = -1

def dfs(index, moji):
    global N,S,count
    if index==N:
        count+=1
        return
    if S[index] in moji:
        dfs(index+1, moji)
    else:
        dfs(index+1, moji)
        dfs(index+1, moji+S[index])

dfs(0,'')
print(count)

### FIXED CODE ###

N = int(input())
S = input()
MOD = 10**9+7

alp = 'abcdefghijklmnopqrstuvwxyz'
count_alp = [0 for i in range(26)]
count = 1

for s in S:
    count_alp[alp.find(s)]+=1

for i in count_alp:
    count*= (i+1)
print((count-1)%MOD)
### BUGGY CODE ###

#import sys
#sys.setrecursionlimit(10**7)
#from functools import reduce
#from fractions import gcd


# input
n, m = map(int, list(input().split()))
alist = list(map(int, input().split()))

# process
blist=[]
for i in alist:
    for j in alist:
        blist.append(i+j)

blist.sort(reverse=True)

ans = 0
for i in range(m):
    ans += blist[i]    

# output
print(ans)

### FIXED CODE ###

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

# process
A.sort(reverse=True)

# 1回の握手の幸福度がx以上となるものの数、幸福度の合計を求める
def calc(x):
    count, sum = 0, 0

    j, t = 0, 0
    for i in reversed(range(N)):
        while j < N and A[i]+A[j] >= x:
            t += A[j]
            j += 1
        count += j
        sum += A[i]*j + t
    
    return (count, sum)

# 2分探索で答えを求める
def binary_search(x, y):
    mid = (x+y)//2

    count, sum = calc(mid)
    
    if count < M:
        return binary_search(x, mid)
    else:
        if x == mid:
            print(sum-(count-M)*mid)
        else:
            return binary_search(mid, y)

# 実行
binary_search(0, A[0]*2+1)
### BUGGY CODE ###

n,k = map(int,input().split())
s = list(input())
if s[0] == "1":
    cnt_list = []
else:
    cnt_list = [0]
cnt = 1
for i in range(n-1):
    if s[i] == s[i+1]:
        cnt += 1
    else:
        cnt_list.append(cnt)
        cnt = 1
cnt_list.append(cnt)
if s[-1] == '0':
    cnt_list.append(0)
#print(cnt_list)
sum_list = []
right = max(len(cnt_list)-2*k, 1)
for i in range(0,right,2):
    sum_list.append(sum(cnt_list[i:i+2*k+1]))
#print(sum_list)
print(max(sum_list))

### FIXED CODE ###

n,k = map(int,input().split())
s = list(input())
if s[0] == "1":
    cnt_list = []
else:
    cnt_list = [0]
cnt = 1
for i in range(n-1):
    if s[i] == s[i+1]:
        cnt += 1
    else:
        cnt_list.append(cnt)
        cnt = 1
cnt_list.append(cnt)
if s[-1] == '0':
    cnt_list.append(0)
#print(cnt_list)
sum_list = [0]
for i in range(len(cnt_list)):
    sum_list.append(sum_list[i] + cnt_list[i])
ans = 0
for i in range(0,len(sum_list),2):
    right = min(i+2*k+1,len(sum_list)-1)
    ans = max(ans,sum_list[right]-sum_list[i])
print(ans)
### BUGGY CODE ###

N = int(input())

def f(n):
    cnt = 0
    for x in range(1, int(n ** 0.5) + 1):
        for y in range(1, int((n-x**2) ** 0.5) + 1):
            for z in range(1, int((n-x**2-y**2) ** 0.5) + 1):
                if x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x == n:
                    cnt += 1

    return cnt

for i in range(1, N+1):
    print(f(i))


### FIXED CODE ###

n = int(input())

ans = [0 for _ in range(n+1)]

for x in range(1, int(n ** 0.5) + 1):
    for y in range(1, int(n ** 0.5) + 1):
        for z in range(1, int(n ** 0.5) + 1):
            a = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
            if a <= n:
                ans[a] += 1

for i in range(1,n+1):
    print(ans[i])
### BUGGY CODE ###

import sys
import numpy as np

input = sys.stdin.readline
sys.setrecursionlimit(10**7)

N, W = map(int, input().split())
weight = []
value = []
for _ in range(N):
    x, y = map(int, input().split())
    weight.append(x)
    value.append(y)

dp = np.zeros((N + 1, W + 1))
for i in range(N):
    for j in range(W + 1):
        if weight[i] <= j:
            dp[i + 1, j] = max(dp[i, j - weight[i]] + value[i], dp[i, j])
        else:
            dp[i + 1, j] = dp[i, j]

print(int(dp[N, W]))


### FIXED CODE ###

import sys

input = sys.stdin.readline
sys.setrecursionlimit(10**7)
inf = 10**17
mod = 10**9+7

n, w = map(int, input().split())
weight = []
value = []
for _ in range(n):
    x, y = map(int, input().split())
    weight.append(x)
    value.append(y)


dp = [[0] * (w + 1) for j in range(n + 1)]
for i in range(n):
    for j in range(w + 1):
        if j < weight[i]:
            dp[i + 1][j] = dp[i][j]
        else:
            dp[i + 1][j] = max(dp[i][j - weight[i]] + value[i], dp[i][j])
print(dp[n][w])
### BUGGY CODE ###

# coding: utf-8
# Your code here!
import sys
readline = sys.stdin.readline
read = sys.stdin.read


s = input()

MOD = 2019
d = [0]*MOD
d[0] = 1
r = 0
t = 1
for i in reversed(s):
    r += int(i)*t
    r %= MOD
    t *= 10
    d[r] += 1
    
print(sum(i*(i-1)//2 for i in d))

    





### FIXED CODE ###

# coding: utf-8
# Your code here!
import sys
readline = sys.stdin.readline
read = sys.stdin.read


s = input()

MOD = 2019
d = [0]*MOD
d[0] = 1
r = 0
t = 1
for i in reversed(s):
    r += int(i)*t
    r %= MOD
    t *= 10
    t %= MOD
    d[r] += 1
    
print(sum(i*(i-1)//2 for i in d))
### BUGGY CODE ###

s=input().split()

N=int(s[0])
K=int(s[1])

if N > K/2 and N < K:
    print(abs(N-K))

if N <= K/2:
    print(N)

if N==K:
    print(0)

while N > 100*K:
    N=N-100*K
    if N <=100*K:
        break

if N > K:
    while N > K:
        N=N-K
        if N <= K:
            break

    if N > K/2 and N < K:
        print(abs(N-K))

    if N <= K/2:
        print(N)

    if N==K:
        print(0)
    




### FIXED CODE ###

s=input().split()

N=int(s[0])
K=int(s[1])

if N > K/2 and N < K:
    print(abs(N-K))

if N <= K/2:
    print(N)

if N==K:
    print(0)



if N > K:

    


    if N >2*K:
        L=N//K
        N=N-L*K
    else:
        N=N-K
    

    if N > K/2 and N < K:
        print(abs(N-K))

    if N <= K/2:
        print(N)

    if N==K:
        print(0)
### BUGGY CODE ###

import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, islice
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')

N, W = MAP()
w, v = ZIP(N)
max_v = N*sum(v)
dp = [INF]*(max_v+1)
dp[0] = 0
for i in range(N):
	for j in range(max_v-v[i], -1, -1):
		dp[j+v[i]] = min(dp[j+v[i]], dp[j]+w[i])

ans = 0
for i in range(max_v+1):
	if dp[i] <= W:
		ans = i
print(ans)


### FIXED CODE ###

import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, islice
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')

N, W = MAP()
w, v = ZIP(N)
max_v = sum(v)
dp = [INF]*(max_v+1)
dp[0] = 0
for w, v in zip(w, v):
	for i in range(max_v, -1, -1):
		if i-v >= 0:
			dp[i] = min(dp[i], dp[i-v]+w)

ans = 0
for i in range(len(dp)):
	if dp[i] <= W:
		ans = i
print(ans)
### BUGGY CODE ###

import bisect
def main():
    N, Q = map(int, input().split())
    C = list(map(int, input().split()))
    E = []

    D = {i: -1 for i in range(1, N + 1)}
    for i in range(N):
        if D[C[i]] == -1:
            D[C[i]] = i
        else:
            E.append((D[C[i]], i, -1))
            D[C[i]] = i

    for i in range(Q):
        l, r = map(int, input().split())
        E.append((l - 1, r - 1, i))

    def f(tup):
        return tup[0]
    E.sort(key=f, reverse=True)

    ANS = [0] * Q
    y_list = []
    for e in E:
        if e[2] == -1:
            y_list.append(e[1])
            y_list.sort()
        else:
            ans = bisect.bisect_right(y_list, e[1])
            ANS[e[2]] = e[1] - e[0] + 1 - ans

    for i in range(Q):
        print(ANS[i])

if __name__ == '__main__':
    main()

### FIXED CODE ###

from collections import defaultdict
import sys
def read():
    return sys.stdin.readline().rstrip()
def main():
    N, Q = map(int, read().split())
    C = list(map(int, read().split()))
    E = defaultdict(list)

    D = [-1] * (N + 1)
    for i in range(N):
        D_i = D[C[i]]
        if D_i != -1:
            E[D_i].append((D_i, i))
        D[C[i]] = i

    F = defaultdict(list)
    for i in range(Q):
        l, r = map(int, input().split())
        F[l-1].append((r - 1, i))



    # Binary Indexed Tree (Fenwick Tree)
    class BIT:
        def __init__(self, n):
            self.n = n
            self.data = [0] * (n + 1)
            self.el = [0] * (n + 1)

        def sum(self, i):
            s = 0
            while i > 0:
                s += self.data[i]
                i -= i & -i
            return s

        def add(self, i, x):
            # assert i > 0
            self.el[i] += x
            while i <= self.n:
                self.data[i] += x
                i += i & -i

        def get(self, i, j=None):
            if j is None:
                return self.el[i]
            return self.sum(j) - self.sum(i)

    ANS = [0] * Q
    d = BIT(N)
    for x in range(N - 1, -1, -1):
        for e in E[x]:
            d.add(e[1], 1)
        for f in F[x]:
            ANS[f[1]] = f[0] - x + 1 - d.sum(f[0])

    for i in range(Q):
        print(ANS[i])

if __name__ == '__main__':
    main()
### BUGGY CODE ###

import bisect
N = int(input())
D = list(map(int, input().split()))
D.sort()
M = int(input())
T = list(map(int, input().split()))
for i in range(M):
    t = T[i]
    for j in range(N):
        idx = min(bisect.bisect_left(D, t), len(D) - 1)
        d = D[idx]
        if t == d:
            D.pop(idx)
            break
    else:
        print('NO')
        exit()
print('YES')


### FIXED CODE ###

from collections import defaultdict
N = int(input())
D = list(map(int, input().split()))
D_dict = defaultdict(int)
for d in D:
    D_dict[d] += 1
M = int(input())
T = list(map(int, input().split()))
T_dict = defaultdict(int)
for t in T:
    T_dict[t] += 1

for target, t_cnt in T_dict.items():
    d_cnt = D_dict[target]
    if t_cnt > d_cnt:
        print('NO')
        exit()
print('YES')
### BUGGY CODE ###

import heapq
N,M=map(int,input().split())
path=[[float("inf")]*N for i in range(N)]
for _ in range(M):
  l,r,c=map(int,input().split())
  path[l-1][r-1]=c

dist=[float("inf")]*N
dist[0]=0
q=[[dist[i],i] for i in range(N)]
heapq.heapify(q)

while q:
  d,ind=heapq.heappop(q)
  if d<=dist[ind]:
    for i in range(N):
      if ind>=i:p=0
      else:p=path[ind][i]
      if dist[i]>d+p:
        dist[i]=d+p
        heapq.heappush(q,[dist[i],i])

if dist[N-1]==float("inf"):
  print(-1)
else:
  print(dist[N-1])

### FIXED CODE ###

import heapq
N,M=map(int,input().split())
path=[[] for _ in range(N)]
for _ in range(M):
  l,r,c=map(int,input().split())
  path[l-1].append([r,c])
for i in range(1,N):
  path[i].append([i,0])

dist=[float("inf")]*N
dist[0]=0
q=[[dist[i],i] for i in range(N)]
heapq.heapify(q)

while q:
  d,ind=heapq.heappop(q)
  if d<=dist[ind]:
    for i in range(len(path[ind])):
      r,c=path[ind][i]
      if dist[r-1]>d+c:
        dist[r-1]=d+c
        heapq.heappush(q,[dist[r-1],r-1])

if dist[N-1]==float("inf"):
  print(-1)
else:
  print(dist[N-1])
### BUGGY CODE ###

N = int(input())
S = list(input())
S = [int(S[i]) for i in range(N)]
count = 0
for i in range(10):
    for l in range(10):
        for q in range(10):
            t = 0
            for s in range(N):
                if t == 1:
                    break
                if S[s] == i:
                    p = s
                    for r in range(p + 1, N):
                        if t == 1:
                            break
                        if S[r] == l:
                            p = r
                            for b in range(p + 1, N):
                                if t == 1:
                                    break
                                if S[b] == q:
                                    count += 1
                                    t = 1
                                    break
                                elif b == N - 1:
                                    t = 1
                        elif r == N-1:
                            t = 1
                elif s == N - 1:
                    t = 1
print(count)


### FIXED CODE ###

N = int(input())
S = list(input())
S = [int(S[i]) for i in range(N)]
count = 0
for i in range(10):
    for l in range(10):
        for q in range(10):
            t = 0
            for s in range(N):
                if t == 1:
                    break
                if S[s] == i:
                    p = s
                    for r in range(p + 1, N):
                        if t == 1:
                            break
                        if S[r] == l:
                            p = r
                            for b in range(p + 1, N):
                                if t == 1:
                                    break
                                if S[b] == q:
                                    count += 1
                                    t = 1
                                    break
                                elif b == N - 1:
                                    t = 1
                        elif r == N-1:
                            t = 1
                elif s == N - 1:
                    t = 1
print(count)
### BUGGY CODE ###

def main():
    import heapq
    hpop=heapq.heappop
    hpush=heapq.heappush
    n = int(input())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    h = [(-j,i) for i,j in enumerate(b)]
    h2 = []
    h2a=h2.append
    heapq.heapify(h)
    cnt = 0
    while h:
        i, j = hpop(h)
        i=-i
        temp = i-a[j]
        temp2=b[j-1]+b[(j+1)%n]
        sho=temp//temp2
        if  sho==0:
            h2a((i, j))
            continue
        cnt += sho
        b[j] -= temp2*sho
        hpush(h, (-b[j], j))
    h2.sort(key=lambda x: x[1])
    for i in range(n):
        if a[i] != h2[i][0]:
            print(-1)
            return 0
    print(cnt)


main()

### FIXED CODE ###

def main():
    from heapq import heappop as hpop
    from heapq import heappush as hpush
    n = int(input())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    h = []
    for i in range(n):
        hpush(h, (-b[i], i))
    cnt = 0
    while h:
        i, j = hpop(h)
        i = -i
        jj = (j+1) % n
        temp = i-a[j]
        temp2 = b[j-1]+b[jj]
        sho = temp//temp2
        if sho == 0:
            if temp:
                print(-1)
                return 0
            continue
        cnt += sho
        b[j] -= temp2*sho
        hpush(h, (-b[j], j))
    print(cnt)
main()
### BUGGY CODE ###

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

import numpy as np
A = np.array(A, dtype=int)
lenA = len(A)
for i in range(K):
    B = np.zeros(lenA, dtype=int)
#    print(B)
    for j in range(lenA):
        num = A[j]
#        print(j, num)
        B[max(0, j - num): min(lenA, j + num + 1)] += 1
#        print(j, B)
    if np.all(A == B):
#        print('same')
        break
    else:
        A = B
print(' '.join(map(str, A)))

### FIXED CODE ###

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

lenA = len(A)
for i in range(K):
    B = [0 for _ in range(lenA)]
#    print(B)
    for j in range(lenA):
        num = A[j]
#        print(j, num)
        if j - num >= 0:
            B[max(0, j - num)] += 1
        else:
            B[0] += 1
        if j + num + 1 < lenA:
            B[min(lenA, j + num + 1)] -= 1
#        print(j, B)
    for i in range(1, lenA):
        B[i] = B[i-1] + B[i]
    if all([a == b for a, b in zip(A,B)]):
#        print('same')
        break
    else:
        A = B
#print(i+1)
print(' '.join(map(str, A)))
### BUGGY CODE ###

import itertools
import copy

def main():
    N = int(input())
    A = set(list(map(int, input().split())))

    com0 = None
    while True:
        com = list(itertools.combinations(A,2))
        if com0 == com:
            break
        com0 = copy.copy(com)
        for q in com:
            if q[0] != 0 and q[1] != 0:
                if q[0] > q[1]:
                    a1 = q[1]
                    a2 = q[0]
                else:
                    a1 = q[0]
                    a2 = q[1]
                a = a2 % a1
                if a == 1:
                    print(1)
                    return
                elif a == 0:  # a2はa1の倍数
                    if a2 in A:
                        A.remove(a2)
                else:
                    A.add(a)
        #print(A)
    print(min(A))

main()


### FIXED CODE ###

def gcm(a,b):
    while b != 0:
        a, b = b, a % b
    return a

def gcm_list(a):
    ans = a[0]
    l = len(a)
    for i in range(1, l):
        ans = gcm(ans, a[i])
    return ans

N = int(input())
A = list(map(int, input().split()))
print(gcm_list(A))
### BUGGY CODE ###

import math
import fractions
n = int(input())


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

lc = 1

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


for i in range(n):
    lc = lcm(lc,l[i])
ans = 0
for i in range(n):
    ans+=lc//l[i]
    ans%=1000000007
print(ans)


### FIXED CODE ###

import math
import fractions
n = int(input())


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

lc = 1

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


for i in range(n):
    lc = lcm(lc,l[i])
ans = 0
for i in range(n):
    ans+=lc//l[i]

print(ans%1000000007)
### BUGGY CODE ###

import collections

Row = int(input())
List = []
for i in range (Row):
  List.append(input())
c = collections.Counter(List)
tryList = []
k=""
s_l = set(List)
n= len(s_l)
for i in range(n):
  k=s_l.pop()
  if List.count(k) == c.most_common()[0][1]:
    tryList.append(k)
tryList.sort()
for element in tryList:
  print(element)

### FIXED CODE ###

Row = int(input())
dictA= {}
a = ""
mid = 0
for i in range (Row):
  a = input()
  dictA.setdefault(a,0) 
  dictA[a] += 1
  mid = max(mid, dictA[a])
sDict = sorted(dictA.items())
for i in range(len(dictA)):
  if sDict[i][1]== mid:
    print(sDict[i][0])