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

#include <iostream>
#include <algorithm>
#include <vector>
#include <cassert>
using namespace std;

int lg2(int n){
	if( n == 0 || n % 2 == 1) return 0;
	if( n % 2 == 0 ) return 1 + lg(n/2);
}

int main(){
	long long N, M;
	cin >> N >> M;
	
	vector<long long> A(N);
	
	set<int> S;
	for(int i = 0 ; i < N ; i++) {
		cin >> A[i];
		S.insert(lg2(A[i]));
	}
	
	if( S.size() > 1 ){
		cout << 0 << endl;
	}
	
	
	long long lcm = 1;
	for(long long a : A ){
		lcm = a / __gcd(lcm, a) * lcm; 
		if( lcm > 1e10 ){
			cout << 0 << endl;
			return 0;
		}
	}
	
	
	if( M <	lcm / 2 ) {
		cout << 0 << endl;
		return 0;
	}
	assert(lcm%2==0);
	cout << (M - lcm / 2) / lcm + 1 << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int lg2(int)':
a.cc:9:37: error: 'lg' was not declared in this scope; did you mean 'lg2'?
    9 |         if( n % 2 == 0 ) return 1 + lg(n/2);
      |                                     ^~
      |                                     lg2
a.cc: In function 'int main()':
a.cc:18:9: error: 'set' was not declared in this scope
   18 |         set<int> S;
      |         ^~~
a.cc:5:1: note: 'std::set' is defined in header '<set>'; this is probably fixable by adding '#include <set>'
    4 | #include <cassert>
  +++ |+#include <set>
    5 | using namespace std;
a.cc:18:13: error: expected primary-expression before 'int'
   18 |         set<int> S;
      |             ^~~
a.cc:21:17: error: 'S' was not declared in this scope
   21 |                 S.insert(lg2(A[i]));
      |                 ^
a.cc:24:13: error: 'S' was not declared in this scope
   24 |         if( S.size() > 1 ){
      |             ^
Language: C++

#include<bits/stdc++.h>
#include<algorithm>
int n,m;
const int maxn=1e5+50;
int a[maxn];
typedef long long ll;
ll minn;
ll lcm(int a[],int n)
{
	int max=__gcd(a[0],a[1]);
	ll min=a[0];
	for(int i=1;i<n-1;i++){
		min*=a[i];
		max=__gcd(max,a[i+1]);
	}
	min=(min*a[n-1])/max;
	return min;
}
using namespace std;
int main()
{
	cin>>n>>m;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	minn=lcm(a,n)/2;
	int cnt=0;
	while(m>=minn){
		cnt++;
		m=floor(m/minn)-floor(m/(2*minn));
	}
	cout<<cnt<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'll lcm(int*, int)':
a.cc:10:17: error: '__gcd' was not declared in this scope
   10 |         int max=__gcd(a[0],a[1]);
      |                 ^~~~~
a.cc:10:17: note: suggested alternatives:
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h:1137:5: note:   'std::__gcd'
 1137 |     __gcd(_EuclideanRingElement __m, _EuclideanRingElement __n)
      |     ^~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:58:
/usr/include/c++/14/numeric:134:5: note:   'std::__detail::__gcd'
  134 |     __gcd(_Tp __m, _Tp __n)
      |     ^~~~~
Language: C++

#include<iostream>
#include<vector>
#include<math.h>
using namespace std;
int main(){
  int N,M,count;
  cin>>N>>M;
  double array[N];
  for(int p=0;p<N;p++){
     cin>>array[p];
  }
  vector<int>ans;
  int b=0;
  
  for(double a=1;a<M+1;a++){
     for(int s=0;s<N;s++){
        double f=fmod((a/array[s]-0.5),1.0);
         if(f==0){
           for(int h=0;h<=b;h++){
             if(ans[h]==a){
               break;
             }else{
              ans[h]=a;
                count++;
                 )
         }
     }
  }
     }
           
cout<<count<<endl;
}
  
  


Compiler output:
a.cc: In function 'int main()':
a.cc:25:18: error: expected primary-expression before ')' token
   25 |                  )
      |                  ^
a.cc:32:2: error: expected '}' at end of input
   32 | }
      |  ^
a.cc:5:11: note: to match this '{'
    5 | int main(){
      |           ^
Language: C++

#include<iostream>
#include<vector>
#include<math.h>
using namespace std;
int main(){
  int N,M,count;
  cin>>N>>M;
  double array[N];
  for(int p=0;p<N;p++){
     cin>>array[p];
  }
  vector<int>ans;
  int b=0;
  
  for(double a=1;a<M+1;a++){
     for(int s=0;s<N;s++){
        double f=fmod((a/array[s]-0.5),1.0);
         if(f==0){
           for(int h=0;h=<b;h++){
             if(ans[h]==a){
               break;
             }else{
              ans[h]=a;
                count++;
                 )
         }
     }
  }
     }
           
cout<<count<<endl;
}
  
  


Compiler output:
a.cc: In function 'int main()':
a.cc:19:26: error: expected primary-expression before '<' token
   19 |            for(int h=0;h=<b;h++){
      |                          ^
a.cc:25:18: error: expected primary-expression before ')' token
   25 |                  )
      |                  ^
a.cc:32:2: error: expected '}' at end of input
   32 | }
      |  ^
a.cc:5:11: note: to match this '{'
    5 | int main(){
      |           ^
Language: C++

#include<iostream>
#include<vector>
#include<math.h>
using namespace std;
int main(){
  int N,M,count;
  cin>>N>>M;
  double array[N];
  for(int p=0;p<N;p++){
     cin>>array[p];
  }
  vector<int>ans;
  
  for(double a=1;a<M+1;a++){
     for(int s=0;s<N;s++){
        double f=fmod((a/array[s]-0.5),1.0);
         if(f==0){
           for(int h=0;h<b;h++){
             if(ans[h]==a){
               break;
             }else{
              ans[h]=a;
                count++;
                 )
         }
     }
  }
     }
           
cout<<count<<endl;
}
  
  


Compiler output:
a.cc: In function 'int main()':
a.cc:18:26: error: 'b' was not declared in this scope
   18 |            for(int h=0;h<b;h++){
      |                          ^
a.cc:24:18: error: expected primary-expression before ')' token
   24 |                  )
      |                  ^
a.cc:31:2: error: expected '}' at end of input
   31 | }
      |  ^
a.cc:5:11: note: to match this '{'
    5 | int main(){
      |           ^
Language: C++

#include<iostream>
#include<vector>
using namespace std;
int main(){
  int N,M,count;
  cin>>N>>M;
  double array[N];
  for(int p=0;p<N;p++){
     cin>>array[p];
  }
  vector<int>ans;
  
  for(double a=1;a<M+1;a++){
     for(int s=0;s<N;s++){
        double f=(a/array[s]-0.5)%1.0
         if(f==0){
           for(int h=0;h<b;h++){
             if(ans[h]==a){
               break;
             }else{
              ans[h]=a;
                count++;
                 )
         }
     }
  }
     }
           
cout<<count<<endl;
}
  
  


Compiler output:
a.cc: In function 'int main()':
a.cc:15:34: error: invalid operands of types 'double' and 'double' to binary 'operator%'
   15 |         double f=(a/array[s]-0.5)%1.0
      |                  ~~~~~~~~~~~~~~~~^~~~
      |                             |     |
      |                             |     double
      |                             double
a.cc:30:2: error: expected '}' at end of input
   30 | }
      |  ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^
Language: C++

#include<iostream>
#include<vector>
using namespace std;
int main(){
  int N,M,count;
  cin>>N>>M;
  double array[N];
  for(int p=0;p<N;p++){
     cin>>array[p];
  }
  vector<int>ans;
  
  for(double a=1;a<M+1;a++){
     for(int s=0;s<N;s++){
        f=(a/array[s]-0.5)%1.0
         if(f==0){
           for(int h=0;h<b;h++){
             if(ans[h]==a){
               break;
             }else{
              ans[h]=a;
                count++;
                 )
         }
     }
  }
     }
           
cout<<count<<endl;
}
  
  


Compiler output:
a.cc: In function 'int main()':
a.cc:15:9: error: 'f' was not declared in this scope
   15 |         f=(a/array[s]-0.5)%1.0
      |         ^
a.cc:15:27: error: invalid operands of types 'double' and 'double' to binary 'operator%'
   15 |         f=(a/array[s]-0.5)%1.0
      |           ~~~~~~~~~~~~~~~~^~~~
      |                      |     |
      |                      |     double
      |                      double
a.cc:30:2: error: expected '}' at end of input
   30 | }
      |  ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^
