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):
N, M = map(int, input().split())
a_n = list(map(int, input().split()))
a_n = [int(a_n[i]*1/2) for i in range(len(a_n))]
 
def lcm(lis):
    from fractions import gcd
    x = lis[0]
    for i in range(1, len(lis)):
        x = (x * lis[i]) // gcd(x, lis[i])
    return x
res = lcm(a_n)
 
count = 0
p = 0
while res * (2 * p + 1) <= M:
    count += 1
    p += 1
print(count)

N, M = map(int, input().split())
a_n = list(map(int, input().split()))
a_n = [int(a_n[i]*1/2) for i in range(len(a_n))]
 
def lcm(lis):
    from fractions import gcd
    x = lis[0]
    for i in range(1, len(lis)):
        x = (x * lis[i]) // gcd(x, lis[i])
    return x
res = lcm(a_n)
count = 0
for i in range(len(M)):
    count += 1
    if res*(2*i + 1) > M:
      break
print(count)

N, M = map(int, input().split())
a_n = [int(x/2) for x in input().split()]

def lcm(lis):
    from fractions import gcd
    x = lis[0]
    for i in range(1, len(lis)):
        x = (x * lis[i]) // gcd(x, lis[i])
    return x
res = lcm(a_n)
count = 0
for i in range(int(M/res)-1):
    count += 1
print(count)

N, M = map(int, input().split(" "))
a_n = list(set(map(int, input().split(" "))))
g = a.copy()
 
while not any(x%2 for x in g):
  g = [i //2 for i in g]
  if not all(x%2 for x in g): 
    print(0); exit(0)

def gcd(a, b):
  while b:
    a, b = b, a % b
  return a
 
def lcm(a, b):
  return a * b // gcd(a, b)
 
tot = 1
 
for x in a:
  tot = lcm(tot, x//2)
print((M//tot+1)//2)

N, M = map(int, input().split())
a_n = list(map(int, input().split()))
a_n = [int(a_n[i]*1/2) for i in range(len(a_n))]
 
def lcm(lis):
    from fractions import gcd
    x = lis[0]
    for i in range(1, len(lis)):
        x = (x * lis[i]) // gcd(x, lis[i])
    return x
res = lcm(a_n)
 
count = 0
for i in range(M):
  count += 1
  if res * (2 * i + 1) > M:
    break
print(count)

N, M = map(int, input().split())
a_n = list(map(int, input().split()))
a_n = [int(a_n[i]*1/2) for i in range(len(a_n))]

def lcm(lis):
    from fractions import gcd
    x = lis[0]
    for i in range(1, len(lis)):
        x = (x * lis[i]) // gcd(x, lis[i])
    return x
res = lcm(a_n)
count = 0
for i in range(int(M/res)-1):
    count += 1
print(count)

N, M = map(int, input().split())
a_n = list(map(int, input().split()))
a_n = [int(a_n[i]*1/2) for i in range(len(a_n))]
 
def lcm(lis):
    from fractions import gcd
    x = lis[0]
    for i in range(1, len(lis)):
        x = (x * lis[i]) // gcd(x, lis[i])
    return x
res = lcm(a_n)
count = 0
for i in range(len(M)):
  count += 1
  if res*(2*i + 1) > M:
    break
print(count)

N, M = map(int, input().split(" "))
a_n = list(set(map(int, input().split(" "))))
g = a.copy()
 
while not any(x%2 for x in g):
  g = [i //2 for i in g]
  if not all(x%2 for x in g): 
    print(0); exit(0)

def gcd(a, b):
  while b:
    a, b = b, a % b
  return a
 
def lcm(a, b):
  return a * b // gcd(a, b)
 
tot = 1
 
for x in a:
  tot = lcm(tot, x//2)
print((M//tot+1)//2)

N, M = map(int, input().split())
a_n = list(map(int, input().split()))
a_n = [int(a_n[i]*1/2) for i in range(len(a_n))]
 
def lcm(lis):
    from fractions import gcd
    x = lis[0]
    for i in range(1, len(lis)):
        x = (x * lis[i]) // gcd(x, lis[i])
    return x
res = lcm(a_n)

count = 0
for i in range(len(M)):
  count += 1
  if res * (2 * i + 1) > M:
    break

print(count)

N,M = map(int, input().split())
a_n = list(map(int, input().split()))
g = a_n.copy()

while not any(x%2 for x in g): g = [x//2 for x in g]
if not all(x%2 for x in g): print(0); exit(0)
def gcd(a,b):
  while b: a,b = b,a%b
  return a
lcm = lambda a,b: a*b//gcd(a,b)
tot = 1
for x in l: tot = lcm(tot,x//2)
print((m//tot+1)//2)

N, M = map(int, input().split())
a_n = list(map(int, input().split()))
a_n = [int(a_n[i]*1/2) for i in range(len(a_n))]
 
def lcm(lis):
    from fractions import gcd
    x = 0
    x = [(x * lis[i]) // gcd(x, lis[i]) for i in range(1, len(lis))]
    return x
res = lcm(a_n)
 
count = 0
p = 0
while res * (2 * p + 1) <= M:
    count += 1
    p += 1
print(count)

N, M = map(int, input().split())
a_n = list(map(int, input().split()))
a_n = [int(a_n[i]*1/2) for i in range(len(a_n))]
 
def lcm(lis):
    from fractions import gcd
    x = lis[0]
    for i in range(1, len(lis)):
        x = (x * lis[i]) // gcd(x, lis[i])
    return x
res = lcm(a_n)
 
count = 0
for i in range(M):
  if res * (2 * i + 1) <= M:
    count += 1
  else:
    break
print(count)

N,M = map(int, input().split())
a_n = list(map(int, input().split()))
g = a_n.copy()
 
while not any(x%2 for x in g): g = [x//2 for x in g]
if not all(x%2 for x in g): print(0); exit(0)
def gcd(a,b):
  while b: a,b = b,a%b
  return a
lcm = lambda a,b: a*b//gcd(a,b)
tot = 1
for x in a_n: tot = lcm(tot,x//2)
print((M//tot+1)//2)

Verdicts: Wrong Answer

Runtime Error

Runtime Error

Runtime Error

Wrong Answer

Wrong Answer

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Wrong Answer

Accepted