Harryxun/stf_run huggingface dataset:
import math

def get_sieve_of_eratosthenes(n):
    if not isinstance(n, int):
        raise TypeError('n is int type.')
    if n < 2:
        raise ValueError('n is more than 2')
    prime = []
    limit = math.sqrt(n)
    data = [i + 1 for i in range(1, n)]
    while True:
        p = data[0]
        if limit <= p:
            return prime + data
        prime.append(p)
        data = [e for e in data if e % p != 0]

n = int(input())
a = list(map(int,input().split()))
maxval = max(a)
p = get_sieve_of_eratosthenes(maxval)
d = [-1]*1000010
m = [-1]*1000010
flag = True


for i in p:
  tmp = i
  multi = 2
  while(tmp<=maxval):
    d[tmp] = i
    tmp = tmp*multi
    multi += 1
    
for i in a:
  while(d[i]!=i):
    if(m[d[i]]==1):
      flag = False
      break
    m[d[i]] = 1
    i = i // d[i]
  m[d[i]] = 1
  if(flag == False):
    break
  
if(flag):
  print("pairwise coprime")
else:
  ans = a[0]
  for i in range(1, n):
    ans = math.gcd(ans, a[i])
  if ans==1:
    print("setwise coprime")
  else:
    print("not coprime")

### FIXED CODE ###

import sys, math
input= sys.stdin.readline

N = int(input())
A_lst = list(map(int, input().split()))
lst=[0]*(10**6+1)

# 割れる最大の素数を出す
for i in range(2, 10**6+1):
  if not lst[i]:
    for j in range(i, 10**6+1, i):
      lst[j] = i
      
# not coprimeか判定する
ans = 'not coprime'
GCD = A_lst[0]
for i in range(N):
  GCD = math.gcd(GCD, A_lst[i])
  
if GCD != 1:
  print(ans)
else:
  ans = 'setwise coprime'
  post = 1
  visited = [0]*(10**6+1)
  for i in range(N):
    a = A_lst[i]
    while a > 1:
      dv = lst[a]
      if visited[dv]:
        post = 0
        break
      while a % dv == 0:
        a //= dv
      visited[dv] = 1
  
  if post:
    ans = 'pairwise coprime'
  print(ans)
N, D = map(int, input().split())

X = [0] * N
Y = [0] * N

for i in range(N):
    X[i], Y[i] = map(int, input.split())

count = 0

for i in range(N):
    if(D**2 >= X[i]**2 + Y[i]**2):
        count += 1

print(count)




### FIXED CODE ###

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

X = [0] * N
Y = [0] * N

for i in range(N):
    X[i], Y[i] = map(int, input().split())

count = 0

for i in range(N):
    if(D**2 >= X[i]**2 + Y[i]**2):
        count += 1

print(count)
from collections import deque

N, K = map(int, input().split())
d = list(map(int, input().split()))
left = [0]
left_m = [0]
right = [0]
right_m = [0]
for i, l, r in zip(range(K), d, d[::-1]):
    left.append(left[i] + l)
    left_m.append(l if l < 0 else 0)
    right.append(right[i] + r)
    right_m.append(r if r < 0 else 0)
point = 0
for i in range(K + 1):
    for j in range(K + 1 - i):
        minus = list(sorted(left_m[:i + 1] + right_m[:j + 1]))
        point = max(point, left[i] + right[j] - sum(minus[:K - i - j]))
print(point)

### FIXED CODE ###

N, K = map(int, input().split())
d = list(map(int, input().split()))
left = [0]
left_m = []
right = [0]
right_m = []
for i, l, r in zip(range(K), d, d[::-1]):
    left.append(left[i] + l)
    left_m.append(l if l < 0 else 0)
    right.append(right[i] + r)
    right_m.append(r if r < 0 else 0)
point = 0
m = min(N, K)
for i in range(m + 1):
    for j in range(m - i + 1):
        p = K - i - j
        minus = list(sorted(left_m[:i] + right_m[:j]))
        point = max(point, left[i] + right[j] - sum(minus[:p]))
print(point)
import math
import decimal
decimal.getcontext().prec = 6
a, b, c = map(int, input().split())
a = decimal.Decimal(a)
b = decimal.Decimal(b)
c = decimal.Decimal(c)
d = decimal.Decimal(math.sqrt(a*b))
if a + 2 * d +b - c < 1e-20:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

