Buggy python submission (verdict: Runtime Error):
import fractions
n = int(input())

al = list(map(int,input().split()))

front_gcd = []

a_init = al[0]
for a in al:
    a_init = fractions.gcd(a, a_init)
    front_gcd.append(a_init)
    
back_gcd = []

b_init = al[-1]
for b in al[::-1]:
    b_init = fractions.gcd(b, b_init)
    back_gcd.append(b_init)
    
back_gcd = back_gcd[::-1]

ans = 1
for i in range(n):
    if i == 0:
        x = back_gcd[1]
    elif i == n-1:
        x = front_gcd[-2]
    else:
        x = fractions.gcd(front_gcd[i-1], back_gcd[i+1])
    if gcd > ans:
        ans = x

print(ans)



Fixed submission:
import fractions
n = int(input())

al = list(map(int,input().split()))

front_gcd = []

a_init = al[0]
for a in al:
    a_init = fractions.gcd(a, a_init)
    front_gcd.append(a_init)
    
back_gcd = []

b_init = al[-1]
for b in al[::-1]:
    b_init = fractions.gcd(b, b_init)
    back_gcd.append(b_init)
    
back_gcd = back_gcd[::-1]

ans = 1
for i in range(n):
    if i == 0:
        x = back_gcd[1]
    elif i == n-1:
        x = front_gcd[-2]
    else:
        x = fractions.gcd(front_gcd[i-1], back_gcd[i+1])
    if x > ans:
        ans = x

print(ans)

Buggy python submission (verdict: Runtime Error):
from fractions import gcd
n = int(input())

al = list(map(int,input().split()))

front_gcd = []

a_init = al[0]
for a in al:
    a_init = gcd(a, a_init)
    front_gcd.append(a_init)
    
back_gcd = []

b_init = al[-1]
for b in al[::-1]:
    b_init = gcd(b, b_init)
    back_gcd.append(b_init)
    
back_gcd = back_gcd[::-1]

ans = 1
for i in range(n):
    if i == 0:
        gcd = back_gcd[1]
    elif i == n-1:
        gcd = front_gcd[-2]
    else:
        gcd = gcd(front_gcd[i-1], back_gcd[i+1])
    if gcd > ans:
        ans = gcd

print(ans)



Fixed submission:
import fractions
n = int(input())

al = list(map(int,input().split()))

front_gcd = []

a_init = al[0]
for a in al:
    a_init = fractions.gcd(a, a_init)
    front_gcd.append(a_init)
    
back_gcd = []

b_init = al[-1]
for b in al[::-1]:
    b_init = fractions.gcd(b, b_init)
    back_gcd.append(b_init)
    
back_gcd = back_gcd[::-1]

ans = 1
for i in range(n):
    if i == 0:
        x = back_gcd[1]
    elif i == n-1:
        x = front_gcd[-2]
    else:
        x = fractions.gcd(front_gcd[i-1], back_gcd[i+1])
    if x > ans:
        ans = x

print(ans)

Buggy python submission (verdict: Runtime Error):
import math
n = int(input())

al = list(map(int,input().split()))

front_gcd = []

a_init = al[0]
for a in al:
    a_init = math.gcd(a, a_init)
    front_gcd.append(a_init)
    
back_gcd = []

b_init = al[-1]
for b in al[::-1]:
    b_init = math.gcd(b, b_init)
    back_gcd.append(b_init)
    
back_gcd = back_gcd[::-1]

ans = 1
for i in range(n):
    if i == 0:
        gcd = back_gcd[1]
    elif i == n-1:
        gcd = front_gcd[-2]
    else:
        gcd = math.gcd(front_gcd[i-1], back_gcd[i+1])
    if gcd > ans:
        ans = gcd

print(ans)



Fixed submission:
import fractions
n = int(input())

al = list(map(int,input().split()))

front_gcd = []

a_init = al[0]
for a in al:
    a_init = fractions.gcd(a, a_init)
    front_gcd.append(a_init)
    
back_gcd = []

b_init = al[-1]
for b in al[::-1]:
    b_init = fractions.gcd(b, b_init)
    back_gcd.append(b_init)
    
back_gcd = back_gcd[::-1]

ans = 1
for i in range(n):
    if i == 0:
        x = back_gcd[1]
    elif i == n-1:
        x = front_gcd[-2]
    else:
        x = fractions.gcd(front_gcd[i-1], back_gcd[i+1])
    if x > ans:
        ans = x

print(ans)