Buggy python submission (verdict: Runtime Error):
from functools import reduce
from fractions import gcd
#from math import gcd

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

gcd_all = reduce(gcd, A)
list = []

for i in range(N):
    #gcd_1 = reduce(gcd, (A[:i]+A[i+1:]))
    for j in range(N):
        if i == j:
            continue
        list.append(gcd(A[i],A[j]))
    #print(list)
    #print(max(list))
    if gcd_all == max(list):
        index = i
        #print(index)
    list = []

    #if gcd_1 >= gcd_all:
     #   gcd_all = gcd_1
A.pop(index)
print(reduce(gcd, A))
#print(gcd_all)


Fixed submission:
from fractions import gcd
from functools import reduce
N = int(input())
A = list(map(int, input().split()))

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

max_m = 0
for i in range(N):
    m = gcd(L[i], R[i+1])
    if max_m < m:
        max_m = m
print(max_m)

Buggy python submission (verdict: Runtime Error):
from functools import reduce
from fractions import gcd
from math import gcd

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

gcd_all = reduce(gcd, A)
list = []

for i in range(N):
    #gcd_1 = reduce(gcd, (A[:i]+A[i+1:]))
    for j in range(N):
        if i == j:
            continue
        list.append(gcd(A[i],A[j]))
    #print(list)
    #print(max(list))
    if gcd_all == max(list):
        index = i
        #print(index)
    list = []

    #if gcd_1 >= gcd_all:
     #   gcd_all = gcd_1
A.pop(index)
print(reduce(gcd, A))
#print(gcd_all)


Fixed submission:
from fractions import gcd
from functools import reduce
N = int(input())
A = list(map(int, input().split()))

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

max_m = 0
for i in range(N):
    m = gcd(L[i], R[i+1])
    if max_m < m:
        max_m = m
print(max_m)

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

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

gcd_all = reduce(gcd, A)

for i in range(N):
    gcd_1 = reduce(gcd, (A[:i]+A[i+1:]))
    if gcd_1 >= gcd_all:
        gcd_all = gcd_1

print(gcd_all)


Fixed submission:
from fractions import gcd
from functools import reduce
N = int(input())
A = list(map(int, input().split()))

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

max_m = 0
for i in range(N):
    m = gcd(L[i], R[i+1])
    if max_m < m:
        max_m = m
print(max_m)

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

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

gcd_all = functools.reduce(fractions.gcd, A)

for i in range(N):
    gcd_1 = functools.reduce(fractions.gcd, (A[:i]+A[i+1:]))
    if gcd_1 >= gcd_all:
        gcd_all = gcd_1

print(gcd_all)


Fixed submission:
from fractions import gcd
from functools import reduce
N = int(input())
A = list(map(int, input().split()))

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

max_m = 0
for i in range(N):
    m = gcd(L[i], R[i+1])
    if max_m < m:
        max_m = m
print(max_m)

Buggy python submission (verdict: Time Limit Exceeded):
import functools
#import math
import fractions

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

#gcd_all = functools.reduce(math.gcd, A)
gcd_all = functools.reduce(fractions.gcd, A)

for i in range(N):
    #gcd_1 = functools.reduce(math.gcd, list)
    gcd_1 = functools.reduce(fractions.gcd, (A[:i]+A[i+1:]))
    if gcd_1 >= gcd_all:
        gcd_all = gcd_1

print(gcd_all)


Fixed submission:
from fractions import gcd
from functools import reduce
N = int(input())
A = list(map(int, input().split()))

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

max_m = 0
for i in range(N):
    m = gcd(L[i], R[i+1])
    if max_m < m:
        max_m = m
print(max_m)

Buggy python submission (verdict: Time Limit Exceeded):
import functools
#import math
import fractions

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

#gcd_all = functools.reduce(math.gcd, A)
gcd_all = functools.reduce(fractions.gcd, A)
#print(gcd_all)

for i in range(N):
    #list = A[:i] + A[i+1:]
    #print(list)
    #gcd_1 = functools.reduce(math.gcd, list)
    gcd_1 = functools.reduce(fractions.gcd, (A[:i]+A[i+1:]))
    #print(gcd_1)
    if gcd_1 >= gcd_all:
        #index = i
        #value = gcd_1
        gcd_all = gcd_1

#A[index] = value

#print(functools.reduce(math.gcd, A))
#print(functools.reduce(fractions.gcd, A))
print(gcd_all)


Fixed submission:
from fractions import gcd
from functools import reduce
N = int(input())
A = list(map(int, input().split()))

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

max_m = 0
for i in range(N):
    m = gcd(L[i], R[i+1])
    if max_m < m:
        max_m = m
print(max_m)

Buggy python submission (verdict: Time Limit Exceeded):
import functools
#import math
import fractions

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

#gcd_all = functools.reduce(math.gcd, A)
gcd_all = functools.reduce(fractions.gcd, A)
#print(gcd_all)

