qyliang/CodeNanoFix huggingface dataset:
# Buggy code:
class uf():
    def __init__(self,n):
        self.n=n
        self.pa=[-2]*n
    def find(self,x):
        if self.pa[x]<-1:
            return x
        else:
            self.pa[x]=self.find(self.pa[x])
            return self.pa[x]
    def unite(self,x,y):
        x=self.find(x)
        y=self.find(y)
        if x==y:
        	return True
        else:
            if self.pa[x]>self.pa[y]:
                x,y=y,x
            self.pa[x]+=y
            self.pa[y]=x
            return True
    def same(self,x,y):
        return self.find[x]==find.pa[y]
    def size(self,x):
        return -self.pa[self.find(x)] 
n,m=map(int,input().split())
import sys
input=sys.stdin.readline
uf=uf(n)
for _ in range(m):
    a,b,c=map(int,input().split())
    uf.unite(a-1,b-1)
memo=set([])
for i in range(n):
    memo.add(uf.find(i))
print(len(memo))

# Fixed code:
class uf():
    def __init__(self,n):
        self.n=n
        self.pa=[-1]*n
    def find(self,x):
        if self.pa[x]<0:
            return x
        else:
            self.pa[x]=self.find(self.pa[x])
            return self.pa[x]
    def unite(self,x,y):
        x=self.find(x)
        y=self.find(y)
        if x==y:
        	return True
        else:
            if self.pa[x]>self.pa[y]:
                x,y=y,x
            self.pa[x]+=self.pa[y]
            self.pa[y]=x
            return True
    def same(self,x,y):
        return self.find[x]==find.pa[y]
    def size(self,x):
        return -self.pa[self.find(x)] 
n,m=map(int,input().split())
import sys
input=sys.stdin.readline
uf=uf(n)
for _ in range(m):
    a,b,c=map(int,input().split())
    uf.unite(a-1,b-1)
memo=set([])
for i in range(n):
    memo.add(uf.find(i))
print(len(memo))
# Buggy code:
N = int(input())
V = list(map(int,input().split()))
C = list(map(int,input().split()))

anc = 0
for i in range(N):
  if V[i] > C[i]:
    anc = anc + (V[i]-C[i])

print(ans)

# Fixed code:
N = int(input())
V = list(map(int,input().split()))
C = list(map(int,input().split()))

ans = 0
for i in range(N):
  if V[i] > C[i]:
    ans = ans + (V[i]-C[i])

print(ans)
# Buggy code:
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

m = a[0]
k = b[0]
for i in range(n):
    if a[i] >b[i] :
        ans = a[i]-b[i]
print(ans)

# Fixed code:
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = 0
m = a[0]
k = b[0]
for i in range(n):
    if a[i] >b[i] :
        ans += a[i]-b[i]
print(ans)
# Buggy code:
def calculate_max(Ans, value):
    temp = Ans
    if (Ans + value) > Ans:
        temp += value
    if tmep < 0 :
        temp = 0
    return temp
# input processing 
N = int(input())
Value = map(int, input().split())
Cost = map(int, input().split())
# profit calculation
Profit = [Value[i] - Cost[i] for i in range(N)]
Answer = 0
# process
for i in range(N):
    Answer = calculate_max(Answer, Profit[i])
# Output
print(Answer)


# Fixed code:
def calculate_max(Ans, value):
    temp = Ans
    if (Ans + value) > Ans:
        temp += value
    if temp < 0 :
        temp = 0
    return temp
# input processing 
N = int(input())
Value = list(map(int, input().split()))
Cost = list(map(int, input().split()))
# profit calculation
Profit = [Value[i] - Cost[i] for i in range(N)]
Answer = 0
# process
for i in range(N):
    Answer = calculate_max(Answer, Profit[i])
# Output
print(Answer)
# Buggy code:
n=int(input())
arr=list(map(int,input().split()))
arr2=lisT9map(int,input().split())
ans=0
for i in range(n):
	if(arr[i]-arr2[i]>0):
		ans+=arr[i]-arr2[i]

	#ans=max(ans,arr[i]-arr2[i])
