Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

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


import fractions
from functools import reduce

ans=0
proc=lambda x: reduce(fractions.gcd, x)
GCD_target=proc(A)
#print("GCD_target = {}".format(GCD_target))

for i in range(N):
   #copied_A = A[:]
   remove=A.popleft()
   
   GCD_current= proc(A) #gcd_list(list(A))
   A.append(remove)
   #print(GCD_current)
   ans=max(ans,GCD_current)

print(ans)




Fixed submission:
from fractions import *
n = int(input())
a = [0]+list(map(int, input().split()))+[0]
b = [0]*(n+2)
c = [0]*(n+2)
for i in range(1, n+1):
	b[i] = gcd(b[i-1], a[i])
for i in range(n, 0, -1):
	c[i] = gcd(c[i+1], a[i])

ans=1
for i in range(1, n+1):
    x1 = b[i-1]
    x2 = c[i+1]
    ans=max(ans, gcd(x1, x2))

print(ans)

Buggy python submission (verdict: Runtime Error):
from collections import deque

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


import fractions
from functools import reduce

ans=0
GCD_target=gcd_list(A)
#print("GCD_target = {}".format(GCD_target))

for i in range(N):
   #copied_A = A[:]
   remove=A.popleft()
   proc=lambda x: reduce(fractions.gcd, x)
   GCD_current= proc(list(A)) #gcd_list(list(A))
   A.append(remove)
   #print(GCD_current)
   ans=max(ans,GCD_current)

print(ans)



Fixed submission:
from fractions import *
n = int(input())
a = [0]+list(map(int, input().split()))+[0]
b = [0]*(n+2)
c = [0]*(n+2)
for i in range(1, n+1):
	b[i] = gcd(b[i-1], a[i])
for i in range(n, 0, -1):
	c[i] = gcd(c[i+1], a[i])

ans=1
for i in range(1, n+1):
    x1 = b[i-1]
    x2 = c[i+1]
    ans=max(ans, gcd(x1, x2))

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

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


import fractions
from functools import reduce

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


ans=0
GCD_target=gcd_list(A)
#print("GCD_target = {}".format(GCD_target))

for i in range(N):
   #copied_A = A[:]
   remove=A.popleft()
   GCD_current=gcd_list(list(A))
   A.append(remove)
   #print(GCD_current)
   ans=max(ans,GCD_current)

print(ans)

Fixed submission:
from fractions import *
n = int(input())
a = [0]+list(map(int, input().split()))+[0]
b = [0]*(n+2)
c = [0]*(n+2)
for i in range(1, n+1):
	b[i] = gcd(b[i-1], a[i])
for i in range(n, 0, -1):
	c[i] = gcd(c[i+1], a[i])

ans=1
for i in range(1, n+1):
    x1 = b[i-1]
    x2 = c[i+1]
    ans=max(ans, gcd(x1, x2))

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(map(int,input().split(" ")))

import fractions
from functools import reduce

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


ans=0
GCD_target=gcd_list(A)
#print("GCD_target = {}".format(GCD_target))

for i in range(N):
   #copied_A = A[:]
   remove=A.pop(i)
   GCD_current=gcd_list(A)
   A.insert(i,remove)
   #print(GCD_current)
   ans=max(ans,GCD_current)

print(ans)

Fixed submission:
from fractions import *
n = int(input())
a = [0]+list(map(int, input().split()))+[0]
b = [0]*(n+2)
c = [0]*(n+2)
for i in range(1, n+1):
	b[i] = gcd(b[i-1], a[i])
for i in range(n, 0, -1):
	c[i] = gcd(c[i+1], a[i])

ans=1
for i in range(1, n+1):
    x1 = b[i-1]
    x2 = c[i+1]
    ans=max(ans, gcd(x1, x2))

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(map(int,input().split(" ")))

import fractions
from functools import reduce

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


ans=0
GCD_target=gcd_list(A)
#print("GCD_target = {}".format(GCD_target))

for i in range(N):
   copied_A = A[:]
   copied_A.pop(i)
   GCD_current=gcd_list(copied_A)
   #print(GCD_current)
   ans=max(ans,GCD_current)

print(ans)

Fixed submission:
from fractions import *
n = int(input())
a = [0]+list(map(int, input().split()))+[0]
b = [0]*(n+2)
c = [0]*(n+2)
for i in range(1, n+1):
	b[i] = gcd(b[i-1], a[i])
for i in range(n, 0, -1):
	c[i] = gcd(c[i+1], a[i])

ans=1
for i in range(1, n+1):
    x1 = b[i-1]
    x2 = c[i+1]
    ans=max(ans, gcd(x1, x2))

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=input().split(" ")
for i in range(N):
   A[i]=int(A[i])

import fractions
from functools import reduce

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


ans=0
GCD_target=gcd_list(A)

for i in range(N):
   copied_A = A[:]
   copied_A.pop(i)
   GCD_current=gcd_list(copied_A)
   ans=max(ans,GCD_current)

print(ans)

Fixed submission:
from fractions import *
n = int(input())
a = [0]+list(map(int, input().split()))+[0]
b = [0]*(n+2)
c = [0]*(n+2)
for i in range(1, n+1):
	b[i] = gcd(b[i-1], a[i])
for i in range(n, 0, -1):
	c[i] = gcd(c[i+1], a[i])

ans=1
for i in range(1, n+1):
    x1 = b[i-1]
    x2 = c[i+1]
    ans=max(ans, gcd(x1, x2))

print(ans)