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)
    return divisors

candidate1 = []
candidate = {}
for i in range(N):
    if i > 1:
        delete_key = []
        for c in candidate.keys():
            if A[i] % c == 0:
                candidate[c]['atari'] += 1
            else:
                candidate[c]['hazure'] += 1        
    elif i == 0:
        candidate1 = make_divisors(A[i])
    elif i == 1:
        candidate2 = make_divisors(A[i])
        prev = -1
        for c in sorted(candidate1 + candidate2):
            if c != prev and prev != -1 and candidate[prev]['atari'] < 2:
                candidate[prev]['hazure'] += 1
            if c not in candidate:
                candidate[c] = {
                    'atari': 1,
                    'hazure': 0
                }
            else:
                candidate[c]['atari'] += 1
            prev = c
        if candidate[prev]['atari'] < 2:
            candidate[prev]['hazure'] += 1            
max = 0
for c in candidate:
    if candidate[c]['hazure'] < 2 and max < c:
        max = c
print(max)

Fixed submission:
N = int(input())
A = sorted(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)
    return divisors

candidate1 = []
candidate = {}
for i in range(N):
    if i > 1:
        delete_key = []
        for c in candidate.keys():
            if A[i] % c == 0:
                candidate[c]['atari'] += 1
            else:
                candidate[c]['hazure'] += 1        
    elif i == 0:
        candidate1 = make_divisors(A[i])
    elif i == 1:
        candidate2 = make_divisors(A[i])
        prev = -1
        for c in sorted(candidate1 + candidate2):
            if c != prev and prev != -1 and candidate[prev]['atari'] < 2:
                candidate[prev]['hazure'] += 1
            if c not in candidate:
                candidate[c] = {
                    'atari': 1,
                    'hazure': 0
                }
            else:
                candidate[c]['atari'] += 1
            prev = c
        if candidate[prev]['atari'] < 2:
            candidate[prev]['hazure'] += 1            
max = 0
for c in candidate:
    if candidate[c]['hazure'] < 2 and max < c:
        max = c
print(max)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = sorted(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)
    return divisors

candidate1 = []
candidate = {}
for i in range(N):
    if i > 1:
        delete_key = []
        for c in candidate.keys():
            if A[i] % c == 0:
                candidate[c]['atari'] += 1
            else:
                candidate[c]['hazure'] += 1        
    elif i == 0:
        candidate1 = make_divisors(A[i])
    elif i == 1:
        candidate2 = make_divisors(A[i])
        prev = -1
        for c in sorted(candidate1 + candidate2):
            if c != prev and prev != -1 and candidate[prev]['atari'] < 2:
                candidate[prev]['hazure'] += 1
            if c not in candidate:
                candidate[c] = {
                    'atari': 1,
                    'hazure': 0
                }
            else:
                candidate[c]['atari'] += 1
            prev = c
        if candidate[prev]['atari'] < 2:
            candidate[prev]['hazure'] += 1            
max = 0
for c in candidate:
    if candidate[c]['hazure'] < 2 and max < c:
        max = c
print(max)

Fixed submission:
N = int(input())
A = sorted(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)
    return divisors

candidate1 = []
candidate = {}
for i in range(N):
    if i > 1:
        delete_key = []
        for c in candidate.keys():
            if A[i] % c == 0:
                candidate[c]['atari'] += 1
            else:
                candidate[c]['hazure'] += 1        
    elif i == 0:
        candidate1 = make_divisors(A[i])
    elif i == 1:
        candidate2 = make_divisors(A[i])
        prev = -1
        for c in sorted(candidate1 + candidate2):
            if c != prev and prev != -1 and candidate[prev]['atari'] < 2:
                candidate[prev]['hazure'] += 1
            if c not in candidate:
                candidate[c] = {
                    'atari': 1,
                    'hazure': 0
                }
            else:
                candidate[c]['atari'] += 1
            prev = c
        if candidate[prev]['atari'] < 2:
            candidate[prev]['hazure'] += 1            
max = 0
for c in candidate:
    if candidate[c]['hazure'] < 2 and max < c:
        max = c