print(ans)


# Fixed code:
n=int(input())
arr=list(map(int,input().split()))
arr2=list(map(int,input().split()))
ans=0
for i in range(n):
	if(arr[i]-arr2[i]>0):
		ans+=arr[i]-arr2[i]

	#ans=max(ans,arr[i]-arr2[i])
print(ans)
# Buggy code:
n=int(input())
v=map(int,input().split())
c=map(int,input().split())
ans=0
for i in range(n):
    if c[i]-v[i]>0:
        ans+=c[i]-v[i]
print(ans)

# Fixed code:
n=int(input())
v=list(map(int,input().split()))
c=list(map(int,input().split()))
ans=0
for i in range(n):
    if v[i]-c[i]>0:
        ans+=v[i]-c[i]
print(ans)
# Buggy code:
n=int(input())
v=list(map(int,input().split()))
c=list(map(int,input().split()))
print(sum([i for i in range(n) if v[i] > c[i]]))

# Fixed code:
n=int(input())
v=list(map(int,input().split()))
c=list(map(int,input().split()))
print(sum([v[i] - c[i] for i in range(n) if v[i] > c[i]]))
# Buggy code:
n =int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))
ans = 0
for i in range(n):
  if (v[i] - c[i]) > 0:
    ans +~ v[i] - c[i]
print(ans)

# Fixed code:
n =int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))
ans = 0
for i in range(n):
  if (v[i] - c[i]) > 0:
    ans += v[i] - c[i]
print(ans)
# Buggy code:
N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))
D = [X[i] - Y[i] for i in range(N)]
D = filter(lambda x: x > 0, D)
print(sum(D))

# Fixed code:
N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))
D = [V[i] - C[i] for i in range(N)]
D = filter(lambda x: x > 0, D)
print(sum(D))
# Buggy code:
n = int(input())
x =list(map(int, input().split()))
y =list(map(int, input().split()))
diff = [x[i]-y[i] for i in range(n)]
num = 0
for d in diff:
    if(d > 0):
        num += d

# Fixed code:
n = int(input())
x =list(map(int, input().split()))
y =list(map(int, input().split()))
diff = [x[i]-y[i] for i in range(n)]
num = 0
for d in diff:
    if(d > 0):
        num += d
print(num)
# Buggy code:
N = int(input())
V = list(map(int, input().split())) 
C = list(map(int, input().split())) 

X = 0
Y = 0

for i in range(N):
    if V[i] < C[i]:
        X = V[i]
        Y = V[i]
        X += X 
        Y += Y

if (X-Y) > 0:
    print(X-Y)

# Fixed code:
N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))

X = 0
Y = 0

for i in range(N):
    if V[i] > C[i]:
        v = V[i]
        c = C[i]
        X = X + v
        Y = Y + c

print(X-Y)
# Buggy code:
def solve():
    N = int(input())
    V = list(map(int,input().split()))
    C = list(map(int,input().split()))
    cnt=0
    for i in range(len(V)):
        if V < C:
            pass
        else:
            cnt += V(i)-C(i)
    print(cnt)


solve()


# Fixed code:
def solve():
    N = int(input())
    V = list(map(int,input().split()))
    C = list(map(int,input().split()))
    cnt=0
    for i in range(len(V)):
        if V[i] < C[i]:
            pass
        else:
            cnt += V[i]-C[i]
    print(cnt)


