Buggy python submission (verdict: Runtime Error):
import sys
from fractions import gcd

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


def merge(a, b):
    g = gcd(a, b)
    a //= g
    b //= g
    if a % 2 == 0:
        return 0
    if b % 2 == 0:
        return 0
    n = a * b * g
    if n > 10 ** 9:
        return 0
    return n


n, m = map(int, readline().split())
a = list(map(int, readline().split()))

a = [x >> 1 for x in a]

for i in range(n-1):
    a[i+1] = int(a[i] * a[i+1] / merge(a[i], a[i+1]))

if a[n-1] > 10**9:
    print("0")
else:
    t = m // a[i+1]
    ans = (m // a[i+1]) - (m // (a[i+1] * 2))
    print(ans)


Fixed submission:
from fractions import gcd
from functools import reduce

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
N, M, *A = map(int, read().split())
 
# 「奇数倍」に帰着
A = [x >> 1 for x in A]
 

def merge(a, b):
    g = gcd(a, b)
    a //= g
    b //= g
    if a % 2 == 0:
        return 0
    if b % 2 == 0:
        return 0
    n = a * b * g
    if n > 10 ** 9:
        return 0
    return n


x = reduce(merge, A)

if x == 0:
    answer = 0
else:
    answer = (M//x) - (M//(x+x))
 
print(answer)

Buggy python submission (verdict: Runtime Error):
import sys
from fractions import gcd

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n, m = map(int, readline().split())
a = list(map(int, readline().split()))

a = [x >> 1 for x in a]

for i in range(n-1):
    a[i+1] = int(a[i] * a[i+1] / gcd(a[i], a[i+1]))

if a[n-1] > 10**9:
    print("0")
else:
    t = m // a[i+1]
    ans = (m // a[i+1]) - (m // (a[i+1] * 2))
    print(ans)


Fixed submission:
from fractions import gcd
from functools import reduce

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
N, M, *A = map(int, read().split())
 
# 「奇数倍」に帰着
A = [x >> 1 for x in A]
 

def merge(a, b):
    g = gcd(a, b)
    a //= g
    b //= g
    if a % 2 == 0:
        return 0
    if b % 2 == 0:
        return 0
    n = a * b * g
    if n > 10 ** 9:
        return 0
    return n


x = reduce(merge, A)

if x == 0:
    answer = 0
else:
    answer = (M//x) - (M//(x+x))
 
print(answer)

Buggy python submission (verdict: Runtime Error):
import sys
import math

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n, m = map(int, readline().split())
a = list(map(int, readline().split()))

for i in range(n-1):
    a[i+1] = int(a[i] * a[i+1] / math.gcd(a[i], a[i+1]))

t = (a[n-1] // 2)
t = m // t
ans = math.ceil(t / 2)
print(ans)


Fixed submission:
from fractions import gcd
from functools import reduce

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
N, M, *A = map(int, read().split())
 
# 「奇数倍」に帰着
A = [x >> 1 for x in A]
 

def merge(a, b):
    g = gcd(a, b)
    a //= g
    b //= g
    if a % 2 == 0:
        return 0
    if b % 2 == 0:
        return 0
    n = a * b * g
    if n > 10 ** 9:
        return 0
    return n


x = reduce(merge, A)

if x == 0:
    answer = 0
else:
    answer = (M//x) - (M//(x+x))
 
print(answer)

Buggy python submission (verdict: Runtime Error):
from fractions import gcd
import sys
import math

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n, m = map(int, readline().split())
a = list(map(int, readline().split()))

for i in range(n-1):
    a[i+1] = int(a[i] * a[i+1] / gcd(a[i], a[i+1]))

t = (a[n-1] // 2)
t = m // t
ans = math.ceil(t / 2)
print(ans)


Fixed submission:
from fractions import gcd
from functools import reduce

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
N, M, *A = map(int, read().split())
 
# 「奇数倍」に帰着
A = [x >> 1 for x in A]
 

def merge(a, b):
    g = gcd(a, b)
    a //= g
    b //= g
    if a % 2 == 0:
        return 0
    if b % 2 == 0:
        return 0
    n = a * b * g
    if n > 10 ** 9:
        return 0
    return n


x = reduce(merge, A)

if x == 0:
    answer = 0
else:
    answer = (M//x) - (M//(x+x))
 
print(answer)