k = int(input())
a = [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(a[k-1])
S=input()

h = S//3600
S = S%3600

m = S//60
s = S%60

print(':'.join(map(str,[h, m, s])))

### FIXED CODE ###

S=int(input())

h = S//3600
S = S%3600

m = S//60
s = S%60

print(h,m,s,sep=":")
n, m = map(int, input().split())
a = [-1]*n
b = []
for i in range(m):
    x, y, z = map(int, input().split())
    if a[x-1] != -1:
        if a[y-1] != -1:
            if a[x-1] != a[y-1]:
                b[a[x-1]] |= b[a[y-1]]
                for j in b[a[y-1]]:
                    a[j] = a[x-1]
                b.pop(a[y-1])
        else:
            b[a[x-1]].add(y-1)
            a[y-1] = a[x-1]
    else:
        if a[y-1] != -1:
            b[a[y-1]].add(x-1)
            a[x-1] = a[y-1]
        else:
            b.append({x-1, y-1})
            a[x-1] = a[y-1] = len(b) - 1
print(len(b)+a.count(-1))

### FIXED CODE ###

class UnionFind:
    def __init__(self, n):
        self.par = [i for i in range(n)]
        self.rank = [0]*n

    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        if self.rank[x] < self.rank[y]:
            self.par[x] = y
        else:
            self.par[y] = x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1

    def same(self, x, y):
        return self.find(x) == self.find(y)

n, m = map(int, input().split())
uf = UnionFind(n)
for i in range(m):
    x, y, z = map(int, input().split())
    uf.unite(x-1, y-1)
print(len(set(uf.find(i) for i in range(n))))
import math

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

rev = 10**9+7

if n-m==0:
    ans = 2 * math.factorial(n) * math.factorial(m)
elif (abs(n-m)==1):
    ans = 1 * math.factorial(n) : math.factorial(m)
else:
    ans = 0
print(ans%rev)


### FIXED CODE ###

import math

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

rev = 10**9+7

if n-m==0:
    ans = 2 * math.factorial(n) * math.factorial(m)
elif (abs(n-m)==1):
    ans = 1 * math.factorial(n) * math.factorial(m)
else:
    ans = 0
print(ans%rev)
h,w = map(int,input().split())
li  = list(list(input()) for i in range(h))
sc  = [[0]*w for j in range(h)]
ans = 0

def chk_l(y,x,score):
  if x==0:
    return score
  
  if li[y][x-1]=='.':
    score += 1
    return chk_l(y,x-1,score)
  else:
    return score

def chk_r(y,x,w,score):
  if x==w-1:
    return score

  if li[y][x+1]=='.':
    score += 1
    return chk_r(y,x+1,w,score)
  else:
    return score

def chk_t(y,x,score):
  if y==0:
    return score
  
  if li[y-1][x]=='.':
    score += 1
    return chk_t(y-1,x,score)
  else:
    return score

def chk_b(y,x,h,score):
  if y==h-1:
    return score
  
  if li[y+1][x]=='.':
    score += 1
    return chk_b(y+1,x,h,score)
  else:
    return score

for y in range(h):
  for x in range(w):
    if li[y][x]=='#':
      continue
    score = 1
    score = chk_l(y,x,score)
    score = chk_r(y,x,w,score)
    score = chk_t(y,x,score)
    score = chk_b(y,x,h,score)
    sc[y][x] = score

for y in range(h):
  for x in range(w):
    ans = max(ans,sc[y][x])

print(ans)

### FIXED CODE ###

# import itertools
# import pprint
# import copy
# from collections import deque

h,w   = map(int,input().split())
mp    = list(list(input()) for i in range(h))
scx   = [[0 for _ in range(w)] for _ in range(h)]
scy   = [[0 for _ in range(w)] for _ in range(h)]
donex = [[0 for _ in range(w)] for _ in range(h)]
doney = [[0 for _ in range(w)] for _ in range(h)]
sc    = 0
ans   = 0

for y in range(h):
  for x in range(w):
    if mp[y][x]=='#':
      scx[y][x]==0
    elif donex[y][x]==1:
      continue
    else:
      l = 1
      while(x+l<w):
        if mp[y][x+l]=='#':
          break
        l += 1
      for i in range(l):
        scx[y][x+i] = l
        donex[y][x+i] = 1

for y in range(h):
  for x in range(w):
    if mp[y][x]=='#':
      scy[y][x]==0
    elif doney[y][x]==1:
      continue
    else:
      l = 1
      while(y+l<h):
        if mp[y+l][x]=='#':
          break
        l += 1
      for i in range(l):
        scy[y+i][x] = l
        doney[y+i][x] = 1

for y in range(h):
  for x in range(w):
    ans = max(ans, (scy[y][x] + scx[y][x] - 1))

print(ans)
n = input()
if(n % 9 == 0): print("Yes")
else : print("No")


### FIXED CODE ###

n = int(input())
if n % 9 == 0:
    print("Yes")
else:
    print("No")
# -*- Coding: utf-8 -*-

a, b, c = map(int, input().split())
candy = [a, b, c]
if max(candy) == sum(candy) - max(candy):
    print("YES")
else:
    Print("NO")


### FIXED CODE ###

[a,b,c]=list(map(int,input().split()))
if a+b==c or a+c==b or b+c==a :
    print("Yes")
else:
    print("No")
import math
n = int(input())
a_list = list(map(int, input().split()))
num = a_list[0]

for i in range(n):
    num = math.gcd(num, a_list[i])
print(num)

### FIXED CODE ###

import fractions
n = int(input())
a_list = list(map(int, input().split()))
num = a_list[0]

for i in range(n):
    num = fractions.gcd(num, a_list[i])
print(num)
N, M = map(int, input().split())

students = []
for i in range(N):
    students.append(input().split())

checkpoints = []
for i in range(M):
    checkpoints.append(input().split())

for x1, y1 in students:
    result = 10**8
    index = 1
    for x2, y2 in checkpoints:
        val = abs(int(x1) - int(x2)) + abs(int(y1) - int(y2))
        if result > val:
            ans = index
            result = val
        index += 1
    print(ans)

### FIXED CODE ###

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

students = []
for i in range(N):
    students.append(input().split())

checkpoints = []
for i in range(M):
    checkpoints.append(input().split())

for x1, y1 in students:
    result = 99999999999
    index = 1
    for x2, y2 in checkpoints:
        val = abs(int(x1) - int(x2)) + abs(int(y1) - int(y2))
        if result > val:
            ans = index
            result = val
        index += 1
    print(ans)
N, M = map(int, input().split())
G = [[] for i in range(N)]
for i in range(M):
    l, r, d = map(int, input().split())
    l, r = l - 1, r - 1
    G[l].append((r, d))
    G[r].append((l, -d))
used = [False] * N
dist = [0] * N
flag = False


def dfs(v, d0):
    global flag
    if used[v]:
        if dist[v] != d0:
            flag = True
            return
    else:
        used[v] = True
        dist[v] = d0

        for w, d1 in G[v]:
            dfs(w, d0 + d1)


for i in range(N):
    if not used[i]:
        dfs(i, 0)

if flag:
    print("No")
else:
    print("Yes")



### FIXED CODE ###

import sys
sys.setrecursionlimit(200002)
N, M = map(int, input().split())
G = [[] for i in range(N)]
for i in range(M):
    l, r, q = map(int, input().split())
    G[l - 1].append((r - 1, q))
    G[r - 1].append((l - 1, -q))
X = [None] * N


def dfs(u):
    global X, G
    for w, d in G[u]:
        if X[w] is None:
            X[w] = X[u] + d
            if not dfs(w):
                return False
        else:
            if X[w] != X[u] + d:
                return False

    return True


flag = True
for i in range(N):
    if X[i] is None:
        X[i] = 0
        flag &= dfs(i)

if flag:
    print("Yes")
else:
    print("No")
# -*- coding: utf-8 -*-


if __name__ == '__main__':

    n, m = [int(s) for s in input().split()]
    E = [set() for _ in range(n)]
    for _ in range(m):
        s, t = [int(s) for s in input().split(" ")]
        E[s].add(t)
        E[t].add(s)

    def dfs(current, prev):
        global timer
        prenum[current] = timer
        lowest[current] = prenum[current]
        timer += 1

        visited[current] = 1

        for v in E[current]:
            if visited[v] == 0:
                parent[v] = current
                dfs(v, current)
                lowest[current] = min(lowest[current], lowest[v])
            elif v != prev:  # current -> v is back-edge
                lowest[current] = min(lowest[current], prenum[v])

    prenum = [None] * n
    parent = [None] * n
    lowest = [float("inf")] * n
    timer = 1
    visited = [0] * n

    dfs(0, -1)

    ap = []
    np = 0
    for i in range(1, n):
        p = parent[i]
        if p == 0:
            np += 1
        elif prenum[p] <= lowest[i]:
            ap.append(p)

    if np > 1:
        ap.append(0)

    ap = list(set(ap))
    ap.sort()
    if ap:
        print("\n".join(map(str, ap)))



### FIXED CODE ###

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

import sys
sys.setrecursionlimit(200000)


if __name__ == '__main__':

    n, m = [int(s) for s in input().split()]
    E = [set() for _ in range(n)]
    for _ in range(m):
        s, t = [int(s) for s in input().split(" ")]
        E[s].add(t)
        E[t].add(s)

    def dfs(current, prev):
        global timer
        prenum[current] = timer
        lowest[current] = prenum[current]
        timer += 1

        visited[current] = 1

        for v in E[current]:
            if visited[v] == 0:
                parent[v] = current
                dfs(v, current)
                lowest[current] = min(lowest[current], lowest[v])
            elif v != prev:  # current -> v is back-edge
                lowest[current] = min(lowest[current], prenum[v])

    prenum = [None] * n
    parent = [None] * n
    lowest = [float("inf")] * n
    timer = 1
    visited = [0] * n

    dfs(0, -1)

    ap = []
    np = 0
    for i in range(1, n):
        p = parent[i]
        if p == 0:
            np += 1
        elif prenum[p] <= lowest[i]:
            ap.append(p)

    if np > 1:
        ap.append(0)

    ap = list(set(ap))
    ap.sort()
    if ap:
        print("\n".join(map(str, ap)))
n = int(input())
s = []
zyogen = []
kagen = []
for i in range(n):
    k, z = map(int, input().split())
    kagen.append(k)
    zyogen.append(z)

kk = sorted(k)
zz = sorted(z)
if(n % 2 == 0):
    aa = n // 2
    x = kk[aa-1] + kk[a]
    y = zz[aa-1] ++ + zz[a]
    print(y-x+1)
else:
    aa = n // 2
    x = kk[aa]
    y = zz[aa]
    print(y-x+1)
    

### FIXED CODE ###

n = int(input())
s = []
zyogen = []
kagen = []
for i in range(n):
    k, z = map(int, input().split())
    kagen.append(k)
    zyogen.append(z)

kk = sorted(kagen)
zz = sorted(zyogen)
if(n % 2 == 0):
    aa = n // 2
    x = kk[aa-1] + kk[aa]
    y = zz[aa-1] + zz[aa]
    print(y-x+1)
else:
    aa = n // 2
    x = kk[aa]
    y = zz[aa]
    print(y-x+1)
q=input()
x=[int(i) for i in input().split()]
cnt=input()
j=0
y=[int(i) for i in input().split()]
x=x.sort()
y=y.sort()

for k in range(len(y)) :
    for i in range(len(x)) :
        if x[i] == y[k] :
            del x[i]
            break
        if i+1 == len(x) :
            print('NO')
            j=1
if j==0 :
    print('OK')
    

### FIXED CODE ###


q=input()
x=[int(i) for i in input().split()]
cnt=input()
y=[int(i) for i in input().split()]

if max(x) >= max(y):
    MAX=max(x)
else:
    MAX=max(y)

dic = {}

for k in x :
    if k in dic.keys() :
        dic[k] += 1
    else :
        dic[k] = 1
    
for i in y :
    if i in dic.keys() :
        dic[i] -= 1
        if dic[i] == -1 :
            print('NO')
            exit()
    else :
        print('NO')
        exit()
print('YES')
import math

N,X=map(int,input().split(" "))
xl=list(map(int,input().split(" ")))
xl.append(X)
xl=sorted(xl)

xy=[xl[i+1]-xl[i] for i in range(len(xl)-1)]

ans=max(xy)
for i in range(len(xy)):
    ans=math.gcd(ans,xy[i])

print(ans)

### FIXED CODE ###

def gcd(a, b):
	while b:
		a, b = b, a % b
	return a


N,X=map(int,input().split(" "))
xl=list(map(int,input().split(" ")))
xl.append(X)
xl=sorted(xl)

xx=[xl[i+1]-xl[i] for i in range(len(xl)-1)]

ans=max(xx)
for i in range(len(xx)):
    ans=gcd(ans,xx[i])

print(ans)
N, Ma, Mb = map(int, input().split())

items = []
mas = []
mbs = []
costs = []
for i in range(N):
  ma, mb, c = map(int, input().split())
  mas.append(ma)
  mbs.append(mb)
  costs.append(c)

max_cost = 5000
dp = [[[max_cost for k in range(410)] for j in range(410)] for i in range(41)]

for i in range(N):
  for j in range(400):
    for k in range(400):
      if dp[i][j][k] == max_cost:
        continue
      if dp[i][j][k] > dp[i+1][j][k]:
        dp[i][j][k] = dp[i+1][j][k]
      if dp[i+1][j+mas[i]][k+mbs[i]] > dp[i][j][k] + costs[i]:
        dp[i+1][j+mas[i]][k+mbs[i]] = dp[i][j][k] + costs[i]
        
min_cost = 1000000000000000000
for (int wa = 1; wa < 400; ++wa) :
  for (int wb = 1; wb < 400; ++wb) :
    if (wa * mb != wb * ma):
      continue;
      if min_cost > dp[N][wa][wb]:
        min_cost = dp[N][wa][wb]

  
if min_cost == 1000000000000000000:
  print("-1")
else:
  print(min_cost)

### FIXED CODE ###

N, Ma, Mb = map(int, input().split())

items = []
mas = []
mbs = []
costs = []
for i in range(N):
  ma, mb, c = map(int, input().split())
  mas.append(ma)
  mbs.append(mb)
  costs.append(c)

max_cost = 5000
dp = [[[max_cost for k in range((N+1)*10)] for j in range((N+1)*10)] for i in range(N+1)]
dp[0][0][0] = 0

for i in range(N):
  for j in range(N*10):
    for k in range(N*10):
      if dp[i][j][k] == max_cost:
        continue
      if dp[i+1][j][k] > dp[i][j][k]:
        dp[i+1][j][k] = dp[i][j][k]
      if dp[i+1][j+mas[i]][k+mbs[i]] > dp[i][j][k] + costs[i]:
        dp[i+1][j+mas[i]][k+mbs[i]] = dp[i][j][k] + costs[i]
        
min_cost = max_cost
for wa in range(1, N*10):
  for wb in range(1, N*10):
    if (wa * Mb != wb * Ma):
      continue;
    if min_cost > dp[N][wa][wb]:
      min_cost = dp[N][wa][wb]

  
if min_cost == max_cost:
  print("-1")
else:
  print(min_cost)
print(input().count(1))

### FIXED CODE ###

S = input()

count = 0

for s in S:
  if s == "1":
    count += 1

print(count)
if N%K == 0:
   print("0")

#最小値を求める上では余りが割る数を下回るまで続く
elif abs(N%K- K)<N:
     print(abs(N%K- K))
 
else:
     print(N[0])

### FIXED CODE ###

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

if N%K == 0:
    print("0")
elif abs(N%K- K)<N:
    print(abs(N%K- K))
else:
     print(N)
a = input()
b = input()
print(a*b)

### FIXED CODE ###

a,b = map(int, input().split())
print(a*b)
S=input()
if S.count("hi")*2==len(s):
  print("Yes")
else:
  print("No")

### FIXED CODE ###

S=input()
if S.count("hi")*2==len(S):
  print("Yes")
else:
  print("No")
N = int(input())
factor_a = []
factor_b = []
ans = N
if N % 2 == 0:
    for a in range(1, N/2+1):
        sum_a = sum([int(i) for i in str(a)])
        sum_b = sum([int(i) for i in str(N-a)])
        if sum_a + sum_b < ans:
            ans = sum_a + sum_b
else:
    for a in range(1, (N+1)/2+1):
        sum_a = sum([int(i) for i in str(a)])
        sum_b = sum([int(i) for i in str(N-a)])
        if sum_a + sum_b < ans:
            ans = sum_a + sum_b
print(ans)

### FIXED CODE ###

N = int(input())
factor_a = []
factor_b = []
ans = N
for a in range(1, N):
    sum_a = sum([int(i) for i in str(a)])
    sum_b = sum([int(i) for i in str(N-a)])
    if sum_a + sum_b < ans:
        ans = sum_a + sum_b
print(ans)
li = list(input())
list = ['dream','dreamer','erase','eraser']
flag = 'No'
for x in list:
  for y in list:
    if x + y = li:
      flag = 'YES'
  
print(flag)

### FIXED CODE ###

import re
S = input()
'''
メタ文字：
^ = 文字列の先頭、
| = OR
+ = 直前のパターンを1回以上繰り返し、
$ = 文字列の末尾
'''
if re.match("^(dream|dreamer|erase|eraser)+$", S):
    print('YES')
else:
    print('NO')
s = input()
w = input()
if s <= w:
    print("unsafe")
else:
    print("safe")

### FIXED CODE ###

s , w =map(int , input() . split())
if s <= w:
    print("unsafe")
else:
    print("safe")
n=int(input())
if n<=999:
  print('ABC'+'{0:03d}'.format(n))
else:
  n=n-999
  print('ABD'+{0:03d}'.format(n))

### FIXED CODE ###

n=int(input())
if n<=999:
  print('ABC')
else:
  print('ABD')
n, s = map(int, (input().split()))
ans = 0

for x,y in product(range(n+1), range(n+1)):
    if 0 <= s - x - y <= n:
        ans += 1
print(ans)

### FIXED CODE ###

n, s = map(int, (input().split()))
ans = 0

for x in range(n + 1):
    for y in range(n + 1):
        if 0 <= s - x - y <= n:
            ans += 1
print(ans)
n=int(input())
T=int(input())
minimum=1000
for i in range(n):
  c=int(input())
  t=int(input())
  if t <= T :
    minnimum = min(minimum,c)
print(minimum)
    


### FIXED CODE ###

n,T = map(int,input().split())
minimum=10000
for i in range(n):
  c,t = map(int,input().split())
  if t <= T :
    minimum = min(minimum,c)
if minimum == 10000:
  print('TLE')
else:
  print(minimum)
n=int(input())
a = [list(map(int,input().split()))]
count =1
while True:
  for i in range(n):
    if all(a[i]%(2**count)==0):
      count+=1
    else:
      print(count-1)
      break

### FIXED CODE ###

n=int(input())
a = list(map(int,input().split()))
count =1
 
while all(a[i]%(2**count)==0 for i in range(n)):
  count+=1
print(count-1)
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()))
W = X * Y * Z
D = [0] * W
m = 0
for i in range(X):
	for j in range(Y):
		for k in range(Z):
			D[m] = A[i] + B[j] + C[k]
			m = m + 1
