Buggy python submission (verdict: Time Limit Exceeded):
#https://atcoder.jp/contests/abc125/tasks/abc125_c



N = int(input())
A = [int(i) for i in input().split()]

i=2
b=[1]#a=0
c=[1]
d=[]
while True:
    a = 0
    for j in range(N):
        if A[j] % i != 0:
            a += 1
        if a > 1:
            d.append(i) #black list
            break

    #print(i,A,a)

    if a == 0:
        b.append(i) #white list
        for j in range(len(A)):
            A[j] = int(A[j] / i)
        i = 2
    if a == 1:
        c.append(i) #gray list
    if a > 0:
        i += 1
    
    k=0
    while True:
        if k >= len(d):
            break
        if i % d[k] == 0:
            i += 1
            k = -1
        k += 1


    if i > min(A):
        break

bs = 1
for i in range(len(b)):
    bs *= b[i]
print(bs * max(c))


Fixed submission:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 0, 1, -1, 1, -1, -1, 1]
dy = [1, -1, 0, 0, 1, -1, 1, -1]

n = INT()
a = LIST()
arr1 = [0 for _ in range(n)]
arr2 = [0 for _ in range(n)]
arr1[0] = a[0]
arr2[-1] = a[-1]
for i in range(1, n):
    arr1[i] = gcd(arr1[i - 1], a[i])
for i in reversed(range(n - 1)):
    arr2[i] = gcd(arr2[i + 1], a[i])
ans = arr1[-1]
for i in range(n): #delete a[i]
    if 0 < i < n - 1:
        ans = max(ans, gcd(arr1[i - 1], arr2[i + 1]))
    elif i == 0:
        ans = max(ans, arr2[1])
    elif i == n - 1:
        ans = max(ans, arr1[n - 2])
print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = [int(i) for i in input().split()]

i=2
b=[1]#a=0
c=[1]
d=[]
while True:
    a = 0
    for j in range(N):
        if A[j] % i != 0:
            a += 1
        if a > 1:
            d.append(i) #black list
            break

    print(i,A,a)

    if a == 0:
        b.append(i) #white list
        for j in range(len(A)):
            A[j] = int(A[j] / i)
        i = 2
    if a == 1:
        c.append(i) #gray list
    if a > 0:
        i += 1
    
    k=0
    while True:
        if k >= len(d):
            break
        if i % d[k] == 0:
            i += 1
            k = -1
        k += 1


    if i > min(A):
        break

bs = 1
for i in range(len(b)):
    bs *= b[i]
print(bs * max(c))

Fixed submission:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 0, 1, -1, 1, -1, -1, 1]
dy = [1, -1, 0, 0, 1, -1, 1, -1]

n = INT()
a = LIST()
arr1 = [0 for _ in range(n)]
arr2 = [0 for _ in range(n)]
arr1[0] = a[0]
arr2[-1] = a[-1]
for i in range(1, n):
    arr1[i] = gcd(arr1[i - 1], a[i])
for i in reversed(range(n - 1)):
    arr2[i] = gcd(arr2[i + 1], a[i])
ans = arr1[-1]
for i in range(n): #delete a[i]
    if 0 < i < n - 1:
        ans = max(ans, gcd(arr1[i - 1], arr2[i + 1]))
    elif i == 0:
        ans = max(ans, arr2[1])
    elif i == n - 1:
        ans = max(ans, arr1[n - 2])
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
#https://atcoder.jp/contests/abc125/tasks/abc125_c

import math

N = int(input())
A = [int(i) for i in input().split()]

i=2
b=[1]#a=0
c=[1]
#d=[]
while True:
    a = 0
    for j in range(N):
        if A[j] % i != 0:
            a += 1
        #print(i,A[j],a)
        if a > 1:
            break

    if a == 0:
        b.append(i) #white list
        for j in range(len(A)):
            A[j] = int(A[j] / i)
        i = 2
    if a == 1:
        c.append(i) #gray list
    if a > 0:
        i += 1

    if i > min(A):
        break

bs = 1
for i in range(len(b)):
    bs *= b[i]
print(bs * max(c))

'''
a=[]
for i in range(0,N,2):
    if i == N-1:
        a.append(A[i])
        break
    else:
        a.append(math.gcd(A[i],A[i+1]))
'''

Fixed submission:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 0, 1, -1, 1, -1, -1, 1]
dy = [1, -1, 0, 0, 1, -1, 1, -1]

n = INT()
a = LIST()
arr1 = [0 for _ in range(n)]
arr2 = [0 for _ in range(n)]
arr1[0] = a[0]
arr2[-1] = a[-1]
for i in range(1, n):
    arr1[i] = gcd(arr1[i - 1], a[i])
for i in reversed(range(n - 1)):
    arr2[i] = gcd(arr2[i + 1], a[i])
ans = arr1[-1]
for i in range(n): #delete a[i]
    if 0 < i < n - 1:
        ans = max(ans, gcd(arr1[i - 1], arr2[i + 1]))
    elif i == 0:
        ans = max(ans, arr2[1])
    elif i == n - 1:
        ans = max(ans, arr1[n - 2])
print(ans)