Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
# Your code here!

from collections import defaultdict
import copy

N = int(input())
A = sorted(list(map(int, input().rstrip().split(' '))))

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()
    return divisors
    
max_divisor = 0
for a in A[:2]:
    divisors = make_divisors(a)
    
    for divisor in divisors:
        divisable = 0
        for a in A:
            if a % divisor == 0:
                divisable += 1
        
        if divisable >= N - 1:
            max_divisor = max(max_divisor, divisor)
            
            
print(max_divisor)
            
    

Fixed submission:
# coding: utf-8
# Your code here!

from collections import defaultdict
import copy

N = int(input())
A = sorted(list(map(int, input().rstrip().split(' '))))

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()
    return divisors
    
max_divisor = 0
for a in A[:2]:
    divisors = make_divisors(a)
    
    for divisor in divisors:
        if divisor > max_divisor:
            nondivisable = 0
            for a in A:
                if a % divisor != 0:
                    nondivisable += 1
                if nondivisable > 2:
                    break
                
            if nondivisable <= 1:
                max_divisor = divisor
            
            
print(max_divisor)

Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
# Your code here!

from collections import defaultdict

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

memo = defaultdict(int)
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()
    return divisors
    
for a in A:
    divisors = make_divisors(a)
    for divisor in divisors:
        memo[divisor] += 1

max_divisor = 1        
for k,v in memo.items():
    if v >= N - 1:
        max_divisor = max(max_divisor, k)
        
print(max_divisor)

Fixed submission:
# coding: utf-8
# Your code here!

from collections import defaultdict
import copy

N = int(input())
A = sorted(list(map(int, input().rstrip().split(' '))))

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()
    return divisors
    
max_divisor = 0
for a in A[:2]:
    divisors = make_divisors(a)
    
    for divisor in divisors:
        if divisor > max_divisor:
            nondivisable = 0
            for a in A:
                if a % divisor != 0:
                    nondivisable += 1
                if nondivisable > 2:
                    break
                
            if nondivisable <= 1:
                max_divisor = divisor
            
            
print(max_divisor)