for i in range(N):
    list = A[:i] + A[i+1:]
    #print(list)
    #gcd_1 = functools.reduce(math.gcd, list)
    gcd_1 = functools.reduce(fractions.gcd, list)
    #print(gcd_1)
    if gcd_1 >= gcd_all:
        #index = i
        #value = gcd_1
        gcd_all = gcd_1

#A[index] = value

#print(functools.reduce(math.gcd, A))
#print(functools.reduce(fractions.gcd, A))
print(gcd_all)


Fixed submission:
from fractions import gcd
from functools import reduce
N = int(input())
A = list(map(int, input().split()))

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

max_m = 0
for i in range(N):
    m = gcd(L[i], R[i+1])
    if max_m < m:
        max_m = m
print(max_m)

Buggy python submission (verdict: Time Limit Exceeded):
import functools
import math
import fractions

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

#gcd_all = functools.reduce(math.gcd, A)
gcd_all = functools.reduce(fractions.gcd, A)
#print(gcd_all)

for i in range(N):
    list = A[:i] + A[i+1:]
    #print(list)
    #gcd_1 = functools.reduce(math.gcd, list)
    gcd_1 = functools.reduce(fractions.gcd, list)
    #print(gcd_1)
    if gcd_1 >= gcd_all:
        #index = i
        #value = gcd_1
        gcd_all = gcd_1

#A[index] = value

#print(functools.reduce(math.gcd, A))
#print(functools.reduce(fractions.gcd, A))
print(gcd_all)


Fixed submission:
from fractions import gcd
from functools import reduce
N = int(input())
A = list(map(int, input().split()))

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

max_m = 0
for i in range(N):
    m = gcd(L[i], R[i+1])
    if max_m < m:
        max_m = m
print(max_m)

Buggy python submission (verdict: Time Limit Exceeded):
import functools
import math
import fractions

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

#gcd_all = functools.reduce(math.gcd, A)
gcd_all = functools.reduce(fractions.gcd, A)
#print(gcd_all)

for i in range(N):
    list = A[:i] + A[i+1:]
    #print(list)
    #gcd_1 = functools.reduce(math.gcd, list)
    gcd_1 = functools.reduce(fractions.gcd, list)
    #print(gcd_1)
    if gcd_1 >= gcd_all:
        index = i
        value = gcd_1
        gcd_all = gcd_1

A[index] = value

#print(functools.reduce(math.gcd, A))
print(functools.reduce(fractions.gcd, A))



Fixed submission:
from fractions import gcd
from functools import reduce
N = int(input())
A = list(map(int, input().split()))

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

max_m = 0
for i in range(N):
    m = gcd(L[i], R[i+1])
    if max_m < m:
        max_m = m
print(max_m)

Buggy python submission (verdict: Runtime Error):
import functools
import math
import fractions

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

#gcd_all = functools.reduce(math.gcd, A)
gcd_all = functools.reduce(fractions.gcd, A)
#print(gcd_all)

for i in range(N):
    list = A[:i] + A[i+1:]
    #print(list)
    #gcd_1 = functools.reduce(math.gcd, list)
    gcd_1 = functools.reduce(fractions.gcd, list)
    #print(gcd_1)
    if gcd_1 >= gcd_all:
        index = i
        value = gcd_1
        gcd_all = gcd_1

A[index] = value

print(functools.reduce(math.gcd, A))




Fixed submission:
from fractions import gcd
from functools import reduce
N = int(input())
A = list(map(int, input().split()))

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

max_m = 0
for i in range(N):
    m = gcd(L[i], R[i+1])
    if max_m < m:
        max_m = m
print(max_m)

Buggy python submission (verdict: Runtime Error):
import functools
import math

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

gcd_all = functools.reduce(math.gcd, A)
#print(gcd_all)

for i in range(N):
    list = A[:i] + A[i+1:]
    #print(list)
    gcd_1 =  functools.reduce(math.gcd, list)
    #print(gcd_1)
    if gcd_1 >= gcd_all:
        index = i
        value = gcd_1
        gcd_all = gcd_1

A[index] = value

print(functools.reduce(math.gcd, A))




Fixed submission:
from fractions import gcd
from functools import reduce
N = int(input())
A = list(map(int, input().split()))

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

max_m = 0
for i in range(N):
    m = gcd(L[i], R[i+1])
    if max_m < m:
        max_m = m
print(max_m)

Buggy python submission (verdict: Runtime Error):
import functools
import math

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

gcd_all = functools.reduce(math.gcd, A)
#print(gcd_all)

for i in range(N):
    list = A[:i] + A[i+1:]
    #print(list)
    gcd_1 =  functools.reduce(math.gcd, list)
    #print(gcd_1)
    if gcd_1 >= gcd_all:
        index = i
        value = gcd_1
        gcd_all = gcd_1

A[index] = value

print(functools.reduce(math.gcd, A))




Fixed submission:
from fractions import gcd
from functools import reduce
N = int(input())
A = list(map(int, input().split()))

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

max_m = 0
for i in range(N):
    m = gcd(L[i], R[i+1])
    if max_m < m:
        max_m = m
print(max_m)