Buggy python submission (verdict: Time Limit Exceeded):
N =int(input())
A = list(map(int,input().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

A = sorted(A)

def del_dicts(dicts,i):
    del_list=[]
    for k,v in dicts.items():
        if v<i:
            del_list.append(k)
    for d in del_list:
        del dicts[d]
    return dicts

dicts = {}

for i in range(len(A)):
    if i<=2:
        for num in make_divisors(A[i]):
            if num in dicts:
                dicts[num]+=1
            else:
                dicts[num]=1
    
    else:
        del_list=[]
        
        for k in dicts.keys():
            if A[i]%k == 0:
                dicts[k]+=1
    dicts = del_dicts(dicts,i)
print(max(dicts.keys()))

Fixed submission:
N =int(input())
A = list(map(int,input().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

A = sorted(A)
from collections import Counter
check = Counter(A)
for c,k in check.items():
    if k>=N-1:
        A=[c]



def del_dicts(dicts,i):
    del_list=[]
    for k,v in dicts.items():
        if v<i:
            del_list.append(k)
    for d in del_list:
        del dicts[d]
    return dicts

dicts = {}

for i in range(len(A)):
    if i<=2:
        for num in make_divisors(A[i]):
            if num in dicts:
                dicts[num]+=1
            else:
                dicts[num]=1
    
    else:
        del_list=[]
        
        for k in dicts.keys():
            if A[i]%k == 0:
                dicts[k]+=1
    dicts = del_dicts(dicts,i)
print(max(dicts.keys()))

Buggy python submission (verdict: Time Limit Exceeded):
N =int(input())
A = list(map(int,input().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

A = sorted(A)

dicts = {}

for i in range(len(A)):
    for num in make_divisors(A[i]):
        if num in dicts:
            dicts[num]+=1
        else:
            dicts[num]=1
    
    if i>=2:
        del_list=[]
        for k,v in dicts.items():
            if v<i:
                del_list.append(k)
        for d in del_list:
            del dicts[d]

print(max(dicts.keys()))

Fixed submission:
N =int(input())
A = list(map(int,input().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

A = sorted(A)
from collections import Counter
check = Counter(A)
for c,k in check.items():
    if k>=N-1:
        A=[c]



def del_dicts(dicts,i):
    del_list=[]
    for k,v in dicts.items():
        if v<i:
            del_list.append(k)
    for d in del_list:
        del dicts[d]
    return dicts

dicts = {}

for i in range(len(A)):
    if i<=2:
        for num in make_divisors(A[i]):
            if num in dicts:
                dicts[num]+=1
            else:
                dicts[num]=1
    
    else:
        del_list=[]
        
        for k in dicts.keys():
            if A[i]%k == 0:
                dicts[k]+=1
    dicts = del_dicts(dicts,i)
print(max(dicts.keys()))

Buggy python submission (verdict: Runtime Error):
N =int(input())
A = list(map(int,input().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

A = sorted(A)

dicts = {}

if len(A) <=2:
    for i in A:
        for num in make_divisors(i):
            if num in dicts:
                dicts[num]+=1
            else:
                dicts[num]=1
    max_value=0
    for k,v in dicts.items():
        if v>=N-1 and max_value<k:
            max_value=k

    print(max_value)
else:
    for i in range(3):
        for num in make_divisors(A[i]):
            if num in dicts:
                dicts[num]+=1
            else:
                dicts[num]=1
    
    #
    new_list=[]
    for k,v in dicts.items():
        if v>=2:
            new_list.append(k)
    new_set=set(new_list)
    for i in range(3,len(A)):
        for num in new_set:
            if A[i]%num!=0:
                new_set-=set([num])
    print(max(new_set))

Fixed submission:
N =int(input())
A = list(map(int,input().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

A = sorted(A)
from collections import Counter
check = Counter(A)
for c,k in check.items():
    if k>=N-1:
        A=[c]



def del_dicts(dicts,i):
    del_list=[]
    for k,v in dicts.items():
        if v<i:
            del_list.append(k)
    for d in del_list:
        del dicts[d]
    return dicts

dicts = {}

for i in range(len(A)):
    if i<=2:
        for num in make_divisors(A[i]):
            if num in dicts:
                dicts[num]+=1
            else:
                dicts[num]=1
    
    else:
        del_list=[]
        
        for k in dicts.keys():
            if A[i]%k == 0:
                dicts[k]+=1
    dicts = del_dicts(dicts,i)
print(max(dicts.keys()))

Buggy python submission (verdict: Time Limit Exceeded):
N =int(input())
A = list(map(int,input().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

dicts = {}
for i in A:
    for num in make_divisors(i):
        if num in dicts:
            dicts[num]+=1
        else:
            dicts[num]=1


max_value=0
for k,v in dicts.items():
    if v>=N-1 and max_value<k:
        max_value=k

print(max_value)

Fixed submission:
N =int(input())
A = list(map(int,input().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

A = sorted(A)
from collections import Counter
check = Counter(A)
for c,k in check.items():
    if k>=N-1:
        A=[c]



def del_dicts(dicts,i):
    del_list=[]
    for k,v in dicts.items():
        if v<i:
            del_list.append(k)
    for d in del_list:
        del dicts[d]
    return dicts

dicts = {}

for i in range(len(A)):
    if i<=2:
        for num in make_divisors(A[i]):
            if num in dicts:
                dicts[num]+=1
            else:
                dicts[num]=1
    
    else:
        del_list=[]
        
        for k in dicts.keys():
            if A[i]%k == 0:
                dicts[k]+=1
    dicts = del_dicts(dicts,i)
print(max(dicts.keys()))

Buggy python submission (verdict: Time Limit Exceeded):
N =int(input())
A = list(map(int,input().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

dicts = {}
for i in A:
    for num in make_divisors(i):
        if num in dicts:
            dicts[num]+=1
        else:
            dicts[num]=1


max_value=0
for k,v in dicts.items():
    if v>=N-1 and max_value<k:
        max_value=k

print(max_value)

Fixed submission:
N =int(input())
A = list(map(int,input().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

A = sorted(A)
from collections import Counter
check = Counter(A)
for c,k in check.items():
    if k>=N-1:
        A=[c]



def del_dicts(dicts,i):
    del_list=[]
    for k,v in dicts.items():
        if v<i:
            del_list.append(k)
    for d in del_list:
        del dicts[d]
    return dicts

dicts = {}

for i in range(len(A)):
    if i<=2:
        for num in make_divisors(A[i]):
            if num in dicts:
                dicts[num]+=1
            else:
                dicts[num]=1
    
    else:
        del_list=[]
        
        for k in dicts.keys():
            if A[i]%k == 0:
                dicts[k]+=1
    dicts = del_dicts(dicts,i)
print(max(dicts.keys()))