solve()
# Buggy code:
a=input()
p=list(map(int,input().split()))
q=list(map(int,input().split()))
cost=0
for i in range(a):
    if p[i] - q[[i] > 0:
        cost += (p[i]-q[i])   
print(n)

# Fixed code:
a=int(input())
p=list(map(int,input().split()))
q=list(map(int,input().split()))
cost=0
for i in range(a):
    if p[i] - q[i] > 0:
        cost += (p[i]-q[i])   
print(cost)
# Buggy code:
n=int(input())
v=list(map(int,input().split()))
c=list(map(int,input().split()))
ans1=0
ans2=0
for i in range (len(v)):
    if v[i]>c[i]:
        ans1 += v[i]-c[i]
    else:
        ans2 += c[i]-v[i]
print(min(ans1,ans2))

# Fixed code:
n=int(input())
v=list(map(int,input().split()))
c=list(map(int,input().split()))
ans1=0
ans2=0
for i in range (len(v)):
    if v[i]>c[i]:
        ans1 += v[i]-c[i]
print(ans1)
# Buggy code:
from sys import stdin

N = int(stdin.readline().rstrip())
data = [stdin.readline().rstrip().split() for _ in range(N)]

profit = []
sum_profit = 0

for i in N:
    profit[i] = data[1][i] - data[2][i]
    if profit[i] > 0:
        sum_profit += profit[i]

print(sum_profit)

# Fixed code:
from sys import stdin

N = int(stdin.readline().rstrip())
data = [stdin.readline().rstrip().split() for _ in range(2)]

profit = [0] * N
sum_profit = 0

for i in range(N):
    profit[i] = int(data[0][i]) - int(data[1][i])
    if profit[i] > 0:
        sum_profit += profit[i]

print(sum_profit)
# Buggy code:
n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))
ans = 0
for a, b in zip(v,c):
    ans +=max(a-b,0)
ans

# Fixed code:
n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))
ans = 0
for a, b in zip(v,c):
    ans +=max(a-b,0)
print(ans)
# Buggy code:
a = int(input())
List=list(map(int,input().split()))
List2=list(map(int,input().split()))

print(List)
sum=0
i=0
while i < a:
  if List[i] - List2[i] > 0:
    sum += List[i] - List2[i]
  i +=1
print(sum)

# Fixed code:
a = int(input())
List=list(map(int,input().split()))
List2=list(map(int,input().split()))

sum=0
i=0
while i < a:
  if List[i] - List2[i] > 0:
    sum += List[i] - List2[i]
  i +=1
print(sum)
# Buggy code:
# coding: utf-8
N = int(input())
V = list(map(int,input().split()))
C = list(map(int,input().split()))
ans = 0
for i in [ V[_] - C[_] for _ in range(N)]:
    if i> 0:
        ans+=j
print(ans)

# Fixed code:
# coding: utf-8
N = int(input())
V = list(map(int,input().split()))
C = list(map(int,input().split()))
VC = []
for i in range(N):
    VC.append(V[i] -  C[i])
ans = 0
for j in VC:
    if j > 0:
        ans+=j
print(ans)
# Buggy code:
import numpy as np

n=int(input())
v = [int(x) for x in input().split()]
c = [int(x) for x in input().split()]

v = np.array(v)
c= np.array(c)
hikizan = v-c

x = np.zeros((3,n))
x[1] = v
x[2] = c
x[0] = hikizan

a = x[: , x[0,:].argsort()]

kotae = 0

for i in range(0,n):
    if a[0,i] > 0:
        kotae += a[0,i]
        
print(kotae)

# Fixed code:
import numpy as np

n=int(input())
v = [int(x) for x in input().split()]
c = [int(x) for x in input().split()]

v = np.array(v)
c= np.array(c)
hikizan = v-c

x = np.zeros((3,n))
x[1] = v
x[2] = c
x[0] = hikizan

kotae = 0

for i in range(0,n):
    if x[0,i] > 0:
        kotae += x[0,i]
        
print(int(kotae))
# Buggy code:
N = input()
V = input().split()
C = input().split()
ret_X_Y = 0

for i in range(len(V)):
    if (V[i] - C[i]) > 0:
        ret_X_Y += V[i] - C[i]
print(ret_X_Y)

