Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
import fractions

N = int(input().rstrip())
As = list(map(int, input().rstrip().split()))


def gcd_list(cur_gcd, numbers):
    res = cur_gcd
    for num in numbers:
        res = fractions.gcd(res, num)
    return res


max_gcd = max(As)
if N > 2:
    # i == 0
    # others = As[1:]
    max_gcd = gcd_list(max_gcd, As[1:])
    tmp_gcd = As[0]

    # i >= 1
    for i in range(1, N):
        # others = As[i + 1:]
        max_gcd = max(gcd_list(tmp_gcd, As[i + 1:]), max_gcd)
        tmp_gcd = fractions.gcd(tmp_gcd, As[i])

print(max_gcd)

Fixed submission:
# -*- coding: utf-8 -*-
import fractions

N = int(input().rstrip())
A = [0] + list(map(int, input().rstrip().split())) + [0]

L = [0] * (N + 2)
R = [0] * (N + 2)

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

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

print(max(fractions.gcd(L[i], R[i + 2]) for i in range(0, N)))

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
import fractions

N = int(input().rstrip())
As = list(map(int, input().rstrip().split()))


def gcd_list(cur_gcd, numbers):
    res = cur_gcd
    for idx in range(len(numbers)):
        res = fractions.gcd(res, numbers[idx])
    return res


max_gcd = max(As)
if N > 2:
    # i == 0
    others = As[1:]
    max_gcd = gcd_list(max_gcd, others)
    tmp_gcd = As[0]

    # i >= 1
    for i in range(1, N):
        others = As[i + 1:]
        max_gcd = max(gcd_list(tmp_gcd, others), max_gcd)
        tmp_gcd = fractions.gcd(tmp_gcd, As[i])

print(max_gcd)

Fixed submission:
# -*- coding: utf-8 -*-
import fractions

N = int(input().rstrip())
A = [0] + list(map(int, input().rstrip().split())) + [0]

L = [0] * (N + 2)
R = [0] * (N + 2)

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

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

print(max(fractions.gcd(L[i], R[i + 2]) for i in range(0, N)))

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
import fractions

N = int(input().rstrip())
As = list(map(int, input().rstrip().split()))


def gcd_list(cur_gcd, numbers):
    res = cur_gcd
    for idx in range(len(numbers)):
        res = fractions.gcd(res, numbers[idx])
    return res


max_gcd = 0
if(N) == 2:
    max_gcd = max(As)
else:
    # i == 0
    others = [As[j] for j in range(1, N)]
    res = fractions.gcd(others[0], others[1])
    if len(others) > 2:
        res = gcd_list(res, As[2:])
    max_gcd = res
    tmp_gcd = As[0]

    # i >= 1
    for i in range(1, N):
        others = [As[j] for j in range(N) if j > i]
        max_gcd = max(gcd_list(tmp_gcd, others), max_gcd)
        tmp_gcd = fractions.gcd(tmp_gcd, As[i])

print(max_gcd)

Fixed submission:
# -*- coding: utf-8 -*-
import fractions

N = int(input().rstrip())
A = [0] + list(map(int, input().rstrip().split())) + [0]

L = [0] * (N + 2)
R = [0] * (N + 2)

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

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

print(max(fractions.gcd(L[i], R[i + 2]) for i in range(0, N)))

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
import fractions

N = int(input().rstrip())
As = list(map(int, input().rstrip().split()))


def gcd_list(numbers):
    res = fractions.gcd(numbers[0], numbers[1])
    if len(numbers) > 2:
        for idx in range(2, len(numbers)):
            res = fractions.gcd(res, numbers[idx])
    return res


max_gcd = 0
if(N) == 2:
    max_gcd = max(As)
else:
    for i in range(N):
        others = [As[j] for j in range(N) if j != i]
        max_gcd = max(gcd_list(others), max_gcd)

print(max_gcd)

Fixed submission:
# -*- coding: utf-8 -*-
import fractions

N = int(input().rstrip())
A = [0] + list(map(int, input().rstrip().split())) + [0]

L = [0] * (N + 2)
R = [0] * (N + 2)

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

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

print(max(fractions.gcd(L[i], R[i + 2]) for i in range(0, N)))

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import math

N = int(input().rstrip())
As = list(map(int, input().rstrip().split()))


def gcd_list(numbers):
    res = math.gcd(numbers[0], numbers[1])
    if len(numbers) > 2:
        for idx in range(2, len(numbers)):
            res = math.gcd(res, numbers[idx])
    return res


max_gcd = 0
if(N) == 2:
    max_gcd = max(As)
else:
    for i in range(N):
        others = [As[j] for j in range(N) if j != i]
        max_gcd = max(gcd_list(others), max_gcd)

print(max_gcd)

Fixed submission:
# -*- coding: utf-8 -*-
import fractions

N = int(input().rstrip())
A = [0] + list(map(int, input().rstrip().split())) + [0]

L = [0] * (N + 2)
R = [0] * (N + 2)

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

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

print(max(fractions.gcd(L[i], R[i + 2]) for i in range(0, N)))

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import math

N = int(input())
As = list(map(int, input().split()))


def gcd_list(numbers):
    res = math.gcd(numbers[0], numbers[1])
    if len(numbers) > 2:
        for idx in range(2, len(numbers)):
            res = math.gcd(res, numbers[idx])
    return res


max_gcd = 0
if(N) == 2:
    max_gcd = max(As)
else:
    for i in range(N):
        others = [As[j] for j in range(N) if j != i]
        max_gcd = max(gcd_list(others), max_gcd)

print(max_gcd)

Fixed submission:
# -*- coding: utf-8 -*-
import fractions

N = int(input().rstrip())
A = [0] + list(map(int, input().rstrip().split())) + [0]

L = [0] * (N + 2)
R = [0] * (N + 2)

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

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

print(max(fractions.gcd(L[i], R[i + 2]) for i in range(0, N)))

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import math

N = int(input())
As = list(map(int, input().split()))


def gcd_list(numbers):
    res = math.gcd(numbers[0], numbers[1])
    for idx in range(2, len(numbers)):
        res = math.gcd(res, numbers[idx])
    return res


max_gcd = 0
if(N) == 2:
    max_gcd = max(As)
else:
    for i in range(N):
        others = [As[j] for j in range(N) if j != i]
        max_gcd = max(gcd_list(others), max_gcd)

print(max_gcd)

Fixed submission:
# -*- coding: utf-8 -*-
import fractions

N = int(input().rstrip())
A = [0] + list(map(int, input().rstrip().split())) + [0]

L = [0] * (N + 2)
R = [0] * (N + 2)

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

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

print(max(fractions.gcd(L[i], R[i + 2]) for i in range(0, N)))

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import math
from functools import reduce


N = int(input())
As = list(map(int, input().split()))


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

max_gcd = 0

for i in range(len(As)):
    others = [As[j] for j in range(len(As)) if j != i]
    max_gcd = max(gcd_list(others), max_gcd)

print(max_gcd)

Fixed submission:
# -*- coding: utf-8 -*-
import fractions

N = int(input().rstrip())
A = [0] + list(map(int, input().rstrip().split())) + [0]

L = [0] * (N + 2)
R = [0] * (N + 2)

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

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

print(max(fractions.gcd(L[i], R[i + 2]) for i in range(0, N)))