Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))

def gcd(m, n):
  while n:
    m, n = n, m%n
  return m

L = [0] * N
for i in range(N-1):
  L[i+1] = gcd(L[i], A[i])

R = [0] * N
for i in range(N, -1, -1):
  R[i-1] = gcd(R[i], A[i])

ans = 0
for i in range(N):
  ans = max(ans, gcd(L[i], R[i]))
print(ans)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))

def gcd(m, n):
  while n:
    m, n = n, m%n
  return m

L = [0]
R = [0]
for i in range(N):
  L.append(gcd(L[i], A[i]))
  R.append(gcd(R[i], A[-(i+1)]))
R = R[::-1]
ans = 0
for i in range(N):
  ans = max(ans, gcd(L[i], R[i+1]))
print(ans)

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

def gcd(m, n):
  while n:
    m, n = n, m%n
  return m

ans = []
for i in range(N):
  tmp = A[:i] + A[i+1:]
  res = tmp[0]
  for r in range(1,len(tmp)):
    res = gcd(res, tmp[r])
  ans.append(res)
print(max(ans))

Fixed submission:
N = int(input())
A = list(map(int,input().split()))

def gcd(m, n):
  while n:
    m, n = n, m%n
  return m

L = [0]
R = [0]
for i in range(N):
  L.append(gcd(L[i], A[i]))
  R.append(gcd(R[i], A[-(i+1)]))
R = R[::-1]
ans = 0
for i in range(N):
  ans = max(ans, gcd(L[i], R[i+1]))
print(ans)

Buggy python submission (verdict: Runtime Error):
def ans():
  N = int(input())
  A = list(map(int,input().split()))

  def gcd(m, n):
    while n:
      m, n = n, m%n
    return m

  res = []
  k = max(A)
  f = False
  ind = A.index(k)
  if k%2 == 0:
    f = True
  for i in range(N):
    if i != ind:
      if f:
        if (k%A[i])%2 == 0:
          res.append(gcd(k, A[i]))
      else:
        if (k%A[i])%2 == 1:
          res.append(gcd(k, A[i]))
  print(max(res))
ans()

Fixed submission:
N = int(input())
A = list(map(int,input().split()))

def gcd(m, n):
  while n:
    m, n = n, m%n
  return m

L = [0]
R = [0]
for i in range(N):
  L.append(gcd(L[i], A[i]))
  R.append(gcd(R[i], A[-(i+1)]))
R = R[::-1]
ans = 0
for i in range(N):
  ans = max(ans, gcd(L[i], R[i+1]))
print(ans)

Buggy python submission (verdict: Runtime Error):
def ans():
  N = int(input())
  A = list(map(int,input().split()))

  def gcd(m, n):
    while n:
      m, n = n, m%n
    return m

  res = set()
  k = max(A)
  for i in range(N):
    res.add(gcd(A[i], k))
  print(list(res)[N-1])

ans()

Fixed submission:
N = int(input())
A = list(map(int,input().split()))

def gcd(m, n):
  while n:
    m, n = n, m%n
  return m

L = [0]
R = [0]
for i in range(N):
  L.append(gcd(L[i], A[i]))
  R.append(gcd(R[i], A[-(i+1)]))
R = R[::-1]
ans = 0
for i in range(N):
  ans = max(ans, gcd(L[i], R[i+1]))
print(ans)

Buggy python submission (verdict: Runtime Error):
def ans():
  N = int(input())
  A = list(map(int,input().split()))

  def gcd(m, n):
    while n:
      m, n = n, m%n
    return m

  res = set()
  x = min(A)
  for i in range(N):
    res.add(gcd(A[i], x))

  b = A[0]
  for a in A[1:]:
    b = gcd(a, b)
  print(list(res)[b-1])
ans()

Fixed submission:
N = int(input())
A = list(map(int,input().split()))

def gcd(m, n):
  while n:
    m, n = n, m%n
  return m

L = [0]
R = [0]
for i in range(N):
  L.append(gcd(L[i], A[i]))
  R.append(gcd(R[i], A[-(i+1)]))
R = R[::-1]
ans = 0
for i in range(N):
  ans = max(ans, gcd(L[i], R[i+1]))
print(ans)