Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))

def gcd(a, b):
    if min(a, b) == 0:
        return max(a, b)
    while b:
        a, b = b, a % b
    return a

def gcd_l(l):
    if len(l) == 1:
        return l[0]
    else:
        return gcd(l[0], gcd_l(l[1:]))

ans = 0
from copy import deepcopy
for i in range(n):
    li = deepcopy(a)
    li.remove(a[i])
    ans = max(ans, gcd_l(li))

print(ans)


Fixed submission:
n = int(input())
a = list(map(int, input().split()))

def gcd(a, b):
    if min(a, b) == 0:
        return max(a, b)
    while b:
        a, b = b, a % b
    return a

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

r = r[::-1]

ans = 0
for i in range(n):
    g = gcd(l[i], r[i+1])
    ans = max(ans, g)

print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))

def gcd(a, b):
    if min(a, b) == 0:
        return max(a, b)
    while b:
        a, b = b, a % b
    return a

def l(i):
    if i == 0:
        return 0
    else:
        return gcd(l(i-1), a[i-1])

def r(i):
    if i == n:
        return 0
    else:
        return gcd(r(i+1), a[i])

gcd_max = 1
for i in range(n):
    i_gcd = gcd(l(i), r(i+1))
    if i_gcd > gcd_max:
        gcd_max = i_gcd

print(gcd_max)


Fixed submission:
n = int(input())
a = list(map(int, input().split()))

def gcd(a, b):
    if min(a, b) == 0:
        return max(a, b)
    while b:
        a, b = b, a % b
    return a

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

r = r[::-1]

ans = 0
for i in range(n):
    g = gcd(l[i], r[i+1])
    ans = max(ans, g)

print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))

def gcd(a, b):
    if min(a, b) == 0:
        return max(a, b)
    while b:
        a, b = b, a%b
    return a

def l(i):
    if i == 0:
        return 0
    else:
        return gcd(l(i-1), a[i-1])

def r(i):
    if i == n:
        return 0
    else:
        return gcd(r(i+1), a[i])

gcd_max = 1
for i in range(n):
    i_gcd = gcd(l(i), r(i+1))
    if i_gcd > gcd_max:
        gcd_max = i_gcd

print(gcd_max)


Fixed submission:
n = int(input())
a = list(map(int, input().split()))

def gcd(a, b):
    if min(a, b) == 0:
        return max(a, b)
    while b:
        a, b = b, a % b
    return a

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

r = r[::-1]

ans = 0
for i in range(n):
    g = gcd(l[i], r[i+1])
    ans = max(ans, g)

print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))

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

def gcd_l(l):
    if len(l) <= 1:
        return l[0]
    elif len(l) == 2:
        return gcd(l[0], l[1])
    else:
        return gcd(gcd_l(l[:-1]), l[-1])

gcd_max = 1
for i in range(n):
    if i == 0:
        i_gcd = gcd_l(a[i+1:])
    elif i == n-1:
        i_gcd = gcd_l(a[:i])
    else:
        i_gcd = gcd(gcd_l(a[:i]), gcd_l(a[i+1:]))
    if i_gcd > gcd_max:
        gcd_max = i_gcd

print(gcd_max)


Fixed submission:
n = int(input())
a = list(map(int, input().split()))

def gcd(a, b):
    if min(a, b) == 0:
        return max(a, b)
    while b:
        a, b = b, a % b
    return a

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

r = r[::-1]

ans = 0
for i in range(n):
    g = gcd(l[i], r[i+1])
    ans = max(ans, g)

print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))

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

def gcd_l(l):
    if len(l) == 1:
        return l[0]
    elif len(l) == 2:
        return gcd(l[0], l[1])
    else:
        return gcd(gcd_l(l[:-1]), l[-1])

gcd_max = 1
for i in range(n):
    i_gcd = gcd_l(a[:i]+a[i+1:])
    if i_gcd > gcd_max:
        gcd_max = i_gcd

print(gcd_max)


Fixed submission:
n = int(input())
a = list(map(int, input().split()))

def gcd(a, b):
    if min(a, b) == 0:
        return max(a, b)
    while b:
        a, b = b, a % b
    return a

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

r = r[::-1]

ans = 0
for i in range(n):
    g = gcd(l[i], r[i+1])
    ans = max(ans, g)

print(ans)