Harryxun/stf_run huggingface dataset:
N = int(input())

for h in range(1,3501):
  for n in range(1,3501):
    if (4*h*n-N*n-N*h)!= 0:
        w = N*h*n/(4*h*n-N*n-N*h)
    if w >0 and w.is_integer():
      print(h,n,int(w))
      exit()

### FIXED CODE ###

N = int(input())
for h in range(1, 3501):
    for n in range(h, 3501):
        if (4*h*n-N*n-N*h)>0 and (N*h*n)%(4*h*n-N*n-N*h)==0:
            print(h, n, (N*h*n)//(4*h*n-N*n-N*h))
            exit()
N = input()
A = input()

print(N*N-A)

### FIXED CODE ###

N = int(input())
A = int(input())

print(N*N-A)
import sys
S = list(input())
T = list(input())
for i in range(len(S)):
    if S == T:
        print("Yes")
        sys.exit(0)
    l = S[1:] + list(l[0])
print("No")

### FIXED CODE ###

import sys
S = list(input())
T = list(input())

for i in range(len(S)):
    if S == T:
        print("Yes")
        sys.exit(0)
    S = S[1:] + list(S[0])
print("No")
a,b=map(int input().split())
if a>=13:
    print(b\n)
elif a<=5:
    print(0\n)
else:
    print(b/2\n)
    

### FIXED CODE ###

a,b=map(int,input().split())
if a>=13:
    print(b)
elif a<=5:
    print(0)
else:
    print(b//2)
import math

a , b , x = map(int,input().split())
if  x <= a*a*b/2:
    h = 2*x / (b*a)
    theta = math.degrees(math.atan(h/b))
else:
    upper=(2*x / (a*a)) - b
    if b = upper:
        theta = 90
    else:
        theta = math.degrees(math.atan(a / (b - upper)))

print(90-theta)

### FIXED CODE ###

import math

a , b , x = map(int,input().split())
if  x <= a*a*b/2:
    h = 2*x / (b*a)
    theta = math.degrees(math.atan(h/b))
else:
    upper=(2*x / (a*a)) - b
    if b == upper:
        theta = 90
    else:
        theta = math.degrees(math.atan(a / (b - upper)))

print(90-theta)
import math
import fraction
from functools import reduce
N,M=map(int,input().split())
A=list(map(int,input().split()))
def lcm_base(x, y):
    return (x * y) // fraction.gcd(x, y)
def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)
saisyou = lcm(*A)
kosuu = math.ceil(M/saisyou)
print(kosuu)

### FIXED CODE ###

K,X = map(int,input().split())
if 500*K >= X:
    print('Yes')
else:
    print('No')
n = input()
if n.count(7) == 0:
    print("No)
else:
    print("Yes")

### FIXED CODE ###

n = input()
if n.count("7") == 0:
    print("No")
else:
    print("Yes")
import collections

if __name__ == '__main__':
    n, m = map(int, input().split())
    l = [list(map(int, input().split())) for i in range(m)]

    ways = [[] for i in range(n+1)]

    for i in l:
        ways[i[0]].append(i[1])
        ways[i[1]].append(i[0])

    #print(ways)

    q = collections.deque()

    ans = [-1] * n # 道案内
    ans[0] = 0

    q.append(1)

    while(len(q) != 0):
        item = q.popleft()
        for i in ways[item]:
            if ans[i-1] == -1:
                ans[i-1] = item
                q.append(i)
                #print(ans , i , item)

    if -1 in ans:
        print("No")

    else:
        for i in range(1,n):
        print("Yes")
        print(ans[i])


### FIXED CODE ###

import collections

if __name__ == '__main__':
    n, m = map(int, input().split())
    l = [list(map(int, input().split())) for i in range(m)]

    ways = [[] for i in range(n+1)]

    for i in l:
        ways[i[0]].append(i[1])
        ways[i[1]].append(i[0])

    #print(ways)

    q = collections.deque()

    ans = [-1] * n # 道案内
    ans[0] = 0

    q.append(1)

    while(len(q) != 0):
        item = q.popleft()
        for i in ways[item]:
            if ans[i-1] == -1:
                ans[i-1] = item
                q.append(i)
                #print(ans , i , item)

    if -1 in ans:
        print("No")
    else:
        print("Yes")
        for i in range(1,n):
            print(ans[i])
import math

a = list(map(int, input().split()))
print((a[0] * a[1]) // math.gcd(a[0], a[1]))

### FIXED CODE ###

a = list(map(int, input().split()))
b = a[0]
while b % a[1] != 0:
  b += a[0]
print(b)
while True:
    try:
        ls = []
        dic = {}# {'your' : [appeared,len]}
        
        ls = raw_input().split()
        for k in range(len(ls)):
            if ls[k] not in dic.keys():
                dic[ls[k]] = []
                dic[ls[k]].append(1)
                dic[ls[k]].append(len(ls[k]))
            else:
                dic[ls[k]][0] += 1
        
        a=max(dic) # value[0]
        b=max(dic.items(), key=lambda x: x[1][1])[0]
        print "%s %s" % (a,b)
    except EOFError:
        break

### FIXED CODE ###


wordlist = []
wordlist = raw_input().split()
dic = {}       
longest = ['',0]  
m = 0
for word in wordlist:    
    # mode
    if word not in dic:
        dic[word] = 1
    else:
        dic[word] += 1
    
    # word_length    
    if m == 0:
        longest[0] = word
        longest[1] = len(word)
        m += 1
    else:
        if len(word) > longest[1]:
            longest[0] = word
            longest[1] = len(word)

mode_key = sorted(dic.items(),key = lambda x:x[1],reverse=True)[0][0]                   
print '%s %s' % (mode_key,longest[0])
def isPrime(n):
    if n == 1: return False
 
    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False
 
    return True
  
num = input()
 
res = True
ans = 0
if num > 2 and num%2 == 0:
  num += 1
while(res):
  if isPrime(num):
    print(num)
    break
  num += 2

### FIXED CODE ###

A, B = input().split()
print(B+A)
import sys
from functools import reduce
input = sys.stdin.readline

# python > pypy
MOD = 10**9 + 7
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

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

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

lcm_ = a[0]
for i in range(n):
    lcm_ = lcm(lcm_, a[i])

b = list(map(lambda x: lcm_//x, a))
ans = 0
for i in range(len(b)):
    ans += b[i]
    ans %= MOD
print(ans)


### FIXED CODE ###

n = int(input())

c = [[0 for _ in range(10)] for _ in range(10)]
for k in range(1, n+1):
    s = str(k)
    c[int(s[0])][int(s[-1])] += 1
ans = 0
for i in range(10):
    for j in range(10):
        ans += c[i][j] * c[j][i]
print(ans)
a = input()
b = input()

list_a = [0]*int(b)
list_b = [0]*int(a)

for i in range(0,int(b)):
    list_a[i] = int(a)*10**i

for i in range(0,int(a)):
    list_b[i] = int(b)*10**i
    
a_r = sum(list_a) 
b_r =sum(list_b)

if(int(a_r)<int(b_r)):
    print(str(a_r))
elif(int(a_r)>int(b_r)):
    print(str(b_r))
else:
    print(str(a_r))


### FIXED CODE ###

a, b = input().split()

list_a = [0]*int(b)
list_b = [0]*int(a)

for i in range(0,int(b)):
    list_a[i] = int(a)*10**i

for i in range(0,int(a)):
    list_b[i] = int(b)*10**i
    
a_r = sum(list_a) 
b_r =sum(list_b)

if(a<b):
    print(str(a_r))
elif(a>b):
    print(str(b_r))
else:
    print(str(a_r))
n=int(raw_input())
a=raw_input()
x=sum([a[i]=="01"[i%2] for i in range(n)])
ans=min([x,n-x])
print ans



### FIXED CODE ###

a=raw_input()
x=sum([a[i]=="01"[i%2] for i in range(len(a))])
ans=min([x,len(a)-x])
print ans
import sys
sys.setrecursionlimit(1000000)
 
def xgcd(a, b):
    x0, y0, x1, y1 = 1, 0, 0, 1
    while b != 0:
        q, a, b = a // b, b, a % b
        x0, x1 = x1, x0 - q * x1
        y0, y1 = y1, y0 - q * y1
    return a, x0, y0
 
def modinv(a, m):
    g, x, y = xgcd(a, m)
    if g != 1:
        raise Exception('modular inverse does not exist')
    else:
        return x % m
 
def combination(n,r,q):
    if r==1:
        return n%q
 
    return ((n*combination(n-1,r-1,q)%q)*modinv(r,q))%q
 
def _input():
    return list(map(int, input().split()))
 
def main():
    i=_input()
    x,y=i[0],i[1]
    if 2*y>=x and 2*x>=y and (2*y-x)%3==0 and (2*x-y)%3==0:
        n=(2*y-x)//3
        m=(2*x-y)//3
        print(int(combination(n+m,min(m,n),1000000007)))
    else:
        print(0)
 
if __name__ == "__main__":
    main()


### FIXED CODE ###

import sys
sys.setrecursionlimit(1000000)
 
def xgcd(a, b):
    x0, y0, x1, y1 = 1, 0, 0, 1
    while b != 0:
        q, a, b = a // b, b, a % b
        x0, x1 = x1, x0 - q * x1
        y0, y1 = y1, y0 - q * y1
    return a, x0, y0
 
def modinv(a, m):
    g, x, y = xgcd(a, m)
    if g != 1:
        raise Exception('modular inverse does not exist')
    else:
        return x % m
 
def combination(n,r,q):
    if r==0:
        return 1
 
    return ((n*combination(n-1,r-1,q)%q)*modinv(r,q))%q
 
def _input():
    return list(map(int, input().split()))
 
def main():
    i=_input()
    x,y=i[0],i[1]
    if 2*y>=x and 2*x>=y and (2*y-x)%3==0 and (2*x-y)%3==0:
        n=(2*y-x)//3
        m=(2*x-y)//3
        print(int(combination(n+m,min(m,n),1000000007)))
    else:
        print(0)
 
if __name__ == "__main__":
    main()
a,b,c = map(int,input().split)

if a == b:
  print("No")
else a!= b:
  if c == a:
    print("Yes")
  else:
    if c ==b:
      print("Yes")
    else:
      print("No")
  

### FIXED CODE ###

a,b,c = map(int,input().split())

s = set([a,b,c])

if len(s) == 2:
  print("Yes")
else:
  print("No")
C = input()
print(chr(ord(C+1)))


### FIXED CODE ###

print(chr(ord(input())+1))
import fractions
import functools
n=int(input())
a=list(map(int,input().split()))
b=[0]*(n-1)
for i in range(n-1):
  b[i]=fractions.gcd(a[i],a[i+1])
m=min(b)
cnt=b.count(m)
if cnt==1:
  idx_1=b.index(m)
  idx_2=b.index(m)+1
  z=a[idx_1]
  del z
  x=functools.reduce(fractions.gcd,a)
  a.insert(idx_1,z)
  del a[idx_2]
  y=functools.reduce(fractions.gcd,a)
  print(max(x,y))  
else:
  print(m)
  
  


### FIXED CODE ###

import fractions 
n=int(input())
a=list(map(int,input().split()))
ans=a[0]
sna=a[n-1]
Ans=[ans]*n
Sna=[sna]*n
for j in range(1,n):
  ans=fractions.gcd(ans,a[j])
  Ans[j]=ans
  sna=fractions.gcd(sna,a[n-j-1])
  Sna[j]=sna
m=Sna[n-2]
for k in range(n-2):
  m=max(m,fractions.gcd(Ans[k],Sna[n-3-k]))
m=max(m,Ans[n-2])
print(m)
s=input()
lens=len(s)
count=0
for i in range(lens):
    for k in range(i,lens):
        num=s[i:k]
        if(len(num)>=4):
            if(int(num)%2019==0):
                count=count+1
print(count)

### FIXED CODE ###

SW=input()
SW=SW.split()
if(int(SW[1])>=int(SW[0])):
    print('unsafe')
else:
    print('safe')
N,i=map(int, input().split())
print(L-i+1)

### FIXED CODE ###

N,i=map(int, input().split())
print(N-i+1)
from collections import Counter
import numpy as np
from scipy.sparse.csgraph import connected_components
from scipy.sparse import csr_matrix

N, M, K = map(int, input().split())
exc = [set() for _ in range(N)]
edge = []

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

edge = np.array(edge).T
matr = csr_matrix(([1 for _ in range(M)], edge), (N, N))
_, labels = connected_components(matr)
ct = Counter(labels)

for _ in range(K):
    c, d = map(int, input().split())
    if labels[c - 1] == labels[d - 1]:
        exc[c - 1].add(d - 1)
        exc[d - 1].add(c - 1)

ans = [ct[labels[i]] - len(exc[i]) - 1 for i in range(N)]
print(*ans)


### FIXED CODE ###

class UnionFind:
    def __init__(self, n):
        self.n = n
        self.parent = [i for i in range(n)]
        self.height = [1] * n
        self.size = [1] * n

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

    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x != y:
            if self.height[x] < self.height[y]:
                self.parent[x] = y
                self.size[y] += self.size[x]
            else:
                self.parent[y] = x
                self.size[x] += self.size[y]
                if self.height[x] == self.height[y]:
                    self.height[x] += 1

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

    def group_size(self, x):
        return self.size[self.find(x)]


N, M, K = map(int, input().split())
uf = UnionFind(N)
exc = [set() for _ in range(N)]

for _ in range(M):
    a, b = map(int, input().split())
    exc[a - 1].add(b - 1)
    exc[b - 1].add(a - 1)
    uf.unite(a - 1, b - 1)
for _ in range(K):
    c, d = map(int, input().split())
    if uf.issame(c - 1, d - 1):
        exc[c - 1].add(d - 1)
        exc[d - 1].add(c - 1)

ans = [uf.group_size(i) - len(exc[i]) - 1 for i in range(N)]
print(*ans)
import math

a,b=map(int,input().split())
print(ceil((b-1)/(a-1)))

### FIXED CODE ###

import math

a,b=map(int,input().split())
print(math.ceil((b-1)/(a-1)))
s = [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,54,1,4,1,51]

k = int(input())

print(s[k-1])

### FIXED CODE ###

s = [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())

print(s[k-1])
import sys

input = lambda: sys.stdin.readline().rstrip()

n, m, k = map(int, input().split())
A = sorted(list(map(int, input().split())))
B = sorted(list(map(int, input().split())))

cnt = 0
if A[0] < B[0] and A[0] <= k:
    cnt += 1
    k -= A[0]

idx_a = 1
idx_b = 0

while k >= 0:
    if B[idx_b] > A[idx_a]:
        k -= A[idx_a]
        if k >= 0: cnt += 1
        if idx_a < n - 1: idx_a += 1

    if B[idx_b] < A[idx_a]:
        k -= B[idx_b]
        if k >= 0: cnt += 1
        if idx_b < m - 1: idx_b += 1

    if B[idx_b] == A[idx_a]:
        k -= A[idx_a]
        k -= B[idx_b]
        if k >= 0: cnt += 2
        if idx_a < n - 1: idx_a += 1
        if idx_b < m - 1: idx_b += 1

print(cnt)

### FIXED CODE ###

from itertools import accumulate

n, m, k = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

A = [0] + A
A = list(accumulate(A))

B = [0] + B
B = list(accumulate(B))

ans = 0
b_cnt = m
for a_cnt in range(n+1):
    if A[a_cnt] > k: continue

    while A[a_cnt]+B[b_cnt] > k:
        b_cnt -= 1
    ans = max(ans, a_cnt+b_cnt)

print(ans)
def popcnt_int(n): # n:int
    return bin(n).count('1')

def popcnt_bin(s): # s:str
    return s.count('1')

def poptimes(n, cnt=1): #:int
    if n==0:
        return cnt
    else:
        n %= popcnt_int(n)
        cnt += 1
        return poptimes(n, cnt)

n = int(input())
s = input()

s_int = int(s,2)
pc = popcnt_bin(s)
pc_plus = pc+1
pc_minus = pc-1
#print(n,s,s_int,pc,pc_plus,pc_minus)

l_plus = [2**(n-i-1) % (pc+1) for i in range(n)]
l_minus = [2**(n-i-1) % (pc-1) for i in range(n)]
#print(l_plus)
#print(l_minus)

for i in range(n):
    if s[i] == '1':
        if pc != 1:
            tmp = (s_int % pc_minus) - (l_minus[i] % pc_minus)
            print(poptimes(tmp))
        else:
            print(0)
            continue
    
    else:
        tmp = (s_int % pc_plus) + (l_plus[i] % pc_plus)
        print(poptimes(tmp))


### FIXED CODE ###

def popcnt_int(n): # n:int
    return bin(n).count('1')

def popcnt_bin(s): # s:str
    return s.count('1')

def poptimes(n, cnt=1): #:int
    if n==0:
        return cnt
    else:
        n %= popcnt_int(n)
        cnt += 1
        return poptimes(n, cnt)

n = int(input())
s = input()

s_int = int(s,2)
pc = popcnt_bin(s)
pc_plus = s_int % (pc+1)
if  pc != 1:
    pc_minus = s_int % (pc-1)
#print(n,s,s_int,pc,pc_plus,pc_minus)

for i in range(n):
    if s[i] == '1':
        if pc != 1:
            tmp = pc_minus - pow(2, n-i-1, pc-1)
            print(poptimes(tmp % (pc-1)))
        else:
            print(0)
            continue
    
    else:
        tmp = pc_plus + pow(2, n-i-1, pc+1)
        print(poptimes(tmp % (pc+1)))
a,b,c = map(int,input().split())
a_set = {1}
b_set = {1}
for i in range(1,a):
    if a % i == 0:
        a_set.add(i)

for i in range(1,b):
    if b % i == 0:
        b_set.add(i)

c_list = list(a_set & b_set)
c_list.sort()
print(c_list[c - 1])


### FIXED CODE ###

A, B, C = map(int, input().split())#入力された値を空白で区切ってその値をint型に変換して代入している
print(min(int(B / A), C))#intで囲うことで少数を切り捨てている
import sys
sys.setrecursionlimit(100000000)

n = int(raw_input())
h = list(map(int, raw_input().split()))
memo = {}

def get_cost(i, j):
    if j >= n:
        return 0
    return abs(h[i] - h[j])

def get_min_cost_from_postion(i):
    if i >= n-1:
        return 0
    if i in memo:
        return memo[i]
    k = min(2, (N-1)-i)
    ans = min(
        get_cost(i, i+x) + get_min_cost_from_postion(i+x) for x in range(1,k+1))

    memo[i] = ans
    return ans

ans = get_min_cost_from_postion(0)

print ans


### FIXED CODE ###

import sys
sys.setrecursionlimit(100000000)

n = int(raw_input())
h = list(map(int, raw_input().split()))
memo = {}

def get_cost(i, j):
    if j >= n:
        return 0
    return abs(h[i] - h[j])

def get_min_cost_from_postion(i):
    if i >= n-1:
        return 0
    if i in memo:
        return memo[i]
    k = min(2, (n-1)-i)
    ans = min(
        get_cost(i, i+x) + get_min_cost_from_postion(i+x) for x in range(1,k+1))

    memo[i] = ans
    return ans

ans = get_min_cost_from_postion(0)

print ans
N = int(input())
S = input()
cnt = 0

for i in range(10):
    for j in range(10):
        for k in range(10):
            idx = S.find(str(k))
            if idx != -1:
                idx = S.find(str(j),idx+1)
                if idx != -1:
                    idx = S.find(str(i),idx+1)
                    if idx != -1:
                        cnt += 1

print(cnt)

### FIXED CODE ###

m,d = map(int,input().split())
M,D = map(int,input().split())

if m != M:
    print(1)
else:
    print(0)
print(eval(input().replace(' ','+0.5*'))

### FIXED CODE ###

a,b=map(int,input().split());print(a+b//2)
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
    return random.randint(ran1, ran2)
def rand_List(ran1, ran2, rantime):
    return [random.randint(ran1, ran2) for i in range(rantime)]
def rand_ints_nodup(ran1, ran2, rantime):
  ns = []
  while len(ns) < rantime:
    n = random.randint(ran1, ran2)
    if not n in ns:
      ns.append(n)
  return sorted(ns)

def rand_query(ran1, ran2, rantime):
  r_query = []
  while len(r_query) < rantime:
    n_q = rand_ints_nodup(ran1, ran2, 2)
    if not n_q in r_query:
      r_query.append(n_q)
  return sorted(r_query)

from collections import defaultdict, deque, Counter
from sys import exit
from decimal import *
import heapq
from math import sqrt
from fractions import gcd
import random
import string
import copy
from itertools import combinations, permutations, product
from operator import mul, itemgetter
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7

#############
# Main Code #
#############

A = input()
Ac = collections.Counter(A)
cnt = 0
for val in Ac.values():
    cnt += val * (val - 1) // 2
print(len(A) * (len(A)-1) // 2 - cnt + 1)

### FIXED CODE ###

def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
    return random.randint(ran1, ran2)
def rand_List(ran1, ran2, rantime):
    return [random.randint(ran1, ran2) for i in range(rantime)]
def rand_ints_nodup(ran1, ran2, rantime):
  ns = []
  while len(ns) < rantime:
    n = random.randint(ran1, ran2)
    if not n in ns:
      ns.append(n)
  return sorted(ns)

def rand_query(ran1, ran2, rantime):
  r_query = []
  while len(r_query) < rantime:
    n_q = rand_ints_nodup(ran1, ran2, 2)
    if not n_q in r_query:
      r_query.append(n_q)
  return sorted(r_query)

from collections import defaultdict, deque, Counter
from sys import exit
from decimal import *
import heapq
from math import sqrt
from fractions import gcd
import random
import string
import copy
from itertools import combinations, permutations, product
from operator import mul, itemgetter
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7

#############
# Main Code #
#############

A = input()
Ac = Counter(A)
cnt = 0
for val in Ac.values():
    cnt += val * (val - 1) // 2
print(len(A) * (len(A)-1) // 2 - cnt + 1)
x = map(int, input().split())
print(x[0]+x[1]+x[2])

### FIXED CODE ###

x=input().split()
print(x[0][0]+x[1][0]+x[2][0])
K = int(input())
A, B = map(int,input().split())
C = A % K
if B - A >= K - 1:
  print('OK')
elif C == o:
  print('OK')
elif C + B - A >= K:
  print('OK')
else:
  print('NG')

### FIXED CODE ###

K = int(input())
A, B = map(int,input().split())
C = A % K
if B - A >= K - 1:
  print('OK')
elif C == 0:
  print('OK')
elif C + B - A >= K:
  print('OK')
else:
  print('NG')
8
WWWWWEEE

### FIXED CODE ###


N = int(input())
S = input()

W = [0]
E = [0]

for i in range(N): 
  s = S[i]
  if s == "W":
    W.append(W[-1] + 1)
    E.append(E[-1])
  else:
    W.append(W[-1])
    E.append(E[-1] + 1)


ans = float("inf")
for i in range(N):
  ans = min(ans, W[i] + (E[-1] - E[i+1]))
print(ans)
import math

def lcm(a,b):
    return (a*b)//math.gcd(a,b)

n=int(input())
a=list(map(int,input().split()))
for i in range(n-1):    
    if(i==0):
        m=lcm(a[0],a[1])
    else:
        m=lcm(m,a[i+1])
m-=1
f=0
for i in range(n):
    f+=m%a[i]
print(f)

### FIXED CODE ###

import fractions

def lcm(a,b):
    return (a*b)//fractions.gcd(a,b)

n=int(input())
a=list(map(int,input().split()))
for i in range(n-1):    
    if(i==0):
        m=lcm(a[0],a[1])
    else:
        m=lcm(m,a[i+1])
m-=1
f=0
for i in range(n):
    f+=m%a[i]
print(f)
n = int(input())
l = list(map(int, input().split()))
if not 1 in l:
  print(-1)
  exit()
cnt = 1
ans = 0
for item in l:
  if item = cnt:
    ans += 1
    cnt += 1
print(n - ans)

### FIXED CODE ###

n = int(input())
l = list(map(int, input().split()))
if not 1 in l:
  print(-1)
  exit()
cnt = 1
ans = 0
for item in l:
  if item == cnt:
    ans += 1
    cnt += 1
print(n - ans)
A, B, K = list(map(int, input().split()))

if A > B:
    n = A
else:
    n = B

l = []
for i in range(1, n):
    if A % i == 0 and B % i == 0:
        l.append(i)

print(l[-K])

### FIXED CODE ###

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

if A < B:
    n = A
else:
    n = B

l = []
for i in range(1, n+1):
    if A % i == 0 and B % i == 0:
        l.append(i)

print(l[-K])
import collections
N = int(input())
xy_array = [list(map(int, input().split())) for i in range(N)]
# print(xy_array)
distance_array = []
for i in range(N):
    x_i, y_i = xy_array[i]
    for j in range(N):
        if i == j:
            continue
        x_j, y_j = xy_array[j]
        distance_array.append((x_i - x_j, y_i - y_j))

ans_array = collections.Counter(distance_array)
max_count = ans_array.most_common()[0][1]
print(N - max_count)


### FIXED CODE ###

import collections
N = int(input())
xy_array = [list(map(int, input().split())) for i in range(N)]
if N == 1:
    print(1)
    exit()
# print(xy_array)
distance_array = []
for i in range(N):
    x_i, y_i = xy_array[i]
    for j in range(N):
        if i == j:
            continue
        x_j, y_j = xy_array[j]
        distance_array.append((x_i - x_j, y_i - y_j))

ans_array = collections.Counter(distance_array)
max_count = ans_array.most_common()[0][1]
print(N - max_count)
"""
python3 main.py < input.txt
"""
import math
import itertools as it
import heapq


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

if len(A) == 2:
        print(max(A[0][1], A[1][1]))
        exit(0)

maxX=-1
for i, ai in enumerate(A):
        x=10**20
        l=list(A)
        l0, l1=(l[1][1], l[2][1]) if i == 0 else (l[0][1], l[2][1]) if i == 1 else (l[0][1], l[1][1]) 
        if (3 if i <= 2 else 2) == len(A):
                print("XXX")
                maxX=-1
        else:
                x=math.gcd(l0, l1)
                for (j, lj) in l[(3 if i <= 2 else 2):]:
                        if i != j:
                                x=math.gcd(x, lj)
        maxX=max(x, maxX)
print(maxX)

### FIXED CODE ###

"""
python3 main.py < input.txt
"""
import math
import itertools as it
import heapq

def gcd(a, b):
        return a if b == 0 else gcd(b, a%b)
N=int(input())
A=list(map(int, input().split()))

L=[A[0]]
for i in range(1, N):
        L.append(gcd(L[-1], A[i]))
R=[A[-1]]
for i in reversed(range(N-1)):
        R.append(gcd(R[-1], A[i]))
R.reverse()

m=max(R[1], L[-2])
for i in range(1, N-1):
        m=max(m, gcd(L[i-1], R[i+1]))
print(m)