Problem p02814 (python)

Fixed submission:
import fractions
import functools

def lcm(n1, n2):
    return n1 * n2 // fractions.gcd(n1, n2)

N, M = map(int, input().split())
A = list(map(int, input().split()))
for i in range(N):
    A[i] //= 2

lcmA = functools.reduce(lcm, A)
gcdA = functools.reduce(fractions.gcd, A)
if (lcmA // gcdA) % 2 == 0:
    print(0)
else:
    print((M // lcmA + 1) // 2)

Buggy submission (verdict: Runtime Error):
import fractons
import functools

def lcm(n1, n2):
    return n1 * n2 // fractions.gcd(n1, n2)

N, M = map(int, input().split())
A = list(map(int, input().split()))
for i in range(N):
    A[i] //= 2

lcmA = functools.reduce(lcm, A)
gcdA = functools.reduce(fractions.gcd, A)
if (lcmA // gcdA) % 2 == 0:
    print(0)
else:
    print((M // lcmA + 1) // 2)

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

def lcm(n1, n2):
    return n1 * n2 // gcd(n1, n2)

N, M = map(int, input().split())
A = list(map(int, input().split()))
for i in range(N):
    A[i] //= 2

lcmA = reduce(lcm, A)
print((M // lcmA + 1) // 2)

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

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

for i, a in enumerate(A):
    if i == 0:
        lcmA = a
    else:
        lcmA = int(a * lcmA / gcd(a, lcmA))

if M < lcmA//2:
    print(0)
else:
    minA = min(A)
    ans = 0
    for i in range(lcmA//2, M+1, lcmA):
        if i % 2 == 1:
            ans += 1
        elif minA < i:
            ans += 1

    print(ans)

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

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

for i, a in enumerate(A):
    if i == 0:
        lcmA = a
    else:
        lcmA = int(a * lcmA / gcd(a, lcmA))

if M < lcmA//2:
    print(0)
else:
    print( 1 + (M - max(lcmA//2, min(A) * 0.5))//lcmA)

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

def lcm(a,b):
    return int(a * b / gcd(a, b))

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

for i, a in enumerate(A):
    if i == 0:
        lcmA = a
    else:
        lcmA = int(a * lcmA / gcd(a, lcmA))

lcmA = reduce(lcm, A)
if M < lcmA//2:
    print(0)
else:
    print( 1 + (M - max(lcmA//2, min(A) * 0.5))//lcmA)

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

def lcm(a,b):
    return int(a * b / gcd(a, b))

N, M = map(int,input().split())
A = set(list(map(int,input().split())))
if len(A) == 1:
    lcmA = A[0]
else:
    lcmA = reduce(lcm, A)

n = lcmA
while n % 2 == 0:
    n //= 2
if n == 1:
    print(0)
else:
  print( 1 + (M - n)//(2*n))

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

def lcm(a,b):
    return int(a * b / gcd(a, b))

N, M = map(int,input().split())
A = sorted(list(map(int,input().split())))
if len(A) == 1:
    lcmA = A[0]
else:
    lcmA = reduce(lcm, A)

n = lcmA
while n % 2 == 0:
    n //= 2
if n == 1:
    print(0)
else:
  print( 1 + (M - n)//lcmA)

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

def lcm(a,b):
    return int(a * b / gcd(a, b))

N, M = map(int,input().split())
A = sorted(list(map(int,input().split())))
lcmA = reduce(lcm, A)
if M < lcmA//2:
    print(0)
else:
    print( 1 + (M - lcmA//2)//lcmA)