Problem p03061 (python)

Fixed submission:
from functools import reduce
from itertools import combinations
from fractions import gcd

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


Left = [0] * (N + 1)
Right = [0] * (N + 1)

for i in range(N):
    Left[i + 1] = gcd(Left[i], A[i])
    Right[N - i - 1] = gcd(Right[N - i], A[N - i - 1])
ans = 0
for i in range(N):
    ans = max(ans, gcd(Left[i], Right[i + 1]))
    
print(ans)

Buggy submission (verdict: Runtime Error):
from functools import reduce
from itertools import combinations
from fractions import gcd

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

def get_gcd(number_list):
    return reduce(gcd, number_list)

def L_gcd(i):
    if i == -1:
        return 0
    else:
        return gcd(A[i - 1], L_gcd(i - 1))
        
def R_gcd(i):
    if i == N:
        return 0
    else:
        return gcd(A[i], R_gcd(i + 1))


gcd_list = []
for i in range(N):
    Left = L_gcd(i)
    Right = R_gcd(i)
    gcd_list.append(gcd(Left, Right))


print(int(max(gcd_list)))

Buggy submission (verdict: Runtime Error):
from functools import reduce
from itertools import combinations
from fractions import gcd

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

def get_gcd(number_list):
    return reduce(gcd, number_list)

def L_gcd(i):
    if i == -1:
        return 0
    else:
        return gcd(A[i - 1], L_gcd(i - 1))
        
def R_gcd(i):
    if i == N:
        return 0
    else:
        return gcd(A[i], R_gcd(i + 1))


gcd_list = []
for i in range(N):
    Left = L_gcd(i)
    Right = R_gcd(i + 1)
    gcd_list.append(gcd(Left, Right))

#print(gcd_list)

print(int(max(gcd_list)))

Buggy submission (verdict: Runtime Error):
from functools import reduce
from itertools import combinations
from fractions import gcd

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

def get_gcd(number_list):
    return reduce(gcd, number_list)

def L_gcd(i):
    if i == 0:
        return 0
    else:
        return gcd(A[i - 1], L_gcd(i - 1))
        
def R_gcd(i):
    if i == N:
        return 0
    else:
        return gcd(A[i], R_gcd(i + 1))


gcd_list = []
for i in range(N):
    Left = L_gcd(i)
    Right = R_gcd(i + 1)
    gcd_list.append(gcd(Left, Right))

#print(gcd_list)

print(int(max(gcd_list)))

Buggy submission (verdict: Runtime Error):

from functools import reduce
from itertools import combinations
from math import gcd

def get_gcd(number_list):
    return reduce(gcd, number_list)

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

skipped = list(combinations(Numbers, N - 1))

gcd_list = [get_gcd(item) for item in skipped]
    
print(int(max(gcd_list)))

Buggy submission (verdict: Runtime Error):

from functools import reduce
from itertools import combinations
from fractions import gcd

def get_gcd(number_list):
    return reduce(gcd, number_list)

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

skipped = list(map(combinations(Numbers, N - 1)))

gcd_list = [get_gcd(item) for item in skipped]
    
print(int(max(gcd_list)))

Buggy submission (verdict: Runtime Error):
#ずっとre
from functools import reduce
from itertools import combinations
from fractions import gcd

def get_gcd(number_list):
    return reduce(gcd, number_list)

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

skipped = list(map(list, combinations(Numbers, N - 1)))

gcd_list = [get_gcd(skipped) for i in range(N)]
    
print(int(max(gcd_list)))

Buggy submission (verdict: Runtime Error):
#ずっとre
from functools import reduce
from itertools import combinations
from fractions import gcd

def get_gcd(number_list):
    return reduce(gcd, number_list)

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

skipped = list(map(list, combinations(Numbers, 5)))

gcd_list = [get_gcd(skipped) for i in range(N)]
    
print(int(max(gcd_list)))

Buggy submission (verdict: Runtime Error):
#ずっとre
from math import gcd
from functools import reduce

def get_gcd(number_list):
    return reduce(gcd, number_list)

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

gcd_list = [0] * N
for i in range(N):
    tmp_list = Numbers[:i] + Numbers[i + 1:]
    gcd_list[i] = get_gcd(tmp_list)
    
print(int(max(gcd_list)))

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

def get_gcd(number_list):
    return reduce(gcd, number_list)

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

gcd_list = []
for i in range(N):
    tmp_list = Numbers[:i] + Numbers[i + 1:]
    gcd_list.append(get_gcd(tmp_list))
print(int(max(gcd_list)))

Buggy submission (verdict: Runtime Error):
N = int(input())
Numbers = list(map(int, input().split()))

from math import gcd
from functools import reduce
import sys

def get_gcd(number_list):
    return reduce(gcd, number_list)

gcd_list = []
for i in range(N):
    tmp_list = Numbers[:i] + Numbers[i + 1:]
    gcd_list.append(get_gcd(tmp_list))
print(int(max(gcd_list)))

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

def get_gcd(number_list):
    return reduce(gcd, number_list)

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

gcd_list = []
for i in range(N):
    tmp_list = Numbers[:i] + Numbers[i + 1:]
    gcd_list.append(get_gcd(tmp_list))
print(int(max(gcd_list)))

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

def gcd(number_list):
    return reduce(math.gcd, number_list)

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

print(Numbers)

if len(Numbers) == 2:
    print(int(max(Numbers)))
    sys.exit()
else:
    gcd_list = []
    for i in range(N):
        tmp_list = Numbers[:i] + Numbers[i + 1:]
        gcd_list.append(gcd(tmp_list))
    print(int(max(gcd_list)))

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

def gcd(number_list):
    return reduce(math.gcd, number_list)

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

if N == 2:
    print(int(max(Numbers)))
    sys.exit()
else:
    gcd_list = []
    for i in range(N):
        tmp_list = Numbers[:i] + Numbers[i + 1:]
        gcd_list.append(gcd(tmp_list))
    print(int(max(gcd_list)))

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

def gcd(number_list):
    return reduce(math.gcd, number_list)

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


gcd_list = []
for i in range(N):
    tmp_list = Numbers[:i] + Numbers[i + 1:]
    gcd_list.append(gcd(tmp_list))
print(int(max(gcd_list)))

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

def gcd(number_list):
    return reduce(math.gcd, number_list)

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

if N == 2:
    print(int(max(Numbers)))
    sys.exit()

gcd_list = []
for i in range(N):
    tmp_list = Numbers[:i] + Numbers[i + 1:]
    gcd_list.append(gcd(tmp_list))
print(int(max(gcd_list)))

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

def gcd(number_list):
    return reduce(math.gcd, number_list)

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

if N == 2:
    print(max(Numbers))
    sys.exit()

gcd_list = []
for i in range(N):
    tmp_list = Numbers[:i] + Numbers[i + 1:]
    gcd_list.append(gcd(tmp_list))
print(max(gcd_list))