Language: C++

#include<iostream>
#include<vector>
using namespace std;
int main(){
  int N,M,count;
  cin>>N>>M;
  double array[N];
  for(int p=0;p<N;p++){
     cin>>array[p];
  }
  vector<int>ans;
  
  for(double a=1;a<M+1;a++){
     for(int s=0;s<N;s++){
        f=(a/array[s]-0.5)%1
         if(f==0){
           for(int h=0;h<b;h++){
             if(ans[h]==a){
               break;
             }else{
              ans[h]=a;
                count++;
                 )
         }
     }
  }
           
cout<<count<<endl;
}
  
  


Compiler output:
a.cc: In function 'int main()':
a.cc:15:9: error: 'f' was not declared in this scope
   15 |         f=(a/array[s]-0.5)%1
      |         ^
a.cc:15:27: error: invalid operands of types 'double' and 'int' to binary 'operator%'
   15 |         f=(a/array[s]-0.5)%1
      |           ~~~~~~~~~~~~~~~~^~
      |                      |     |
      |                      |     int
      |                      double
a.cc:29:2: error: expected '}' at end of input
   29 | }
      |  ^
a.cc:13:28: note: to match this '{'
   13 |   for(double a=1;a<M+1;a++){
      |                            ^
a.cc:29:2: error: expected '}' at end of input
   29 | }
      |  ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^
Language: C++

#include<iostream>
using namespace std;
int main(){
  int N,M,count;
  cin>>N>>M;
  double array[N];
  for(int p=0;p<N;p++){
     cin>>array[p];
  }
  int ans[];
  
  for(double a=1;a<M+1;a++){
     for(int s=0;s<N;s++){
        f=(a/array[s]-0.5)%1
         if(f==0){
           for(int h=0;h<b;h++){
             if(ans[h]==a){
               break;
             }else{
              ans[h]=a;
                count++;
                 )
         }
     }
  }
           
cout<<count<<endl;
}
  
  


Compiler output:
a.cc: In function 'int main()':
a.cc:10:7: error: storage size of 'ans' isn't known
   10 |   int ans[];
      |       ^~~
a.cc:14:9: error: 'f' was not declared in this scope
   14 |         f=(a/array[s]-0.5)%1
      |         ^
a.cc:14:27: error: invalid operands of types 'double' and 'int' to binary 'operator%'
   14 |         f=(a/array[s]-0.5)%1
      |           ~~~~~~~~~~~~~~~~^~
      |                      |     |
      |                      |     int
      |                      double
a.cc:28:2: error: expected '}' at end of input
   28 | }
      |  ^
a.cc:12:28: note: to match this '{'
   12 |   for(double a=1;a<M+1;a++){
      |                            ^
a.cc:28:2: error: expected '}' at end of input
   28 | }
      |  ^
