Buggy python submission (verdict: Runtime Error):
from fractions import gcd

n = int(input())
a = [int(i) for i in input().split()]
l,r = [0],[0]
for i in range(n//2+1):
    l.append(gcd(l[i],a[i]))
    r.append(gcd(a[n-i-1],r[i]))

#print(l,r)
ans = 0
for i in range(min(len(l),len(r))):
    ans = max(ans,gcd(l[i],r[n-i-1]))
print(ans)


Fixed submission:
from fractions import gcd

n = int(input())
a = [int(i) for i in input().split()]
l,r = [0],[0]
for i in range(1,n):
    l.append(gcd(l[i-1],a[i-1]))
    r.append(gcd(r[i-1],a[-i]))
r = r[::-1]
ans = 0

for i in range(n):
    ans = max(ans,gcd(l[i],r[i]))
print(ans)

Buggy python submission (verdict: Runtime Error):
from fractions import gcd

n = int(input())
a = [int(i) for i in input().split()]
l,r,ans = [a[0]],[a[-1]],[gcd(a[0],a[-1])]
if len(a) == 2:
    print(gcd(a[0],a[1]))
    exit()
for i in range(1,n//2+1):
    l.append(gcd(a[i-1],a[i]))
    r.append(gcd(a[n-i],a[n-i-1]))
    ans.append(r[-1])
    ans.append(l[-1])
ans = list(set(ans))
print(ans[1])


Fixed submission:
from fractions import gcd

n = int(input())
a = [int(i) for i in input().split()]
l,r = [0],[0]
for i in range(1,n):
    l.append(gcd(l[i-1],a[i-1]))
    r.append(gcd(r[i-1],a[-i]))
r = r[::-1]
ans = 0

for i in range(n):
    ans = max(ans,gcd(l[i],r[i]))
print(ans)

Buggy python submission (verdict: Runtime Error):
import fractions
from functions import reduce

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

n = int(input())
a = [int(i) for i in input().split()]
ans = 0
l,r = [],[]
for i in range(n):
	l = gcd_list([a[i] for m in range(i)])
	r = gcd_list([a[i] for m in range(n-1,i,-1)])
	ans = max(ans,l,r)
print(ans)


Fixed submission:
from fractions import gcd

n = int(input())
a = [int(i) for i in input().split()]
l,r = [0],[0]
for i in range(1,n):
    l.append(gcd(l[i-1],a[i-1]))
    r.append(gcd(r[i-1],a[-i]))
r = r[::-1]
ans = 0

for i in range(n):
    ans = max(ans,gcd(l[i],r[i]))
print(ans)

Buggy python submission (verdict: Runtime Error):
import math

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

n = int(input())
a = [int(i) for i in input().split()]
m = []
if len(a) == 2:
    print(max(a))

else:
    for i in range(n-1):
        m.append(gcd(a[i],a[i+1]))
    m.append(gcd(a[0],a[n-1]))
    m = list(set(m))
    m.sort()
    print(m[1])


Fixed submission:
from fractions import gcd

n = int(input())
a = [int(i) for i in input().split()]
l,r = [0],[0]
for i in range(1,n):
    l.append(gcd(l[i-1],a[i-1]))
    r.append(gcd(r[i-1],a[-i]))
r = r[::-1]
ans = 0

for i in range(n):
    ans = max(ans,gcd(l[i],r[i]))
print(ans)

Buggy python submission (verdict: Runtime Error):
import math

n = int(input())
a = [int(i) for i in input().split()]
m = []
if len(a) == 2:
    print(max(a))

else:
    for i in range(n-2):
        m.append(math.gcd(a[i],a[i+1]))
    m.append(math.gcd(a[0],a[n-1]))
    m = list(set(m))
    m.sort()
    print(m[1])


Fixed submission:
from fractions import gcd

n = int(input())
a = [int(i) for i in input().split()]
l,r = [0],[0]
for i in range(1,n):
    l.append(gcd(l[i-1],a[i-1]))
    r.append(gcd(r[i-1],a[-i]))
r = r[::-1]
ans = 0

for i in range(n):
    ans = max(ans,gcd(l[i],r[i]))
print(ans)

Buggy python submission (verdict: Runtime Error):
import math

n = int(input())
a = [int(i) for i in input().split()]
m = []
if len(a) == 2:
    print(max(a))

else:
    for i in range(n-1):
        m.append(math.gcd(a[i],a[i+1]))
    m.append(math.gcd(a[0],a[n-1]))
    m = list(set(m))
    m.sort()
    print(m[1])


Fixed submission:
from fractions import gcd

n = int(input())
a = [int(i) for i in input().split()]
l,r = [0],[0]
for i in range(1,n):
    l.append(gcd(l[i-1],a[i-1]))
    r.append(gcd(r[i-1],a[-i]))
r = r[::-1]
ans = 0

for i in range(n):
    ans = max(ans,gcd(l[i],r[i]))
print(ans)

Buggy python submission (verdict: Runtime Error):
import math

n = int(input())
a = [int(i) for i in input().split()]
m = []
if len(a) == 2:
    print(max(a))

else:
    for i in range(n-1):
        m.append(math.gcd(a[i],a[i+1]))
    m.append(math.gcd(a[0],a[i+1]))
    m = list(set(m))
    m.sort()
    print(m[1])


Fixed submission:
from fractions import gcd

n = int(input())
a = [int(i) for i in input().split()]
l,r = [0],[0]
for i in range(1,n):
    l.append(gcd(l[i-1],a[i-1]))
    r.append(gcd(r[i-1],a[-i]))
r = r[::-1]
ans = 0

for i in range(n):
    ans = max(ans,gcd(l[i],r[i]))
print(ans)