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

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

l = [0]*(n+2) # l(i) = A1, A2, ..., A(i-1)のgcd
r = [0]*(n+2) # r(i) = Ai, A(i+1), ..., A(n)のgcd

for i in range(n):
	l[i+1] = math.gcd(l[i],a[i])
for i in reversed(range(n)):
	r[i] = math.gcd(r[i+1],a[i])

ext = [0] * n
for i in range(n):
	ext[i] = math.gcd(l[i],r[i+1])

print (max(ext))

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


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

l = [0]*(n+2) # l(i) = A1, A2, ..., A(i-1)のgcd
r = [0]*(n+2) # r(i) = Ai, A(i+1), ..., A(n)のgcd

for i in range(n):
	l[i+1] = gcd(l[i],a[i])
for i in reversed(range(n)):
	r[i] = gcd(r[i+1],a[i])

ext = [0] * n
for i in range(n):
	ext[i] = gcd(l[i],r[i+1])

print (max(ext))

Buggy python submission (verdict: Time Limit Exceeded):
def gcd(a, b):
	if a < b:
		a, b = b, a
	if b == 0:
		return a
	c = a % b
	return gcd(b, c)

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

maxt = 0
for i in range(n):

	b = a[0:i]
	b += (a[i+1:n])
	tmp = b[0]

	for bi in b[1::]:
		tmp = gcd(tmp,bi)
		
	if maxt < tmp:
		maxt = tmp
 
print (maxt)


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


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

l = [0]*(n+2) # l(i) = A1, A2, ..., A(i-1)のgcd
r = [0]*(n+2) # r(i) = Ai, A(i+1), ..., A(n)のgcd

for i in range(n):
	l[i+1] = gcd(l[i],a[i])
for i in reversed(range(n)):
	r[i] = gcd(r[i+1],a[i])

ext = [0] * n
for i in range(n):
	ext[i] = gcd(l[i],r[i+1])

print (max(ext))

Buggy python submission (verdict: Runtime Error):
import math
def gcd(a, b):
	if a < b:
		a, b = b, a
	if b == 0:
		return a
	c = a % b
	return gcd(b, c)

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

maxt = 0
for i in range(n):
	b = a[0:i]
	b += (a[i+1:n])
	tmp = b[0]

	for bi in b[1::]:
		tmp = math.gcd(tmp,bi)
		
	if maxt < tmp:
		maxt = tmp
 
print (maxt)

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


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

l = [0]*(n+2) # l(i) = A1, A2, ..., A(i-1)のgcd
r = [0]*(n+2) # r(i) = Ai, A(i+1), ..., A(n)のgcd

for i in range(n):
	l[i+1] = gcd(l[i],a[i])
for i in reversed(range(n)):
	r[i] = gcd(r[i+1],a[i])

ext = [0] * n
for i in range(n):
	ext[i] = gcd(l[i],r[i+1])

print (max(ext))

Buggy python submission (verdict: Runtime Error):
import math
def gcd(a, b):
	if a < b:
		a, b = b, a
	if b == 0:
		return a
	c = a % b
	return gcd(b, c)

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

maxt = 0
for i in range(n):
	b = []
	for k in range(n):
		if (i != k):
			b.append(a[k])
	tmp = b[0]

	for bi in b[1::]:
		tmp = math.gcd(tmp,bi)
		
	if maxt < tmp:
		maxt = tmp
 
print (maxt)

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


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

l = [0]*(n+2) # l(i) = A1, A2, ..., A(i-1)のgcd
r = [0]*(n+2) # r(i) = Ai, A(i+1), ..., A(n)のgcd

for i in range(n):
	l[i+1] = gcd(l[i],a[i])
for i in reversed(range(n)):
	r[i] = gcd(r[i+1],a[i])

ext = [0] * n
for i in range(n):
	ext[i] = gcd(l[i],r[i+1])

print (max(ext))

Buggy python submission (verdict: Time Limit Exceeded):
 
 
def gcd(a, b):
	if a < b:
		a, b = b, a
	if b == 0:
		return a
	c = a % b
	return gcd(b, c)
 


n = int(input())
a = list(map(int,input().split()))
gcds = []
for i in range(n):
	listgcd = 0
	b = []
	for k in range(n):
		if (i != k):
			b.append(a[k])
	tmp = b[0]
	for bi in b:
		tmp = gcd(tmp,bi)
		
	gcds.append(tmp)
 
print (max(gcds))

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


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

l = [0]*(n+2) # l(i) = A1, A2, ..., A(i-1)のgcd
r = [0]*(n+2) # r(i) = Ai, A(i+1), ..., A(n)のgcd

for i in range(n):
	l[i+1] = gcd(l[i],a[i])
for i in reversed(range(n)):
	r[i] = gcd(r[i+1],a[i])

ext = [0] * n
for i in range(n):
	ext[i] = gcd(l[i],r[i+1])

print (max(ext))

Buggy python submission (verdict: Runtime Error):
import math
from functools import reduce
 
 
def gcd_list(numbers):
	return reduce(math.gcd, numbers)
 
 
n = int(input())
a = list(map(int,input().split()))
gcds = []
for i in range(n):
	b = []
	for k in range(n):
		if (i != k):
			b.append(a[k])
	gcds.append(gcd_list(b))
 
print (max(gcds))

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


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

l = [0]*(n+2) # l(i) = A1, A2, ..., A(i-1)のgcd
r = [0]*(n+2) # r(i) = Ai, A(i+1), ..., A(n)のgcd

for i in range(n):
	l[i+1] = gcd(l[i],a[i])
for i in reversed(range(n)):
	r[i] = gcd(r[i+1],a[i])

ext = [0] * n
for i in range(n):
	ext[i] = gcd(l[i],r[i+1])

print (max(ext))

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

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

def gcd_list(numbers):
    return reduce(math.gcd, numbers)


n = int(input())
a = list(map(int,input().split()))
gcds = []
for i in range(n):
	b = []
	for k in range(n):
		if (i != k):
			b.append(a[k])
	gcds.append(gcd_list(b))

print (max(gcds))

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


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

l = [0]*(n+2) # l(i) = A1, A2, ..., A(i-1)のgcd
r = [0]*(n+2) # r(i) = Ai, A(i+1), ..., A(n)のgcd

for i in range(n):
	l[i+1] = gcd(l[i],a[i])
for i in reversed(range(n)):
	r[i] = gcd(r[i+1],a[i])

ext = [0] * n
for i in range(n):
	ext[i] = gcd(l[i],r[i+1])

print (max(ext))