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

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

gcd_l = [0]
gcd_r = [0]

for i in range(N):
    gcd_l.append(math.gcd(gcd_l[i], A[i]))
    gcd_r.append(math.gcd(gcd_r[i], A[-(i+1)]))
gcd_r = gcd_r[::-1]

ans = []
for i in range(N):
    ans.append(math.gcd(gcd_l[i], gcd_r[i+1]))
ans_2 = max(ans)
print(ans_2)

Fixed submission:
import fractions


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

gcd_l = [0]
gcd_r = [0]
for i in range(N):
    gcd_l.append(fractions.gcd(gcd_l[i], A[i]))
    gcd_r.append(fractions.gcd(gcd_r[i], A[-(i+1)]))
gcd_r = gcd_r[::-1]

ans = []
for i in range(N):
    ans.append(fractions.gcd(gcd_l[i], gcd_r[i+1]))

print(max(ans))

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

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

gcd_l = [0]
gcd_r = [0]

for i in range(N):
    gcd_l.append(math.gcd(gcd_l[i], A[i]))
    gcd_r.append(math.gcd(gcd_r[i], A[-(i+1)]))
gcd_r = gcd_r[::-1]

ans = []
for i in range(N):
    ans.append(math.gcd(gcd_l[i], gcd_r[i+1]))
print(max(ans))

Fixed submission:
import fractions


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

gcd_l = [0]
gcd_r = [0]
for i in range(N):
    gcd_l.append(fractions.gcd(gcd_l[i], A[i]))
    gcd_r.append(fractions.gcd(gcd_r[i], A[-(i+1)]))
gcd_r = gcd_r[::-1]

ans = []
for i in range(N):
    ans.append(fractions.gcd(gcd_l[i], gcd_r[i+1]))

print(max(ans))

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

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

gcd_l = [0]
gcd_r = [0]

for i in range(N):
    gcd_l.append(math.gcd(gcd_l[i], A[i]))
    gcd_r.append(math.gcd(gcd_r[i], A[-(i+1)]))
gcd_r = gcd_r[::-1]

ans = []
for i in range(N):
    ans.append(math.gcd(gcd_l[i], gcd_r[i+1]))
print(max(ans))

Fixed submission:
import fractions


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

gcd_l = [0]
gcd_r = [0]
for i in range(N):
    gcd_l.append(fractions.gcd(gcd_l[i], A[i]))
    gcd_r.append(fractions.gcd(gcd_r[i], A[-(i+1)]))
gcd_r = gcd_r[::-1]

ans = []
for i in range(N):
    ans.append(fractions.gcd(gcd_l[i], gcd_r[i+1]))

print(max(ans))

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

N = int(input())
A = list(map(int, input().split()))
a_list = []
b_list = []
c_list = []

A.sort()
#print(math.gcd(6, 7))
if 4 <= N:
    a, b, c = math.gcd(A[0], A[1]), math.gcd(A[1], A[2]), math.gcd(A[0], A[2])
    for i in range(3, N):
        a_list.append(math.gcd(A[i], a))
        b_list.append(math.gcd(A[i], b))
        c_list.append(math.gcd(A[i], c))
    a_list.sort()
    b_list.sort()
    c_list.sort()
    ans = max(a_list[0], b_list[0], c_list[0])

elif N == 3:
    ans = max(math.gcd(A[0], A[1]), math.gcd(A[1], A[2]), math.gcd(A[0], A[2]))

elif N == 2:
    ans = max(A[0], A[1])
else:
    ans = 1000000000
    print(N)

print(ans)

Fixed submission:
import fractions


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

gcd_l = [0]
gcd_r = [0]
for i in range(N):
    gcd_l.append(fractions.gcd(gcd_l[i], A[i]))
    gcd_r.append(fractions.gcd(gcd_r[i], A[-(i+1)]))
gcd_r = gcd_r[::-1]

ans = []
for i in range(N):
    ans.append(fractions.gcd(gcd_l[i], gcd_r[i+1]))

print(max(ans))

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

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

A.sort()
#print(math.gcd(6, 7))
if N >= 3:
    ans = max(math.gcd(A[0], A[1]), math.gcd(A[1], A[2]), math.gcd(A[0], A[2]))
elif N == 2:
    ans = max(A[0], A[1])
else:
    ans = 1000000000

print(ans)

Fixed submission:
import fractions


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

gcd_l = [0]
gcd_r = [0]
for i in range(N):
    gcd_l.append(fractions.gcd(gcd_l[i], A[i]))
    gcd_r.append(fractions.gcd(gcd_r[i], A[-(i+1)]))
gcd_r = gcd_r[::-1]

ans = []
for i in range(N):
    ans.append(fractions.gcd(gcd_l[i], gcd_r[i+1]))

print(max(ans))