Problem p03061 (python)

Fixed submission:
import fractions # for python 3.4.3

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

gcd_l = [0]
gcd_r = [0]
for i in range(N):
    gcd_l.append(fractions.gcd(gcd_l[i], A[i]))
    gcd_r.append(fractions.gcd(gcd_r[i], A[-(i+1)]))
    #print(gcd_l)
    #print(gcd_r)
gcd_r = gcd_r[::-1]

ans = []
for i in range(N):
    ans.append(fractions.gcd(gcd_l[i], gcd_r[i+1]))

print(max(ans))

Buggy submission (verdict: Runtime Error):
from copy import deepcopy

def gcd(a, b):
	while b:
		a, b = b, a % b
	return(a)

def gcd_mul(numbers):
    s = gcd(numbers[0], numbers[1])
    for i in range(2, len(numbers)) :
        s = gcd(s, numbers[i])
    return(s)

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

ans = 0
A2 = deepcopy(A)
for i in range(N) :
    del A[i]
    g = gcd_mul(A)
    if g > ans :
        ans = g
    A = deepcopy(A2)
print(ans)

Buggy submission (verdict: Runtime Error):
from copy import deepcopy

def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

def gcd_mul(numbers):
    s = gcd(numbers[0], numbers[1])
    for i in range(2, len(numbers)) :
        s = gcd(s, numbers[i])
    return(s)

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

ans = 0
A2 = deepcopy(A)
for i in range(N) :
    del A[i]
    g = gcd_mul(A)
    if g > ans :
        ans = g
    A = deepcopy(A2)
print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np

def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

def gcd_mul(numbers):
    s = gcd(numbers[0], numbers[1])
    for i in range(2, len(numbers)) :
        s = gcd(s, numbers[i])
    return(s)

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

ans = 0
for i in range(N) :
    B = A[np.arange(len(A))!=i]
    g = gcd_mul(B)
    if g > ans :
        ans = g
print(ans)

Buggy submission (verdict: Runtime Error):
import fraction
import numpy as np

def gcd_mul(numbers):
    s = fraction.gcd(numbers[0], numbers[1])
    for i in range(2, len(numbers)) :
        s = fraction.gcd(s, numbers[i])
    return(s)

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

ans = 0
for i in range(N) :
    B = A[np.arange(len(A))!=i]
    g = gcd_mul(B)
    if g > ans :
        ans = g
print(ans)

Buggy submission (verdict: Runtime Error):
import math
import numpy as np

def gcd_mul(numbers):
    s = math.gcd(numbers[0], numbers[1])
    for i in range(2, len(numbers)) :
        s = math.gcd(s, numbers[i])
    return(s)

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

ans = 0
for i in range(N) :
    B = A[np.arange(len(A))!=i]
    g = gcd_mul(B)
    if g > ans :
        ans = g
print(ans)

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce
import numpy as np

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

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

ans = 0
for i in range(N) :
    B = A[np.arange(len(A))!=i]
    g = gcd(*B)
    if g > ans :
        ans = g
print(ans)

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce
import numpy as np

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

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

ans = 0
for i in range(N) :
    B = A[np.arange(len(A))!=i]
    g = gcd(*B)
    if g > ans :
        ans = g
print(ans)