Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
 
def gcd(a,b):
  if b==0:
    return a
  else:
  	return gcd(b, a%b)

def gcd_list(X):
  dmy=gcd(X[0],X[1])
  dmy=X[0]*X[1]
  for i in range(len(X)):
    dmy=gcd(dmy,X[i])
  return dmy
 
if N==2:
  print(max(A))
else:
  R=0
  for i in range(N):
    C=A[:i]
    C.extend(A[i+1:])
    #R.append(gcd_list(C))
    #R[i]=gcd_list(C)
    R=max(R,gcd_list(C))
 
  #print(int(max(R)))
  print(int(R))

Fixed submission:
def gcd(a,b):
    if b == 0:
        return a
    if a % b == 0:
        return b
    else:
        return gcd(b,a%b)

N = int(input())
A = [i for i in map(int,input().split())]
L = [0]
R = [0]
for i in range(N):
    L.append(gcd(L[-1],A[i]))
for i in range(N-1,-1,-1):
    R.append(gcd(R[-1],A[i]))
R.reverse()
g = []
for i in range(N):
    g.append(gcd(L[i],R[i+1]))
print(max(g))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
 
def gcd(a,b):
  if b==0:
    return a
  else:
  	return gcd(b, a%b)

def gcd_list(X):
  dmy=gcd(X[0],X[1])
  dmy=X[0]*X[1]
  for i in range(len(X)):
    dmy=gcd(dmy,X[i])
  return dmy
 
if N==2:
  print(max(A))
else:
  R=[0]*N
  for i in range(N):
    C=A[:i]
    C.extend(A[i+1:])
    #R.append(gcd_list(C))
    R[i]=gcd_list(C)
 
  print(int(max(R)))

Fixed submission:
def gcd(a,b):
    if b == 0:
        return a
    if a % b == 0:
        return b
    else:
        return gcd(b,a%b)

N = int(input())
A = [i for i in map(int,input().split())]
L = [0]
R = [0]
for i in range(N):
    L.append(gcd(L[-1],A[i]))
for i in range(N-1,-1,-1):
    R.append(gcd(R[-1],A[i]))
R.reverse()
g = []
for i in range(N):
    g.append(gcd(L[i],R[i+1]))
print(max(g))

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

def gcd(a,b):
  if b==0:
    return a
  else:
  	return gcd(b, a%b)

def gcd_list(X):
  dmy=gcd(X[0],X[1])
  dmy=X[0]*X[1]
  for i in range(len(X)):
    dmy=gcd(dmy,X[i])
  return dmy

if N==2:
  print(max(A))
else:
  R=[]
  for i in range(N):
    C=A[:i]
    C.extend(A[i+1:])
    R.append(gcd_list(C))

  print(int(max(R)))

Fixed submission:
def gcd(a,b):
    if b == 0:
        return a
    if a % b == 0:
        return b
    else:
        return gcd(b,a%b)

N = int(input())
A = [i for i in map(int,input().split())]
L = [0]
R = [0]
for i in range(N):
    L.append(gcd(L[-1],A[i]))
for i in range(N-1,-1,-1):
    R.append(gcd(R[-1],A[i]))
R.reverse()
g = []
for i in range(N):
    g.append(gcd(L[i],R[i+1]))
print(max(g))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
 
def gcd(a,b):
  if b==0:
    return a
  else:
  	return gcd(b, a%b)
 
def gcd_list(X):
  dmy=gcd(X[0],X[1])
  dmy=X[0]*X[1]
  for i in range(len(X)):
    dmy=gcd(dmy,X[i])
  return dmy
 
if N==2:
  print(max(A))
else:
  R=[]
  for i in range(N):
    C=A[:i]
    C.extend(A[i+1:])
    R.append(gcd_list(C))
 
  print(int(max(R)))

Fixed submission:
def gcd(a,b):
    if b == 0:
        return a
    if a % b == 0:
        return b
    else:
        return gcd(b,a%b)

N = int(input())
A = [i for i in map(int,input().split())]
L = [0]
R = [0]
for i in range(N):
    L.append(gcd(L[-1],A[i]))
for i in range(N-1,-1,-1):
    R.append(gcd(R[-1],A[i]))
R.reverse()
g = []
for i in range(N):
    g.append(gcd(L[i],R[i+1]))
print(max(g))

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

def gcd(a,b):
  if b==0:
    return a
  else:
  	return gcd(b, a%b)

def gcd_list(X):
  dmy=gcd(X[0],X[1])
  dmy=X[0]*X[1]
  for i in range(len(X)):
    dmy=gcd(dmy,X[i])
  return dmy

if N==2:
  print(max(A))
else:
  R=[]
  for i in range(N):
    C=A[:i]
    C.extend(A[i+1:])
    R.append(gcd_list(C))

  print(int(max(R)))

Fixed submission:
def gcd(a,b):
    if b == 0:
        return a
    if a % b == 0:
        return b
    else:
        return gcd(b,a%b)

N = int(input())
A = [i for i in map(int,input().split())]
L = [0]
R = [0]
for i in range(N):
    L.append(gcd(L[-1],A[i]))
for i in range(N-1,-1,-1):
    R.append(gcd(R[-1],A[i]))
R.reverse()
g = []
for i in range(N):
    g.append(gcd(L[i],R[i+1]))
print(max(g))