# Fixed code:
N = input()
V = input().split()
C = input().split()
ret_X_Y = 0
V = [int(i) for i in V]
C = [int(i) for i in C]
for i in range(len(V)):
    if (V[i] - C[i]) > 0:
        ret_X_Y += V[i] - C[i]
print(ret_X_Y)
# Buggy code:
n = int(input())
v = list(map(int, input().split))
c = list(map(int, input().split))
d = 0
for i range(n):
    d = v[i] - c[i]
    if 0 < d:
        ans += d
print(int(ans))


# Fixed code:
n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))
ans = 0
for i in range(n):
    d = v[i] - c[i]
    if 0 < d:
        ans += d
print(int(ans))
# Buggy code:
n=int(input())
v=list(map(int,input().split()))
c=list(map(int,input().split()))
num=0
for i in range(n):
            if(v[i]-c[i]>0):
                num+=v[i]-d[i]
print(num)


# Fixed code:
n=int(input())
v=list(map(int,input().split()))
c=list(map(int,input().split()))
num=0
for i in range(n):
            if((v[i]-c[i])>0):
                num+=(v[i]-c[i])
print(num)
# Buggy code:
N = int(input())
C = list(map(int, input().split()))
V = list(map(int, input().split()))
sum = 0
for i in range(N):
  if V[i] > C[i]:
    sum += V[i] - C[i]
print(sum)

# Fixed code:
N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))
ans = 0

for i in range(N):
    if V[i] > C[i]:
        ans += V[i]-C[i]
print(ans)
# Buggy code:
N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))
R = []
for i range(N):
  R.append(V[i] - C[i])
cost = 0
for r in R:
  if r > 0:
    cost += r
print(cost)
  

# Fixed code:
N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))
R = []
for i in range(N):
  l = V[i] - C[i]
  R.append(l)
cost = 0
for r in R:
  if r > 0:
    cost += r
print(cost)
# Buggy code:
N=int(input())
V=list(map(int,input().split()))
C=list(map(int,input().split()))
print(V)
print(C)
ans =0
for i in range(N):
  z = V[i]-C[i]
  if z>0:
    ans+=z
    
print(ans)

# Fixed code:
N=int(input())
V=list(map(int,input().split()))
C=list(map(int,input().split()))
ans =0
for i in range(N):
  z = V[i]-C[i]
  if z>0:
    ans+=z
    
print(ans)
# Buggy code:
N = int(input())
V = map(int, input().split())
C = map(int, input().split())

answer = 0
for i in range(N):
  if V[i] > C[i]:
    answer += V[i] - C[i]

print(int(answer))

# Fixed code:
N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))

answer = 0
for i in range(N):
  if V[i] > C[i]:
    answer += V[i] - C[i]

print(int(answer))
# Buggy code:
N=int(input())
V=[]
C=[]
dif=[]
sum=0
V=list(input().split())
C=list(input().split())
for i in range(N):
    dif.append(int(V[i])-int(C[i]))
print(dif)
for i in range(N):
    if dif[i]>=0:
        sum+=dif[i]
print(sum)


# Fixed code:
N=int(input())
V=[]
C=[]
dif=[]
sum=0
V=list(input().split())
C=list(input().split())
for i in range(N):
    dif.append(int(V[i])-int(C[i]))
for i in range(N):
    if dif[i]>=0:
        sum+=dif[i]
print(sum)
# Buggy code:
n = int(input())
vs = input().split(" ")
cs = input().split(" ")

xy = 0
for i in range(n):
  v = vs[i]
  c = cs[i]
  if v>c:
    xy += v-c

print(xy)

# Fixed code:
n = int(input())
vs = input().split(" ")
cs = input().split(" ")
 
xy = 0
for i in range(n):
  v = int(vs[i])
  c = int(cs[i])
  if v>c:
    xy += v-c
 
print(xy)
# Buggy code:
import heapq
N = int(input()) 
V=list(map(int,input().split())) 
C= list(map(int,input().split())) 
a=[] 
for i in range(0,N): 
  if V[i]>=C[i]: 
    heapq.heappush(a,(V[i]-C[i])) 
 　else: 
    continue 
