Buggy python submission (verdict: Time Limit Exceeded):
def make_divisors(n):
    divisors = []

    for i in range(1, int(n**0.5) + 1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n // i)

    divisors.sort(reverse=True)
    return divisors


N = int(input())
A = sorted([int(x) for x in input().split()])
ans = 1

for i in range(2):
    divisors = make_divisors(A[i])

    for divisor in divisors:
        indivisible_count = 0
        for j in range(N):
            if A[j] % divisor != 0:
                indivisible_count += 1

        if indivisible_count <= 1 and divisor > ans:
            ans = divisor

print(ans)


Fixed submission:
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5) + 1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n // i)

    divisors.sort(reverse=True)
    return divisors


N = int(input())
A = sorted([int(x) for x in input().split()])

ans = 1
for i in range(2):
    div_list = make_divisors(A[i])

    for div_i in div_list:
        wrong_count = 0

        for A_i in A:
            if A_i % div_i != 0:
                wrong_count += 1

        if wrong_count <= 1 and div_i > ans:
            ans = div_i

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import fractions
from functools import reduce
import copy


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


N = int(input())
A = [int(i) for i in input().split()]

ans = 1
for i in range(N):
    a = copy.copy(A)
    a.pop(i)
    g = gcd_list(a)
    if g > ans:
        ans = g
print(ans)


Fixed submission:
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5) + 1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n // i)

    divisors.sort(reverse=True)
    return divisors


N = int(input())
A = sorted([int(x) for x in input().split()])

ans = 1
for i in range(2):
    div_list = make_divisors(A[i])

    for div_i in div_list:
        wrong_count = 0

        for A_i in A:
            if A_i % div_i != 0:
                wrong_count += 1

        if wrong_count <= 1 and div_i > ans:
            ans = div_i

print(ans)

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

divs = {}
for A_i in A:
    for i in range(1, int(A_i ** 0.5) + 1):
        if A_i % i == 0:
            if i in divs:
                divs[i] += 1
            else:
                divs[i] = 1
            if i != A_i // i:
                if A_i // i in divs:
                    divs[A_i // i] += 1
                else:
                    divs[A_i // i] = 1
divs = sorted(divs.items(), key=lambda x: x[0], reverse=True)

for divs_i in divs:
    if divs_i[1] == N or divs_i[1] == N - 1:
        print(divs_i[0])
        break


Fixed submission:
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5) + 1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n // i)

    divisors.sort(reverse=True)
    return divisors


N = int(input())
A = sorted([int(x) for x in input().split()])

ans = 1
for i in range(2):
    div_list = make_divisors(A[i])

    for div_i in div_list:
        wrong_count = 0

        for A_i in A:
            if A_i % div_i != 0:
                wrong_count += 1

        if wrong_count <= 1 and div_i > ans:
            ans = div_i

print(ans)