print(max)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = sorted(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)
    return divisors

candidate1 = []
candidate = {}
for i in range(N):
    if i == 0:
        candidate1 = make_divisors(A[i])
    elif i == 1:
        candidate2 = make_divisors(A[i])
        prev = -1
        for c in sorted(candidate1 + candidate2):
            if c != prev and prev != -1 and candidate[prev]['atari'] < 2:
                candidate[prev]['hazure'] += 1
            if c not in candidate:
                candidate[c] = {
                    'atari': 1,
                    'hazure': 0
                }
            else:
                candidate[c]['atari'] += 1
            prev = c
        if candidate[prev]['atari'] < 2:
            candidate[prev]['hazure'] += 1            
    else:
        delete_key = []
        for c in candidate.keys():
            if A[i] % c == 0:
                candidate[c]['atari'] += 1
            else:
                if candidate[c]['hazure'] > 0:
                    delete_key.append(c)
                else:
                    candidate[c]['hazure'] += 1
        for d in delete_key:
            del candidate[d]
print(max(candidate.keys()))

Fixed submission:
N = int(input())
A = sorted(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)
    return divisors

candidate1 = []
candidate = {}
for i in range(N):
    if i > 1:
        delete_key = []
        for c in candidate.keys():
            if A[i] % c == 0:
                candidate[c]['atari'] += 1
            else:
                candidate[c]['hazure'] += 1        
    elif i == 0:
        candidate1 = make_divisors(A[i])
    elif i == 1:
        candidate2 = make_divisors(A[i])
        prev = -1
        for c in sorted(candidate1 + candidate2):
            if c != prev and prev != -1 and candidate[prev]['atari'] < 2:
                candidate[prev]['hazure'] += 1
            if c not in candidate:
                candidate[c] = {
                    'atari': 1,
                    'hazure': 0
                }
            else:
                candidate[c]['atari'] += 1
            prev = c
        if candidate[prev]['atari'] < 2:
            candidate[prev]['hazure'] += 1            
max = 0
for c in candidate:
    if candidate[c]['hazure'] < 2 and max < c:
        max = c
print(max)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = sorted(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)
    return divisors


candidate = {}
for i in range(N):
    if i == 0:
        candidate1 = make_divisors(A[i])
        for c in candidate1:
            candidate[c] = {
                'atari': 1,
                'hazure': 0,
            }
    elif i == 1:
        candidate2 = make_divisors(A[i])
        for c in candidate:
            if c not in candidate2:
                candidate[c]['hazure'] += 1
        for c in candidate2:
            if c not in candidate:
                candidate[c] = {
                    'atari': 1,
                    'hazure': 1
                }
            else:
                candidate[c]['atari'] += 1
    else:
        delete_key = []
        for c in candidate.keys():
            if A[i] % c == 0:
                candidate[c]['atari'] += 1
            else:
                if candidate[c]['hazure'] > 0:
                    delete_key.append(c)
                else:
                    candidate[c]['hazure'] += 1
        for d in delete_key:
            del candidate[d]
print(max(candidate.keys()))

Fixed submission:
N = int(input())
A = sorted(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)
    return divisors

candidate1 = []
candidate = {}
for i in range(N):
    if i > 1:
        delete_key = []
        for c in candidate.keys():
            if A[i] % c == 0:
                candidate[c]['atari'] += 1
            else:
                candidate[c]['hazure'] += 1        
    elif i == 0:
        candidate1 = make_divisors(A[i])
    elif i == 1:
        candidate2 = make_divisors(A[i])
        prev = -1
        for c in sorted(candidate1 + candidate2):
            if c != prev and prev != -1 and candidate[prev]['atari'] < 2:
                candidate[prev]['hazure'] += 1
            if c not in candidate:
                candidate[c] = {
                    'atari': 1,
                    'hazure': 0
                }
            else:
                candidate[c]['atari'] += 1
            prev = c
        if candidate[prev]['atari'] < 2:
            candidate[prev]['hazure'] += 1            
max = 0
for c in candidate:
    if candidate[c]['hazure'] < 2 and max < c:
        max = c
print(max)