print(sum(a))

# Fixed code:
import heapq
N = int(input()) 
V=list(map(int,input().split())) 
C= list(map(int,input().split())) 
a=[] 
for i in range(0,N): 
  if V[i]>=C[i]:
    heapq.heappush(a,(V[i]-C[i])) 
  else:
    continue 
print(sum(a))
# Buggy code:
n = input()
v = input()
v = v.split()
c = input()
c = c.split()

VSubC = []

for index in range(n):
  heapq.heappush(VSubC, -(v[index] - c[index]))

answer = 0
while(len(VSubC) > 0):
  item = heapq.heappop(VSubC)
  if (item < 0):
    answer -= item
  else:
    break

print(answer)

# Fixed code:
import heapq

n = input()
v = input()
v = v.split()
c = input()
c = c.split()

VSubC = []

for index in range(int(n)):
  heapq.heappush(VSubC, -(int(v[index]) - int(c[index])))

answer = 0
while(len(VSubC) > 0):
  item = heapq.heappop(VSubC)
  if (item < 0):
    answer -= item
  else:
    break

print(answer)
# Buggy code:
n = int(input())
v = list(map(int,input().split())
c = list(map(int,input().split())
sum = 0
for i in range(n):
     if v[i] >c[i]:
      sum += v[i]-c[i]
print(sum)


# Fixed code:
n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))
profit = 0

for i in range(n):
	if (v[i] - c[i]) > 0:
		profit += (v[i] - c[i])
		
print(profit)
# Buggy code:
import math
n = int(input())
v = [int(i) for i in input().split()]
if n == 2:
    print(max(v))

l = [0 for i in range(n)]
r = l[:]


def gcd(x, y):
    if y > x:
        x, y = y, x
    if y == 0:
        return x
    if x % y == 0:
        return y
    return gcd(y, x % y)


for i in range(n):
    l[i] = gcd(l[i-1], v[i-1])
for i in range(n - 1)[::-1]:
    r[i] = gcd(r[i + 1], v[i + 1])
m = [gcd(l[i], r[i]) for i in range(n)]
print(max(m))


# Fixed code:
n = int(input())
v = [int(i) for i in input().split()]


def gcd(x, y):
    if y > x:
        x, y = y, x
    if y == 0:
        return x
    if x % y == 0:
        return y
    return gcd(y, x % y)


l = [0 for i in range(n)]
r = [0 for i in range(n)]

for i in range(1, n):
    l[i] = gcd(l[i - 1], v[i - 1])
for i in range(n - 1)[::-1]:
    r[i] = gcd(r[i+1], v[i+1])
m = [gcd(l[i], r[i]) for i in range(n)]
print(max(m))
# Buggy code:
N = int(input())
A = list(map(int, input().split()))
gcd_list=[]
reverse_gcd_list = []


def gcd(x,y):
    if x<y:
        x,y=y,x
    #x>y
    if y==0:
        return x
    if x%y==0:
        return y
    else:
        return gcd(y,x%y)

gcd_list.append(A[0])
reverse_gcd_list.append(A[-1])

for i in range(1,N):
    gcd_list.append(gcd(gcd_list[i-1], A[i]))
    reverse_gcd_list.insert(0,gcd(reverse_gcd_list[0], A[-1-i]))

num = [gcd_list[-2], reverse_gcd_list[1]]
for i in range(N-2):
    num = num.append(gcd(gcd_list[i], reverse_gcd_list[i+2]))

print(max(num))


# Fixed code:
N = int(input())
A = list(map(int, input().split()))
gcd_list=[]
reverse_gcd_list = []


def gcd(x,y):
    if x<y:
        x,y=y,x
    #x>y
    if y==0:
        return x
    if x%y==0:
        return y
    else:
        return gcd(y,x%y)

gcd_list.append(A[0])
reverse_gcd_list.append(A[-1])

