Buggy python submission (verdict: Time Limit Exceeded):
n = int(input(), 10)
a = list(map(int, input().split()))
greatCDlist = []


def gcd(m, n):
    if m < n:
        m ^= n
        n ^= m
        m ^= n
    if n == 0:
        return m
    else:
        return gcd(n, m % n)


for i in range(n):
    pop = a.pop(i)
    greatCD = 1
    for j in range(n-1):
        if j == 0:
            greatCD = a[0]
        else:
            greatCD = gcd(greatCD, a[j])
    a.insert(i, pop)
    greatCDlist.append(greatCD)

maxg = 1
for i in range(n):
    if maxg < greatCDlist[i]:
        maxg = greatCDlist[i]

print(maxg)


Fixed submission:
n = int(input(), 10)
a = list(map(int, input().split()))
greatCDlist = []


def gcd(m, n):
    if m < n:
        m ^= n
        n ^= m
        m ^= n
    if n == 0:
        return m
    else:
        return gcd(n, m % n)


left = [0 for i in range(n+1)]
right = [0 for i in range(n+1)]

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


for i in range(n-1, -1, -1):
    right[i] = gcd(right[i+1], a[i])


result = 0
for i in range(n):
    l = left[i]
    r = right[i+1]
    result = max(result, gcd(l, r))

print(result)

Buggy python submission (verdict: Runtime Error):
n = int(input(), 10)
a = list(map(int, input().split()))
greatCDlist = []

for i in range(n):
  pop = a.pop(i)
  greatCD = 1
  for j in range(n):
    if j == 0:
      greatCD = gcd(a[0], a[1])
    else:
      greatCD = gcd(greatCD, a[j])
  a.insert(i, pop)
  greatCDlist.append(greatCD)

maxg = 1
for i in range(n):
  if maxg > greatCDlist[i]:
    maxg = greatCDlist[i]

print(maxg)


def gcd(m, n):
  if m < n:
    m ^= n
    n ^= m
    m ^= n
  if n == 0:
    return m
  else:
    return gcd(n, n % m)

Fixed submission:
n = int(input(), 10)
a = list(map(int, input().split()))
greatCDlist = []


def gcd(m, n):
    if m < n:
        m ^= n
        n ^= m
        m ^= n
    if n == 0:
        return m
    else:
        return gcd(n, m % n)


left = [0 for i in range(n+1)]
right = [0 for i in range(n+1)]

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


for i in range(n-1, -1, -1):
    right[i] = gcd(right[i+1], a[i])


result = 0
for i in range(n):
    l = left[i]
    r = right[i+1]
    result = max(result, gcd(l, r))

print(result)

Buggy python submission (verdict: Runtime Error):
n = int(input(), 10)
a = list(map(int, input().split()))
greatCDlist = []

for i in range(n):
  pop = a.pop(i)
  greatCD = 1
  for j in range(n):
    if j == 0:
		greatCD = gcd(a[0], a[1])
    else:
      greatCD = gcd(greatCD, a[j])
  a.insert(i, pop)
  greatCDlist.append(greatCD)

maxg = 1
for i in range(n):
  if maxg > greatCDlist[i]:
    maxg = greatCDlist[i]

print(maxg)


def gcd(m, n):
  if m < n:
    m ^= n
    n ^= m
    m ^= n
  if n == 0:
    return m
  else:
    return gcd(n, n % m)

Fixed submission:
n = int(input(), 10)
a = list(map(int, input().split()))
greatCDlist = []


def gcd(m, n):
    if m < n:
        m ^= n
        n ^= m
        m ^= n
    if n == 0:
        return m
    else:
        return gcd(n, m % n)


left = [0 for i in range(n+1)]
right = [0 for i in range(n+1)]

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


for i in range(n-1, -1, -1):
    right[i] = gcd(right[i+1], a[i])


result = 0
for i in range(n):
    l = left[i]
    r = right[i+1]
    result = max(result, gcd(l, r))

print(result)