Buggy python submission (verdict: Time Limit Exceeded):
import sys
import fractions
import functools
from collections import Counter, deque, defaultdict
from math import factorial
import heapq, bisect
import math
import itertools
sys.setrecursionlimit(10 ** 5 + 10)
INF = 10**15 +5
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

n = INT()
a = LIST()

res = 0
for i in range(n):
    aa = a[:i] + a[i+1:]
    gcd = functools.reduce(fractions.gcd, aa)
    res = max(res,gcd)

print(res)


Fixed submission:
import sys
import fractions
import functools
from collections import Counter, deque, defaultdict
from math import factorial
import heapq, bisect
import math
import itertools
sys.setrecursionlimit(10 ** 5 + 10)
INF = 10**15 +5
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

n = INT()
a = LIST()

L = [0]*n
R = [0]*n
L[0] = INF
L[1] = a[0] 
R[n-1] = INF
R[n-2] = a[n-1]

GCDs = [0]*n

for i in range(2, n):
    L[i] = fractions.gcd(L[i-1], a[i-1])

for i in range(n-3,-1,-1):
    R[i] = fractions.gcd(R[i+1], a[i+1])

GCDs[0] = R[0]
GCDs[n-1] = L[n-1]

for i in range(1,n-1):
    GCDs[i] = fractions.gcd(L[i], R[i])

res = max(GCDs)

print(res)

Buggy python submission (verdict: Runtime Error):
import sys
import fractions
import functools
from collections import Counter, deque, defaultdict
from math import factorial
import heapq, bisect
import math
import itertools
sys.setrecursionlimit(10 ** 5 + 10)
INF = 10**15 +5
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

n = INT()
a = LIST()

res = 0
for i in range(n):
    aa = a[:i] + a[i+1:]
    gcd = reduce(math.gcd, aa)
    res = max(res,gcd)

print(res)


Fixed submission:
import sys
import fractions
import functools
from collections import Counter, deque, defaultdict
from math import factorial
import heapq, bisect
import math
import itertools
sys.setrecursionlimit(10 ** 5 + 10)
INF = 10**15 +5
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

n = INT()
a = LIST()

L = [0]*n
R = [0]*n
L[0] = INF
L[1] = a[0] 
R[n-1] = INF
R[n-2] = a[n-1]

GCDs = [0]*n

for i in range(2, n):
    L[i] = fractions.gcd(L[i-1], a[i-1])

for i in range(n-3,-1,-1):
    R[i] = fractions.gcd(R[i+1], a[i+1])

GCDs[0] = R[0]
GCDs[n-1] = L[n-1]

for i in range(1,n-1):
    GCDs[i] = fractions.gcd(L[i], R[i])

res = max(GCDs)

print(res)

Buggy python submission (verdict: Runtime Error):
import sys
import fractions
import functools
from collections import Counter, deque, defaultdict
from math import factorial
import heapq, bisect
import math
import itertools
sys.setrecursionlimit(10 ** 5 + 10)
INF = 10**15 +5
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

n = INT()
a = LIST()

res = 0
for i in range(n):
    aa = a[:i] + a[i+1:]
    gcd = functools.reduce(math.gcd, aa)
    res = max(res,gcd)

print(res)


Fixed submission:
import sys
import fractions
import functools
from collections import Counter, deque, defaultdict
from math import factorial
import heapq, bisect
import math
import itertools
sys.setrecursionlimit(10 ** 5 + 10)
INF = 10**15 +5
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

n = INT()
a = LIST()

L = [0]*n
R = [0]*n
L[0] = INF
L[1] = a[0] 
R[n-1] = INF
R[n-2] = a[n-1]

GCDs = [0]*n

for i in range(2, n):
    L[i] = fractions.gcd(L[i-1], a[i-1])

for i in range(n-3,-1,-1):
    R[i] = fractions.gcd(R[i+1], a[i+1])

GCDs[0] = R[0]
GCDs[n-1] = L[n-1]

for i in range(1,n-1):
    GCDs[i] = fractions.gcd(L[i], R[i])

res = max(GCDs)

print(res)