a.cc:3:11: note: to match this '{'
    3 | int main(){
      |           ^
Language: C++

#include<iostream>
using namespace std;
int main(){
  int N,M,count;
  cin>>N>>M;
  double array[N];
  for(int p=0;p<N;p+*){
     cin>>array[p];
  }
  int ans[];
  
  for(double a=1;a<M+1;a++){
     for(int s=0;s<N;s++){
        f=(a/array[s]-0.5)%1
         if(f==0){
           for(int h=0;h<b;h++){
             if(ans[h]==a){
               break;
             }else{
              ans[h]=a
                count++;
                 )
         }
     }
  }
           
cout<<count<<endl;
}
  
  


Compiler output:
a.cc: In function 'int main()':
a.cc:7:22: error: expected primary-expression before ')' token
    7 |   for(int p=0;p<N;p+*){
      |                      ^
a.cc:10:7: error: storage size of 'ans' isn't known
   10 |   int ans[];
      |       ^~~
a.cc:14:9: error: 'f' was not declared in this scope
   14 |         f=(a/array[s]-0.5)%1
      |         ^
a.cc:14:27: error: invalid operands of types 'double' and 'int' to binary 'operator%'
   14 |         f=(a/array[s]-0.5)%1
      |           ~~~~~~~~~~~~~~~~^~
      |                      |     |
      |                      |     int
      |                      double
a.cc:28:2: error: expected '}' at end of input
   28 | }
      |  ^
a.cc:12:28: note: to match this '{'
   12 |   for(double a=1;a<M+1;a++){
      |                            ^
a.cc:28:2: error: expected '}' at end of input
   28 | }
      |  ^
a.cc:3:11: note: to match this '{'
    3 | int main(){
      |           ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
 
#define pb push_back
#define ll long long
#define maxn 100005
#define fr(i,j,k) for(int i=j;i<k;i++)
#define f(n) fr(i,0,n)
#define f1(n) fr(i,1,n+1)
#define ms(i) memset(i,0,sizeof(i));
#define ms1(i) memset(i,-1,sizeof(i));
#define F first
#define S second
const int mod = 1e9 + 7;

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    int n, k;
    cin >> n >> k;
    vector<int>v(n);
    ll lcm = 1;
    for(auto &i:v){
        cin >> i;
        i >>= 1;
        lcm =  i * lcm /__gcd(lcm,i);   
        if(lcm > k){
            cout << 0 << '\n';
            exit(0);
        }
    }
    for(auto i:v){
        if((lcm/i)%2==0){
            cout << 0 << endl;
            exit(0);
        }
    }
    k /= lcm;
    ll ans = (k + 1) / 2;
    cout << ans << '\n';
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:30: error: no matching function for call to '__gcd(long long int&, int&)'
   25 |         lcm =  i * lcm /__gcd(lcm,i);
      |                         ~~~~~^~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h:1137:5: note: candidate: 'template<class _EuclideanRingElement> _EuclideanRingElement std::__gcd(_EuclideanRingElement, _EuclideanRingElement)'
 1137 |     __gcd(_EuclideanRingElement __m, _EuclideanRingElement __n)
      |     ^~~~~
/usr/include/c++/14/bits/stl_algo.h:1137:5: note:   template argument deduction/substitution failed:
a.cc:25:30: note:   deduced conflicting types for parameter '_EuclideanRingElement' ('long long int' and 'int')
   25 |         lcm =  i * lcm /__gcd(lcm,i);
      |                         ~~~~~^~~~~~~
Language: C++

def gcd(a,b):
  while b > 0:
    a, b = b, a % b
  return a
 
n , m = list(map(int , input().split()))
arr = list(map(int , input().split()))
lcm = arr[0]
for i in range(1,n):
  hcf = gcd(lcm, arr[i])
  lcm = (lcm*arr[i])//hcf 
lcm = lcm//2
sum = m//lcm
if(sum%2==0):
  print(sum//2)
else:
  print(int(sum//2+1))

Compiler output:
a.cc:1:1: error: 'def' does not name a type
    1 | def gcd(a,b):
      | ^~~
Language: C++

#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
#define rep(X,N) for(ll X = 0; X < (N); X++)
#define PI (acos(-1.0))
#define pback push_back
#define mpair make_pair
#define MODN 1000000007
#define ALL(V) (V).begin(),(V).end()

typedef long long ll;

using namespace std;
using namespace boost::multiprecision;

ll gcd(ll a, ll b){
    if(a < b) return gcd(b, a);

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

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

int main(){

    int n,m;
    cin >> n >> m;
    
    vector<int> a;

    int maxa = 0;

    ll lcmi = 1;

    rep(i,n){
        int tmp;
        cin >> tmp;

        lcmi = lcm(lcmi, tmp / 2);

        maxa = max(maxa, tmp / 2);

        if(lcmi > (ll)m){
            break;
        }

        a.pback(tmp / 2);
    }

    bool oddeven = true;

    assert(a[i] != 0);

    rep(i,n){
        if((lcmi / a[i]) % 2 == 0){
            oddeven = false;
            break;
        }
    }

    int ans = 0;

    cerr << lcmi << endl;

    if(oddeven){

        for(int i = lcmi; i <= m; i = i + lcmi * 2){
            ans++;
        }

    }

    cout << ans << endl;

    return 0;
}

Compiler output:
a.cc:2:10: fatal error: boost/multiprecision/cpp_int.hpp: No such file or directory
    2 | #include <boost/multiprecision/cpp_int.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

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

int main(){
  int N,M;
  cin >> N >> M;
  vector<int> a(N);
  
  for(int i=0;i<N;i++){
    cin>>a.at(i);
  }
  
  set<int> X;
  int i=0;
  int x=a.at(0)*i+a.at(0)/2;
  while(x<=M){
    X.insert(x);
    i++;
    x=a.at(0)*i+a.at(0)/2;
  }
  
  set<int> A;
  for(i=1;i<N;i++){
    if(!A.contain(a.at(i))){
      A.insert(a.at(i));
    }
  }
  
  for(i:A){
    for(x:X){
      if(x%i!=i/2){
        X.erase(x);
        continue;
      }
    }
  }
  
  cout<<X.size()<<endl;
}
  
  
  

Compiler output:
a.cc: In function 'int main()':
a.cc:24:11: error: 'class std::set<int>' has no member named 'contain'
   24 |     if(!A.contain(a.at(i))){
      |           ^~~~~~~
a.cc:29:8: error: found ':' in nested-name-specifier, expected '::'
   29 |   for(i:A){
      |        ^
      |        ::
a.cc:29:7: error: 'i' is not a class, namespace, or enumeration
   29 |   for(i:A){
      |       ^
a.cc:39:1: error: expected primary-expression before '}' token
   39 | }
      | ^
a.cc:38:24: error: expected ')' before '}' token
   38 |   cout<<X.size()<<endl;
      |                        ^
      |                        )
   39 | }
      | ~                       
a.cc:29:6: note: to match this '('
   29 |   for(i:A){
      |      ^
a.cc:39:1: error: expected primary-expression before '}' token
   39 | }
      | ^
Language: C++

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

int main(){
  int N,M;
  cin >> N >> M;
  vector<int> a(N);
  
  for(int i=0;i<N;i++){
    cin>>a.at(i);
  }
  
  set<int> X;
  int i=0;
  int x=a.at(0)*i+a.at(0)/2;
  while(x<=M){
    X.insert(x);
    i++;
    x=a.at(0)*i+a.at(0)/2;
  }
  
  set<int> A;
  for(i=1;i<N;i++){
    if(!A.contain(a.at(i)){
      A.insert(a.at(i));
    }
  }
  
  for(i:A){
    for(x:X){
      if(x%i!=i/2){
        X.erase(x);
        continue;
      }
    }
  }
  
  cout<<X.size()<<endl;
}
  
  
  

Compiler output:
a.cc: In function 'int main()':
a.cc:24:11: error: 'class std::set<int>' has no member named 'contain'
   24 |     if(!A.contain(a.at(i)){
      |           ^~~~~~~
a.cc:24:27: error: expected ')' before '{' token
   24 |     if(!A.contain(a.at(i)){
      |       ~                   ^
      |                           )
a.cc:27:3: error: expected primary-expression before '}' token
   27 |   }
      |   ^
a.cc:29:8: error: found ':' in nested-name-specifier, expected '::'
   29 |   for(i:A){
      |        ^
      |        ::
a.cc:29:7: error: 'i' is not a class, namespace, or enumeration
   29 |   for(i:A){
      |       ^
a.cc:39:1: error: expected primary-expression before '}' token
   39 | }
      | ^
a.cc:38:24: error: expected ')' before '}' token
   38 |   cout<<X.size()<<endl;
      |                        ^
      |                        )
   39 | }
      | ~                       
a.cc:29:6: note: to match this '('
   29 |   for(i:A){
      |      ^
a.cc:39:1: error: expected primary-expression before '}' token
   39 | }
      | ^
Language: C++

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

int main(){
  int N,M;
  cin >> N >> M;
  vector<int> a(N);
  for(int i=0;i<N;i++){
    cin>>a.at(i);
  }
  
  set<int> X;
  int i=0;
  int x=A.at(0)*i+A.at(0)/2;
  while(x<=M){
    X.insert(x);
    i++;
    x=A.at(0)*i+A.at(0)/2;
  }
  
  for(i=0;i<N;i++){
    for(x:X){
      if(x%A.at(i)!=A.at(i)/2){
        X.erase(x);
        continue;
      }
    }
  }
  
  cout<<X.size()<<endl;
}
  
  
  

Compiler output:
a.cc: In function 'int main()':
a.cc:14:9: error: 'A' was not declared in this scope
   14 |   int x=A.at(0)*i+A.at(0)/2;
      |         ^
a.cc:22:10: error: found ':' in nested-name-specifier, expected '::'
   22 |     for(x:X){
      |          ^
      |          ::
a.cc:22:9: error: 'x' is not a class, namespace, or enumeration
   22 |     for(x:X){
      |         ^
a.cc:28:3: error: expected primary-expression before '}' token
   28 |   }
      |   ^
a.cc:27:6: error: expected ';' before '}' token
   27 |     }
      |      ^
      |      ;
   28 |   }
      |   ~   
a.cc:28:3: error: expected primary-expression before '}' token
   28 |   }
      |   ^
a.cc:27:6: error: expected ')' before '}' token
   27 |     }
      |      ^
      |      )
   28 |   }
      |   ~   
a.cc:22:8: note: to match this '('
   22 |     for(x:X){
      |        ^
a.cc:28:3: error: expected primary-expression before '}' token
   28 |   }
      |   ^
Language: C++

#include <bits/stdc++.h>

using namespace std;


#define PI 3.14159265
#define int long long


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


main(){


	int n, m; cin >> n >> m;

	vector <int> a(n);

	for(int i = 0; i < n; i++){
		cin >> a[i];
	}


	int LCM1 = 1, LCM2 = 1;

	for(int i = 0; i < n; i++){
		LCM1 = lcm(LCM1, a[i] / 2);
		if(LCM1 > 1e9){
			cout << 0 << endl; return;
		}
		LCM2 = lcm(LCM2, a[i]);
	}

	cout << m / LCM1 - m / LCM2 << endl;




	

	
	
	return 0;
}

Compiler output:
a.cc:15:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   15 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:32:44: error: return-statement with no value, in function returning 'int' [-fpermissive]
   32 |                         cout << 0 << endl; return;
      |                                            ^~~~~~
Language: C++

#include <bits/stdc++.h>

using namespace std;

int main() {
  int n;
  long long m;
  cin >> n >> m;
  long long lcm = 1;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    lcm = lcm / __gcd(lcm, a[i]) * a[i];
  }
  if (lcm % 2 == 1) {
    cout << "0\n";
    return 0;
  }
  for (int i = 0; i < n; i++) {
    if (lcm / a[i] % 2 != 1) {
      cout << "0\n";
      return 0;
    }
  }
  long long res = (m - lcm / 2) / lcm + 1;
  if (res < 0) res = 0;
  cout << res << '\n';
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:22: error: no matching function for call to '__gcd(long long int&, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&)'
   13 |     lcm = lcm / __gcd(lcm, a[i]) * a[i];
      |                 ~~~~~^~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h:1137:5: note: candidate: 'template<class _EuclideanRingElement> _EuclideanRingElement std::__gcd(_EuclideanRingElement, _EuclideanRingElement)'
 1137 |     __gcd(_EuclideanRingElement __m, _EuclideanRingElement __n)
      |     ^~~~~
/usr/include/c++/14/bits/stl_algo.h:1137:5: note:   template argument deduction/substitution failed:
a.cc:13:22: note:   deduced conflicting types for parameter '_EuclideanRingElement' ('long long int' and 'int')
   13 |     lcm = lcm / __gcd(lcm, a[i]) * a[i];
      |                 ~~~~~^~~~~~~~~~~
Language: C++

// In the name of God

#include <bits/stdc++.h>

using namespace std;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	long long n, m;
	cin >> n >> m;
	set<int> s;
	long long lcm1 = 1;
	long long lcm2 = 1;
	for(int i=0;i<n;i++) {
		int x;
		cin >> x;
		s.insert(x);
		lcm2 = (lcm2*x)/__gcd(lcm2, x);
		x/=2;
		lcm1 = (lcm1*x)/__gcd(lcm1, x);
	}
	if(lcm1 > m) {
		cout << 0;
		exit(0);
	}
	else {
		cout << 1 + (m-lcm1)/lcm2;
	}
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:38: error: no matching function for call to '__gcd(long long int&, int&)'
   19 |                 lcm2 = (lcm2*x)/__gcd(lcm2, x);
      |                                 ~~~~~^~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_algo.h:1137:5: note: candidate: 'template<class _EuclideanRingElement> _EuclideanRingElement std::__gcd(_EuclideanRingElement, _EuclideanRingElement)'
 1137 |     __gcd(_EuclideanRingElement __m, _EuclideanRingElement __n)
      |     ^~~~~
/usr/include/c++/14/bits/stl_algo.h:1137:5: note:   template argument deduction/substitution failed:
a.cc:19:38: note:   deduced conflicting types for parameter '_EuclideanRingElement' ('long long int' and 'int')
   19 |                 lcm2 = (lcm2*x)/__gcd(lcm2, x);
      |                                 ~~~~~^~~~~~~~~
a.cc:21:38: error: no matching function for call to '__gcd(long long int&, int&)'
   21 |                 lcm1 = (lcm1*x)/__gcd(lcm1, x);
      |                                 ~~~~~^~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1137:5: note: candidate: 'template<class _EuclideanRingElement> _EuclideanRingElement std::__gcd(_EuclideanRingElement, _EuclideanRingElement)'
 1137 |     __gcd(_EuclideanRingElement __m, _EuclideanRingElement __n)
      |     ^~~~~
/usr/include/c++/14/bits/stl_algo.h:1137:5: note:   template argument deduction/substitution failed:
a.cc:21:38: note:   deduced conflicting types for parameter '_EuclideanRingElement' ('long long int' and 'int')
   21 |                 lcm1 = (lcm1*x)/__gcd(lcm1, x);
      |                                 ~~~~~^~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
long int gcd(long int a,long int b){
  if(b==0)
    return a;
  return gcd(b,a%b);
}
int main(){ int flag=0;
  long int gcd,n,m,i,lcm=1;
  cin>>n>>m;
  for(i=0;i<n;i++){
    cin>>a[i];
    lcm=gcd(a[i],0);
  }long long int k=1,ans=-1;
  for(i=0;i<n;i++){
    k=k*a[i];
  if(k%lcm==0)
  {k=k/lcm;
  flag=1;} 
    if(flag==1)
    { if(k>m)
      ans=0;break;
    }
  }}
           if(ans==0)
             cout<<ans<<endl;
           else{ ans=m/k;
                if((ans+0.5)>((1.0*ans)/k))
             cout<<ans+1<<end;
           }
  }

Compiler output:
a.cc: In function 'int main()':
a.cc:12:10: error: 'a' was not declared in this scope
   12 |     cin>>a[i];
      |          ^
a.cc:13:12: error: 'gcd' cannot be used as a function
   13 |     lcm=gcd(a[i],0);
      |         ~~~^~~~~~~~
a.cc:16:9: error: 'a' was not declared in this scope
   16 |     k=k*a[i];
      |         ^
a.cc: At global scope:
a.cc:25:12: error: expected unqualified-id before 'if'
   25 |            if(ans==0)
      |            ^~
a.cc:27:12: error: expected unqualified-id before 'else'
   27 |            else{ ans=m/k;
      |            ^~~~
a.cc:31:3: error: expected declaration before '}' token
   31 |   }
      |   ^
Language: C++

#include <bits/stdc++.h>
using ll=long long;
using namespace std;
#define rep_i(i, n) for (int i = 0; i < (n); ++i)
#define rep_ll(i, n) for (long long i = 0; i < (n); ++i)
#define r_rep_i(i, start, end) for (int i = (start); i < (end); ++i)
#define r_rep_ll(i, start, end) for (long long i = (start); i < (end); ++i)
#define debug_vi(v) copy((v).begin(), (v).end(), ostream_iterator<int>(cout, " "));
#define debug_vll(v) copy((v).begin(), (v).end(), ostream_iterator<long long>(cout, " "));
#define debug_vd(v) copy((v).begin(), (v).end(), ostream_iterator<double>(cout, " "));
#define sort_v(v) sort((v).begin(), (v).end()); //昇順
#define d_sort_vi(v) sort((v).begin(), (v).end(), greater<int>()); //降
#define d_sort_vd(v) sort((v).begin(), (v).end(), greater<double>()); //昇順
#define say(t) cout << (t) << endl;
#define sum_vi(v) accumulate((v).begin(), (v).end(), 0);
#define sum_vll(v)accumulate((v).begin(), (v).end(), 0LL);

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

  ll n, m; cin >> n >> m;
  vector<ll> hoge(n);
  ll tmpp;
  rep_i(i, n){
    cin >> tmpp;
    hoge[i] = tmpp/2;
  }

  ll prev_koubai;
  ll a, b, r, x, tmp;
  a = hoge[0];
  b = hoge[1];
  x = a*b;
  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }

  r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }

  prev_koubai = x/b;
  // cout << "pre:" << prev_koubai << endl;
  for (int i = 2; i < n; i++){
    if(prev_koubai > m){
      say(0);
      return;
    }
    a = prev_koubai;
    b = hoge[i];
    x = a*b;
    if(a<b){
      tmp = a;
      a = b;
      b = tmp;
    }
    r = a % b;
    while(r!=0){
      a = b;
      b = r;
      r = a % b;
    }
    prev_koubai = x/b;
  }
  if(prev_koubai % 2 == 0){
    say(0);
    return 0;
  }

  ll count = 0;
  ll i = 3;
  // cout << prev_koubai << endl;
  ll aaa = prev_koubai;
  while(prev_koubai <= m){
    count += 1;
    prev_koubai = aaa*(i);
    i += 2;
  }
  say(count);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:53:7: error: return-statement with no value, in function returning 'int' [-fpermissive]
   53 |       return;
      |       ^~~~~~
Language: C++

N, M = list(map(int, input().split(" ")))
list_a = list(map(int, input().split(" ")))

##半公倍数が存在するかチェック
def check_exist(l) :
  if(len(l) == 0) :
    return True
  while(True) :
    flag = l[0] % 2
    for x in l[1:] :
      if(x % 2 != flag) :
        return False
    if(flag == 0) :
      l = list(map(lambda x: int(x/2), l))
    else :
      return True
    

##最大公約数を求める

def gcd(a, b) :
  if(b==0) :
    return a
  else :
    return gcd(b, a%b)
   
##最小公倍数を求める
def lcm(a, b) :
  cd = gcd(a, b)
  return a * b / cd
  
##複数個の整数の最小公倍数を求める
def lcm_multi(l) :
  if(len(l) < 2) :
    return l[0]
  cm = lcm(l[0], l[1])
  for i in range(2, N) :
    cm = lcm(l[i], cm)
    
  return cm

ans = 0
if(not(check_exist(list_a))) :
  print(0)
  exit()

lcm_m = lcm_multi(list_a)
if(M-lcm_m/2 < 0) :
  print(0)
else :
  print(int((M-lcm_m/2) / lcm_m) + 1)



Compiler output:
a.cc:4:1: error: stray '##' in program
    4 | ##半公倍数が存在するかチェック
      | ^~
a.cc:19:1: error: stray '##' in program
   19 | ##最大公約数を求める
      | ^~
a.cc:27:1: error: stray '##' in program
   27 | ##最小公倍数を求める
      | ^~
a.cc:32:1: error: stray '##' in program
   32 | ##複数個の整数の最小公倍数を求める
      | ^~
a.cc:1:1: error: 'N' does not name a type
    1 | N, M = list(map(int, input().split(" ")))
      | ^
Language: C++

// Problem : D - Semi Common Multiple
// Contest : AtCoder Beginner Contest 150
// URL : https://atcoder.jp/contests/abc150/tasks/abc150_d
// Memory Limit : 1024.000000 MB 
// Time Limit : 2000.000000 milisec 
// Powered by CP Editor (https://github.com/coder3101/cp-editor2)

#include<bits/stdc++.h>
#define pb push_back
#define int long long
#define vi vector<int>
#define pii pair<int,int>
#define f first
#define se second
using namespace std;
template<typename T1,typename T2>istream &operator>>(istream &is, vector<pair<T1,T2>> &v) { for (pair<T1,T2> &t : v) is >> t.f>>t.se; return is; }
template<typename T>istream &operator>>(istream &is, vector<T> &v) { for (T &t : v) is >> t; return is; }
template<typename T>ostream &operator<<(ostream &os, const vector<T> &v) { for (const T &t : v) {os << t <<" ";} os << '\n'; return os; }
double pi=acos(-1.0);
int m=1000000007;
int abst(int a)
{return a<0?-a:a;}
struct HASH{
  size_t operator()(const pii &x)const{
    return (size_t) x.first * 37U + (size_t) x.second;}};
int Pow(int n,int x){int ans=1;
 while(x>0)
 {if(x&1)ans=(ans*n)%m;n=(n*n)%m;x=x>>1;}
 return ans;}

int max(int a,int b){return a>b?a:b;}
int min(int a,int b){return a<b?a:b;}

void solve()
{
int n,m;
cin>>n>>m;
vi v(n);
cin>>v;
  for(int i=0;i<n;i++)
  {
    if(a[i]&1)
    {
      cout<<0;
      return;
    }
  }
//cout<<gcd<<" ";
int lcm=v[0]/2;
//cout<<lcm<<" ";
//set<int> s;
for(int i=1;i<n;i++)
{
if((v[i]/2)>lcm || lcm%(v[i]/2)!=0)
{
	int gcd=__gcd(v[i]/2,lcm);
	lcm=(lcm*(v[i]/2))/gcd;
}
	if(lcm>m)
	{
		cout<<"0";
		return;
	}
}
//cout<<lcm<<" ";
int count=m/lcm;
if(count==1)
cout<<1;
else
cout<<count/2+count%2;
}

int32_t main(){
ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
int t;
//cin>>t;
t=1;
while(t--)
{
    solve();
}
}


Compiler output:
a.cc: In function 'void solve()':
a.cc:42:8: error: 'a' was not declared in this scope
   42 |     if(a[i]&1)
      |        ^
Language: C++

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

int main(){
	
	set<int>v;
	set<int>::iterator it;
	
	int n, m;
	cin >> n >> m;
	
	m *= 2;
	
	long long h = -1LL;
	for(int i = 0 ; i < n ; i ++){
		long long x;
		cin >> x;
		v.insert(x);
		if(h == -1LL) h = x;
		else h = __gcd(h, x);
	}
	
	long long g = 1LL;
	for(it = v.begin() ; it != v.end() ; it++)
		g *= (*it);
	
	g /= h;
	for(it = v.begin() ; it != v.end() ; it++){
		long long k = g/(*it);
		if((k % 2LL) == 0LL){
			cout << "0\n";
			return 0;
		}
	}
		
	
	int cnt = 0;
	for(int i = (swap ? 2 : 1) ; ; i += 2){
		long long x = g * i;
		if(x <= m) cnt++;
		else break;
	}
	
	cout << cnt << "\n";
	
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:38:33: error: cannot resolve overloaded function 'swap' based on conversion to type 'bool'
   38 |         for(int i = (swap ? 2 : 1) ; ; i += 2){
      |                                 ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define int long long
int32_t main() {
  int no_of_input,maxx;
  cin >> no_of_input >> maxx;
  int currmin = 1;
  int input;
  vector<int> vect1;
  for(int i=0;i<no_of_input;i++){
    cin >> input;
    vect1.push_back(input);
    int idk = __gcd(currmin,input);
    currmin *= input;
    currmin /= idk;
    assert(input%2!=1);
    if(currmin>maxx*2){
      cout << 0;
      return 0;
    }
  }
  for(auto k:vect1){
    if(currmin/k)/2%2==1){
      cout << 0;
      return 0;
    }
  }
  cout << ((maxx-currmin/2)/currmin)+1;
}

Compiler output:
a.cc: In function 'int32_t main()':
a.cc:23:18: error: expected primary-expression before '/' token
   23 |     if(currmin/k)/2%2==1){
      |                  ^
Language: C++

/* ~created by Pratik~ */

#include <bits/stdc++.h> 
using namespace std; 
  
typedef long long int ll; 
  
int gcd(int a, int b) 
{ 
    if (b == 0) 
        return a; 
    return gcd(b, a % b); 
} 
ll findlcm(int arr[], int n) 
{ 
    ll ans = arr[0]; 
  
    for (int i = 1; i < n; i++) 
        ans = (((arr[i] * ans)) / 
                (gcd(arr[i], ans))); 
    return ans; 
} 
int main()
{
	int n,m,i;
	cin>>n>>m;
	ll a[n],b[n];
	for(i=0;i<n;i++)
	{
		cin>>a[i];
		b[i]=a[i]/2;
	}
	ll c1=0,c=0,tmp=a[0],val=0;
	while((tmp%2==0)&&(tmp>0))
	{
		c1++;
		tmp/=2;
	}
	for(i=0;i<n;i++)
	{
		c=0;
		tmp=a[i];
		while((tmp%2==0)&&(tmp>0))
		{
			c++;
			tmp/=2;
		}
		// cout<<a[i]<<" "<<c<<" "<<c1<<endl;
		if(c==c1) val++;
	}
	if(val!=n) cout<<0<<endl;
	else
	{
		ll lc=findlcm(b,n);
		// cout<<lc<<endl;
		ll ans=m/lc;
		if(ans%2==0)
			ans/=2;
		else 
			ans=ans/2+1;
		cout<<ans<<endl;
	}
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:54:31: error: cannot convert 'll*' {aka 'long long int*'} to 'int*'
   54 |                 ll lc=findlcm(b,n);
      |                               ^
      |                               |
      |                               ll* {aka long long int*}
a.cc:14:16: note:   initializing argument 1 of 'll findlcm(int*, int)'
   14 | ll findlcm(int arr[], int n)
      |            ~~~~^~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define all(v) v.begin(), v.end()
using in = int64_t;
#define rep(i, n) for (in i = 0ll; i < (in)(n); i++)
const double PI=3.14159265358979323846;
const int64_t waru = 1000000007;
const in INF=1<<30;
using vec = vector<vector<int>>;

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

    return gcd(b, a % b);
}

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

in vlcm(in n,vector<in> a,in m){
  in ret=1ll;
   for(in i=0ll;i<n;i++){
      ret =lcm(ret,a[i]);
     if(ret>m){cout<<0;return -1;}
   }
  return ret;
}

int main(){
  in n,m;
  cin>>n>>m;
  vector<in> a(n);
  rep(i,n) cin>>a[i];
  
  in flag=0ll;
  in flag2=0ll;
  in cnt2=0ll;
  
  while(flag==0ll){
    if(a[0]%2!=0ll) flag=1ll;
    else{ flag=0ll; cnt2 ++;}
    
     rep(i,n){
        if(a[i]%2ll!=0) flag2=1ll;
         else flag2=0ll;
       if(flag != flag2){flag=2ll;break;}
       if(flag==0ll) a[i] /=2ll;
     }
  }
  if(flag==2ll){cout<<0;return 0;}
  //rep(i,n) cout<<a[i];
  
  in x= vlcm(n,a);
  if(x==-1ll) return 0;
  in ans =0;
  //cout<<cnt2;
  for(in i=1ll;i*(1<<cnt2-1ll)*x<=m;i+=2ll){
     ans ++;
  }
  cout<<ans;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:56:13: error: too few arguments to function 'in vlcm(in, std::vector<long int>, in)'
   56 |   in x= vlcm(n,a);
      |         ~~~~^~~~~
a.cc:23:4: note: declared here
   23 | in vlcm(in n,vector<in> a,in m){
      |    ^~~~
Language: C++

#include <bits/stdc++.h>

using namespace std;
#define SORT(a) sort((a).begin(), (a).end())
#define RSORT(a) reverse((a).begin(), (a).end())
#define rep(i, a, b) for (int64_t i = (a); i < (b); ++i)
const int MOD = 1e9 + 7;
typedef long long ll;
const long long INF = 1LL << 60;
using Graph = vector<vector<int>>;

//最大公約数の計算
ll GCD(ll a, ll b) {
  if (b == 0) return a;
  return GCD(b, a % b);
}
ll lcm(ll a, ll b) { return a * b / GCD(a, b); }

int main() {
  int n;
  ll m;
  cin >> n >> m;
  vector<ll> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) a[i] /= 2;
  ll cnt = 0;
  ll t = a[0];
  int num = 0;

  for (int i = 0; i < n; i++) {
    t = lcm(t, a[i]);
  }
  for (int i = 1;; i++) {
    if (t * i > m) break;
    if (i % 2 == 1) cnt++;
  }

  bool ans = true;

  for (int i = 0;; i++) {
    if (a[0] % 2 == 0) {
      a[0] /= 2;
      num++;
    } else
      　break;
  }

  for (int i = 1; i < n; i++) {
    if (a[i] % (ll)pow(2, num) == 0) {
      a[i] /= (ll)pow(2, num);
    } else
      ans = false;
    if (a[i] % 2 == 0) ans = false;
  }

  if (ans)
    cout << cnt << endl;
  else
    cout << 0 << endl;
}


Compiler output:
a.cc:45:7: error: extended character 　 is not valid in an identifier
   45 |       　break;
      |       ^
a.cc: In function 'int main()':
a.cc:45:7: error: '\U00003000break' was not declared in this scope
   45 |       　break;
      |       ^~~~~~~
Language: Java

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N=sc.nextInt();
		int M=sc.nextInt();
		int[] tmpA = new int[N];
		for(int i=0;i<N;i++) {
			tmpA[i]=sc.nextInt();
		}
		
		boolean flag = true;
		for(int i=0;i<N-1;i++) {
			if(divCountByTwo(tmpA[i])!=divCountByTwo(tmpA[i+1])) {
				flag = false;
				break;
			}
		}
		
		
		if(flag) {
			int tmplcm = 1;
			for(int i=0;i<N;i++) {
				tmplcm = lcm(tmpA[i],tmplcm);
			}
			int T = tmplcm/2;
			int tmp = M/T;
			if(tmp%2==1) {
				System.out.println(tmp/2+1);
			}else {
				System.out.println(tmp/2);
			}
		}else {
			System.out.println(0);
		}
		
		
	}
	
	static boolean isOddAndPlus(int n) {
		if(n%2==1 && (n-1)/2>=0) {
			return true;
		}else{
			return false;
		}
	}

	static int divCountByTwo(int n) {
		if(n%2>0) {
			return 0;
		}else {
			return 1+divCountByTwo(n/2);
		}
	}
	
	static int gcd(int a,int b) {
		if(a<b) {
			return gcd(b,a);
		}else if(b==0){
			return a;
		}else {
			return gcd(b,a%b);
		}
	}
	
	static int lcm(int a,int b) {
		return a*b/gcd(a,b);
	}
	
	

Compiler output:
Main.java:70: error: reached end of file while parsing
	}
	 ^
1 error
Language: C++

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

#define rep(i,n) for (int i=0; i<(n); ++i);
typedef long long ll;

ll LCM(ll a, ll b) {
    ll x=a*b,r;
    if(a<b)
        swap(a, b);

    r = a%b;
    while(r != 0){
        a = b;
        b = r;
        r = a % b;
    }

    return x/b;
}

int RR(int x) {
    int r=0;
    while(x%2 == 0) {
        x /= 2;
        r++;
    }
    return r;
}

int main() {
    ll N,M,x=1,t;
    cin >> N >> M;
    vector<ll> a(N);

    rep(i,N) {
        cin >> a.at(i);
        if(a.at(i)%2 == 1) {
            cout << 0 << endl;
            return 0;
        }
        a.at(i) /= 2;
    }

    t = RR(a.at(0));
    rep(i,N) {
        if(RR(a.at(i)) != t) {
            cout << 0 << endl;
            return 0;
        }
        a.at(i) >>= t;
    }
    M >>= t;
    
    rep(i,N) {
        x = LCM(x, a.at(i));
        if(x > M) {
            cout << 0 << endl;
            return 0;
        }
    }

    cout << (M/x+1)/2 << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:21: error: 'i' was not declared in this scope
   37 |         cin >> a.at(i);
      |                     ^
a.cc:47:20: error: 'i' was not declared in this scope
   47 |         if(RR(a.at(i)) != t) {
      |                    ^
a.cc:51:14: error: 'i' was not declared in this scope
   51 |         a.at(i) >>= t;
      |              ^
a.cc:56:25: error: 'i' was not declared in this scope
   56 |         x = LCM(x, a.at(i));
      |                         ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define all(v) v.begin(), v.end()
using in = int64_t;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const double PI=3.14159265358979323846;
const int64_t waru = 1000000007;
const in INF=1<<30;
using vec = vector<vector<int>>;

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

    return gcd(b, a % b);
}

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

int vlcm(int n;vector<int> a){
  int ret=1;
   for(int i=0;i<n;i++){
      ret =lcm(ret,a[i]);
   }
  return ret;
}

int main(){
  int n,m;
  cin>>n>>m;
  vector<int> a(n);
  rep(i,n) cin>>a[i];
  
  int flag=0;
  int flag2=0;
  int cnt2=0;
  
  while(flag==0){
    if(a[0]%2!=0) flag=1;
    else{ flag=0; cnt2 ++;}
    
     rep(i,n){
        if(a[i]%2!=0) flag2=1;
         else flag2=0;
       if(flag != flag2){flag=2;break;}
       if(flag==0) a[i] /=2;
     }
  }
  if(flag==2){cout<<0;return 0;}
  
  int x= vlcm(n,a);
  int ans =0;
  for(int i=1;i*(1<<cnt2)*x<=m;i+=2){
     ans ++;
  }
  cout<<ans;
}


Compiler output:
a.cc:23:15: error: expected ')' before ';' token
   23 | int vlcm(int n;vector<int> a){
      |         ~     ^
      |               )
a.cc:23:29: error: expected initializer before ')' token
   23 | int vlcm(int n;vector<int> a){
      |                             ^
a.cc: In function 'int main()':
a.cc:54:14: error: too many arguments to function 'int vlcm(int)'
   54 |   int x= vlcm(n,a);
      |          ~~~~^~~~~
a.cc:23:5: note: declared here
   23 | int vlcm(int n;vector<int> a){
      |     ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

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

ll lcm(ll x, ll y) {
    return x / gcd(x,y) * y;
}

int main(void)
{
    IOS
    int n, m;
    cin >> n >> m;
    set<int> st;
    map<int,int> m;
    REP(i,n) {
        int a;
        cin >> a;
        int b = a;
        int x = 0;
        while(b / 2 % 2 == 0) {
            x++;
            b /= 2;
        }
        st.insert(a);
    }

    if (m.size() != 1) OUT(0)
    else {
        ll l = 1;
        int mn = 0;
        for(auto x:st) {
            if (l == 1) {
                l = x;
                mn = x + x / 2;
            } else {
                ll ix = x / 2, il = l / 2;
                while(ix != il && ix <= m && il < m) {
                    if (ix < il) ix += x;
                    else il += l;
                }
                mn = ix;
                l = lcm(l,x);
            }
            cerr << l << " " << mn << endl;
        }
        int ans = 0;
        for(int i = mn; i <= m; i+=l) ans++;
        cout << ans << endl;
    }

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:18: error: conflicting declaration 'std::map<int, int> m'
   34 |     map<int,int> m;
      |                  ^
a.cc:31:12: note: previous declaration as 'int m'
   31 |     int n, m;
      |            ^
a.cc:47:11: error: request for member 'size' in 'm', which is of non-class type 'int'
   47 |     if (m.size() != 1) OUT(0)
      |           ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000000000000
#define MOD 1000000007
#define all(v) v.begin(),v.end()
#define pb push_back
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int kaijo[2000010];
struct edge{int to,cost;};
int gcd(int a,int b){
    if(b==0)return a;
    return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
bool prime(int a){
    if(a==1)return false;
    for(int i=2;i*i<=a;i++){
        if(a%i==0)return false;
    }
    return true;
}
void init_fact(){
    kaijo[0]=1;
    for(int i=1;i<=2000000;i++){
        kaijo[i]=kaijo[i-1]*i;
        kaijo[i]%=MOD;
    }
}
int modpow(int a,int b){
    if(b==0)return 1;
    if(b%2)return modpow(a,b-1)*a%MOD;
    int memo=modpow(a,b/2);
    return memo*memo%MOD;
}
int comb(int a,int b){
    if(!kaijo[0])init_fact();
    return kaijo[a]*modpow(kaijo[a-b],MOD-2)%MOD*modpow(kaijo[b],MOD-2)%MOD;
}
int inv(int x){
    x=modpow(x,MOD-2);
    return x;
}
bool kosa(double ax,double ay,double bx,double by,double cx,double cy,double dx,double dy){
    double ta=(cx-dx)*(ay-cy)+(cy-dy)*(cx-ax);
    double tb=(cx-dx)*(by-cy)+(cy-dy)*(cx-bx);
    double tc=(ax-bx)*(cy-ay)+(ay-by)*(ax-cx);
    double td=(ax-bx)*(dy-ay)+(ay-by)*(ax-dx);
    return tc*td<0&&ta*tb<0;
}
double dist(double ax,double ay,double bx,double by){
    return sqrt((bx-ax)*(bx-ax)+(ay-by)*(ay-by));
}
int n,m,L=1;
int cnt;
signed main(){
    cin>>n>>m;
    rep(i,n){
        int a;
        cin>>a;
        a/=2;
        L=lcm(L,a);
        int c=0;
        while(a%2==0){
            a/=2;
            c++;
        }
        if(i==0)cnt=c;
        else{
            if(cnt!=c){
                cout<<0<<endl;
                return 0;
            }
        }
        if(L>m){
            cout<<0<<endl;
            return 0;
        }
    }
    if(e&&o){
        cout<<0<<endl;
        return 0;
    }
    cout<<(m/L+1)/2<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:87:8: error: 'e' was not declared in this scope
   87 |     if(e&&o){
      |        ^
a.cc:87:11: error: 'o' was not declared in this scope
   87 |     if(e&&o){
      |           ^
Language: C++

#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long double ld;

// ユーグリッド互除法
int GCD(int a, int b)
{
  if(b == 0) return a;
  else return GCD(b, a % b);
}

// 最小公倍数
int LCM(int a, int b)
{
  int g = GCD(a,b);
  return a*(b/g);
}

// 3個以上の場合の最小公倍数
int LCM_multi(vector<int> a)
{
  int l = a[0];
  FOR(i,1,a.size()){
    l = LCM(a[i], l);
  }
  return l;
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int n, m;
	cin >> n >> m;
	set<int> st2;
	vector<int> al(n);
	REP(i,n){
		int a;
		cin >> a;		
		int cnt2 = 0;
		int a_cp = a/2;
		al[i] = a_cp;
		while(a_cp%2==0){
			cnt2++;
			a_cp /= 2;
		}
		st2.insert(cnt2);
		if(st2.size()>1) || a%2==1){
			cout << 0 << '\n';
			return 0;
		}
		
	}
	al.push_back(1);
	int to = LCM_multi(al);
	int to2 = to;
	int cnt = 0;
	while(to2<=m){
		cnt++;
		to2 = to * (2*cnt + 1);
	}
	cout << cnt << '\n';
	return 0;
}




Compiler output:
a.cc: In function 'int main()':
a.cc:53:34: error: expected primary-expression before '||' token
   53 |                 if(st2.size()>1) || a%2==1){
      |                                  ^~
Language: C++

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

int bi(int n){
    int num=0;
    while(n%2==0){
        if(n%2==0){
            n /= 2;
            num++;
        }
    }
    return num;
}

long long int lcm(int x,int y){
 long long int z = x * y;
 int tmp;
 int r;
 if(x < y){
    tmp = x;
    x = y;
    y = tmp;
  }
  r = x % y;
  while(r!=0){
    x = y;
    y = r;
    r = x % y;
  }
  return z/y
}

int main(){
 int N;
 int M;
 cin >> N >> M;
 int a[N];
 int i;
 int aaa = 0;
 for(i=0;i<N;++i){
   cin >> a[i];}
 int check = bi(a[0]);
  for(i=1;i<N;++i){
   if(check!=bi(a[i])){
       aaa++;
       break;
   }}
   if(aaa>0)cout << 0 << endl;
 else{
   long long int obj = a[0]/2;
     for(int j=1;j<N;j++){
        obj = lcm(obj,a[j]/2);
        if(obj>M)break;
     }
 cout << M/obj << endl;
 }
}

Compiler output:
a.cc: In function 'long long int lcm(int, int)':
a.cc:30:13: error: expected ';' before '}' token
   30 |   return z/y
      |             ^
      |             ;
   31 | }
      | ~