Harryxun/stf_run huggingface dataset:
from bisect  import bisect_left

n = int(input())
a = list(map(int,input().split()))
a.sort()
b = [2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 
     131072, 262144, 524288, 1048576, 2097152, 4194304, 8388608, 16777216, 33554432, 
     67108864, 134217728, 268435456, 536870912]

t = []
bIdx = 0
for aa in a :
    while b[bIdx] <= aa:
        bIdx += 1   
    t.append(b[bIdx]-aa)
t.sort(reverse=True)


u = [0 for i in range(len(t))]

#print(a)        
#print(t)
sum = 0
for i in range (len(a)-1,-1,-1):
    k = bisect_left(a,t[i])
    #print(t[i],k)
    if a[k] == t[i] and u[k] == 0 and k != i:
        #print(a[i],t[i],i)
        sum += 1
        u[k] += 1
print(sum)

### FIXED CODE ###

from bisect  import bisect_left

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

sum = 0
for i in range (len(a)-1,-1,-1):

    b = 1
    while b <= a[i]:
        b = b<<1
    t = b - a[i]
    #print("2^",t)

    k = bisect_left(a,t)
    if a[k] == t and k < i:
        sum += 1
        a[k] -= 0.1
        a[i] += 0.1
print(sum)
A, B, C = (i.upper for i in input().split())

ans = A[0]+B[0]+C[0]
# ANS = ans.upper()
print(ans)

### FIXED CODE ###

A, B, C = (i for i in input().split())

a = A[0]
b = B[0]
c = C[0]
ans = a+b+c
ANS = ans.upper()
print(ANS)
in_data = input()
 
data = in_data.split(' ')
A = int(data[0])
B = int(data[1])
if B == 1:
  print("0")
else
  c = (B - 1) // A + 1
  print(c)

### FIXED CODE ###

in_data = input()
 
data = in_data.split(' ')
A = int(data[0])
B = int(data[1])
if B == 1:
  print("0")
else:
  c = (B - 1) // (A - 1)
  d = (B - 1) / (A - 1)
  if c < d:
    c = c + 1
  print(c)
x, n = map(int, input().split())
P = list(map(int, input().split()))
P.sort()
notP = [i for i in range(1, 101) if i not in P]

ans = notP[0]
for p in notP:
  delta = abs(x - p)
  if delta<ans:
    ans = p
    
print(ans)

### FIXED CODE ###

x, n = map(int, input().split())

import sys

if n==0:
  print(x)
  sys.exit()
  
P = list(map(int, input().split()))
P.sort()
notP = [i for i in range(0, 102) if i not in P]

ans = notP[0]
min_delta = abs(x - ans)

for p in notP:
  delta = abs(x - p)
  if delta<min_delta:
    ans = p
    min_delta = abs(x - ans)
    
print(ans)
import sys
read = sys.stdin.read
def main():
    n, c = map(int, input().split())
    # cs[0]とcs[-1]はindex error除け。
    cs = [0] * 10001

    for _ in range(n):
        s, t, c = map(int, input().split())
        cs[s] += 1
        cs[t + 1] -= 1
    cur = 0
    r = 0
    for cse in cs:
        cur += cse
        r = max(r, cur)
    print(r)

if __name__ == '__main__':
    main()

### FIXED CODE ###

import sys
read = sys.stdin.read
def main():
    n, c = map(int, input().split())
    d = {e: [0] * (c + 1) for e in range(100001)}
    d1 = [0] * 100001
    m = map(int, read().split())
    stc = zip(m, m, m)
    for s, t, c in stc:
        if d[s][c]:
            d1[s - 1] -= 1
            d1[s] += 1
        else:
            d[s][c] = 1
        if d[t][c]:
            d1[t - 1] -= 1
            d1[t] += 1
        else:
            d[t][c] = 1
        d1[s - 1] += 1
        d1[t] -= 1

    cur = 0
    r = 0
    for i1 in range(100001):
        cur += d1[i1]
        r = max(r, cur)
    print(r)

if __name__ == '__main__':
    main()
import numpy as np
H, W, N, *A = map(int, open('0').read().split())
ls = []
for i in range(N):
  ls += [str(i+1)]*A[i]
