Buggy python submission (verdict: Runtime Error):
import fractions
n=int(input())
a=list(map(int,input().split()))
b=[a[0]]*(n-1)
c=[a[n-1]]*(n-1)
for i in range(n-1):
  b[i+1]=min(b[i],fractions.gcd(a[i],a[i+1]))
  c[n-i-2]=min(c[n-i-1],fractions.gcd(a[n-i-1],a[n-i-2]))
x=1
for j in range(n-1):
  if j==0:
    print(c[1])
  else:
    y=fractions.gcd(b[j-1],c[j+1])
    if x<y:
      x=y
    else:
      x=x
print(x)

Fixed submission:
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)

Buggy python submission (verdict: Runtime Error):
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 submission:
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)

Buggy python submission (verdict: Runtime Error):
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=a.index(b.index(m))
  idx_2=a.index(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 submission:
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)

Buggy python submission (verdict: Runtime Error):
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)
c=b.count(m)
if c==1:
  idx=b.index(m)
  del b[idx]
  print(min(b))
else:
  print(min(b))
  


Fixed submission:
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)

Buggy python submission (verdict: Runtime Error):
import fractions
import functools
n=int(input())
a=list(map(int,input().split()))
b=[0]*(n-1)
for i in range(n-1):
  c=[a[i],a[i+1]]
  b[i]=fractions.gcd(c)
m=min(b)
c=b.count(m)
if c==1:
  idx=b.index(m)
  del b[idx]
  print(min(b))
else:
  print(min(b))
  

Fixed submission:
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)

Buggy python submission (verdict: Time Limit Exceeded):
import fractions
import functools
n=int(input())
a=list(map(int,input().split()))
A=functools.reduce(fractions.gcd,a)
for i in range(n):
    c=a[i]
    del a[i]
    B=functools.reduce(fractions.gcd,a)
    if A<B:
        A=B
    else:
        A=A
    a.insert(i,c)
print(A)


Fixed submission:
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)

Buggy python submission (verdict: Time Limit Exceeded):
import fractions
import functools
n=int(input())
a=list(map(int,input().split()))
A=functools.reduce(fractions.gcd,a)
for i in range(n):
    c=a[i]
    del a[i]
    B=functools.reduce(fractions.gcd,a)
    if A<B:
        A=B
    else:
        A=A
    a.insert(i,c)
print(A)


Fixed submission:
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)

Buggy python submission (verdict: Time Limit Exceeded):
import functools
n=int(input())
a=list(map(int,input().split()))
def gcd(j,k):
  if j<k:j,k=k,j
  if j%k==0:return k
  return gcd(k,j%k)
A=functools.reduce(gcd,a)
for i in range(n):
    c=a[i]
    del a[i]
    B=functools.reduce(gcd,a)
    if A<B:
        A=B
    else:
        A=A
    a.insert(i,c)
print(A)


Fixed submission:
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)

Buggy python submission (verdict: Runtime Error):
import math
import functools
n=int(input())
a=list(map(int,input().split()))
A=functools.reduce(math.gcd,a)
for i in range(n):
    c=a[i]
    del a[i]
    B=functools.reduce(math.gcd,a)
    if A<B:
        A=B
    else:
        A=A
    a.insert(i,c)
print(A)


Fixed submission:
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)

Buggy python submission (verdict: Runtime Error):
import math
from functools import reduce
n=int(input())
a=list(map(int,input().split()))
def gcd(*numbers):
    return reduce(math.gcd,numbers)
A=gcd(*a)
for i in range(n):
    c=a[i]
    del a[i]
    B=gcd(*a)
    if A<B:
        A=B
    else:
        A=A
    a.insert(i,c)
print(A)


Fixed submission:
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)

Buggy python submission (verdict: Runtime Error):
import math
from functools import reduce
n=3
a=[12,15,18]
def gcd(*numbers):
    return reduce(math.gcd,numbers)
A=gcd(*a)
for i in range(n):
    c=a[i]
    del a[i]
    B=gcd(*a)
    if A<B:
        A=B
    else:
        A=A
    a.insert(i,c)
print(A)

Fixed submission:
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)

Buggy python submission (verdict: Runtime Error):
import math
from functools import reduce
n=int(input())
a=list(map(int,input().spiit()))
def gcd(*numbers):
  return reduce(math.gcd,numbers)
A=gcd(a)
for i in range(n):
  del(a[i])
  B=gcd(a)
  if A<B:
    A=B
  else:
    A=A
print(A)
    
    

Fixed submission:
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)