Problem p02814 (python)

Fixed submission:
N,M = map(int, input().split())
a_n = list(map(int, input().split()))
g = a_n.copy()
 
while not any(x%2 for x in g): g = [x//2 for x in g]
if not all(x%2 for x in g): print(0); exit(0)
def gcd(a,b):
  while b: a,b = b,a%b
  return a
lcm = lambda a,b: a*b//gcd(a,b)
tot = 1
for x in a_n: tot = lcm(tot,x//2)
print((M//tot+1)//2)

Buggy submission (verdict: Runtime Error):
N,M = map(int, input().split())
a_n = list(map(int, input().split()))
g = a_n.copy()

while not any(x%2 for x in g): g = [x//2 for x in g]
if not all(x%2 for x in g): print(0); exit(0)
def gcd(a,b):
  while b: a,b = b,a%b
  return a
lcm = lambda a,b: a*b//gcd(a,b)
tot = 1
for x in l: tot = lcm(tot,x//2)
print((m//tot+1)//2)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split(" "))
a_n = list(set(map(int, input().split(" "))))
g = a.copy()
 
while not any(x%2 for x in g):
  g = [i //2 for i in g]
  if not all(x%2 for x in g): 
    print(0); exit(0)

def gcd(a, b):
  while b:
    a, b = b, a % b
  return a
 
def lcm(a, b):
  return a * b // gcd(a, b)
 
tot = 1
 
for x in a:
  tot = lcm(tot, x//2)
print((M//tot+1)//2)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split(" "))
a_n = list(set(map(int, input().split(" "))))
g = a.copy()
 
while not any(x%2 for x in g):
  g = [i //2 for i in g]
  if not all(x%2 for x in g): 
    print(0); exit(0)

def gcd(a, b):
  while b:
    a, b = b, a % b
  return a
 
def lcm(a, b):
  return a * b // gcd(a, b)
 
tot = 1
 
for x in a:
  tot = lcm(tot, x//2)
print((M//tot+1)//2)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
a_n = list(map(int, input().split()))
a_n = [int(a_n[i]*1/2) for i in range(len(a_n))]
 
def lcm(lis):
    from fractions import gcd
    x = 0
    x = [(x * lis[i]) // gcd(x, lis[i]) for i in range(1, len(lis))]
    return x
res = lcm(a_n)
 
count = 0
p = 0
while res * (2 * p + 1) <= M:
    count += 1
    p += 1
print(count)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
a_n = list(map(int, input().split()))
a_n = [int(a_n[i]*1/2) for i in range(len(a_n))]
 
def lcm(lis):
    from fractions import gcd
    x = lis[0]
    for i in range(1, len(lis)):
        x = (x * lis[i]) // gcd(x, lis[i])
    return x
res = lcm(a_n)

count = 0
for i in range(len(M)):
  count += 1
  if res * (2 * i + 1) > M:
    break

print(count)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
a_n = list(map(int, input().split()))
a_n = [int(a_n[i]*1/2) for i in range(len(a_n))]
 
def lcm(lis):
    from fractions import gcd
    x = lis[0]
    for i in range(1, len(lis)):
        x = (x * lis[i]) // gcd(x, lis[i])
    return x
res = lcm(a_n)
count = 0
for i in range(len(M)):
  count += 1
  if res*(2*i + 1) > M:
    break
print(count)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
a_n = list(map(int, input().split()))
a_n = [int(a_n[i]*1/2) for i in range(len(a_n))]
 
def lcm(lis):
    from fractions import gcd
    x = lis[0]
    for i in range(1, len(lis)):
        x = (x * lis[i]) // gcd(x, lis[i])
    return x
res = lcm(a_n)
count = 0
for i in range(len(M)):
    count += 1
    if res*(2*i + 1) > M:
      break
print(count)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
a_n = [int(x/2) for x in input().split()]

def lcm(lis):
    from fractions import gcd
    x = lis[0]
    for i in range(1, len(lis)):
        x = (x * lis[i]) // gcd(x, lis[i])
    return x
res = lcm(a_n)
count = 0
for i in range(int(M/res)-1):
    count += 1
print(count)