Problem p02814 (python)

Fixed submission:
import fractions
from functools import reduce
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)
def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
nm=list(map(int, input().split()))
a=list(map(int, input().split()))
n=nm[0]
m=nm[1]
b=0
c=a[0]
dnum=0
while c%2==0:
    dnum+=1
    c=c//2
for i in range(len(a)):
    c=a[i]
    dnum1=0
    while c%2==0:
        dnum1+=1
        c=c//2
    #print(dnum)
    if dnum1!=dnum:
        b=1
        break

#print(a)
if b==1:
    print(0)
else:
    for i in range(len(a)):
        a[i]=a[i]//2
    #print(a)
    amc=lcm_list(a)
    #print(amc)
    # version3.5にてgcdがfractionsからmathに移動した
    print(int((m+amc)/(2*amc)))

Buggy submission (verdict: Runtime Error):
import math
def lcm_list(numbers):
    answer=numbers[0]
    for number in numbers:
        answer=(answer*number/math.gcd(answer,number))
    return answer
nm=list(map(int, input().split()))
a=list(map(int, input().split()))
n=nm[0]
m=nm[1]
b=0
while a[0]%2==0:
    for i in range(len(a)):
        if a[i]%2==0:
            a[i]=int(a[i]/2)
        else:
            b=1
            break
if b==1:
    print(0)
else:
    #amc=lcm_list(a)
    amc=math.gcd(a[0],a[1])
    print(int((m+amc)/(2*amc)))

Buggy submission (verdict: Runtime Error):
import math
def lcm_list(numbers):
    answer=numbers[0]
    for number in numbers:
        answer=(answer*number/math.gcd(answer,number))
    return answer
nm=list(map(int, input().split()))
a=list(map(int, input().split()))
n=nm[0]
m=nm[1]
b=0
while a[0]%2==0:
    for i in range(len(a)):
        if a[i]%2==0:
            a[i]=int(a[i]/2)
        else:
            b=1
            break
if b==1:
    print(0)
else:
    amc=lcm_list(a)
    #amc=math.gcd()
    print(int((m+amc)/(2*amc)))

Buggy submission (verdict: Runtime Error):
import math
def lcm_list(numbers):
    answer=numbers[0]
    for number in numbers:
        answer=(answer*number/math.gcd(answer*number))
    return answer
nm=list(map(int, input().split()))
a=list(map(int, input().split()))
n=nm[0]
m=nm[1]
b=0
while a[0]%2==0:
    for i in range(len(a)):
        if a[i]%2==0:
            a[i]=int(a[i]/2)
        else:
            b=1
            break
if b==1:
    print(0)
else:
    amc=lcm_list(a)
    print(int((m+amc)/(2*amc)))

Buggy submission (verdict: Runtime Error):
import math
def lcm_base(x, y):
    return int((x * y) / math.gcd(x, y))
def lcm_list(numbers):
    answer=numbers[0]
    for number in numbers:
        answer=lcm_base(answer,number)
    return answer
nm=list(map(int, input().split()))
a=list(map(int, input().split()))
n=nm[0]
m=nm[1]
b=0
while a[0]%2==0:
    for i in range(len(a)):
        if a[i]%2==0:
            a[i]=int(a[i]/2)
        else:
            b=1
            break
if b==1:
    print(0)
else:
    # amc=lcm_list(a)
    print(int((m+amc)/(2*amc)))

Buggy submission (verdict: Runtime Error):
import math
def lcm_base(x, y):
    return int((x * y) / math.gcd(x, y))
def lcm_list(numbers):
    answer=numbers[0]
    for number in numbers:
        answer=lcm_base(answer,number)
    return answer
nm=list(map(int, input().split()))
a=list(map(int, input().split()))
n=nm[0]
m=nm[1]
b=0
# while a[0]%2==0:
#     for i in range(len(a)):
#         if a[i]%2==0:
#             a[i]=int(a[i]/2)
#         else:
#             b=1
#             break
if b==1:
    print(0)
