Problem p02814 (python)

Fixed submission:
import fractions,sys

n,m=map(int,input().split())
a = list(map(int, input().split()))
# ans = a[0]
# for i in range(1,n):
#     ans = ans * a[i] // fractions.gcd(ans, a[i])
ff=[]
for j in  a:
    count=0
    for i in range(1,36):
        if j%(2**i)==0:
            count+=1
    ff.append(count)
ff=[i==ff[0] for i in ff]

 
b = [int(i/2) for i in a]
# b_list=[i%4==0 for i in b]
# bb=sum(b_list)
# if bb!=0 and bb!=n:
if all(ff)==False:
    print(0)
    exit()

ans2= b[0]
for i in range(1,n):
    ans2 = ans2 * b[i] // fractions.gcd(ans2, b[i])

# tf=[(ans2/i)%2==0 for i in b]
# and any(tf)
if ans2>m:
    print(0)
else:
    print((m-ans2)//(ans2*2)+1)

Buggy submission (verdict: Runtime Error):
import fractions,sys

n,m=map(int,input().split())
a = list(map(int, input().split()))
# ans = a[0]
# for i in range(1,n):
#     ans = ans * a[i] // fractions.gcd(ans, a[i])
ff=[]
for j in  a:
    count=0
    for i in range(1,36):
        if j%(2**i)==0:
            count+=1
    ff.append(count)
ff=[i==ff[0] for i in ff]

 
# b = [int(i/2) for i in a]
# b_list=[i%4==0 for i in b]
# bb=sum(b_list)
# if bb!=0 and bb!=n:
if all(ff)==False:
    print(0)
    exit()

ans2= b[0]
for i in range(1,n):
    ans2 = ans2 * b[i] // fractions.gcd(ans2, b[i])

# tf=[(ans2/i)%2==0 for i in b]
# and any(tf)
if ans2>m:
    print(0)
else:
    print((m-ans2)//(ans2*2)+1)

Buggy submission (verdict: Runtime Error):
import fractions,sys

n,m=map(int,input().split())
a = list(map(int, input().split()))
# ans = a[0]
# for i in range(1,n):
#     ans = ans * a[i] // fractions.gcd(ans, a[i])
ff=[]
for j in  a:
    count=0
    for i in range(1,36):
        if j%(2**i)==0:
            count+=1
    ff.append(count)
ff=[i==ff[0] for i in ff]

 
# b = [int(i/2) for i in a]
# b_list=[i%4==0 for i in b]
# bb=sum(b_list)
# if bb!=0 and bb!=n:
if all(ff)==False:
    print(0)
#     exit()

ans2= b[0]
for i in range(1,n):
    ans2 = ans2 * b[i] // fractions.gcd(ans2, b[i])

# tf=[(ans2/i)%2==0 for i in b]
# and any(tf)
if ans2>m:
    print(0)
else:
    print((m-ans2)//(ans2*2)+1)

Buggy submission (verdict: Runtime Error):
import fractions,sys

n,m=map(int,input().split())
a = list(map(int, input().split()))
# ans = a[0]
# for i in range(1,n):
#     ans = ans * a[i] // fractions.gcd(ans, a[i])
 
 
b = [int(i/2) for i in a]
b_list=[i%4==0 for i in b]
bb=sum(b_list)
if bb!=0 and bb!=n:
    print(0)
    exit()

ans2= b[0]
for i in range(1,n):
    ans2 = ans2 * b[i] // fractions.gcd(ans2, b[i])

tf=[(ans2/i)%2==0 for i in b]
if ans2>m and any(tf):
    print(0)
else:
    print((m-ans2)//(ans2*2)+1)

Buggy submission (verdict: Runtime Error):
import fractions
 
n,m=map(int,input().split())
a = list(map(int, input().split()))
# ans = a[0]
# for i in range(1,n):
#     ans = ans * a[i] // fractions.gcd(ans, a[i])
 
 
b = [int(i/2) for i in a]
ans2= b[0]
for i in range(1,n):
    ans2 = ans2 * b[i] // fractions.gcd(ans2, b[i])

tf=[(ans2/i)%2==0 for i in b]
if ans2>m and any(tf):
    print(0)
else:
    print((m-ans2)//(ans2*2)+1)

Buggy submission (verdict: Runtime Error):
import　fractions

n,m=map(int,input().split())
a = list(map(int, input().split()))
ans = a[0]
for i in range(1,n):
    ans = ans * a[i] // fractions.gcd(ans, a[i])


b = [int(i/2) for i in a]
ans2= b[0]
for i in range(1,n):
    ans2 = ans2 * b[i] // fractions.gcd(ans2, b[i])

Buggy submission (verdict: Runtime Error):
import math

n,m=map(int,input().split())
a = list(map(int, input().split()))
ans = a[0]
for i in range(1,n):
    ans = ans * a[i] // math.gcd(ans, a[i])


b = [int(i/2) for i in a]
ans2= b[0]
for i in range(1,n):
    ans2 = ans2 * b[i] // math.gcd(ans2, b[i])


if ans2>m:
    print(0)
else:
    print((m-ans2)//ans+1)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
a = list(map(int, input().split()))

import math
ans = a[0]
for i in range(1,n):
    ans = ans * a[i] // math.gcd(ans, a[i])


b = [int(i/2) for i in a]
ans2= b[0]
for i in range(1,n):
    ans2 = ans2 * b[i] // math.gcd(ans2, b[i])


if ans2>m:
    print(000)
else:
    print((m-ans2)//ans+1)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
a = list(map(int, input().split()))
import math
ans = a[0]
for i in range(1,n):
    ans = ans * a[i] // math.gcd(ans, a[i])


b = [int(i/2) for i in a]
ans2= b[0]
for i in range(1,n):
    ans2 = ans2 * b[i] // math.gcd(ans2, b[i])


if ans2>m:
    print(0)
else:
    print((m-ans2)//ans+1)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
import math
a = list(map(int, input().split()))
ans = a[0]
for i in range(1, n):
    ans = ans * a[i] // math.gcd(ans, a[i])


b = [int(i/2) for i in a]
ans2= b[0]
for i in range(1, n):
    ans2 = ans2 * b[i] // math.gcd(ans2, b[i])


if ans2>m:
    print(0)
else:
    print((m-ans2)//ans+1)