ls = np.array(ls)
ls = ls.reshape((H,W))
ls[1::2] = ls[1::2,::-1]
for a in ls:
  print(' '.join(a))

### FIXED CODE ###

import numpy as np
H, W, N, *A = map(int, open(0).read().split())
ls = []
for i in range(N):
  ls += [str(i+1)]*A[i]
ls = np.array(ls)
ls = ls.reshape((H,W))
ls[1::2] = ls[1::2,::-1]
for a in ls:
  print(' '.join(a))
x, a, b = map(int, input().split())
if x < b - a:
  print("dangerous")
elif x == b - a:
  primt("safe")
elif x <= b - a:
  print("delicious")


### FIXED CODE ###

x, a, b = map(int, input().split())
if a >= b:
    print('delicious')
elif a + x >= b:
    print('safe')
else:
    print('dangerous')
#ABC126D-EvenRelation.py

from sys import stdin
from functools import lru_cache

input = stdin.readline

N = int(input())

UVW = []

for i in range(N-1):
    UVW.append(list(map(int, input().split())))

UVW.sort()
print(UVW)

@lru_cache(maxsize=None)
def d(i):
    if i == 1:
        return 0
    else:
        for uvw in UVW:
            if uvw[1] == i:
                return d(uvw[0]) + uvw[2]

for _ in range(N):
    if d(i) % 2 == 0:
        print(0)
    else:
        print(1)


### FIXED CODE ###

#ABC126D-EvenRelation.py

import sys
import collections
import numpy as np

def main():
    N = int(sys.stdin.readline())
    UVW = [[] for _ in range(N)]
    for _ in range(N-1):
        u, v, w = list(map(int, sys.stdin.readline().split()))
        UVW[u-1].append([v,w])
        UVW[v-1].append([u,w])
    answerList = [0] + [-1]*(N-1)
    edge = collections.deque([(1,0)])

    while edge:
        u, w1 = edge.pop()
        for v, w2 in UVW[u-1]:
            if answerList[v-1] == -1:
                answerList[v-1] = (w1 + w2) % 2
                edge.append((v,w1+w2))

    for answer in answerList:
        print(answer)



if __name__ == "__main__":
    main()