else:
    amc=lcm_list(a)
    print(int((m+amc)/(2*amc)))

Buggy submission (verdict: Runtime Error):
import math
def lcm_base(x, y):
    return int((x * y) / math.gcd(x, y))
def lcm_list(numbers):
    answer=numbers[0]
    for number in numbers:
        answer=lcm_base(answer,number)
    return answer
nm=list(map(int, input().split()))
a=list(map(int, input().split()))
n=nm[0]
m=nm[1]
b=0
while a[0]%2==0:
    for i in range(len(a)):
        if a[i]%2==0:
            a[i]=int(a[i]/2)
        else:
            b=1
            break
if b==1:
    print(0)
else:
    amc=lcm_list(a)
    print(int((m+amc)/(2*amc)))

Buggy submission (verdict: Runtime Error):
import math
def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)
def lcm_list(numbers):
    answer=numbers[0]
    for number in numbers:
        answer=lcm_base(answer,number)
    return answer
nm=list(map(int, input().split()))
a=list(map(int, input().split()))
n=nm[0]
m=nm[1]
b=0
while a[0]%2==0:
    for i in range(len(a)):
        if a[i]%2==0:
            a[i]=a[i]//2
        else:
            b=1
            break
if b==1:
    print(0)
else:
    amc=lcm_list(a)
    print((m+amc)//(2*amc))

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce
def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)
# def lcm_list(numbers):
#     return reduce(lcm_base, numbers, 1)
nm=list(map(int, input().split()))
a=list(map(int, input().split()))
n=nm[0]
m=nm[1]
b=0
while a[0]%2==0:
    for i in range(len(a)):
        if a[i]%2==0:
            a[i]=a[i]//2
        else:
            b=1
            break
if b==1:
    print(0)
else:
    amc=lcm_list(a)
    print((m+amc)//(2*amc))

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce
def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)
def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
nm=list(map(int, input().split()))
a=list(map(int, input().split()))
n=nm[0]
m=nm[1]
b=0
while a[0]%2==0:
    for i in range(len(a)):
        if a[i]%2==0:
            a[i]=a[i]//2
        else:
            b=1
            break
if b==1:
    print(0)
else:
    amc=lcm_list(a)
    print((m+amc)//(2*amc))

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce
def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)
def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
nm=list(map(int, input().split()))
a=list(map(int, input().split()))
n=nm[0]
m=nm[1]
b=0
while a[0]%2==0:
    for i in range(len(a)):
        if a[i]%2==0:
            a[i]=a[i]//2
        else:
            b=1
            break
if b==1:
    print(0)
else:
    amc=lcm_list(a)
    print((m+amc)//(2*amc))

Buggy submission (verdict: Runtime Error):
def lcm(x, y):
    return (x * y) // math.gcd(x, y)

import math
nm=list(map(int,input().split()))
a=list(map(int,input().split()))
lcm1=a[0]
for i in range(nm[0]-1):
    lcm1=lcm(lcm1, a[i+1])
answer=((nm[1]/lcm1-0.5)+1)//1
print(int(answer))

Buggy submission (verdict: Runtime Error):
def lcm(x, y):
    return (x * y) // math.gcd(x, y)

import math
nm=list(map(int,input().split()))
a=list(map(int,input().split()))
lcm1=a[0]
for i in range(nm[0]-1):
    lcm1=lcm(lcm1, a[i+1])
answer=(nm[1]/lcm1-0.5)//1+1
print(int(answer))

Buggy submission (verdict: Runtime Error):
def lcm(x, y):
    return (x * y) // math.gcd(x, y)

import math
nm=list(map(int,input().split()))
a=list(map(int,input().split()))
lcm1=a[0]
for i in range(nm[0]-1):
    lcm1=lcm(lcm1, a[i+1])
answer=nm[1]//(lcm1)+1
print(answer)