criyle/codenet-compile-errors huggingface dataset:
Language: C++

N = int(input())
P1 = tuple(map(int, input().split()))
P2 = tuple(map(int, input().split()))

import itertools
a = 0
b = 0
for perm in itertools.permutations([i+1 for i in range(N)]):
    if perm <= P1:
        a += 1
    if perm <= P2:
        b += 1
print(abs(b - a))

Compiler output:
a.cc:1:1: error: 'N' does not name a type
    1 | N = int(input())
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll gcd(ll a,ll b)
{
	return b==0?a:gcd(b,a%b);
}
ll lcm(ll a,ll b)
{
	return a*b/gcd(a,b);
}
const int maxn=1e5+10;
int a[maxn];
signed main(){
    int n,m;
    scanf("%lld%lld",&n,&m);
    int lcm1=1;
    for(int i=1;i<=n;i++){
        scanf("%lld",&a[i]);
        if(lcm>m){
            continue;
        }
        lcm1=lcm(lcm1,arr[i]/2);
    }
    //printf("debug %lld\n",lcm);
    int flag=0;
    for(int i=1;i<=n;i++){
        int temp=lcm*2/a[i];
        if(temp%2==0){
            flag=1;
            break;
        }
    }
    if(flag){
        puts("0");
        return 0;
    }
    int cnt=m/lcm;
    if(cnt&1){
        cnt=cnt/2+1;
    }
    else{
        cnt=cnt/2;
    }
    printf("%lld\n",cnt);
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:15: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator>'
   20 |         if(lcm>m){
      |            ~~~^~
a.cc:23:23: error: 'arr' was not declared in this scope
   23 |         lcm1=lcm(lcm1,arr[i]/2);
      |                       ^~~
a.cc:28:21: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator*'
   28 |         int temp=lcm*2/a[i];
      |                  ~~~^~
a.cc:38:14: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator/'
   38 |     int cnt=m/lcm;
      |             ~^~~~
Language: C++

#include <bits/stdc++.h>
#define int long long
using namespace std;
typedef long long int ll;
ll gcd(ll a,ll b)
{
	return b==0?a:gcd(b,a%b);
}
ll lcm(ll a,ll b)
{
	return a*b/gcd(a,b);
}
const int maxn=1e5+10;
int a[maxn];
signed main(){
    int n,m;
    scanf("%lld%lld",&n,&m);
    int lcm1=1;
    for(int i=1;i<=n;i++){
        scanf("%lld",&a[i]);
        if(lcm>m){
            continue;
        }
        lcm1=lcm(lcm1,arr[i]/2);
    }
    //printf("debug %lld\n",lcm);
    int flag=0;
    for(int i=1;i<=n;i++){
        int temp=lcm*2/a[i];
        if(temp%2==0){
            flag=1;
            break;
        }
    }
    if(flag){
        puts("0");
        return 0;
    }
    int cnt=m/lcm;
    if(cnt&1){
        cnt=cnt/2+1;
    }
    else{
        cnt=cnt/2;
    }
    printf("%lld\n",cnt);
    return 0;
}

Compiler output:
a.cc:2:13: error: 'long long long' is too long for GCC
    2 | #define int long long
      |             ^~~~
a.cc:4:19: note: in expansion of macro 'int'
    4 | typedef long long int ll;
      |                   ^~~
a.cc:2:18: error: 'long long long' is too long for GCC
    2 | #define int long long
      |                  ^~~~
a.cc:4:19: note: in expansion of macro 'int'
    4 | typedef long long int ll;
      |                   ^~~
a.cc: In function 'int main()':
a.cc:21:15: error: invalid operands of types '<unresolved overloaded function type>' and 'long long int' to binary 'operator>'
   21 |         if(lcm>m){
      |            ~~~^~
a.cc:24:23: error: 'arr' was not declared in this scope
   24 |         lcm1=lcm(lcm1,arr[i]/2);
      |                       ^~~
a.cc:29:21: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator*'
   29 |         int temp=lcm*2/a[i];
      |                  ~~~^~
a.cc:39:14: error: invalid operands of types 'long long int' and '<unresolved overloaded function type>' to binary 'operator/'
   39 |     int cnt=m/lcm;
      |             ~^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(k,i,n) for(ll i=k;i<n;++i)
int main(void){
    ll n,m;
    cin>>n>>m;
    ll a[n];
    rep(0,i,n){
        cin>>a[i];
        if(a[i]%2==0)a[i]=a[i]/2;
        else{
            cout<<0;
            return 0;
        }
    }
    ll tmp=1,cnt;
    rep(1,i,n){
        while(a[0]%2==0){
            tmp*=2;
            a[0]/=2;
        }
        if(i==0){
            cnt=tmp;
        }else{
        if(!(cnt==tmp)){
            cout<<0;
            return 0;
        }
    }
    ll l=lcm(a[0],a[1]);
    rep(2,i,n)l=lcm(l,a[i]);
    ll ans=0;
    for(ll i=l;i<m;i+=l*2)++ans;
    cout<<ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:36:2: error: expected '}' at end of input
   36 | }
      |  ^
a.cc:5:15: note: to match this '{'
    5 | int main(void){
      |               ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define repl(i, l, r) for (ll i = (l); i < (r); i++)
#define rep(i, n) repl(i, 0, n)
#define CST(x) cout << fixed << setprecision(x)
using ll = long long;
const ll MOD = 1000000007;
const int inf = 1e9 + 10;
const ll INF = 4e18 + 10;
const int dx[9] = {1, 0, -1, 0, 1, -1, -1, 1, 0};
const int dy[9] = {0, 1, 0, -1, 1, 1, -1, -1, 0};
int main() {
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);

	ll n, m;
	cin >> n >> m;
	ll a[n];
	rep(i, n) cin >> a[i];
	ll p = 1;
	rep(i, n) {
		p = lcm(p, a[i] / 2);
		if (p > m) {
			cout << 0 << endl;
			return 0;
		}
		ll ans = (m - p) / (2 * p) + 1;
		cout << ans << endl;
		return 0;
	}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:10: error: expected '}' at end of input
   31 |         }
      |          ^
a.cc:12:12: note: to match this '{'
   12 | int main() {
      |            ^
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;


int main(){
   int n,m;
   cin >> n >> m;
   vector<int> a(n);
   rep(i,n) cin >> a[i]; 
   int ans=1;
   int div = 0;
   int a_cp = a[0];
   do{
      a_cp /= 2; 
      div++;
   }while(a_cp%2==0);
   rep(i,n){
      if(a[i]%pow(2,i)!=0){
         cout << 0 << endl;
      }
   }

   cout << ans << endl;
   return 0;  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:14: error: invalid operands of types '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} and '__gnu_cxx::__promote<double>::__type' {aka 'double'} to binary 'operator%'
   21 |       if(a[i]%pow(2,i)!=0){
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;


int main(){
   int n,m;
   cin >> n >> m;
   vector<int> a(n);
   rep(i,n) cin >> a[i]; 
   int ans=1;
   int div = 0;
   int a_cp = a[0];
   do{
      a_cp /= 2; 
      div++;
   }while(a_cp%2==0)
   rep(i,n){
      if(a[i]%pow(2,i)!=0){
         cout << 0 << endl;
      }
   }

   cout << ans << endl;
   return 0;  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:21: error: expected ';' before 'for'
   19 |    }while(a_cp%2==0)
      |                     ^
      |                     ;
a.cc:21:14: error: invalid operands of types '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} and '__gnu_cxx::__promote<double>::__type' {aka 'double'} to binary 'operator%'
   21 |       if(a[i]%pow(2,i)!=0){
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

bool f(vector<int> a, int j){
   rep(i,n) a[i]
   return 
}

int main(){
   int n,m;
   cin >> n >> m;
   vector<int> a(n);
   rep(i,n) cin >> a[i]; 
   int ans=1;
   int div = 0;
   int a_cp = a[0];
   do{
      a_cp /= 2; 
      div++;
   }while(a_cp%2==0)
   rep(i,n){
      if(a[i]%pow(2,i)!=0){
         cout << 0 << endl;
      }
   }

   cout << ans << endl;
   return 0;  
}

Compiler output:
a.cc: In function 'bool f(std::vector<int>, int)':
a.cc:8:10: error: 'n' was not declared in this scope
    8 |    rep(i,n) a[i]
      |          ^
a.cc:2:39: note: in definition of macro 'rep'
    2 | #define rep(i,n) for (int i = 0; i < (n); ++i)
      |                                       ^
a.cc:8:17: error: expected ';' before 'return'
    8 |    rep(i,n) a[i]
      |                 ^
      |                 ;
    9 |    return
      |    ~~~~~~        
a.cc:8:16: warning: ignoring return value of 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = int; _Alloc = std::allocator<int>; reference = int&; size_type = long unsigned int]', declared with attribute 'nodiscard' [-Wunused-result]
    8 |    rep(i,n) a[i]
      |                ^
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:1128:7: note: declared here
 1128 |       operator[](size_type __n) _GLIBCXX_NOEXCEPT
      |       ^~~~~~~~
a.cc:10:1: warning: no return statement in function returning non-void [-Wreturn-type]
   10 | }
      | ^
a.cc: In function 'int main()':
a.cc:23:21: error: expected ';' before 'for'
   23 |    }while(a_cp%2==0)
      |                     ^
      |                     ;
a.cc:25:14: error: invalid operands of types '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} and '__gnu_cxx::__promote<double>::__type' {aka 'double'} to binary 'operator%'
   25 |       if(a[i]%pow(2,i)!=0){
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
typedef pair<int,int> P;
typedef long long ll;
const int INF = 1001001001;
const ll INFL = 1e17;
const int MOD = 1e9+7;

ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}


int f(int x){
    int res = 0;
    while(x%2==0){
        x /= 2;
        res++;
    }
    return res;
}

int main(){
    int n,m;
    cin >> n >> m;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    rep(i,n) a[i] /= 2

    int t = f(a[0]);
    rep(i,n){
        if(a[i] != t){
            cout << 0 << endl;
            return 0;
        }
        a[i] >>= t;
    }

    ll l = 1;
    rep(i,n){
        l = lcm(l,a[i]);
        if(l > m){
            cout << 0 << endl;
            return 0;
        }
    }

    m /= l;
    int ans = (m+1)/2;
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:23: error: expected ';' before 'int'
   28 |     rep(i,n) a[i] /= 2
      |                       ^
      |                       ;
   29 | 
   30 |     int t = f(a[0]);
      |     ~~~                
a.cc:32:20: error: 't' was not declared in this scope
   32 |         if(a[i] != t){
      |                    ^
a.cc:36:18: error: 't' was not declared in this scope
   36 |         a[i] >>= t;
      |                  ^
Language: C++

#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(int)n;i++)
using namespace std;
using ll=long long;

int main(){
  scanf("%lld%lld%lld",&N,&M,&a1);
  if(a1%2){
    cout<<0<<endl;
    return 0;
  }
  b0=b1=a1/=2;
  REP(i,N-1){
    scanf("%lld",&a2);
    if(a2%2){
      cout<<0<<endl;
      return 0;
    }
    b2=a2/=2;
    while(1){
      if(a1>a2)swap(a1,a2);
      a2%=a1;
      if(!a2) break;
    }
    if((b1/a1)%2==0||(b2/a1)%2==0){
      cout<<0<<endl;
      return 0;
    }
    b1=b0;
    b0=b1*b2;
    while(1){
      if(b1>b2)swap(b1,b2);
      b2%=b1;
      if(!b2) break;
    }
    b0/=b1;
    b1=a1;
  }
  cout<<M/b0-M/(b0*2)<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:25: error: 'N' was not declared in this scope
    7 |   scanf("%lld%lld%lld",&N,&M,&a1);
      |                         ^
a.cc:7:28: error: 'M' was not declared in this scope
    7 |   scanf("%lld%lld%lld",&N,&M,&a1);
      |                            ^
a.cc:7:31: error: 'a1' was not declared in this scope; did you mean 'y1'?
    7 |   scanf("%lld%lld%lld",&N,&M,&a1);
      |                               ^~
      |                               y1
a.cc:12:3: error: 'b0' was not declared in this scope; did you mean 'y0'?
   12 |   b0=b1=a1/=2;
      |   ^~
      |   y0
a.cc:12:6: error: 'b1' was not declared in this scope; did you mean 'y1'?
   12 |   b0=b1=a1/=2;
      |      ^~
      |      y1
a.cc:14:19: error: 'a2' was not declared in this scope
   14 |     scanf("%lld",&a2);
      |                   ^~
a.cc:19:5: error: 'b2' was not declared in this scope
   19 |     b2=a2/=2;
      |     ^~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> iint;
typedef pair<ll,ll> llll;
#define ALL(x) (x).begin(),(x).end()
const ll zero = 0;
const ll INF = 3000000000000000000; //10^18
const int inINF = 1000000000; //10^9
const ll MOD = 1000000007; //10^9+7
const ll MOD2 = 998244353;
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

ll lcm(ll a, ll b){
    return a / __gcd(a, b) * b;
}

int main(){
    ll N, M; cin >> N >> M;
    vector<ll> b(N);
    for (ll i = 0; i < N; i++) {
        cin >> b[i]; b[i] = b[i] / 2;
    }   

    if(N == 1){
        printf("%lld\n", M / b[i] - M / (2*b[i]));
        return 0;
    }

    ll L = lcm(b[0], b[1]);
    for (ll i = 2; i < N; i++) {
        L = lcm(L, b[i]);
        if(L > M){
            printf("0\n");
            return 0;
        }
    }

    ll C = M / L;

    ll D = M / (2*L);

    for (ll i = 0; i < N; i++) {
        if( (L / b[i]) % 2 == 0 ){
            D = C;
        }
    }

    printf("%lld\n", C-D);
    


}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:32: error: 'i' was not declared in this scope
   30 |         printf("%lld\n", M / b[i] - M / (2*b[i]));
      |                                ^
Language: C++

#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include <bits/stdc++.h> 
 
using namespace std;
 
long long f(long int x,long int y){
    if (x<y) swap(x,y);
    if (y==0) return x;
    x=x%y;
    return f(x,y);
}
 
int main(){
    long int N,M;
    cin>>N>>M;
    long int a[N],ans=0;
    cin>>a[0];
    int n=0;
    while(a[0]%2==0){
        a[0]=a[0]/2;
        n++;
    }
    for (int i=1;i<N;i++){
        cin>>a[i];
        for (int j=0;j<n;j++){
            if (a[i]%2==0) a[i]=a[i]/2;
            else{
                cout<<0<<endl;
                return 0;    
            }
        }
      　if (a[i]%2==0){
        	cout<<0<<endl;
            return 0;    
        }
    }
    M=M/pow(2,n-1);
    long long x=a[0];
    for (int i=1;i<N;i++){
        x=x*(a[i]/f(x,a[i]));
        if (x>M){
            cout<<0<<endl;
            return 0;
        }
    }
    M=M/x;
    cout<<(M+1)/2<<endl;
 
    return 0;
}

Compiler output:
a.cc:35:7: error: extended character 　 is not valid in an identifier
   35 |       　if (a[i]%2==0){
      |       ^
a.cc: In function 'int main()':
a.cc:35:7: error: '\U00003000if' was not declared in this scope
   35 |       　if (a[i]%2==0){
      |       ^~~~
Language: C

#include <stdio.h>
long long int gcd(long long int a, long long int b){return (a % b) ? gcd(b, a % b): b;}
long long int lcm(long long int a, long long int b){return a*b/gcd(a, b);}

int main(void){
    long long int a[100000];
    long long int n, m;
    scanf("%lld%lld", &n, &m);

    int i, j, k;
    
    for(i = 0; i < n; i++){
        scanf("%lld", &a[i]);
    }

    int cnt, cnt_t;
    //2で割り切れる回数の計算
    int t = a[0];
    cnt = 0;
    while(t % 2 == 0){
        t /= 2;
        cnt++;
    }
    for(i = 1; i < n; i++){
        cnt_t = 0;
        t = a[i];
        while(t % 2 == 0){
            t /= 2;
            cnt_t++;
        }
        if(cnt != cnt_t){
            printf("0\n");
            return 0;
        }
    }

    long long int tmp, x;
    tmp = a[0]/2;
    for(i = 1; i < n; i++){
        tmp = lcm(tmp, a[i]/2);
    }

    x = tmp;s
    long long int ans = (m + x)/2/x;
    
    printf("%lld\n", ans);
    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:43:13: error: 's' undeclared (first use in this function)
   43 |     x = tmp;s
      |             ^
main.c:43:13: note: each undeclared identifier is reported only once for each function it appears in
main.c:43:14: error: expected ';' before 'long'
   43 |     x = tmp;s
      |              ^
      |              ;
   44 |     long long int ans = (m + x)/2/x;
      |     ~~~~      
main.c:46:22: error: 'ans' undeclared (first use in this function)
   46 |     printf("%lld\n", ans);
      |                      ^~~
Language: C++

#include <bits/stdc++.h>
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define ff first
#define ss second
#define P 1000000007
#define in(x, a, b) (a <= x && x < b)

using namespace std;
using ll = long long;
typedef pair<int, int> ii;
typedef vector<ii> vii; 
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
const ll inf = 1000000001, INF = (ll)1e18 + 1;

ll gcd(ll a , ll b)
{
   if(b==0) return a;
   a%=b;
   return gcd(b,a);
}

ll lcm(ll a, ll b) {
	return (a * b) / gcd(a, b);
}

void solve() {
	int n, m;
	cin >> n >> m;
	
	int ok = 1, glc = -1;
	for(int i = 0; i < n; i++) {
		int cnt = 0;
		int cp = a[i];
		while(cp) {
			cp /= 2;
			cnt++;
		}
		
		if(glc == -1) glc = cnt;
		if(cnt != glc) {
			ok = 0;
			break;
		}
	}
	
	if(!ok) cout << 0 << endl;
	
	ll mul = 1;
	vi a(n);
	for(int i = 0; i < n; i++) cin >> a[i], mul = lcm(mul, a[i]);
	
	cout << (m / (mul / 2)) - (m / mul) << endl;
}

int main(){
	ios_base::sync_with_stdio(false);
	solve();
    return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:40:26: error: 'a' was not declared in this scope
   40 |                 int cp = a[i];
      |                          ^
Language: C++

#include <iostream>
#include <cmath>
#include <stdint.h>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
using namespace std;
 
#define int long long
#define INF (1e18)+1
 
int nChoosek( int n, int k )
{
    if (k > n) return 0;
    if (k * 2 > n) k = n-k;
    if (k == 0) return 1;

    int result = n;
    for( int i = 2; i <= k; ++i ) {
        result *= (n-i+1);
        result /= i; 
    }
    return result;
}

int choose2(int n){
	
	return n*(n-1)/2;
}
 
 int countDigit(int  n) 
{ 
    int k = 0; 
    while (n != 0) { 
        k = n%10; 
        n = n / 10; 
    } 
    return k; 
} 

int gcd(int a, int b){
	
	if(b==0){
		return a;
	}
	
	gcd(b,a%b);
	
}

int LCM(int a, int b){
	
	
	return a*b / gcd(a,b);
	
	
}

 
int f(int n){
	
	
	int res = 0;
	
	while( n%2 == 0){
		
		n/=2;
		res++;
	}
	
	return res;
	
}
 
 
int32_t main() {
 
 
 	int N,M;
 	
 	cin >> N >> M;
 	vector<int> arr(N);
 	for(int i=0; i<N; i++){
 		
 		cin >> arr[i];
 		
 		arr[i] /= 2 ;
 		
	}
 	
 	int t = f(arr[0]);
 	
 	for(int i=0; i<N; i++){
 		
 		if(f(arr[i]) != t){
 			
 			cout << 0 << endl;
			 return 0;	
 			
		}
 		
 		arr[i] >> t;
 		
	 }
 	M>>=t ;
 	int g = 1;	
 	
 	for(int i=0; i<N; i++){
 	
	  	g = LCM(g,arr[i]);
	 	
 		if( g > m){
 			cout << 0 << endl;
 			return 0;
		 }
 		
 		
	}
 	
 	
 	M /= g;
 	
 	int ans = (M+1) /2 ;
 	
 	cout << ans << endl;
 
 	return 0;
 
}








Compiler output:
a.cc: In function 'int32_t main()':
a.cc:115:25: error: 'm' was not declared in this scope
  115 |                 if( g > m){
      |                         ^
a.cc: In function 'long long int gcd(long long int, long long int)':
a.cc:50:12: warning: control reaches end of non-void function [-Wreturn-type]
   50 |         gcd(b,a%b);
      |         ~~~^~~~~~~
Language: C++

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using P = pair<int, int>;
typedef long long ll;

ll gcd(ll a, ll b) {
  ll smaller = min(a, b);
  ll bigger = max(a, b);
  ll surplus = bigger % smaller;
  if (surplus == 0) return smaller;
  surplus = gcd(smaller, surplus);
  return surplus;
}

//最小公倍数を求めるメソッド
ll lcm(ll a, ll b) {
  return a / gcd(a, b) * b;
}

int main() {
  int n;
  ll m;
  cin >> n >> m;
  vector<ll> a(n);
  ll lcm_1 = 1;
  ll lcm_2 = 1;
  ll ans = 0;
  bool over = false;
  rep(i, n){
    cin >> a[i];
    lcm_1 = lcm(lcm_1, a[i]);
    if(lcm_1 >=m ){
      over = true;
      break;
    }
  }
  rep(i, n){
    lcm_2 = lcm(lcm_2, a[i]);
    if(lcm_2 > m){
      cout << 0 << endl;
      return 0;
    }
  }
  if(over){
    cout << 1 << endl;
    return 0;
  }
  m += lcm_2;
  ll ans = m / lcm_1;
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:50:6: error: redeclaration of 'll ans'
   50 |   ll ans = m / lcm_1;
      |      ^~~
a.cc:28:6: note: 'll ans' previously declared here
   28 |   ll ans = 0;
      |      ^~~
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
#include <cstdio>
#include <tuple>
#include <numeric>
#include <time.h>
#include <chrono>
#ifdef _MSC_VER
#  include <intrin.h>
#  define __builtin_popcount __popcnt
#endif
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define REP(i,a,b) for(ll i=a;i>b;i--)
#define CST(x) cout<<fixed<<setprecision(x)//小数点以下の桁数指定
#define ct(a) cout<<a<<endl
#define rep(i,n) for(int i=0;i<(n);i++)
#define repl(i,l,r) for(int i=(1);i<(r);i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
static const double pi = 3.141592653589793;
using namespace std;
typedef long long ll;
const ll MOD = 998244353;
const ll INF = (1LL << 31) - 1;
const ll mod = 1e9 + 7;

ll lcm(ll A, ll B) {
	if (a < b)swap(a, b);
	
	ll a = A, b = B;
	

	ll r = a % b;
	while (r != 0) {
		a = b; b = r; r = a % b;
	}
	
	A /= b; B /= b;

	return A * B*b;

}


int main() {
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);


	ll N, M,L=1;
	ll two = 0;
	cin >> N >> M;
	FOR(i, 0, N) {
		ll cur; cin >> cur;

		ll copy = cur;
		ll cnt = 0;
		while (copy % 2 == 0) {
			copy /= 2;
			cnt++;
		}

		if (i == 0) {
			two = cnt;
		}
		else {
			if (two != cnt) {
				cout << 0 << endl;
				return 0;
			}
		}

		L = lcm(L, cur/2);
	}
	cout << L << endl;
	cout << (M + L) / (2 * L) << endl;



}

Compiler output:
a.cc: In function 'll lcm(ll, ll)':
a.cc:37:13: error: 'a' was not declared in this scope
   37 |         if (a < b)swap(a, b);
      |             ^
a.cc:37:17: error: 'b' was not declared in this scope
   37 |         if (a < b)swap(a, b);
      |                 ^
Language: C++

#include <iostream>

using namespace std;
int a[100005];
int gcd(int a,int b)
{
    while(a^=b^=a^=b%=a);
    return b;
}
int main()
{
    int flag=0;
    int n,m;
    cin>>n>>m;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        a[i]=a[i]/2;
    }
    else
    {
        int res=0;
        long long ans=1;
        for(int i=0;i<n;i++)
        {
            if(i>=2&&(a[i]/gcd(ans,a[i])%2==0||ans/gcd(ans,a[i])%2==0))
            {
                flag=1;
            }
            ans*=a[i]/gcd(ans,a[i]);
            if(ans>m)
            {
                flag=1;
                break;
            }
        }
        if(flag==1)
            cout<<0;
        else
        {
            long long ens=ans;
            while(ens<=m)
            {
                res++;
                ens+=2*ans;
            }
            cout<<res;
        }
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:5: error: 'else' without a previous 'if'
   20 |     else
      |     ^~~~
Language: C++

#include <iostream>

using namespace std;
int a[100005];
int gcd(int a,int b)
{
    while(a^=b^=a^=b%=a);
    return b;
}
int main()
{
    int flag=0;
    int n,m;
    cin>>n>>m;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        a[i]=a[i]/2;
    }
    else
    {
        int res=0;
        long long ans=1;
        for(int i=0;i<n;i++)
        {
            if(i>=2&&(a[i]/gcd(ans,a[i])%2==0||ans/gcd(ans,a[i])%2==0)))
            {
                flag=1;
            }
            ans*=a[i]/gcd(ans,a[i]);
            if(ans>m)
            {
                flag=1;
                break;
            }
        }
        if(flag==1)
            cout<<0;
        else
        {
            long long ens=ans;
            while(ens<=m)
            {
                res++;
                ens+=2*ans;
            }
            cout<<res;
        }
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:5: error: 'else' without a previous 'if'
   20 |     else
      |     ^~~~
a.cc:26:72: error: expected primary-expression before ')' token
   26 |             if(i>=2&&(a[i]/gcd(ans,a[i])%2==0||ans/gcd(ans,a[i])%2==0)))
      |                                                                        ^
Language: C++

//---------------------------------------------------------------
#include <bits/stdc++.h>
using namespace std;
#include <iostream>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <math.h>
#include <sstream>
#include <numeric>
#include <cctype>
#include <bitset>
#include <cassert>
#include<algorithm>
//---------------------------------------------------------------
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define SIZE 100005
#define INF 1000000000000000LL
#define all(x) x.begin(),x.end()
using pint = pair<int,int>;
using vec = vector<int>;
using ll=long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
//---------------------------------------------------------------
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//---------------------------------------------------------------

//↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

ll GCD(ll a, ll b){
    ll s = a, t = b;
    while(s%t != 0){
        ll u = s%t;
        s=t; t=u;
    }
    return t;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    ll n,m;cin>>n>>m;
    vll a(n);
    rep(i,n) {cin>>a[i];}
    vll b(n,0);
    auto c = a;
    for(int i=0; i<n; i++){
        while(c[i]%2==0){
            c[i]/=2;
            b[i]++;
        }
    }

    rep(i,n) a[i]/=2;

    bool ok = false;
    rep(i,n-1){
        if(b[i]!=b[i+1]) ok = true;
    }

    if(ok){
        cout<<0<<endl;
        return 0;
    }else{
        
        ll t=1;
        rep(i,n){
            t = t*a[i]/GCD(t,a[i]);
        }

        if(t>=m){
            cout<<0<<endl;
            return 0;
        }
        
        if(t<m){
        ll ans = 1;
        ll cnt = 0;
        while(true){
            cnt++;
            ll T;
            T = t*ans;
            if(T>m){
                cnt--;
                break;
            }
            if(T==m) break;
            ans+=2;
        }

        cout<<cnt<<endl;
        return 0;

    }else{
        cout<<0<<endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:103:2: error: expected '}' at end of input
  103 | }
      |  ^
a.cc:43:12: note: to match this '{'
   43 | int main() {
      |            ^
Language: C++

//---------------------------------------------------------------
#include <bits/stdc++.h>
using namespace std;
#include <iostream>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <math.h>
#include <sstream>
#include <numeric>
#include <cctype>
#include <bitset>
#include <cassert>
#include<algorithm>
//---------------------------------------------------------------
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define SIZE 100005
#define INF 1000000000000000LL
#define all(x) x.begin(),x.end()
using pint = pair<int,int>;
using vec = vector<int>;
using ll=long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
//---------------------------------------------------------------
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//---------------------------------------------------------------

//↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

ll GCD(ll a, ll b){
    ll s = a, t = b;
    while(s%t != 0){
        ll u = s%t;
        s=t; t=u;
    }
    return t;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    ll n,m;cin>>n>>m;
    vll a(n);
    rep(i,n) {cin>>a[i];}
    vll b(n,0);
    auto c = a;
    for(int i=0; i<n; i++){
        while(c[i]%2==0){
            c[i]/=2;
            b[i]++;
        }
    }

    rep(i,n) a[i]/=2;

    bool ok = false;
    rep(i,n-1){
        if(b[i]!=b[i+1]) ok = true;
    }

    if(ok){
        cout<<0<<endl;
        return 0;
    }else{
        
        ll t=1;
        rep(i,n){
            t = t*a[i]/GCD(t,a[i]);
        }

        if(t>=m){
            cout<<0<<endl;
            return 0;
        }
        
        if(t<m){
        ll ans = 1;
        ll cnt = 0;
        while(true){
            cnt++;
            ll T;
            T = t*ans;
            if(T>m){
                cnt--;
                break;
            }
            if(T==m) break;
            ans+=2;
        }

        cout<<cnt<<endl;
        return 0;

    }
    }else{
        cout<<0<<endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:101:6: error: 'else' without a previous 'if'
  101 |     }else{
      |      ^~~~
Language: C++

#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <iomanip>
#include <cassert>

using namespace std;
typedef long long ll;
int gcd(int a, int b){
   if(a>b)return gcd(b,a);
   if(b%a==0) return a;
   else return gcd(b%a,a);
}

int main(){
   int N,M;
   cin >> N >>M;
   int a[N];
   long long k=1;
   for (int i = 0; i < N; i++)
   {
      cin >> a[i];
   }
   for (int i = 0; i < N; i++)
   {
      k *= (a[i]/2)/gcd(a[i]/2, k);
      if(k > M){
         cout << 0 << endl;
         return 0;
      }
   }
   for(int i = 0 ; i < N; i++){
      if(((k/(a[i]/2))%2==0){
         cout << 0 << endl;
         return 0;
      }
   }
   cout << ((M/k)+1)/2 << endl;
   return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:49:29: error: expected ')' before '{' token
   49 |       if(((k/(a[i]/2))%2==0){
      |         ~                   ^
      |                             )
a.cc:53:4: error: expected primary-expression before '}' token
   53 |    }
      |    ^
Language: C++

#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <iomanip>
#include <cassert>

using namespace std;
typedef long long ll;
int gcd(int a, int b){
   if(a>b)return gcd(b,a);
   if(b%a==0) return a;
   else return gcd(b%a,a);
}

int main(){
   int N,M;
   cin >> N >>M;
   int a[N];
   long long k=1;
   for (int i = 0; i < N; i++)
   {
      cin >> a[i];
   }
   for (int i = 0; i < N; i++)
   {
      k *= (a[i]/2)/gcd(a[i]/2, k);
      if(k > M){
         cout << 0 << endl;
         return 0;
      }
   }
   for(int i = 0 ; i < N; i++){
      if((k/(a[i]/2)%2==0){
         cout << 0 << endl;
         return 0;
      }
   }
   cout << ((M/k)+1)/2 << endl;
   return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:49:27: error: expected ')' before '{' token
   49 |       if((k/(a[i]/2)%2==0){
      |         ~                 ^
      |                           )
a.cc:53:4: error: expected primary-expression before '}' token
   53 |    }
      |    ^
Language: C++

using namespace std;
#define int long long
signed main(){
  int N,M,n;
  cin>>N>>M>>n;
  vector<int> A(N);
  A[0]=n;
  int k=0;
  for(int i=n;i%2==0;i/=2)
    k++;
  for(int i=1;i<N;i++){
    cin>>A[i];
    int l=0;
    for(int j=A[i];j%2==0;j=j/2){
      l++;
    }
    if(k!=l){
      cout<<0<<endl;
      return 0;
    }
  }
  int j=1;
  for(int i=0;i<k;i++)
    j*=2;
  for(int i:A){
    k=k/__gcd(k,i/2)*(i/2);
    if(k>M){
      cout<<0<<endl;
      return 0;
    }
  }
  cout<<(M+k)/k/2<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:3: error: 'cin' was not declared in this scope
    5 |   cin>>N>>M>>n;
      |   ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | using namespace std;
a.cc:6:3: error: 'vector' was not declared in this scope
    6 |   vector<int> A(N);
      |   ^~~~~~
a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
  +++ |+#include <vector>
    1 | using namespace std;
a.cc:2:13: error: expected primary-expression before 'long'
    2 | #define int long long
      |             ^~~~
a.cc:6:10: note: in expansion of macro 'int'
    6 |   vector<int> A(N);
      |          ^~~
a.cc:7:3: error: 'A' was not declared in this scope
    7 |   A[0]=n;
      |   ^
a.cc:18:7: error: 'cout' was not declared in this scope
   18 |       cout<<0<<endl;
      |       ^~~~
a.cc:18:7: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:18:16: error: 'endl' was not declared in this scope
   18 |       cout<<0<<endl;
      |                ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | using namespace std;
a.cc:26:9: error: '__gcd' was not declared in this scope
   26 |     k=k/__gcd(k,i/2)*(i/2);
      |         ^~~~~
a.cc:28:7: error: 'cout' was not declared in this scope
   28 |       cout<<0<<endl;
      |       ^~~~
a.cc:28:7: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:28:16: error: 'endl' was not declared in this scope
   28 |       cout<<0<<endl;
      |                ^~~~
a.cc:28:16: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
a.cc:32:3: error: 'cout' was not declared in this scope
   32 |   cout<<(M+k)/k/2<<endl;
      |   ^~~~
a.cc:32:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:32:20: error: 'endl' was not declared in this scope
   32 |   cout<<(M+k)/k/2<<endl;
      |                    ^~~~
a.cc:32:20: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
Language: C++


#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define int         long long   
#define double      long double
#define endl        "\n"
#define pb          push_back
#define PI          3.1415926535897932384626433832795l
#define F           first
#define S           second
#define mp          make_pair
#define f(i,n)      for(int i=0;i<n;i++)
#define fastio      ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define all(v)      (v).begin(),(v).end()
#define sort(v)     sort((v).begin(),(v).end())
#define rall(v)     (v).rbegin(),(v).rend()
#define rsort(v)     sort((v).rbegin(),(v).rend())
#define gcd(a,b)    __gcd((a),(b))
#define minn(v)     *min_element(v.begin(), v.end());
#define maxx(v)     *max_element(v.begin(), v.end());
#define print(x)    cout<<(x)<<endl;
typedef pair<int,int> pii;  
typedef vector<int> vi;
//x.substr(start, length);
/*
// Create a vector containing n 
//vectors of size m.  
    vector<vector<int> > vec( n , vector<int> (m, 0));  
*/
struct type{
    int k, i, j;
};
//to check if a no is prime or not?
bool isPrime(int n) 
{ 
    if (n <= 1) 
        return false; 
    if (n <= 3) 
        return true; 
    if (n % 2 == 0 || n % 3 == 0) 
        return false; 
  
    for (int i = 5; i * i <= n; i = i + 6) 
        if (n % i == 0 || n % (i + 2) == 0) 
            return false; 
  
    return true; 
}

// minimum subaaray sum of size k-sliding window approach
int findSubarray(int arr[], int n, int k)
{
	int window_sum = 0;
	int min_window = INT_MAX;
	int last = 0;
	for (int i = 0; i < n; i++)
	{
		window_sum += arr[i];
		if (i + 1 >= k)
		{
			if (min_window > window_sum)
			{
				min_window = window_sum;
				last = i;
			}
			window_sum -= arr[i + 1 - k];
		}
	}
	int sum=0;
	for(int i=last-k+1;i<=last;i++)
	{
	    sum+=arr[i];
	}
	return sum;
}
//finds the next permutation to given sequence of nos
int nextpermutation(vi v)
{
    vi t=v;
    sort(t);
    int x=0;
    while(true)
    {
        x++;
        if(t==v)
        {
            return x;
        }
        next_permutation(all(t));
    }
}
signed main() 
{
    fastio;
    //cout << fixed << setprecision(0);
    int n,m;
    cin>>n>>m;
    vi a(n);
    set<int> s;
    f(i,n)
    {
        cin>>a[i];
    }
    for(int i=0;i<n;i++)
    {
        int cur=0;
        int x=a[i];
        while(x%2==0)
        {
            x/=2;
            cur++;
        }
        s.insert(cur);
        
    }
    if(s.size()==1)
    {
        int lcm=a[0];
        for(int i=1;i<n;i++)
        {
            lcm=(lcm*a[i])/(gcd(a[i],lcm));
            if(lcm>m)
            {
                cout<<0;
                return 0;
            }    
        }
        cout<<(2*m/lcm)+1)/2<<endl;
    }
    
    else cout<<0<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:129:26: error: expected ';' before ')' token
  129 |         cout<<(2*m/lcm)+1)/2<<endl;
      |                          ^
      |                          ;
Language: C++

#include "bits/stdc++.h"
#include <set>

using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()
#define int long long
#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
#define mod 1000000007
#define INF 10e10
template <typename T>

void print(T x)
{
	std::cout << x << " ";
}
template <typename T>

void println(T x)
{
	std::cout << x << "\n";
}

int gcd(int a, int b)
{
	if (a%b == 0)return(b);
	else return(gcd(b, a%b));
}

int lcm(int a, int b)
{
	return a * b / gcd(a, b);
}

int cnt2(int a)
{
	int count = 0;
	while (a % 2 == 0) {
		a /= 2;
		count++;
	}
	return count;
}

int main(void) {
	int n, m;
	cin >> n >> m;
	vector<int>a(n);
	rep(i, n) {
		cin >> a[i];
	}

	int count = cnt2(a[0]);
	rep1(i, n) {
		if (count != cnt2(a[i])) {
			print(0);
			return 0;
		}
	}

	int ans = a[0]/2;
	rep1(i, n) {
		ans = lcm(ans, a[i] / 2);
	}
	
	if ((m / ans) % 2 == 0)print(m / (ans * 2));
	else print(m / (ans * 2)+1);
	return 0;
}

Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++

#include <bits/stdc++.h>
#include <math.h>
#include <vector>
#include <queue>
#include <iomanip>
#include <string>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep_1 (i,j,n) for(int i=j;i<n;i++)
typedef long long ll;
typedef long l;
const ll l_INF = 101010101000;
const int INF = 1010101010;
const int dx[4] = {-1,0,1,0};
const int dy[4] = {0,-1,0,1};
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int,int>;

ll gcd(ll x, ll y){
  if(x%y==0){
    return y;
  }else{
    return(gcd(y,x%y));
  }
}
ll lcm(ll x, ll y){
  return x*y/gcd(x,y);
}
int c(int x){
  int ans=0;
  while(x%2==0){
    x/=2;
    ans++;
  }
  return ans;
}
int main(){
  int n, m;
  cin >> n >> m;
  vector<int> a(n);
  rep(i,n){
    cin >> a[i];
    a[i]/=2;
  }
  ll x=1;
  rep(i,n){
    x = lcm(x,a[i]);
  }
  vector<int> count(n);
  rep(i,n) count[i] = c(a[i]);
  bool ok=ture;
  rep(i,n-1) if(count[i]!=count[n-1]) ok = false;
  if(x>m||!ok) cout << 0 << endl;
  else{
    int ans = m / x;
    ans = (ans+1)/2;
    cout << ans << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:53:11: error: 'ture' was not declared in this scope
   53 |   bool ok=ture;
      |           ^~~~
Language: C++

const int MOD = 1000000007;
const int INF = 1e15;
using Graph = vector<vector<int>>;

int gcd(int a, int b){
	if(!a) return b;
	return gcd(b%a,a);
}

int lcm(int x, int y){
	if(x == 0 || y==0) return 0;
	return x/gcd(x, y) *y;
}


signed main(){
  int N, M;
  cin >> N >> M;

  vector<int> A(N);
  for( int i = 0; i < N; i++ ){
    cin >> A[i];
    A[i] /= 2;
  }

  int cnt = 0;
  int B = A[0];
  while( B%2 == 0 ){
    B /= 2;
    cnt++;
  }
  for( int i = 1; i < N; i++ ){
    B = A[i];
    int now = 0;
    while( B%2 == 0 ){
      B /= 2;
      now++;
    }
    //2で割れる回数が異なったら
    if( cnt != now ){
      cout << 0 << endl;
      return 0;
    }
  }

  int LCM = lcm(A[0], A[1]);
  for( int i = 2; i < N; i++ ){
    LCM = lcm(LCM, A[i]);
    if( LCM > M ){
      cout << 0 << endl;
      return 0;
    }
  }

  int ans = 0;
  for( int i = 1; i*LCM <= M; i+=2 ) ans++;
  cout << ans << endl;
}


Compiler output:
a.cc:2:17: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+15' to '2147483647' [-Woverflow]
    2 | const int INF = 1e15;
      |                 ^~~~
a.cc:3:15: error: 'vector' does not name a type
    3 | using Graph = vector<vector<int>>;
      |               ^~~~~~
a.cc: In function 'int main()':
a.cc:18:3: error: 'cin' was not declared in this scope
   18 |   cin >> N >> M;
      |   ^~~
a.cc:20:3: error: 'vector' was not declared in this scope
   20 |   vector<int> A(N);
      |   ^~~~~~
a.cc:20:10: error: expected primary-expression before 'int'
   20 |   vector<int> A(N);
      |          ^~~
a.cc:22:12: error: 'A' was not declared in this scope
   22 |     cin >> A[i];
      |            ^
a.cc:27:11: error: 'A' was not declared in this scope
   27 |   int B = A[0];
      |           ^
a.cc:41:7: error: 'cout' was not declared in this scope
   41 |       cout << 0 << endl;
      |       ^~~~
a.cc:41:20: error: 'endl' was not declared in this scope
   41 |       cout << 0 << endl;
      |                    ^~~~
a.cc:50:7: error: 'cout' was not declared in this scope
   50 |       cout << 0 << endl;
      |       ^~~~
a.cc:50:20: error: 'endl' was not declared in this scope
   50 |       cout << 0 << endl;
      |                    ^~~~
a.cc:57:3: error: 'cout' was not declared in this scope
   57 |   cout << ans << endl;
      |   ^~~~
a.cc:57:18: error: 'endl' was not declared in this scope
   57 |   cout << ans << endl;
      |                  ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;

int N;long M;

long gojohou(long a,long b) {
  long _a=max(a,b);long _b=min(a,b);
  if (_a%_b==0) return _b;
  else return gojohou(_b,_a%_b);
}

int main() {
  cin >> N >> M;long A[N];
  for (int i=0;i<N;i++) {
    cin >> A[i];
    if (i>0) {
      A[i]=(A[i-1]*A[i])/gojohou(A[i-1],A[i]);
    }
  }
  cout << (M+A[N-1]/2)/A[N-1] << endl;
}
    
}

Compiler output:
a.cc:23:1: error: expected declaration before '}' token
   23 | }
      | ^
Language: C++

#include "bits/stdc++.h"
#define rep(i,n) for (int i=0; i<(n); ++i)
using namespace std;
using ll =long long;
using P =pair<int,int>;

//最大公約数を求める関数
ll lcm(ll a,ll b){
    ll c,d,e;
    c=max(a,b);
    d=min(a,b);
    while(1){
        c=c%d;
        if(c==0){
            break;
        }
        e=d;
        d=c;
        c=e;
    }
    return a*b/d;
}
int main(){
    ll n,m;
    cin >> n >> m;
    vector <ll> a(n);
    rep(i,n) cin >> a[i];

    ll sk;
    sk=1;
    int n2;
    n2=0;
    ll n3;
    n3=a[0];


    while(n3%2==0){
        n3/=2;
        ++n2;
        if(n3==0) break;
    }

    ll w;
    w=ll(pow(2,n2-1));

    rep(i,n){
        sk=lcm(sk,a[i]/2);
        if(a[i]%w!=0)){
           sk=-1;
           break; 
        }
        if(sk>m){
            sk=-1;
            break;
        }
    }
    //cout << sk << endl;
    int n4;
    n4=0;
    ll sk2;
    sk2=sk;
    while(sk2%2==0){
        sk2/=2;
        ++n4;
        if(sk2==0) break;
    }
    if(n2!=n4+1){
        sk=-1;
    }
    ll ans;
    if(sk==-1){
        cout << 0 << endl;
    }
    else{
        ans=(m-sk)/(2*sk)+1;
        cout << ans << endl;
    }

    

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:48:22: error: expected primary-expression before ')' token
   48 |         if(a[i]%w!=0)){
      |                      ^
Language: C++

/*

                              Jai Shree Krishna !!
                                 Radhe Radhe !!
                                 
             उद्यमेन हि सिद्ध्यन्ति कार्याणि न मनोरथैः। नहि सुप्तस्य सिंहस्य मुखे प्रविशन्ति मृगाः।।
             
*/
   
   
#include <bits/stdc++.h>
using namespace std;
 
#define int long long
typedef long long ll;
#define loop(i,n)  for(int i=0;i<n;i++)
#define read(a) int a; cin >>a;
#define readarr(a,n) int a[n] ; for(int i=0;i<n;i++) cin >> a[i];
#define readmat(a,n,m) int a[n][m]; for(int i=0;i<n;i++) for(int j=0;j<m;j++) cin >> a[i][j];
#define pb push_back
#define ff first
#define ss second
#define vi vector<int>
#define pi pair<int,int>
#define vvi vector<vector<int>>
#define sti set<int>
#define vpi vector<pair<int,int>>
#define print(a,n) for(int i=0;i<n;i++) cout<<a[i]<<" "; cout<<endl;
#define printmat(a,n,m) for(int i=0;i<n;i++) {for(int j=0;j<m;j++) cout<<a[i][j]<<" "; cout<<endl;}
#define fast ios_base::sync_with_stdio(false);  cin.tie(NULL);
#define endl "\n"
#define mp make_pair
#define ins insert
#define rep(i,s,e)  for(int i=s;i<=e;i++)
#define repd(i,s,e)  for(int i=e;i>=s;i--)
#define vb vector<bool>
#define read2(n,m) int n,m; cin >> n >> m;
#define range(v) v.begin(),v.end()
#define sortd(v) sort(v.begin(),v.end(),greater<int>())
#define sorti(v) sort(v.begin(),v.end())

const ll inf = 1e18;
const ll mod = 1e9 + 7;
 
signed main()
{
 
    fast;
    read2(n,m);
    readarr(a,n);
    int k=0;
    int lcm = a[0]/2;
    vi k;
    rep(i,0,n-1) {
    	a[i]=a[i]/2;
    	int x=a[i];
    	k=0;
    	while(x%2==0){
    		 k++;
    		 x=x/2;
    	}
    	v.pb(k);
    	lcm = (lcm*a[i])/__gcd(a[i],lcm);
    }
    k=0;
    int aa=v[0];
    rep(i,0,n-1){
    	if(v[i]==aa) k++;
    }
    
    if(lcm%2==0 && k!=n) {
    	cout<<0<<endl;
    	return 0;
    }
    
    int i=1,ans=0;
    while(1){
    if(i*lcm<=m){
    	ans++;
    	i+=2;
    }
    else break;
    }
    cout<<ans<<endl;
    return 0;
}

/* Pooja Yadav */

Compiler output:
a.cc: In function 'int main()':
a.cc:53:8: error: conflicting declaration 'std::vector<long long int> k'
   53 |     vi k;
      |        ^
a.cc:51:9: note: previous declaration as 'long long int k'
   51 |     int k=0;
      |         ^
a.cc:62:9: error: 'v' was not declared in this scope
   62 |         v.pb(k);
      |         ^
a.cc:66:12: error: 'v' was not declared in this scope
   66 |     int aa=v[0];
      |            ^