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

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

AL=[0]*N
AR=[0]*N
for i in range(N):
    if i == 0:
        AL[0] = A[0]
        AR[0] = A[N-1]
    else:
        AL[i] = math.gcd(AL[i-1],A[i])
        AR[i] = math.gcd(AR[i-1],A[N-i-1])

max=0
for i in range(N):
    if i == 0:
        n_ex_gcd =  AR[N-2]
    elif i == N-1:
        n_ex_gcd = AL[N-2]
    else:
        n_ex_gcd = math.gcd(AL[i-1],AR[N-i-2])
    if n_ex_gcd > max:
        max = n_ex_gcd
print(max)


Fixed submission:
def gcd(a,b):
    if b==0:
        return a
    return gcd(b,a%b)

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

AL=[0]*N
AR=[0]*N
for i in range(N):
    if i == 0:
        AL[0] = A[0]
        AR[0] = A[N-1]
    else:
        AL[i] = gcd(AL[i-1],A[i])
        AR[i] = gcd(AR[i-1],A[N-i-1])

max=0
for i in range(N):
    if i == 0:
        n_ex_gcd =  AR[N-2]
    elif i == N-1:
        n_ex_gcd = AL[N-2]
    else:
        n_ex_gcd = gcd(AL[i-1],AR[N-i-2])
    if n_ex_gcd > max:
        max = n_ex_gcd
print(max)

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

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

AL=[0]*N
AR=[0]*N
for i in range(N):
    if i == 0:
        AL[0] = A[0]
    else:
        AL[i] = math.gcd(AL[i-1],A[i])
for i in range(N):
    if i == 0:
        AR[0] = A[N-1]
    else:
        AR[i] = math.gcd(AR[i-1],A[N-i-1])

max=0
for i in range(N):
    if i == 0:
        n_ex_gcd =  AR[N-2]
    elif i == N-1:
        n_ex_gcd = AL[N-2]
    else:
        n_ex_gcd = math.gcd(AL[i-1],AR[N-i-2])
    if n_ex_gcd > max:
        max = n_ex_gcd
print(max)

Fixed submission:
def gcd(a,b):
    if b==0:
        return a
    return gcd(b,a%b)

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

AL=[0]*N
AR=[0]*N
for i in range(N):
    if i == 0:
        AL[0] = A[0]
        AR[0] = A[N-1]
    else:
        AL[i] = gcd(AL[i-1],A[i])
        AR[i] = gcd(AR[i-1],A[N-i-1])

max=0
for i in range(N):
    if i == 0:
        n_ex_gcd =  AR[N-2]
    elif i == N-1:
        n_ex_gcd = AL[N-2]
    else:
        n_ex_gcd = gcd(AL[i-1],AR[N-i-2])
    if n_ex_gcd > max:
        max = n_ex_gcd
print(max)

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

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

AL=[0]*N#左からi番目までのGCD
AR=[0]*N#右からi番目までのGCD
for i in range(N):
    if i == 0:
        AL[0] = A[0]
    else:
        AL[i] = math.gcd(AL[i-1],A[i])
for i in range(N):
    if i == 0:
        AR[0] = A[N-1]
    else:
        AR[i] = math.gcd(AR[i-1],A[N-i-1])

max=0
for i in range(N):
    if i == 0:
        n_ex_gcd =  AR[N-2]
    elif i == N-1:
        n_ex_gcd = AL[N-2]
    else:
        n_ex_gcd = math.gcd(AL[i-1],AR[N-i-2])
    if n_ex_gcd > max:
        max = n_ex_gcd
print(max)

Fixed submission:
def gcd(a,b):
    if b==0:
        return a
    return gcd(b,a%b)

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

AL=[0]*N
AR=[0]*N
for i in range(N):
    if i == 0:
        AL[0] = A[0]
        AR[0] = A[N-1]
    else:
        AL[i] = gcd(AL[i-1],A[i])
        AR[i] = gcd(AR[i-1],A[N-i-1])

max=0
for i in range(N):
    if i == 0:
        n_ex_gcd =  AR[N-2]
    elif i == N-1:
        n_ex_gcd = AL[N-2]
    else:
        n_ex_gcd = gcd(AL[i-1],AR[N-i-2])
    if n_ex_gcd > max:
        max = n_ex_gcd
print(max)

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

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

if N==2:
    print(max(A))
    exit()
else:
    max=0
    for i in range(N):
        x = copy.deepcopy(A)
        del x[i]
        c = math.gcd(x[0], x[1])
        for i in range(2,N-1):
            c = math.gcd(c,x[i])
        if c >= max:
            max = c
        x.clear()
    print(max)


Fixed submission:
def gcd(a,b):
    if b==0:
        return a
    return gcd(b,a%b)

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

AL=[0]*N
AR=[0]*N
for i in range(N):
    if i == 0:
        AL[0] = A[0]
        AR[0] = A[N-1]
    else:
        AL[i] = gcd(AL[i-1],A[i])
        AR[i] = gcd(AR[i-1],A[N-i-1])

max=0
for i in range(N):
    if i == 0:
        n_ex_gcd =  AR[N-2]
    elif i == N-1:
        n_ex_gcd = AL[N-2]
    else:
        n_ex_gcd = gcd(AL[i-1],AR[N-i-2])
    if n_ex_gcd > max:
        max = n_ex_gcd
