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


def main():
    n, m = map(int, input().split())
    a = list(map(int, input().split()))
    j = 0
    mul = a[0]
    for i in range(1, n):
        mul = mul * a[i] // fractions.gcd(mul, a[i])
    for i in a:
        if (mul // i) % 2 == 0:
            j = 1
            break
    if m >= mul / 2 and j == 0:
        ans = (m - mul / 2) // mul + 1
        print(int(ans))
    else:
        print(0)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import fractions


def main():
    n, m = map(int, input().split())
    a = list(map(int, input().split()))
    mul = a[0]
    for i in range(1, n):
        mul = mul * a[i] // fractions.gcd(mul, a[i])
    for i in a:
        if (mul // i) % 2 == 0:
            print(0)
            exit()
    if m >= mul / 2:
        ans = (m - mul / 2) // mul + 1
        print(int(ans))
    else:
        print(0)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import fractions


def main():
    n, m = map(int, input().split())
    a = list(map(int, input().split()))
    mul = a[0]
    for i in range(1, n):
        mul = mul * a[i] // fractions.gcd(mul, a[i])
    for i in a:
        if mul // i % 2 == 0:
            print(0)
            exit()
    if m >= mul / 2:
        ans = (m - mul / 2) // mul + 1
        print(int(ans))
    else:
        print(0)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import fractions


def main():
    n, m = map(int, input().split())
    a = list(map(int, input().split()))
    mul = a[0]
    for i in range(1, n):
        mul = mul * a[i] // fractions.gcd(mul, a[i])
    a_2 = map(lambda x: mul // x % 2, a)
    if 0 in a_2:
        print(0)
        exit()
    if m >= mul / 2:
        ans = (m - mul / 2) // mul + 1
        print(int(ans))
    else:
        print(0)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import fractions


def main():
    n, m = map(int, input().split())
    a = list(map(int, input().split()))
    mul = a[0]
    for i in range(1, n):
        mul = mul * a[i] // fractions.gcd(mul, a[i])
    a_2 = map(lambda x: mul / x % 2, a)
    if 0 in a_2:
        print(0)
        exit()
    if m >= mul / 2:
        ans = (m - mul / 2) // mul + 1
        print(int(ans))
    else:
        print(0)


if __name__ == '__main__':
    main()

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)


def main():
    n, m = map(int, input().split())
    a = list(map(int, input().split()))
    mul = lcm_list(a)

    if m > (mul // 2):
        ans = ((m - (mul // 2)) // mul) + 1
        print(int(ans))
    else:
        print(0)


if __name__ == '__main__':
    main()

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)


def main():
    n, m = map(int, input().split())
    a = list(map(int, input().split()))
    mul = lcm_list(a)

    if m > mul // 2:
        ans = (m - mul // 2) // mul + 1
        print(int(ans))
    else:
        print(0)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import math


def main():
    n, m = map(int, input().split())
    a = list(map(int, input().split()))
    mul = a[0]
    for i in range(1, n):
        mul = mul * a[i] // math.gcd(mul, a[i])
    if m > mul // 2:
        ans = (m - mul // 2) // mul + 1
        print(int(ans))
    else:
        print(0)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import math


def main():
    n, m = map(int, input().split())
    a = list(map(int, input().split()))
    mul = a[0]
    for i in range(1, n):
        mul = mul * a[i] // math.gcd(mul, a[i])
    ans = (m - mul / 2) // mul + 1
    print(int(ans))


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import math


def main():
    n, m = map(int, input().split())
    a = list(map(int, input().split()))
    mul = a[0]
    for i in range(1, n):
        mul = mul * a[i] // math.gcd(mul, a[i])
    ans = (m - mul / 2) // mul + 1
    print(int(ans))


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import math


def main():
    n, m = map(int, input().split())
    a = list(map(int, input().split()))
    mul = a[0]
    for i in range(1, n):
        mul = mul * a[i] // math.gcd(mul, a[i])
    if mul % 2 == 1:
        print(0)
        exit()
    ans = (m - mul / 2) // mul + 1
    print(int(ans))


if __name__ == '__main__':
    main()