Problem p02814 (python)

Fixed submission:
import math
import numpy as np
N,M=map(int,input().split())
A=list(map(int,input().split()))
c=1
test=A[0]
l=0

while test%2 == 0:
  test=test//2
  c*=2

def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)
  
for i in np.arange(N-1):
  if A[i+1]%c!=0:
    print(0)
    l=1
    break
  elif A[i+1]%(c*2)==0:
    print(0)
    l=1
    break
  else:
    k=A[i+1]//c
    test=lcm_base(test, k)
if l==0:
  k=test*c//2
  print(M//k//2 + M//k%2)

Buggy submission (verdict: Runtime Error):
import math
import numpy as np
N,M=map(int,input().split())
A=list(map(int,input().split()))
c=1
test=A[0]
l=0

while test%2 == 0:
  test=test//2
  c*=2
  
for i in np.arange(N-1):
  if A[i+1]%c!=0:
    print(0)
    l=1
    break
  elif A[i+1]%(c*2)==0:
    print(0)
    l=1
    break
  else:
    k=A[i+1]//c
    test=test*k//math.gcd(test,k)
if l==0:
  k=test*c/2

Buggy submission (verdict: Runtime Error):
import math
import numpy as np
N,M=map(int,input().split())
A=list(map(int,input().split()))
c=1
test=A[0]
l=0

while test%2 == 0:
  test=test//2
  c*=2

def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)
  
for i in np.arange(N-1):
  if A[i+1]%c!=0:
    print(0)
    l=1
    break
  elif A[i+1]%(c*2)==0:
    print(0)
    l=1
    break
  else:
    k=A[i+1]//c
    test=lcm_base(test, k)
if l==0:
  k=int(test*c/2+0.5)
  print(M//k//2 + M//k%2)

Buggy submission (verdict: Runtime Error):
import math
import numpy as np
N,M=map(int,input().split())
A=list(map(int,input().split()))
c=0
test=A[0]
l=0

while test%2 == 0:
  test=int(test/2+0.5)
  c+=1
d=2**c

def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)
  
for i in np.arange(N-1):
  if A[i+1]%d!=0:
    print(0)
    l=1
    break
  elif A[i+1]%(d*2)==0:
    print(0)
    l=1
    break
  else:
    k=int(A[i+1]/d+0.5)
    test=lcm_base(test, k)
if l==0:
  k=int(test*d/2+0.5)
  print(M//k//2 + M//k%2)

Buggy submission (verdict: Runtime Error):
import math
import numpy as np
N,M=map(int,input().split())
A=list(map(int,input().split()))
c=0
test=A[0]
l=0

while test%2 == 0:
  test=int(test/2+0.5)
  c+=1
d=2**c
 
for i in np.arange(N-1):
  if A[i+1]%d!=0:
    print(0)
    l=1
    break
  elif A[i+1]%(d*2)==0:
    print(0)
    l=1
    break
  else:
    k=int(A[i+1]/d+0.5)
    test=int(test*k/math.gcd(test,k)+0.5)
if l==0:
  k=int(test*d/2+0.5)
  print(M//k//2 + M//k%2)

Buggy submission (verdict: Runtime Error):
import math
import numpy as np
N,M=map(int,input().split())
A=list(map(int,input().split()))
c=0
test=A[0]
l=0

while test%2 == 0:
  test=int(test/2+0.5)
  c+=1
 
for i in np.arange(N-1):
  if A[i+1]%(2**c)!=0:
    print(0)
    l=1
    break
  elif A[i+1]%(2**(c+1))==0:
    print(0)
    l=1
    break
  else:
    k=int(A[i+1]/(2**c)+0.5)
    test=int(test*k/math.gcd(test,k)+0.5)
if l==0:
  k=test*(2**(c-1))
  print(M//k//2 + M//k%2)

Buggy submission (verdict: Runtime Error):
import math
import numpy as np
N,M=map(int,input().split())
A=list(map(int,input().split()))
c=0
test=A[0]
l=0

while test%2 == 0:
  test=int(test/2+0.5)
  c+=1
 
for i in np.arange(N-1):
  if A[i+1]%(2**c)!=0:
    print(0)
    l=1
    break
  elif A[i+1]%(2**(c+1))==0:
    print(0)
    l=1
    break
  else:
    test=int(test*int(A[i+1]/(2**c)+0.5)/math.gcd(test,int(A[i+1]/(2**c)+0.5))+0.5)
if l==0:
  print(M//(test*(2**(c-1)))//2 + M//(test*(2**(c-1)))%2)

Buggy submission (verdict: Runtime Error):
import math
import numpy as np
from numba import jit
N,M=map(int,input().split())
A=list(map(int,input().split()))
c=0
test=A[0]
l=0

while test%2 == 0:
  test=int(test/2)
  c+=1
 
for i in np.arange(N-1):
  if A[i+1]%(2**c)!=0:
    print(0)
    l=1
    break
  elif A[i+1]%(2**(c+1))==0:
    print(0)
    l=1
    break
  else:
    test=int(test*A[i+1]/(2**c)/math.gcd(test,int(A[i+1]/(2**c)+0.5))+0.5)
if l==0:
  print(M//(test*(2**(c-1)))//2 + M//(test*(2**(c-1)))%2)