print(max)

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

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

if N==2:
    print(max(A))
    exit()
else:
    max=0
    for i in range(N):
        x = copy.deepcopy(A)
        del x[i]
        c = math.gcd(x[0], x[1])
        for i in range(2,N-1):
            c = math.gcd(c,x[i])
        if c >= max:
            max = c
    print(max)

Fixed submission:
def gcd(a,b):
    if b==0:
        return a
    return gcd(b,a%b)

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

AL=[0]*N
AR=[0]*N
for i in range(N):
    if i == 0:
        AL[0] = A[0]
        AR[0] = A[N-1]
    else:
        AL[i] = gcd(AL[i-1],A[i])
        AR[i] = gcd(AR[i-1],A[N-i-1])

max=0
for i in range(N):
    if i == 0:
        n_ex_gcd =  AR[N-2]
    elif i == N-1:
        n_ex_gcd = AL[N-2]
    else:
        n_ex_gcd = gcd(AL[i-1],AR[N-i-2])
    if n_ex_gcd > max:
        max = n_ex_gcd
print(max)

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

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

if N==2:
    print(max(A))
    exit()
else:
    max=0
    for i in range(N):
        x = copy.deepcopy(A)
        del x[i]
        c = math.gcd(x[0], x[1])
        for i in range(2,N-1):
            c = mat.gcd(c,x[i])
        if c >= max:
            max = c
    print(max)


Fixed submission:
def gcd(a,b):
    if b==0:
        return a
    return gcd(b,a%b)

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

AL=[0]*N
AR=[0]*N
for i in range(N):
    if i == 0:
        AL[0] = A[0]
        AR[0] = A[N-1]
    else:
        AL[i] = gcd(AL[i-1],A[i])
        AR[i] = gcd(AR[i-1],A[N-i-1])

max=0
for i in range(N):
    if i == 0:
        n_ex_gcd =  AR[N-2]
    elif i == N-1:
        n_ex_gcd = AL[N-2]
    else:
        n_ex_gcd = gcd(AL[i-1],AR[N-i-2])
    if n_ex_gcd > max:
        max = n_ex_gcd
print(max)

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

def gcd(a,b):
    if b==0:return a
    return gcd(b,a%b)

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

if N==2:
    print(max(A))
    exit()
else:
    max=0
    for i in range(N):
        x = copy.deepcopy(A)
        del x[i]
        c = gcd(x[0], x[1])
        for i in range(2,N-1):
            c=gcd(element,x[i])
        if c >= max:
            max = c
print(max)


Fixed submission:
def gcd(a,b):
    if b==0:
        return a
    return gcd(b,a%b)

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

AL=[0]*N
AR=[0]*N
for i in range(N):
    if i == 0:
        AL[0] = A[0]
        AR[0] = A[N-1]
    else:
        AL[i] = gcd(AL[i-1],A[i])
        AR[i] = gcd(AR[i-1],A[N-i-1])

max=0
for i in range(N):
    if i == 0:
        n_ex_gcd =  AR[N-2]
    elif i == N-1:
        n_ex_gcd = AL[N-2]
    else:
        n_ex_gcd = gcd(AL[i-1],AR[N-i-2])
    if n_ex_gcd > max:
        max = n_ex_gcd
print(max)

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

def gcd(a,b):
    if b==0:return a
    return gcd(b,a%b)

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

if N==2:
    print(max(A))
    exit()
else:
    max=0
    for i in range(N):
        x = copy.deepcopy(A)
        del x[i]
        element = gcd(x[0], x[1])
        if N==2:
            c = element
        else:
            for i in range(2,N-1):
                element=gcd(element,x[i])
            c = element
        if c >= max:
            max = c
print(max)


Fixed submission:
def gcd(a,b):
    if b==0:
        return a
    return gcd(b,a%b)

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

AL=[0]*N
AR=[0]*N
for i in range(N):
    if i == 0:
        AL[0] = A[0]
        AR[0] = A[N-1]
    else:
        AL[i] = gcd(AL[i-1],A[i])
        AR[i] = gcd(AR[i-1],A[N-i-1])

max=0
for i in range(N):
    if i == 0:
        n_ex_gcd =  AR[N-2]
    elif i == N-1:
        n_ex_gcd = AL[N-2]
    else:
        n_ex_gcd = gcd(AL[i-1],AR[N-i-2])
    if n_ex_gcd > max:
        max = n_ex_gcd
print(max)

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

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

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

max=0
for i in range(N):
    x = copy.deepcopy(A)
    del x[i]
    c = gcd_list(x)
    if c >= max:
        max = c
print(max)


Fixed submission:
def gcd(a,b):
    if b==0:
        return a
    return gcd(b,a%b)

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

AL=[0]*N
AR=[0]*N
for i in range(N):
    if i == 0:
        AL[0] = A[0]
        AR[0] = A[N-1]
    else:
        AL[i] = gcd(AL[i-1],A[i])
        AR[i] = gcd(AR[i-1],A[N-i-1])

max=0
for i in range(N):
    if i == 0:
        n_ex_gcd =  AR[N-2]
    elif i == N-1:
        n_ex_gcd = AL[N-2]
    else:
        n_ex_gcd = gcd(AL[i-1],AR[N-i-2])
    if n_ex_gcd > max:
        max = n_ex_gcd
print(max)