Problem: Given are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M.  Let a _semi-common multiple_ of A be a positive integer X that satisfies the following condition for every k (1 \leq k \leq N):    * There exists a non-negative integer p such that X= a_k \times (p+0.5).  Find the number of semi-common multiples of A among the integers between 1 and M (inclusive).

Submission attempts (in order):
mod = 10**9+7
import sys
from collections import Counter, defaultdict, deque
from itertools import product, permutations, combinations, combinations_with_replacement
from itertools import accumulate
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush
from math import ceil,floor
from copy import deepcopy
from heapq import heappop,heappush,heapify
import heapq


# l = ['a', 'a', 'a', 'a', 'b', 'c', 'c']
# c = Counter(l)



sys.setrecursionlimit(10 ** 6)

int1 = lambda x: int(x) - 1


p2D = lambda x: print(*x, sep="\n")

def II(): return int(sys.stdin.readline())

def MI(): return map(int, sys.stdin.readline().split())
def MI1(): return map(int1, sys.stdin.readline().split())




def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LI(): return list(map(lambda x:int(x), sys.stdin.readline().split()))
def HI(): return list(map(lambda x:int(x)*(-1), sys.stdin.readline().split()))



# n = II()
# p = tuple(MI())
# q = tuple(MI())

# l = list(permutations(list(range(1,n+1))))
# print(abs(l.index(p)-l.index(q)))
def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a%b)
 
def lcm(a, b):
	return a // gcd(a, b) * b
 
N, M = MI()
a = LI()
a = [a//2 for a in a]

print(a)

while a[0] % 2 == 0:
	for i in range(N):
		if a[i] % 2 != 0:
			print(0)
			exit()
		a[i] //= 2
	M //= 2

print(a)
 
for i in range(N):
	if a[i] % 2 == 0:
		print(0)
		exit()
 
L = 1
for i in range(N):
	L = lcm(L, a[i])
	if M < L:
		print(0)
		exit()
 
print((M // L + 1) // 2)

mod = 10**9+7
import sys
from collections import Counter, defaultdict, deque
from itertools import product, permutations, combinations, combinations_with_replacement
from itertools import accumulate
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush
from math import ceil,floor
from copy import deepcopy
from heapq import heappop,heappush,heapify
import heapq


# l = ['a', 'a', 'a', 'a', 'b', 'c', 'c']
# c = Counter(l)



sys.setrecursionlimit(10 ** 6)

int1 = lambda x: int(x) - 1


p2D = lambda x: print(*x, sep="\n")

def II(): return int(sys.stdin.readline())

def MI(): return map(int, sys.stdin.readline().split())
def MI1(): return map(int1, sys.stdin.readline().split())




def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LI(): return list(map(lambda x:int(x), sys.stdin.readline().split()))
def HI(): return list(map(lambda x:int(x)*(-1), sys.stdin.readline().split()))



# n = II()
# p = tuple(MI())
# q = tuple(MI())

# l = list(permutations(list(range(1,n+1))))
# print(abs(l.index(p)-l.index(q)))
def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a%b)
 
def lcm(a, b):
	return a // gcd(a, b) * b
 
N, M = MI()
A = LI()
A = [a//2 for a in A]

print(A)

while A[0] % 2 == 0:
	for i in range(N):
		if A[i] % 2 != 0:
			print(0)
			exit()
		A[i] //= 2
	M //= 2

print(A)
 
for i in range(N):
	if A[i] % 2 == 0:
		print(0)
		exit()
 
lcm_ = 1
for i in range(N):
	lcm_ = lcm(lcm_, A[i])
	if M < lcm_:
		print(0)
		exit()
 
print((M // lcm_ + 1) // 2)

mod = 10**9+7
import sys
from collections import Counter, defaultdict, deque
from itertools import product, permutations, combinations, combinations_with_replacement
from itertools import accumulate
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush
from math import ceil,floor
from copy import deepcopy
from heapq import heappop,heappush,heapify
import heapq


# l = ['a', 'a', 'a', 'a', 'b', 'c', 'c']
# c = Counter(l)



sys.setrecursionlimit(10 ** 6)

int1 = lambda x: int(x) - 1


p2D = lambda x: print(*x, sep="\n")

def II(): return int(sys.stdin.readline())

def MI(): return map(int, sys.stdin.readline().split())
def MI1(): return map(int1, sys.stdin.readline().split())




def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LI(): return list(map(lambda x:int(x), sys.stdin.readline().split()))
def HI(): return list(map(lambda x:int(x)*(-1), sys.stdin.readline().split()))



# n = II()
# p = tuple(MI())
# q = tuple(MI())

# l = list(permutations(list(range(1,n+1))))
# print(abs(l.index(p)-l.index(q)))
def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a%b)
 
def lcm(a, b):
	return a // gcd(a, b) * b
 
N, M = MI()
A = LI()
A = [a//2 for a in A]


while A[0] % 2 == 0:
	for i in range(N):
		if A[i] % 2 != 0:
			print(0)
			exit()
		A[i] //= 2
	M //= 2

 
for i in range(N):
	if A[i] % 2 == 0:
		print(0)
		exit()
 
tmp_lcm = 1
for i in range(N):
	tmp_lcm = lcm(tmp_lcm, A[i])
	if M < tmp_lcm:
		print(0)
		exit()
 
print((M // tmp_lcm + 1) // 2)

Verdicts: Wrong Answer

Wrong Answer

Accepted