Buggy python submission (verdict: Time Limit Exceeded):
import fractions as math
n = int(input())
list1 = list(map(int,input().split()))
a = 0
for i in range(n):
	L,R = 0,0
	for j in range(0,i):
		L = math.gcd(L,list1[j])
	for j in range(i+1,n):
		R = math.gcd(R,list1[j])
	a = max(a,math.gcd(L,R))

print(a)

Fixed submission:
from collections import deque
import fractions as math
n = int(input())
list1 = list(map(int,input().split()))
list1 = deque(list1)
L = deque([0])
R = deque([0])
M = []

for i in range(len(list1)-1):
	L.append(math.gcd(L[i],list1[i]))
	R.append(math.gcd(R[i],list1[n-i-1]))

for i in range(len(L)):
	M.append(math.gcd(L[i],R[len(R)-i-1]))
print(max(M))

Buggy python submission (verdict: Runtime Error):
import math
#import fractions as math
n = int(input())
list1 = list(map(int,input().split()))
a = 0
for i in range(n):
	L,R = 0,0
	for j in range(0,i):
		L = math.gcd(L,list1[j])
	for j in range(i+1,n):
		R = math.gcd(R,list1[j])
	a = max(a,math.gcd(L,R))

print(a)

Fixed submission:
from collections import deque
import fractions as math
n = int(input())
list1 = list(map(int,input().split()))
list1 = deque(list1)
L = deque([0])
R = deque([0])
M = []

for i in range(len(list1)-1):
	L.append(math.gcd(L[i],list1[i]))
	R.append(math.gcd(R[i],list1[n-i-1]))

for i in range(len(L)):
	M.append(math.gcd(L[i],R[len(R)-i-1]))
print(max(M))

Buggy python submission (verdict: Runtime Error):
import fractions as math
n = int(input())
list1 = list(map(int,input().split()))

a = list1[0]
b = 0

for i in range(n):
	if a > math.gcd(a,list1[i]):
		a = math.gcd(a,list1[i])
		b = list1.index(list1[i])
if b == 1:
	if math.gcd(list1[0],list1[2]) < math.gcd(list1[1],list1[2]):
		b = 0
del list1[b]
a = list1[0]
for i in range(len(list1)):
	a = min(a,math.gcd(a,list1[i]))
print(a)

Fixed submission:
from collections import deque
import fractions as math
n = int(input())
list1 = list(map(int,input().split()))
list1 = deque(list1)
L = deque([0])
R = deque([0])
M = []

for i in range(len(list1)-1):
	L.append(math.gcd(L[i],list1[i]))
	R.append(math.gcd(R[i],list1[n-i-1]))

for i in range(len(L)):
	M.append(math.gcd(L[i],R[len(R)-i-1]))
print(max(M))

Buggy python submission (verdict: Runtime Error):
import math
#import fractions as math
n = int(input())
list1 = list(map(int,input().split()))
if math.gcd(list1[0],list1[1]) < math.gcd(list1[0],list1[-1]):
	a = math.gcd(list1[0],list1[-1])
	b = 0
else:
	a = math.gcd(list1[0],list1[1])
	b = -1

for i in range(0,n):
	if a > math.gcd(a,list1[i]):
		a = math.gcd(a,list1[i])
		b = list1.index(list1[i])
del list1[b]
a = list1[0]
for i in range(0,len(list1)):
	a = min(a,math.gcd(a,list1[i]))
print(a)

Fixed submission:
from collections import deque
import fractions as math
n = int(input())
list1 = list(map(int,input().split()))
list1 = deque(list1)
L = deque([0])
R = deque([0])
M = []

for i in range(len(list1)-1):
	L.append(math.gcd(L[i],list1[i]))
	R.append(math.gcd(R[i],list1[n-i-1]))

for i in range(len(L)):
	M.append(math.gcd(L[i],R[len(R)-i-1]))
print(max(M))

Buggy python submission (verdict: Runtime Error):
import math
#import fractions as math
n = int(input())
list1 = list(map(int,input().split()))
a = math.gcd(list1[0],list1[-1])
b = 0
for i in range(0,n):
	if a > math.gcd(a,list1[i]):
		a = math.gcd(a,list1[i])
		b = list1.index(list1[i])
del list1[b]
a = list1[0]
for i in range(0,len(list1)):
	a = min(a,math.gcd(a,list1[i]))
print(a)




Fixed submission:
from collections import deque
import fractions as math
n = int(input())
list1 = list(map(int,input().split()))
list1 = deque(list1)
L = deque([0])
R = deque([0])
M = []

for i in range(len(list1)-1):
	L.append(math.gcd(L[i],list1[i]))
	R.append(math.gcd(R[i],list1[n-i-1]))

for i in range(len(L)):
	M.append(math.gcd(L[i],R[len(R)-i-1]))
print(max(M))