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

n = int(input())
a = list(map(int, input().split()))
result = []

left = [0] * (n+1)
right = [0] * (n+1)
for i in range(n):
    left[i+1] = gcd(left[i], a[i])
for j in range(n-1, -1, -1):
    right[j] = gcd(right[j+1], a[j])
for i in range(n):
    result.append(gcd(left[i], right[i+1]))

print(max(result))


Fixed submission:
from fractions import gcd

n = int(input())
a = list(map(int, input().split()))
result = []

left = [0] * (n+1)
right = [0] * (n+1)
for i in range(n):
    left[i+1] = gcd(left[i], a[i])
for j in range(n-1, -1, -1):
    right[j] = gcd(right[j+1], a[j])
for i in range(n):
    result.append(gcd(left[i], right[i+1]))

print(max(result))

Buggy python submission (verdict: Runtime Error):
mport fractions

n = int(input())
a = list(map(int, input().split()))
t = []
l = 0
r = 0

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

print(max(t))

Fixed submission:
from fractions import gcd

n = int(input())
a = list(map(int, input().split()))
result = []

left = [0] * (n+1)
right = [0] * (n+1)
for i in range(n):
    left[i+1] = gcd(left[i], a[i])
for j in range(n-1, -1, -1):
    right[j] = gcd(right[j+1], a[j])
for i in range(n):
    result.append(gcd(left[i], right[i+1]))

print(max(result))

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

n = int(input())
a = list(map(int, input().split()))
t = []
a.sort()

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

for i in range(int(n/2) +1):
    aa = a[i]
    a[i] = a[i+1]
    t.append(gcd(*a))
    a[i] = aa
    
print(max(t))

Fixed submission:
from fractions import gcd

n = int(input())
a = list(map(int, input().split()))
result = []

left = [0] * (n+1)
right = [0] * (n+1)
for i in range(n):
    left[i+1] = gcd(left[i], a[i])
for j in range(n-1, -1, -1):
    right[j] = gcd(right[j+1], a[j])
for i in range(n):
    result.append(gcd(left[i], right[i+1]))

print(max(result))

Buggy python submission (verdict: Time Limit Exceeded):
import fractions

n = int(input())
a = list(map(int, input().split()))
t = []
a.sort()

for i in range(int(n/2) + 1):
    x = 0
    for j in range(n):
        if j != i:
            x = fractions.gcd(x, a[j])
    t.append(x)

print(max(t))

Fixed submission:
from fractions import gcd

n = int(input())
a = list(map(int, input().split()))
result = []

left = [0] * (n+1)
right = [0] * (n+1)
for i in range(n):
    left[i+1] = gcd(left[i], a[i])
for j in range(n-1, -1, -1):
    right[j] = gcd(right[j+1], a[j])
for i in range(n):
    result.append(gcd(left[i], right[i+1]))

print(max(result))

Buggy python submission (verdict: Time Limit Exceeded):
import fractions
n = int(input())
a = list(map(int, input().split()))
t = []

for i in range(n):
    x = 0
    for j in range(n):
        if j != i:
            x = fractions.gcd(x, a[j])
    t.append(x)

print(max(t))

Fixed submission:
from fractions import gcd

n = int(input())
a = list(map(int, input().split()))
result = []

left = [0] * (n+1)
right = [0] * (n+1)
for i in range(n):
    left[i+1] = gcd(left[i], a[i])
for j in range(n-1, -1, -1):
    right[j] = gcd(right[j+1], a[j])
for i in range(n):
    result.append(gcd(left[i], right[i+1]))

print(max(result))

Buggy python submission (verdict: Time Limit Exceeded):
import fractions
n = int(input())
a = list(map(int, input().split()))
t = []

for i in range(n):
    x = 0
    for j in range(n):
        if j == i:
            pass
        else:
            x = fractions.gcd(x, a[j])
    t.append(x)

print(max(t))

Fixed submission:
from fractions import gcd

n = int(input())
a = list(map(int, input().split()))
result = []

left = [0] * (n+1)
right = [0] * (n+1)
for i in range(n):
    left[i+1] = gcd(left[i], a[i])
for j in range(n-1, -1, -1):
    right[j] = gcd(right[j+1], a[j])
for i in range(n):
    result.append(gcd(left[i], right[i+1]))

print(max(result))