N = int(input())
d = list(set([int(input()) for _ in range(N)])
print(len(d))


### FIXED CODE ###

N = int(input())
d = list(set([int(input()) for _ in range(N)]))
print(len(d))
h, w = map(int, input().split())
s = [list(input()) for j in range(h)]
cross = [[0,-1],[-1,0],[1,0],[0,1]] # 上左右下の定義

for j in range(w):
  for i in range(h):
    if s[j][i] == '#' or s[j][i] == 'B':
      if i-1>=0 :
        if s[j][i-1] == '#': s[j][i-1] = 'B'
      if i+1<w :
        if s[j][i+1] == '#': s[j][i+1] = 'B'
      if j-1>=0 :
        if s[j-1][i] == '#': s[j-1][i] = 'B'
      if j+1<h :
        if s[j+1][i] == '#': s[j+1][i] = 'B'

for se in s:
  if '#' in se:
    print('No')
    exit()

print('Yes')

### FIXED CODE ###

h, w = map(int, input().split())
s = [list(input()) for j in range(h)]
ans = 'Yes'
for j in range(h):
  for i in range(w):
    ok = False
    if s[j][i] == '#':
      if j-1>=0:
        if s[j-1][i] == '#': ok = True
      if i-1>=0:
        if s[j][i-1] == '#': ok = True
      if j+1<h:
        if s[j+1][i] == '#': ok = True
      if i+1<w:
        if s[j][i+1] == '#': ok = True
      if ok == False:
        print('No')
        exit()
print(ans)
# -*- coding: utf-8 -*-

import re

def comb(n, k):
        a = [0] * 17
        if (n - k < k):
                k = n - k
        if (k == 0):
                return 1
        if (k == 1):
                return n
        if (k > 17):
                return 0
        for i in range(1, k):
                a[i] = i + 2
        for i in range(3, (n - k + 2)):
                a[0] = i
                for j in range(1, k):
                        a[j] += a[j - 1]
        return a[k - 1]

n = int(raw_input())
a = map(int, re.split("\s", raw_input()))
left = 0
right = 0
mask = 10**9 + 7

for i in range(0, n + 1):
        x = a.index(a[i])
        if a[i] in a[x+1:]:
                left = i
                right = a[x+1:].index(a[i]) + x + 1
                break

for i in range(1, n + 2):
        ans = comb(n + 1, i)
        ans -= comb(left + n - right, i - 1)
        print ans % mask

### FIXED CODE ###

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

from collections import Counter
import re

def pow(a, x):
        y = 1
        p = a % mask
        n = x
        while (n > 0):
                if ((n % 2) == 0):
                        p = (p * p) % mask
                        n /= 2
                else:   
                        y = (y * p) % mask
                        n -= 1
        return y

n = int(raw_input())
a = map(int, re.split("\s", raw_input()))
left = 0
right = 0

mask = 10**9 + 7
invm = 10**9 + 5

com = [1]*(n+2)
inv = [1]*(n+2)

tmp = 1 
for i in range(1, n+2):
        tmp = (tmp * i) % mask
        com[i] = tmp
        inv[i] = pow(tmp, invm) % mask

counter = Counter(a)
dup = counter.most_common(1)[0][0]
left = a.index(dup)
right = a[left+1:].index(dup) + left + 1

for i in range(1, n + 2):
        ans = (com[n + 1] * (inv[i] * inv[n + 1 - i]))

        if ((left + n - right - i + 1) >= 0):
                ans -= (com[left + n - right] * inv[i - 1] * inv[left + n - right - i + 1])
        print ans % mask
A,B=map(int.input(),split())
if A<=9 and B<=9:
  print(A*B)
else:
  print(-1)


### FIXED CODE ###

A,B=map(int,input().split())
if A<=9 and B<=9:
  print(A*B)
else:
  print(-1)
import sys
import math

a = int(sys.argv[1])
b = int(sys.argv[2])
c = int(sys.argv[3])

result = math.sqrt(a) + math.sqrt(b) < math.sqrt(c)
if result:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

import sys

argument = sys.stdin.readline()
args = argument.split()
a = int(args[0])
b = int(args[1])
c = int(args[2])

d = c - a - b

result = (d > 0) and 4 * a * b < d**2
if result:
    print("Yes")
else:
    print("No")
N=int(input())
s=input()
ans = s
flag_A = True
r = 0
l = 0
while flag_A:
    flag_B =False
    for n,i in enumerate(s[:-2]):
        if i =="(" and s[n+1] ==")":
            s = s[:n]+s[n+2:]
            flag_B = True
    if not flag_B:
        flag_A = False
for i in s:
    if i ==")":
        r += 1
    else:
        l += 1
print("("*r+ans+")"*l)

### FIXED CODE ###

N=int(input())
s=input()
ans = s
flag_A = True
r = 0
l = 0
while flag_A:
    flag_B =False
    for n,i in enumerate(s):
        if n != len(s)-1 and i =="(" and s[n+1] ==")":
            s = s[:n]+s[n+2:]
            flag_B = True
            break
    if not flag_B:
        flag_A = False
for i in s:
    if i ==")":
        r += 1
    else:
        l += 1
print("("*r+ans+")"*l)
al = list("abcdefghijklmnopqistuvwxyz")

c = input()

print(al[al.index(c)]

### FIXED CODE ###

al = list("abcdefghijklmnopqistuvwxyz")

c = input()

print(al[al.index(c)+1])
def main():
    n, q = map(int, input().split(' '))
    visit = [0 for _ in range(n)]
    point = [0 for _ in range(n)]
    dic = [[] for _ in range(n)]

    def add_p(num):
        if visit[num] == 1:
            return 0
        visit[num] = 1
        for i in dic[num]:
            if visit[i] == 0:
                point[i] += point[num]
                add_p(i)
        return 0
    for _ in range(n-1):
        a, b = map(int, input().split(' '))
        dic[a-1].append(b-1)
        dic[b-1].append(a-1)
    for _ in range(q):
        p, x = map(int, input().split(' '))
        point[p-1] += x
    add_p(0)
    print(*point)

main()

### FIXED CODE ###

def main():
    n, q = map(int, input().split(' '))
    import sys
    from collections import deque
    sys.setrecursionlimit(10**7)

    visit = [True for _ in range(n)]
    point = [0 for _ in range(n)]
    dic = [[] for _ in range(n)]
    for _ in range(n-1):
        a, b = map(int, input().split(' '))
        dic[a-1].append(b-1)
        dic[b-1].append(a-1)
    for _ in range(q):
        p, x = map(int, input().split(' '))
        point[p-1] += x
    next_visit = deque()
    next_visit.append(0)
    visit[0] = False
    counter = 1
    while counter < n:
        t = next_visit.pop()
        for s in dic[t]:
            if visit[s]:
                point[s] += point[t]
                visit[s] = False
                counter += 1
                next_visit.append(s)
    print(*point)
if __name__ == '__main__':
    main()
N=int(input())
S = []
for j in range(N):
    S.append(input())
from collections import Counter
S2=collections.Counter(S)
S1=S2.most_common()

S3=[]
S3.append(S1[0][0])
for i in range(1,len(S1)):
    if S1[i][1]==S1[0][1]:
        S3.append(S1[i][0])
    else:
        break
S3=sorted(S3)
for i in range(0, len(S3)):
    print(S3[i])

### FIXED CODE ###

N=int(input())
S = []
for j in range(N):
    S.append(input())
import collections
S2=collections.Counter(S)
S1=S2.most_common()

S3=[]
S3.append(S1[0][0])
for i in range(1,len(S1)):
    if S1[i][1]==S1[0][1]:
        S3.append(S1[i][0])
    else:
        break
S3=sorted(S3)
for i in range(0, len(S3)):
    print(S3[i])
from itertools import accumulate
N, K = map(int, input().split())
P = [i-1 for i in map(int, input().split())]
C = list(map(int, input().split()))

seen = [0] * N

ans = -10**20

for i in range(N):
    if not seen[i]:
        seen[i] = 1
        loop = [C[i]]
        while True:
            i = P[i]
            if seen[i]:
                break
            seen[i] = 1
            loop.append(C[i])
        L = len(loop)
        loop = loop + loop
        loop = [0] + list(accumulate(loop))
        if loop[L] <= 0:
            move = min(L, K)
            for i in range(L):
                for j in range(1, move + 1):
                    ans = max(ans, loop[i + j] - loop[i])
        else:
            if K > L:
                continue
                div, mod = divmod(K, L)
                tmp = div * loop[L]
                move = min(mod, L)
                if move:
                    for i in range(L):
                        for j in range(1, move + 1):
                            ans = max(ans, tmp + loop[i + j] - loop[i])
                else:
                    ans = max(ans, tmp)
                tmp = (div - 1) * loop[L]
                move = L
                for i in range(L):
                    for j in range(1, move + 1):
                        ans = max(ans, tmp + loop[i + j] - loop[i])
            else:
                move = K
                for i in range(L):
                    for j in range(1, move + 1):
                        ans = max(ans, tmp + loop[i + j] - loop[i])

print(ans)

### FIXED CODE ###

from itertools import accumulate
N, K = map(int, input().split())
P = [i-1 for i in map(int, input().split())]
C = list(map(int, input().split()))

seen = [0] * N

ans = -10**20

for i in range(N):
    if not seen[i]:
        seen[i] = 1
        loop = [C[i]]
        while True:
            i = P[i]
            if seen[i]:
                break
            seen[i] = 1
            loop.append(C[i])
        L = len(loop)
        loop = loop + loop
        loop = [0] + list(accumulate(loop))
        if loop[L] <= 0:
            move = min(L, K)
            for i in range(L):
                for j in range(1, move + 1):
                    ans = max(ans, loop[i + j] - loop[i])
        else:
            if K > L:
                div, mod = divmod(K, L)
                tmp = div * loop[L]
                move = min(mod, L)
                if move:
                    for i in range(L):
                        for j in range(1, move + 1):
                            ans = max(ans, tmp + loop[i + j] - loop[i])
                else:
                    ans = max(ans, tmp)
                tmp = (div - 1) * loop[L]
                move = L
                for i in range(L):
                    for j in range(1, move + 1):
                        ans = max(ans, tmp + loop[i + j] - loop[i])
            else:
                move = K
                for i in range(L):
                    for j in range(1, move + 1):
                        ans = max(ans, loop[i + j] - loop[i])

print(ans)
s1, s2, s3 = map(int, input().split())

list = [s1, s2, s3]
ball = 0

for item in list:
    if item == 1:
        ball += 1

print(ball)

### FIXED CODE ###

s = list(input())
print(s.count('1'))
print(a)

### FIXED CODE ###

S = input()
K = int(input())
n = len(S)

if len(set(S)) == 1:
    print(n * K // 2)
    exit()

SS = S[:] + S[:]
S = list(S)
SS = list(SS)
ans0 = 0
ans1 = 0

c = 0
cnt = 1
for i in range(1, n):
    if S[i - 1] == S[i]:
        cnt += 1
        if i == n-1:
            c += cnt // 2
    else:
        if cnt >= 2:
            c += cnt // 2
        cnt = 1
ans0 = c
c = 0
cnt = 1
m = len(SS)
for i in range(1, m):
    if SS[i - 1] == SS[i]:
        cnt += 1
        if i == m - 1:
            c += cnt // 2
    else:
        if cnt >= 2:
            c += cnt // 2
        cnt = 1

ans1 = c


num = ans1 - ans0
print(ans0 + (K-1) * num)
a = int(input())
b = [input() for i in range(a)]
c = int(input())
d = [input() for j in range(c)]
g = [0]*a
for k in b:
    e = b.count(k)
    f = d.count(k)
    g[k] = e - f
print(max(g))

### FIXED CODE ###

a = int(input())
b = [input() for i in range(a)]
c = int(input())
d = [input() for j in range(c)]
g = [0]*a
t = 0
for k in b:
    e = b.count(k)
    f = d.count(k)
    g[t] = e - f
    t +=1
if max(g) < 0:
    print(0)
else:
    print(max(g))
A = (int, input().split())

if sum(A) < 22:
  print('win')
  exit()

print('bust')

### FIXED CODE ###

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

if sum(A) < 22:
  print('win')
  exit()

print('bust')
n,m=map(int,input().split())
sa={}
sb={}
for _ in range(m):
  a,b=map(int,input().split())
  if a==1:
    sa.add(b)
  if b==n:
    ab.add(a)
print("INPOSSIBLE" if len(sa&sb)==0 else "POSSIBLE") 

### FIXED CODE ###

n,m=map(int,input().split())
sa=set()
sb=set()
for _ in range(m):
  a,b=map(int,input().split())
  if a==1:
    sa.add(b)
  if b==n:
    sb.add(a)
print("IMPOSSIBLE" if len(sa&sb)==0 else "POSSIBLE")
S = input()

if S == "Sunny":
	print("Cloudy")
elif S == "Cloudy":
	  print("Rainy")
else S == "Rainy":
	  print("Sunny")

### FIXED CODE ###

S = input()

if S == "Sunny":
    print("Cloudy")
elif S == "Cloudy":
	print("Rainy")
else:
	print("Sunny")
from collections import deque
n, m = map(int, input().split())
li = [list(map(int, input().split())) for _ in range(m)]

ans = [deque([]) for _ in range(10)]
ans2 = [[] for _ in range(10)]
for i in range(m):
    s = li[i][0]
    t = li[i][1]

    ans[s].append(t)
    ans[t].append(s)
print(ans)

stack = deque([1])
while stack:
    v = stack[0]

    if ans[v]:
        w = ans[v].popleft()
        if ans2[w] == []:
            ans2[w].append(v)
        stack.append(w)
    else:
        stack.popleft()

print('Yes')
for i in range(2, m+1):
    print(ans2[i][0])

### FIXED CODE ###

from collections import deque
n, m = map(int, input().split())
li = [list(map(int, input().split())) for _ in range(m)]

ans = [deque([]) for _ in range(m+10)]
ans2 = [[] for _ in range(m+10)]
for i in range(m):
    s = li[i][0]
    t = li[i][1]

    ans[s].append(t)
    ans[t].append(s)

stack = deque([1])
while stack:
    v = stack[0]

    if ans[v]:
        w = ans[v].popleft()
        if True:
            ans2[w].append(v)
        stack.append(w)
    else:
        stack.popleft()

print('Yes')
for i in range(2, n+1):
    print(ans2[i][0])
import math as M
def R(A): return (A[0]**2+A[1]**2)**.5
def I(i): return [map(int,raw_input().split()) for _ in [0]*i]
def C(a,b): return a>b or abs(a-b)<1e-6
def f(e1):
  tx,ty,sx,sy=e1
  x=[]
  for e2 in WP:
    wx,wy,r=e2
    wt=[tx-wx,ty-wy]; rwt=R(wt)
    sw=[wx-sx,wy-sy]; rsw=R(sw)
    st=[tx-sx,ty-sy]; rst=R(st)
    F=[rwt<r,rsw<r]
    if rst==0: c=1
    elif F==[1,1]: c=1
    elif F==[1,0] or F==[0,1]: c=0
    elif F==[0,0]:
      a=M.pi/2-M.acos(r/rsw)
      b=M.acos((sw[0]*st[0]+sw[1]*st[1])/rsw/rst)
      if C(a,b) and C(rst**2,rsw**2-r**2): c=0
      else: c=1
    x.append(c)
  return all(x)

while 1:
  n=input()
  if n==0: break
  WP=I(n)
  P=I(input())
  for e in P: print ["Safe","Danger"][f(e)]

### FIXED CODE ###

import math as M
def R(A): return (A[0]**2+A[1]**2)**.5
def I(i): return [map(int,raw_input().split()) for _ in [0]*i]
def C(a,b): return a>b or abs(a-b)<1e-6
def f(e1):
  tx,ty,sx,sy=e1
  x=[]
  st=[tx-sx,ty-sy]; rst=R(st)
  for e2 in WP:
    wx,wy,r=e2
    wt=[tx-wx,ty-wy]; rwt=R(wt)
    sw=[wx-sx,wy-sy]; rsw=R(sw)
    F=[rwt<r,rsw<r]
    if F==[1,0] or F==[0,1]: return 0
    elif F==[0,0]:
      a=M.pi/2-M.acos(r/rsw)
      b=M.acos(round((sw[0]*st[0]+sw[1]*st[1])/rsw/rst,4))
      if C(a,b) and C(rst**2,rsw**2-r**2): return 0
  return 1

while 1:
  n=input()
  if n==0: break
  WP=I(n)
  P=I(input())
  for e in P: print ["Safe","Danger"][f(e)]
n = int(input())
k = int(input())

total = 0
for _ in range(n):
  x = int(input())
  total += min(x, k - x)

print(2 * total)

### FIXED CODE ###

input()
k = int(input())
  
total = sum(min(int(tok), k - int(tok)) for tok in input().split())
print(2 * total)
def ceil(x,y):
    if x%y==0:
        return x//y
    return x//y+1
n,h=map(int,input().split())
ab=[list(map(int,input().split())) for i in range(n)]
ab.sort(reverse=True)
max_a=ab[0][0]
ab.sort(key=lambda x:x[1],reverse=True)
c=0
for i in range(n):
    if ab[i][1]>max_a and ab[i][0]!=max_a:
        c+=1
        h-=ab[i][1]
    if h<=0:
        break
if max_a <ab[0][1] and h>0:
   c+=1
   h-=ab[0][1]
c+=ceil(h,max_a) if h>0 else 0
print(c)

### FIXED CODE ###

def comb(n,y):
    for i in range(n+1):
        for j in range(n+1-i):
            if 10000*i+5000*j+1000*(n-i-j)==y:
                return [i,j,n-i-j]
    return [-1,-1,-1]

n,y=map(int,input().split())
print("{} {} {}".format(*comb(n,y)))
ans = list("keyence")

S = input()
for i in range(len(S)):
  if S[i] == ans[0]:
    ans.pop(0)

if len(ans) == 0:
  print("YES")
else:
  print("NO")

### FIXED CODE ###

ans = "keyence"

s = input()
flag=0
if ans in s:
  flag=1
  print("YES")
else:
  for i in range(1,len(ans)):
    if s[:i] == ans[:i] and s[i-len(ans):] == ans[i-len(ans):]:
      flag=1
      print("YES")
      break
if flag==0:
  print("NO")
import math
from functools import reduce
import numpy as np

def gcd(*numbers):
    return reduce(math.gcd, numbers)

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

ans = 0
for i in range(N) :
    B = A[np.arange(len(A))!=i]
    g = gcd(*B)
    if g > ans :
        ans = g
print(ans)





### FIXED CODE ###

import fractions # for python 3.4.3

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

gcd_l = [0]
gcd_r = [0]
for i in range(N):
    gcd_l.append(fractions.gcd(gcd_l[i], A[i]))
    gcd_r.append(fractions.gcd(gcd_r[i], A[-(i+1)]))
    #print(gcd_l)
    #print(gcd_r)
gcd_r = gcd_r[::-1]

ans = []
for i in range(N):
    ans.append(fractions.gcd(gcd_l[i], gcd_r[i+1]))

print(max(ans))
def collatz(a):
    if a%2 == 0:
        return int(a/2)
    else:
        return int(a*3+1)

x = [int(input())]

for i in range(1, 1000001):
    a = collatz(x[i-1])
    if a in x:
        print(i+1)
    else:
        x.append(a)


### FIXED CODE ###

def collatz(a):
    if a%2 == 0:
        return int(a/2)
    else:
        return int(a*3+1)

x = []
n = int(input())
x.append(n)
test = n

for i in range(1, 1000001):
    a = collatz(test)
    if a in x:
        print(i+1)
        exit()
    else:
        x.append(a)
        test = a
N,M=map(int,input().split())
S,r,s=input(),[],N-M
for _ in range(2*N):
    if S[s]=='1':
        s += 1
    else:
        r.append(str(N-s))
        N,s=s,max(0,s-M)
    if N == 0:
        break
print(*[-1] if s else r[::-1])

### FIXED CODE ###

from collections import deque
INF = 10**18

def append_dq(i, x, dq, dp1):
    while True:
        if not len(dq):
            dq.append(i)
            break
        lxi = dq[-1]
        if x > dp1[lxi]:
            dq.append(i)
            break
        dq.pop()
    return dq
dq = deque()
N,M = map(int, input().split())
S = input().strip()
dp1 = [0] + [INF]*N
dp2 = [-1 for _ in range(N+1)]
dq.append(0)
for i, c in enumerate(S[1:]):
    i+=1
    dq = append_dq(i, dp1[i], dq, dp1)
    idx = dq[0]
    if c != "1" and dp1[idx] != INF:
        dp1[i] = dp1[idx] + 1
        dp2[i] = idx
    if i >= M:
        sxi = dq[0]
        if sxi == (i - M):
            dq.popleft()
if dp1[-1] == INF:
    print(-1)
else:
    r = []
    s = N
    while True:
        if s == 0:
            break
        ns = dp2[s]
        r.append(s-ns)
        s = ns
    print(" ".join(map(str, r[::-1])))
a,b,c,d=map(int,input().split())
n=1
while c-b*n>0 and a-d*n>0:
    n+=1
if c-b*(n+1)<=a-d*(n+1):
    print('Yes')
else:
    print('No')

### FIXED CODE ###

s,w=map(int,input().split())
print('unsafe' if w>=s else 'safe')
# D - ModSum
import numpy as np
N = int(input())

if N > 1:
    N_1 = np.array(list(range(1, N+1)))
    P_1 = np.array(list(range(2, N+1)))
    P_1 = np.append(P_1, 1)

    ans = sum(N_1 % P_1)
    print(ans)
else:
    print(0)

### FIXED CODE ###

# D - ModSum
N = int(input())

ans = (N*(N-1))//2
print(int(ans))
s = input().split()
t = input().split()
count = 0

for i in range (0,3):
    if s[i] == t[i]:
        count = count + 1
print (count)      

### FIXED CODE ###

s = list(input())
t = list(input())
count = 0

for i in range (0,3):
    if s[i] == t[i]:
        count = count + 1
print (count)