E = sorted(D, reverse = True)
for n in range(K):
	print(E[n])


### FIXED CODE ###

X, Y, Z, K = map(int, input().split())
A, B, C = [sorted(list(map(int, input().split())))[:: -1][: K] for _ in range(3)]
D = []
for ai in A:
    for bi in B:
        D.append(ai + bi)

D = sorted(D)[:: -1][: K]

res = []
for di in D:
    for ci in C:
        res.append(di + ci)

res = sorted(res)[:: -1][: K]

for ans in res:
    print(ans)
import math
from functools import reduce
import numpy as np

N = int(input())
As = [int(elm) for elm in input().split(" ")] 


def divisor(n):
    ass = []
    for i in range(1,int(n**0.5)+1):
        if n%i == 0:
            ass.append(i)
            ass.append(n//i)
    return ass

if N >= 3:
    gs = []
    for i in range(N//2):
        g = math.gcd(As[i], As[i+1])
        gs.append(g)
    if N % 2 == 1:
        gs.append(As[N-1])

    while len(gs) != 2:
        new_gs = []
        N1 = len(gs)
        for i in range(N1//2):
            g = math.gcd(gs[i], gs[i+1])
            new_gs.append(g)
        if N1 % 2 == 1:
            new_gs.append(gs[-1])
        gs = new_gs

    g1, g2 = gs
    d1 = divisor(g1) 
    d2 = divisor(g2) 
    ds = sorted(d1 + d2, reverse=True)

    for d in ds:
        count = sum([int(A % d == 0) for A in As])
        if count >= N-1:
            out = d
            break

else:
    out = max(As)

print(out)

### FIXED CODE ###

#import math
from fractions import gcd

N = int(input())
As = [int(elm) for elm in input().split(" ")] 


def divisor(n):
    ass = []
    for i in range(1,int(n**0.5)+1):
        if n%i == 0:
            ass.append(i)
            ass.append(n//i)
    return ass

if N >= 3:
    gs = []
    for i in range(0, (N//2)*2 , 2):
        g = gcd(As[i], As[i+1])
        gs.append(g)
    if N % 2 == 1:
        gs.append(As[N-1])

    while len(gs) != 2:
        #print(gs)
        new_gs = []
        N1 = len(gs)
        #print("len",len(gs), (N1//2)*2)
        for i in range(0, (N1//2)*2, 2):
            g = gcd(gs[i], gs[i+1])
            new_gs.append(g)
        if N1 % 2 == 1:
            new_gs.append(gs[-1])
        gs = new_gs

    g1, g2 = gs
    d1 = divisor(g1) 
    d2 = divisor(g2) 
    ds = sorted(d1 + d2, reverse=True)

    #print(gs)
    #print(ds)
    for d in ds:
        count = sum([int(A % d == 0) for A in As])
        if count >= N-1:
            out = d
            break

else:
    out = max(As)

print(out)