Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd
from sys import exit

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

l_gcd_list = [0]
r_gcd_list = [0]
for i in range(N):
    l_gcd_list.append(gcd(l_gcd_list[i], A[i]))
    r_gcd_list.insert(0, gcd(r_gcd_list[0], A[-(i+1)]))
# print(l_gcd_list)
# print(r_gcd_list)

results = []
for i in range(N):
    results.append(gcd(l_gcd_list[i], r_gcd_list[i+1]))

print(max(results))


Fixed submission:
from fractions import gcd
from sys import exit

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

l_gcd_list = [0]
r_gcd_list = [0]
for i in range(N):
    l_gcd_list.append(gcd(l_gcd_list[i], A[i]))
    r_gcd_list.append(gcd(r_gcd_list[i], A[-(i+1)]))
r_gcd_list = r_gcd_list[::-1]
# print(l_gcd_list)
# print(r_gcd_list)

results = []
for i in range(N):
    results.append(gcd(l_gcd_list[i], r_gcd_list[i+1]))

print(max(results))

Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd
from sys import exit

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

l_gcd_list = [0]
r_gcd_list = [0]
for i in range(N):
    l_gcd_list.append(gcd(l_gcd_list[i], A[i]))
    r_gcd_list.insert(0, gcd(r_gcd_list[0], A[-(i+1)]))
# print(l_gcd_list)
# print(r_gcd_list)

result = 0
for i in range(N):
    result = max(result, gcd(l_gcd_list[i], r_gcd_list[i+1]))

print(result)


Fixed submission:
from fractions import gcd
from sys import exit

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

l_gcd_list = [0]
r_gcd_list = [0]
for i in range(N):
    l_gcd_list.append(gcd(l_gcd_list[i], A[i]))
    r_gcd_list.append(gcd(r_gcd_list[i], A[-(i+1)]))
r_gcd_list = r_gcd_list[::-1]
# print(l_gcd_list)
# print(r_gcd_list)

results = []
for i in range(N):
    results.append(gcd(l_gcd_list[i], r_gcd_list[i+1]))

print(max(results))

Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd
from sys import exit

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

l_gcd_list = [0]
r_gcd_list = [0]
for i in range(N):
    l_gcd_list.append(gcd(l_gcd_list[i], A[i]))
    r_gcd_list.insert(0, gcd(r_gcd_list[0], A[-(i+1)]))
# print(l_gcd_list)
# print(r_gcd_list)

result = 0
for i, _ in enumerate(A):
    result = max(result, gcd(l_gcd_list[i], r_gcd_list[i+1]))

print(result)


Fixed submission:
from fractions import gcd
from sys import exit

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

l_gcd_list = [0]
r_gcd_list = [0]
for i in range(N):
    l_gcd_list.append(gcd(l_gcd_list[i], A[i]))
    r_gcd_list.append(gcd(r_gcd_list[i], A[-(i+1)]))
r_gcd_list = r_gcd_list[::-1]
# print(l_gcd_list)
# print(r_gcd_list)

results = []
for i in range(N):
    results.append(gcd(l_gcd_list[i], r_gcd_list[i+1]))

print(max(results))

Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd
from functools import reduce

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

result = 1
previous_gcd = 0
for i, a in enumerate(A):
    # print("a", a)
    result = max(result, gcd(previous_gcd, reduce(gcd, A[i+1:] + [0])))
    previous_gcd = gcd(previous_gcd, a)
    # print("---")

print(result)


Fixed submission:
from fractions import gcd
from sys import exit

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

l_gcd_list = [0]
r_gcd_list = [0]
for i in range(N):
    l_gcd_list.append(gcd(l_gcd_list[i], A[i]))
    r_gcd_list.append(gcd(r_gcd_list[i], A[-(i+1)]))
r_gcd_list = r_gcd_list[::-1]
# print(l_gcd_list)
# print(r_gcd_list)

results = []
for i in range(N):
    results.append(gcd(l_gcd_list[i], r_gcd_list[i+1]))

print(max(results))

Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd
from functools import reduce

_ = input()
A = list(map(int, input().split()))
#print("A", A)

result = 1
for i, a in enumerate(A):
    #print("ignore", a)
    A.pop(i)
    #print("current A", A)

    result = max(result, reduce(gcd, A))
    
    A.insert(i, a)
    #print("org A", A)
    #print("---")

print(result)


Fixed submission:
from fractions import gcd
from sys import exit

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

l_gcd_list = [0]
r_gcd_list = [0]
for i in range(N):
    l_gcd_list.append(gcd(l_gcd_list[i], A[i]))
    r_gcd_list.append(gcd(r_gcd_list[i], A[-(i+1)]))
r_gcd_list = r_gcd_list[::-1]
# print(l_gcd_list)
# print(r_gcd_list)

results = []
for i in range(N):
    results.append(gcd(l_gcd_list[i], r_gcd_list[i+1]))

print(max(results))

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

_ = input()
A = list(map(int, input().split()))
#print("A", A)

result = 1
for i, a in enumerate(A):
    #print("ignore", a)
    A.pop(i)
    #print("current A", A)

    result = max(result, reduce(math.gcd, A))
    
    A.insert(i, a)
    #print("org A", A)
    #print("---")

print(result)


Fixed submission:
from fractions import gcd
from sys import exit

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

l_gcd_list = [0]
r_gcd_list = [0]
for i in range(N):
    l_gcd_list.append(gcd(l_gcd_list[i], A[i]))
    r_gcd_list.append(gcd(r_gcd_list[i], A[-(i+1)]))
r_gcd_list = r_gcd_list[::-1]
# print(l_gcd_list)
# print(r_gcd_list)

results = []
for i in range(N):
    results.append(gcd(l_gcd_list[i], r_gcd_list[i+1]))

print(max(results))

Buggy python submission (verdict: Time Limit Exceeded):
import functools
import operator

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

result = 0
for i, _ in enumerate(A):
    factors = set()
    for j, a in enumerate(A):
        if i == j:
            continue
        factors_a = set()
        for n in range(1, a+1):
            if a%n == 0:
                factors_a.add(n)
                a /= n
        if len(factors) == 0:
            factors = factors_a
        else:
            factors &= factors_a
    if len(factors) > 0:
        result = max(result, functools.reduce(operator.mul, factors))

print(result)


Fixed submission:
from fractions import gcd
from sys import exit

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

l_gcd_list = [0]
r_gcd_list = [0]
for i in range(N):
    l_gcd_list.append(gcd(l_gcd_list[i], A[i]))
    r_gcd_list.append(gcd(r_gcd_list[i], A[-(i+1)]))
r_gcd_list = r_gcd_list[::-1]
# print(l_gcd_list)
# print(r_gcd_list)

results = []
for i in range(N):
    results.append(gcd(l_gcd_list[i], r_gcd_list[i+1]))

print(max(results))