Problem p02814 (python)

Fixed submission:
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a
 
def div_ceil(x, y): return (x + y - 1) // y
 
N, M = map(int, input().split())
*A, = map(int, input().split())
A = list(set([a // 2 for a in A]))
L = A[0]
for a in A[1:]:
    L *= a // gcd(L, a)
for a in A:
    if (L // a) % 2 == 0:
        ans = 0
        break
else:
    ans = div_ceil(M // L, 2)
print(ans)

Buggy submission (verdict: Runtime Error):
import fractions
n,m = map(int,input().split())
l = input().split()
lcm = 1
sum = 0
for i in range(len(l)):
    lcm = (int(l[i]) * lcm) // fractions.gcd(int(l[i]), lcm)
for i in range(len(l)):
    if (lcm // int(l[i])) % 2 == 1:
        sum += 1
if sum == len(l):
    x = m // (int(lcm) / 2)
    y = m // lcm
    print(int(x - y))
else:
    print(0)

Buggy submission (verdict: Runtime Error):
ort fractions
n,m = map(int,input().split())
l = input().split()
lcm = 1
sum = 0
for i in range(len(l)):
    lcm = (int(l[i]) * lcm) // fractions.gcd(int(l[i]), lcm)
for i in range(len(l)):
    if (lcm // int(l[i])) % 2 == 1:
        sum += 1
if sum == len(l):
    x = m // (int(lcm) / 2)
    y = m // lcm
    print(int(x - y))
else:
    print(0)

Buggy submission (verdict: Runtime Error):
import fractions
n,m = map(int,input().split())
l = input().split()
lcm = 1
sum = 0
for i in range(len(l)):
    lcm = (int(l[i]) * lcm) // fractions.gcd(int(l[i]), lcm)
for i in range(len(l)):
    if (lcm // int(l[i])) % 2 == 1:
        sum += 1
if sum == len(l):
    x = m // (int(lcm) / 2)
    y = m // lcm
    print(int(x - y))
else:
    print(0)

Buggy submission (verdict: Runtime Error):
import fractions
n,m = map(int,input().split())
l = input().split()
lcm = 1
sum = 0
for i in range(len(l)):
    lcm = (int(l[i]) * lcm) // fractions.gcd(int(l[i]), lcm)
for i in range(len(l)):
    if lcm // int(len(i)) % 2 == 1:
        sum += 1
if sum == len(l):
    x = m // (int(lcm) / 2)
    y = m // lcm
    print(int(x - y))
else:
    print(0)

Buggy submission (verdict: Runtime Error):
import fractions
n,m = map(int,input().split())
l = input().split()
lcm = 1
sum = 0
for i in range(len(l)):
    lcm = (int(l[i]) * lcm) // fractions.gcd(int(l[i]), lcm)
    sum += int(l[i]) % 2

if sum == len(l) or sum == 0:
    x = m // (int(lcm) / 2)
    y = m // lcm
    print(int(x - y))
else:
    print(0)

Buggy submission (verdict: Runtime Error):
import fractions
n,m = map(int,input().split())
l = input().split()
lcm = 1
for i in range(len(l)):
    lcm = (int(l[i]) * lcm) // fractions.gcd(int(l[i]), lcm)
    
counter = 0
sum = 0

for i in range(len(l)):
    if lcm // int(l[i]) % 2 == 1:
        counter += 1
        
if counter == len(l):
    sum += 1

x = m // (int(lcm)/2)
y = m // lcm
print(int(x-y))

Buggy submission (verdict: Runtime Error):
import fractions
n,m = map(int,input().split())
l = input().split()
lcm = 1
for i in range(len(l)):
    lcm = (int(l[i]) * lcm) // fractions.gcd(int(l[i]), lcm)
x = m // (int(lcm)/2)
y = m // lcm
print(int(x-y))

Buggy submission (verdict: Runtime Error):
import fractions
n,m = map(int,input().split())
l = input().split()
lcm = 1
for i in range(len(l) -1):
    lcm = (int(l[i]) * lcm) // fractions.gcd(int(l[i]), lcm)
x = m // (int(lcm)/2)
y = m // lcm
print(int(x-y))

Buggy submission (verdict: Runtime Error):
import fractions
n,m = map(int,input().split())
l = input().split()
for i in range(len(l) -1):
    lcm = (int(l[i]) * int(l[i + 1])) // fractions.gcd(int(l[i]), int(l[i + 1]))
x = m // (int(lcm)/2)
y = m // lcm
print(int(x-y))

Buggy submission (verdict: Runtime Error):
import fractions
n,m = map(int,input().split())
l = input().split()
for i in range(len(l) -1):
    lcm = (int(l[i]) * int(l[i + 1])) // fractions.gcd(int(l[i]), int(l[i + 1]))
x = m // (int(lcm)/2)
y = m // lcm
print(int(x-y))

Buggy submission (verdict: Runtime Error):
import fractions
n,m = map(int,input().split())
l = input().split()
for i in range(len(l)):
    lcm = (int(l[i]) * int(l[i + 1])) // fractions.gcd(int(l[i]), int(l[i + 1]))
x = m // (int(lcm)/2)
y = m // lcm
print(int(x-y))

Buggy submission (verdict: Runtime Error):
import fractions
n,m = map(int,input().split())
a,b = map(int,input().split())
lcm = (a * b) // fractions.gcd(a, b)
x = m // (int(lcm)/2)
y = m // lcm
print(int(x-y))

Buggy submission (verdict: Runtime Error):
import fractions
n,m = map(int,input().split())
a,b = map(int,input().split())
lcm = (a * b) // fractions.gcd(a, b)
x = m // (lcm /2 )
y = m // (lcm)
print(int(x-y))

Buggy submission (verdict: Runtime Error):
import math
# -*- coding: utf-8 -*-

n, m = map(int, raw_input().split())
a = raw_input().split()

sum = 0
for i in range(m):
    counter = 0
    for k in range(len(a)):
        d = int(a[k])
        if (float(i + 1) - 0.5 * float(d)) % d == 0:
            counter += 1
    if counter == len(a):
        sum += 1

print sum