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):
import copy
import sys
sys.setrecursionlimit(10**7)

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

def main():
    n, m = map(int, input().split())
    
    A = [int(x) for x in input().split()]
    # A_s = set(A)
    # A_ = copy.deepcopy(A)
    # a_lcm = A.pop()
    a_lcm = 1
    
    #if len(A) >= 1:
    for a in A:
        a_lcm = lcm(a_lcm, a)
    #else:
    #    a_lcm = a_lcm
    
    
    for a in A:
        
        # print(0)
        # exit()
        # if a_lcm // 2 % a == 0:
        # if (a_lcm / a) % 2 == 0: 
        if a % 2 == 0:
            continue
    else:
        print(0)
        exit()
        # else:
        #     continue
    
    if (a_lcm / 2) > m:
    # if a_lcm > m * 2:
        print(0)
        exit()
    else:
        
        ans = int((m - (a_lcm / 2)) // a_lcm) + 1
        print(ans)

if __name__ == '__main__':
    main()

import copy
import sys
sys.setrecursionlimit(10**7)

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

def main():
    n, m = map(int, input().split())
    
    A = [int(x) for x in input().split()]
    # A_s = set(A)
    # A_ = copy.deepcopy(A)
    # a_lcm = A.pop()
    a_lcm = 1
    
    #if len(A) >= 1:
    for a in A:
        a_lcm = lcm(a_lcm, a)
    #else:
    #    a_lcm = a_lcm
    
    
    for a in A:
        print(0)
        exit(0)
        # if a_lcm / 2 % a == 0:
        # if (a_lcm / a) % 2 == 0: 
        #     print(0)
        #     exit()
        # else:
        #     continue
    
    # if (a_lcm / 2) > m:
    # # if a_lcm > m * 2:
    #     print(0)
    #     exit()
    # else:
    
    #     ans = int((m - (a_lcm / 2)) // a_lcm) + 1
    #     print(ans)

if __name__ == '__main__':
    main()

import copy

def main():
    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 = map(int, input().split())
    
    A = set([int(x) for x in input().split()])
    
    # A = [int(x) for x in input().split()]
    # A_ = copy.deepcopy(A)
    # a_lcm = A.pop()
    a_lcm = 1
    
    #if len(A) >= 1:
    for a in A:
        a_lcm = lcm(a_lcm, a)
    #else:
    #    a_lcm = a_lcm
    
    
    for i in A:
        if (a_lcm / 2) % i == 0:
        # if (a_lcm / i) % 2 == 0: 
            print(0)
            exit()
        # else:
        #     continue
    
    if (a_lcm / 2) > m:
    # if a_lcm > m * 2:
        print(0)
        exit()
    # else:
    
    # ans = int((m - (a_lcm / 2))) // a_lcm + 1
    ans = int((m - (a_lcm / 2)) // a_lcm) + 1
    print(ans)
    
        # a_lcm = a_lcm // 2
        
        
        
        # else:
         + 1
        # print(ans)

if __name__ == '__main__':
    main()

import copy

def main():
    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 = map(int, input().split())
    
    A = set([int(x) for x in input().split()])
    
    # A = [int(x) for x in input().split()]
    # A_ = copy.deepcopy(A)
    # a_lcm = A.pop()
    a_lcm = 1
    
    #if len(A) >= 1:
    for a in A:
        a_lcm = lcm(a_lcm, a)
    #else:
    #    a_lcm = a_lcm
    
    
    for i in A:
        if (a_lcm / 2) % i == 0:
        # if (a_lcm / i) % 2 == 0: 
            print(0)
            exit()
        # else:
        #     continue
    
    # if (a_lcm / 2) > m:
    if a_lcm > m * 2:
        print(0)
    else:
        ans = 1 
        print(ans)
        
        # ans = int((m - (a_lcm / 2))) // a_lcm + 1
        # ans = int((m - (a_lcm / 2)) // a_lcm) + 1
        # print(ans)
    
        # a_lcm = a_lcm // 2
        
        
        
        # else:
         + 1
        # print(ans)

if __name__ == '__main__':
    main()

import copy
import sys
sys.setrecursionlimit(10**7)

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

def main():
    n, m = map(int, input().split())
    
    A = [int(x) for x in input().split()]
    # A_s = set(A)
    # A_ = copy.deepcopy(A)
    # a_lcm = A.pop()
    a_lcm = 1
    
    #if len(A) >= 1:
    for a in A:
        a_lcm = lcm(a_lcm, a)
    #else:
    #    a_lcm = a_lcm
    
    
    for a in A:
        
        # print(0)
        # exit()
        # if a_lcm // 2 % a == 0:
        # if (a_lcm / a) % 2 == 0: 
        if a % 2 == 0:
            print(0)
            exit()
        # else:
        #     continue
    
    if (a_lcm / 2) > m:
    # if a_lcm > m * 2:
        print(0)
        exit()
    else:
        
        ans = int((m - (a_lcm / 2)) // a_lcm) + 1
        print(ans)

if __name__ == '__main__':
    main()

import copy
import sys
sys.setrecursionlimit(10**7)

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

def main():
    n, m = map(int, input().split())
    
    A = [int(x) for x in input().split()]
    # A_s = set(A)
    # A_ = copy.deepcopy(A)
    # a_lcm = A.pop()
    a_lcm = 1
    
    #if len(A) >= 1:
    for a in A:
        a_lcm = lcm(a_lcm, a)
    #else:
    #    a_lcm = a_lcm
    
    
    for a in A:
        
        print(a)
        exit()
        # if a_lcm / 2 % a == 0:
        # if (a_lcm / a) % 2 == 0: 
        #    print(0)
        #    exit()
        # else:
        #     continue
    
    if (a_lcm / 2) > m:
    # if a_lcm > m * 2:
        print(0)
        exit()
    else:
        
        ans = int((m - (a_lcm / 2)) // a_lcm) + 1
        print(ans)

if __name__ == '__main__':
    main()

import copy
import sys
sys.setrecursionlimit(10**7)

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

def main():
    n, m = map(int, input().split())
    
    A = [int(x) for x in input().split()]
    # A_s = set(A)
    # A_ = copy.deepcopy(A)
    # a_lcm = A.pop()
    a_lcm = 1
    
    #if len(A) >= 1:
    for a in A:
        a_lcm = lcm(a_lcm, a)
    print(1)
    # #else:
    # #    a_lcm = a_lcm
    
    
    
    
    #     # if (a_lcm / i) % 2 == 0: 
    #         print(0)
    #         exit()
    #     # else:
    #     #     continue
    
    # if (a_lcm / 2) > m:
    # # if a_lcm > m * 2:
    #     print(0)
    #     exit()
    # else:
    
    #     ans = int((m - (a_lcm / 2)) // a_lcm) + 1
    #     print(ans)

if __name__ == '__main__':
    main()


def main():
    def gcd(a, b):
        if b == 0:
            return a
        else:
            return gcd(b, a%b)

    def lcm(a, b):
        return int(a / gcd(a, b)) * b
    
    n, m = map(int, input().split())
    A = set([int(x) for x in input().split()])
    a_ = A[0]
    for a in A[1:]:
        a_lcm = lcm(a_, a)
        a_ = a_lcm
    if a_lcm / 2 > m:
        print(0)
    else:
        ans = int((m - (a_lcm / 2))) // a_lcm + 1
        print(ans)

if __name__ == '__main__':
    main()

import copy

def main():
    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 = map(int, input().split())
    
    A = set([int(x) for x in input().split()])
    
    # A = [int(x) for x in input().split()]
    # A_ = copy.deepcopy(A)
    # a_lcm = A.pop()
    a_lcm = 1
    
    #if len(A) >= 1:
    for a in A:
        a_lcm = lcm(a_lcm, a)
    #else:
    #    a_lcm = a_lcm
    
    
    for i in A:
        if (a_lcm / 2) % i == 0:
        # if (a_lcm / i) % 2 == 0: 
            print(0)
            exit()
        # else:
        #     continue
    
    # if (a_lcm / 2) > m:
    if a_lcm > m * 2:
        print(0)
    else:
        
        # ans = int((m - (a_lcm / 2))) // a_lcm + 1
        # ans = int((m - (a_lcm / 2)) // a_lcm) + 1
        # print(ans)
    
        # a_lcm = a_lcm // 2
        
        
        
        # else:
         + 1
        # print(ans)

if __name__ == '__main__':
    main()

import copy
import sys
sys.setrecursionlimit(10**7)

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

def main():
    n, m = map(int, input().split())
    
    A = [int(x) for x in input().split()]
    # A_s = set(A)
    # A_ = copy.deepcopy(A)
    # a_lcm = A.pop()
    a_lcm = 1
    
    #if len(A) >= 1:
    for a in A:
        a_lcm = lcm(a_lcm, a)
    #else:
    #    a_lcm = a_lcm
    
    
    for a in A:
        print(0)
        exit()
        # if a_lcm / 2 % a == 0:
        # if (a_lcm / a) % 2 == 0: 
        #     print(0)
        #     exit()
        # else:
        #     continue
    
    # if (a_lcm / 2) > m:
    # # if a_lcm > m * 2:
    #     print(0)
    #     exit()
    # else:
    
    #     ans = int((m - (a_lcm / 2)) // a_lcm) + 1
    #     print(ans)

if __name__ == '__main__':
    main()

import copy

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

def main():
    n, m = map(int, input().split())
    
    A = set([int(x) for x in input().split()])
    
    # A = [int(x) for x in input().split()]
    # A_ = copy.deepcopy(A)
    # a_lcm = A.pop()
    a_lcm = 1
    
    #if len(A) >= 1:
    for a in A:
        a_lcm = lcm(a_lcm, a)
    #else:
    #    a_lcm = a_lcm
    
    
    for i in A:
        if (a_lcm / 2) % i == 0:
        # if (a_lcm / i) % 2 == 0: 
            print(0)
            exit()
        # else:
        #     continue
    
    if (a_lcm / 2) > m:
    # if a_lcm > m * 2:
        print(0)
        exit()
    else:
        
        # ans = int((m - (a_lcm / 2))) // a_lcm + 1
        ans = int((m - (a_lcm / 2)) // a_lcm) + 1
        print(ans)
    
        # a_lcm = a_lcm // 2
        
        
        
        # else:
         + 1
        # print(ans)

if __name__ == '__main__':
    main()



import copy
# from math import gcd


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
def main():
    n, m = map(int, input().split())
    A = set([int(x) for x in input().split()])
    a_lcm = 1
    for a in A:
        a_lcm = lcm(a_lcm, a)
        
        if (a_lcm / 2) > m:
            print(0)
            exit()
    for a in A:
        if (a_lcm / 2) % a == 0:
            print(0)
            exit()
    
    ans = int((m - (a_lcm / 2)) // a_lcm) + 1
    print(ans)

if __name__ == '__main__':
    main()

Verdicts: Wrong Answer

Wrong Answer

Runtime Error

Runtime Error

Wrong Answer

Wrong Answer

Wrong Answer

Runtime Error

Runtime Error

Wrong Answer

Runtime Error

Accepted