for i in range(1,N):
    gcd_list.append(gcd(gcd_list[i-1], A[i]))
    # reverse_gcd_list.insert(0,gcd(reverse_gcd_list[0], A[-1-i]))
    reverse_gcd_list.append(gcd(reverse_gcd_list[-1], A[-1-i]))

reverse_gcd_list.reverse()
num = [gcd_list[-2], reverse_gcd_list[1]]
for i in range(N-2):
    num.append(gcd(gcd_list[i], reverse_gcd_list[i+2]))

print(max(num))
# Buggy code:
N = int(input())
nums = [int(i) for i in input().split()]
nums = list((set(nums)))
def compute_divs(n):
    divs = []
    for i in range(2,int(n**0.5)+1):
        if n % i == 0:
            divs.append(i)
            if i != n // i:
                divs.append(n//i)
    divs.append(n)
    return divs

if len(nums) == 1: ans = nums[0]
else:
    divs1 = compute_divs(nums[0])
    divs2 = compute_divs(nums[1])
    divs = sorted(list(set(divs1+divs2)))
    print(divs)
    for i in reversed(divs):
        c= 0
        for j in range(len(nums)):
            if nums[j] % i != 0:
                c += 1
                if c == 2:
                    break
        if c <= 1:
            ans = i
            break
print(ans)

# Fixed code:
N = int(input())
nums = [int(i) for i in input().split()]
nums_sorted = sorted(list((set(nums))), reverse=True)
def compute_divs(n):
    divs = []
    if n == 1: return [1]
    for i in range(2,int(n**0.5)+1):
        if n % i == 0:
            divs.append(i)
            if i != n // i:
                divs.append(n//i)
    divs.append(n)
    return divs
ans = 1
if len(nums_sorted) == 1: ans = nums[0]
else:
    divs1 = compute_divs(nums_sorted[0])
    divs2 = compute_divs(nums_sorted[1])
    divs = sorted(list(set(divs1+divs2)))
    for i in reversed(divs):
        c= 0
        for j in nums:
            if j % i != 0:
                c += 1
                if c == 2:
                    break
        if c <= 1:
            ans = i
            break
print(ans)
# Buggy code:
import sys
input=sys.stdin.readline

import math
def make_divisors(n):
    D=[]
    for i in range(1, int(n**0.5)+1):
        if n%i==0:
            D.append(i)
            if i!=n//i:
                D.append(n//i)
    D.sort()
    return D

n=int(input())
A=list(sorted(map(int,input().split())))
D0=list(reversed(make_divisors(A[0])))
D1=list(reversed(make_divisors(A[1])))

print(D0,D1)
ans=1
for d in D0:
    if d==1:
        continue
    cnt=0
    for a in A:
        if a%d!=0:
            cnt+=1
        if cnt>1:
            break
    if cnt<=1:
        ans=max(d,ans)
        break

for d in D1:
    if d==1:
        continue
    cnt=0
    for a in A:
        if a%d!=0:
            cnt+=1
        if cnt>1:
            break
    if cnt<=1:
        ans=max(d,ans)
        break

print(ans)

# Fixed code:
import sys
input=sys.stdin.readline

import math
def make_divisors(n):
    D=[]
    for i in range(1, int(n**0.5)+1):
        if n%i==0:
            D.append(i)
            if i!=n//i:
                D.append(n//i)
    D.sort()
    return D

n=int(input())
A=list(sorted(map(int,input().split())))
D0=list(reversed(make_divisors(A[0])))
D1=list(reversed(make_divisors(A[1])))

ans=1
for d in D0:
    if d==1:
        continue
    cnt=0
    for a in A:
        if a%d!=0:
            cnt+=1
        if cnt>1:
            break
    if cnt<=1:
        ans=max(d,ans)
        break

for d in D1:
    if d==1:
        continue
    cnt=0
    for a in A:
        if a%d!=0:
            cnt+=1
        if cnt>1:
            break
    if cnt<=1:
        ans=max(d,ans)
        break

print(ans)
# Buggy code:
#!/usr/bin/env python3
import sys
import functools
from fractions import gcd


def solve(N: int, A: "List[int]"):
    L = [0] * (N+2)
    R = [0] * (N+2)

    L[1] = A[0]
    for i in range(2,N+1):
        L[i] = gcd(L[i-1], A[i-1])

    R[N] = A[N-1]
    for i in reversed(range(0,N+1)):
        R[i] = gcd(A[i-1], R[i+1])

    # print(L)
    # print(R)

    ans = 0
    for i in range(1,N):
        if(L[i-1] == 0):
            ans = max(ans, R[i+1])
        elif(R[i-1] == 0):
            ans = max(ans, R[i-1])
        else:
            ans = max(ans, gcd(L[i-1], R[i+1]))

    print(ans)

    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [ int(next(tokens)) for _ in range(N) ]  # type: "List[int]"
    solve(N, A)

if __name__ == '__main__':
    main()


# Fixed code:
#!/usr/bin/env python3
import sys
import functools
# from math import gcd
# from fractions import gcd

def gcd(x,y):
    if x<y:
        x,y=y,x
    #x>y
    if y==0:
        return x
    if x%y==0:
        return y
    else:
        return gcd(y,x%y)
 
def solve(N: int, A: "List[int]"):
    L = [0] * (N)
    R = [0] * (N)
 
    for i in range(1, N):
        L[i] = gcd(L[i-1], A[i-1])
    for i in reversed(range(0,N-1)):
        R[i] = gcd(R[i+1], A[i+1])
 
    # print(L)
    # print(R)
 
    ans = 0
    for i in range(N):
        ans = max(ans, gcd(L[i], R[i]))
 
    print(ans)
 
    return
 
 
# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [ int(next(tokens)) for _ in range(N) ]  # type: "List[int]"
    solve(N, A)
 
if __name__ == '__main__':
    main()
# Buggy code:
def gcd(a,b):
    if b==0:
        return a
    return gcd(b,a%b)
N=int(input())
A=list(map(int,input().split()))

L=[0,0]
for ai in A:
    L.append(gcd(L[-1],ai))
    print(L)

R=[0,0]
for ai in A[::-1]:
    R.append(gcd(R[-1],ai))
    print(R)

print(max(gcd(l,r) for l,r in zip(L,reversed(R))))

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

L=[0,0]
for ai in A:
    L.append(gcd(L[-1],ai))
    #print(L)

R=[0,0]
for ai in A[::-1]:
    R.append(gcd(R[-1],ai))
    #print(R)

print(max(gcd(l,r) for l,r in zip(L,reversed(R))))
# Buggy code:
# -*- coding: utf-8 -*-
"""
Created on Sat Apr 27 20:57:32 2019

@author: Yamazaki Kenichi
"""

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

def eg(x,y):
    if y == 0:
        return x
    x, y = y, x%y
    return eg(x,y)

T = [[1,1] for i in range(N)]
T[0][0],T[0][1], = A[0],A[0]
for i in range(1,N):
    T[i][0] = eg(T[i-1][0],A[i])
    T[i][1] = max(eg(T[i-1][1],A[i]),T[i-1][0])
print(max(T[N-1]))

# Fixed code:
# -*- coding: utf-8 -*-
"""
Created on Sat Apr 27 20:57:32 2019

@author: Yamazaki Kenichi
"""

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

def eg(x,y):
    if y == 0:
        return x
    x, y = y, x%y
    return eg(x,y)

T = [[1,1,1] for i in range(N)]
T[0][0],T[0][1],T[0][2] = A[0], 0, 0
for i in range(1,N):
    T[i][0] = eg(T[i-1][0],A[i])
    T[i][1] = T[i-1][0]
    T[i][2] = max(eg(T[i-1][2],A[i]),eg(T[i-1][1],A[i]))
print(max(T[N-1]))