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

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

int lcm(int64_t a, int64_t b){
  int64_t c = max(a, b), d = min(a, b), g;
  for(int i = 1; i < pow(d, 0.5); ++i){
    if(d % i == 0){
      if(c % (d / i) == 0){
        g = d / i;
        break;
      }
    }
  }
  return c / g * d;
}

int div2(int64_t n){
  c = 0;
  while(n % 2 == 0){
    ++c;
    n /= 2;
  }
  return c;
}

int main() {
  int64_t n, m, d = 1;
  cin >> n >> m;
  bool b = 1;
  vector<int64_t> v(n);
  for(int i = 0; i < n; ++i){
    cin >> v[i];
    v[i] /= 2;
    if(div2(v[i] != v[0]){
      b = 0;
      break;
    }
    d = lcm(d, v[i]);
    if(d > m) break;
  }
  if(b) cout << ((m / d) + 1) / 2 << endl;
  else cout << 0 << endl;
}

Compiler output:
a.cc: In function 'int div2(int64_t)':
a.cc:19:3: error: 'c' was not declared in this scope
   19 |   c = 0;
      |   ^
a.cc: In function 'int main()':
a.cc:35:26: error: expected ';' before '{' token
   35 |     if(div2(v[i] != v[0]){
      |                          ^
      |                          ;
a.cc:39:21: error: expected ')' before ';' token
   39 |     d = lcm(d, v[i]);
      |                     ^
      |                     )
a.cc:35:7: note: to match this '('
   35 |     if(div2(v[i] != v[0]){
      |       ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
 
ll gcd(ll a, ll b){
    if(a % b == 0){
        return b;
    }
    return gcd(b, a % b);
}
 
ll lcm(ll a, ll b){
    return a * (b / gcd(a, b));
}
 
int main(){
    ll n, m;  cin >> n >> m;
    vector<ll> lis(n); 
    cin >> lis[0];
    ll a = lis[0] / 2, b;
    for(int i = 1; i < n; i++){
        cin >> lis[i];
        a = lcm(a, lis[i] / 2);
    }
    for(int i = 0; i < n; i++){
        if(a % lis[i] == 0){
            cout << 0 << endl;
            return 0;
        }
    }
    m += a
    cout << m / 2*a << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:11: error: expected ';' before 'cout'
   31 |     m += a
      |           ^
      |           ;
   32 |     cout << m / 2*a << endl;
      |     ~~~~
Language: C++

#include<iostream>
#include<set>
#include<numeric>
using namespace std;
long N,M,i,l=1,a;
int main(){
  cin>>N>>M;
  set<long>A;
  for(i=0;i<N;i++){
    cin>>a;
    A.insert(a/2);
  }
  for(auto a:A)l=l*a/__gcd(a,l);
  for(auto a:A){
    if(l/a%2)continue;
    cout<<0<<endl;
    return 0;
  }
  cout<<(M/l+1)/2<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:22: error: '__gcd' was not declared in this scope; did you mean 'std::__detail::__gcd'?
   13 |   for(auto a:A)l=l*a/__gcd(a,l);
      |                      ^~~~~
      |                      std::__detail::__gcd
In file included from a.cc:3:
/usr/include/c++/14/numeric:134:5: note: 'std::__detail::__gcd' declared here
  134 |     __gcd(_Tp __m, _Tp __n)
      |     ^~~~~
Language: C++

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

auto x = [&](int a, int p){
  return a*(p+0.5);
}

int main() {
  int n, n;
  cin >> n >> m;
  vector<int>a(n);
  vector<int>ans(n);
  for (int i = 1; i <= (n); ++i){
    cin >> a[i];
  }
  
  
  return 0;
}


Compiler output:
a.cc:6:11: error: non-local lambda expression cannot have a capture-default
    6 | auto x = [&](int a, int p){
      |           ^
a.cc:10:1: error: expected ',' or ';' before 'int'
   10 | int main() {
      | ^~~
Language: C++

#include<bits/stdc++.h>
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (int)(x).size()
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}

ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
int main(){
  ll n,m;
  cin>>n>>m;
  vll a(n);
  vll b(n);
  ll ans=0;
  rep(i,n){
    cin>>a[i];
    b[i]=a[i]/2;
  }
  ll cu=0;
  while(b[0]%2==0){
    if(b[0]%2==0){
      cu++;
      b[0]/=2;
    }
  }
  rep(i,n){
    ll ccu=0;
    while(b[i]%2==0){
      if(b[i]%2==0){
        ccu++;
        b[i]/=2;
      }
    }
    if(cu!=ccu){
      COUT(0);
      return 0;
    }
  }  
    ll j=b[0];
    for(int i=1;i<n;i++){
      j=lcm(j,b[i]);
    }
    if(j>m) COUT(0);
    else{
      ll c=(m-j)/(2*j)+1;
    }
   
    COUT(c);
}
  


Compiler output:
a.cc: In function 'int main()':
a.cc:87:10: error: 'c' was not declared in this scope
   87 |     COUT(c);
      |          ^
a.cc:17:24: note: in definition of macro 'COUT'
   17 | #define COUT(x) cout<<(x)<<endl
      |                        ^
Language: C++

#include<bits/stdc++.h>
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (int)(x).size()
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}

ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
int main(){
  ll n,m;
  cin>>n>>m;
  vll a(n);
  vll b(n);
  ll ans=0;
  rep(i,n){
    cin>>a[i];
    b[i]=a[i]/2;
  }
  ll cu=0;
  while(b[0]%2==0){
    if(b[0]%2==0){
      cu++;
      b[0]/=2;
    }
  }
  rep(i,n){
    ll ccu=0;
    while(b[i]%2==0){
      if(b[i]%2==0){
        ccu++;
        b[i]/=2;
      }
    }
    if(cu!=ccu){
      COUT(0);
      return 0;
    }
  }  
  else{
    ll j=b[0];
    for(int i=1;i<n;i++){
      j=lcm(j,b[i]);
    }
    if(j>m) COUT(0);
    else{
      ll c=(m-j)/(2*j);
    }
   
    COUT(c+1);
  }
}
  


Compiler output:
a.cc: In function 'int main()':
a.cc:78:3: error: 'else' without a previous 'if'
   78 |   else{
      |   ^~~~
a.cc:88:10: error: 'c' was not declared in this scope
   88 |     COUT(c+1);
      |          ^
a.cc:17:24: note: in definition of macro 'COUT'
   17 | #define COUT(x) cout<<(x)<<endl
      |                        ^
Language: C++

#include<bits/stdc++.h>
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (int)(x).size()
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}

ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
int main(){
  ll n,m;
  cin>>n>>m;
  vll a(n);
  vll b(n);
  ll ans=0;
  rep(i,n){
    cin>>a[i];
    b[i]=a[i]/2;
  }
  ll cu=0;
  while(b[0]%2==0){
    if(b[0]%2==0){
      cu++;
      b[0]/=2;
    }
  }
  rep(i,n){
    ll ccu=0;
    while(b[i]%2==0){
      if(b[i]%2==0){
        ccu++;
        b[i]/=2;
      }
    }
    if(cu!=ccu){
      COUT(0);
      return 0;
    }
  }  
  else{
    ll j=b[0];
    for(int i=1;i<n;i++){
      j=lcm(j,b[i]);
    }
    if(j>m) COUT(0);
    else{
      c=(m-j)/(2*j);
    }
   
    COUT(c+1);
  }
}
  


Compiler output:
a.cc: In function 'int main()':
a.cc:78:3: error: 'else' without a previous 'if'
   78 |   else{
      |   ^~~~
a.cc:85:7: error: 'c' was not declared in this scope
   85 |       c=(m-j)/(2*j);
      |       ^
a.cc:88:10: error: 'c' was not declared in this scope
   88 |     COUT(c+1);
      |          ^
a.cc:17:24: note: in definition of macro 'COUT'
   17 | #define COUT(x) cout<<(x)<<endl
      |                        ^
Language: C++

import fractions
from functools import reduce

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)


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

kobai=lcm_list(list(map(lambda x:int(x/2),a_list)))


a=M//kobai

if a%2==1:
    print(a//2+1)
else:
    print(a//2)


Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import fractions
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

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

#define REP(i, n) for (ll (i) = 0 ; (i) < (ll)(n) ; ++(i))
#define REPN(i, m, n) for (ll (i) = m ; (i) < (ll)(n) ; ++(i))
#define REP_REV(i, n) for (ll (i) = (ll)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (ll (i) = (ll)(n) - 1 ; (i) >= m ; --(i))

#define INF 2e9
#define INF_LL 1LL<<60
#define ll long long

typedef pair<ll, ll> P;

ll gcd(ll a, ll b){
    ll tmp;
    if(a<b){
        tmp = a;
        a = b;
        b = tmp;
    }

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

    return b;
}

ll kaisuu(ll a) {
    int i = 0;
    while(1) {
        if(a % 2 == 0) {
            i++;
            a /= 2;
        } else {
            break;
        }
    }

    return i;
}

set<ll> st;

int main() {
    ll n, m, ans = 0;
    cin >> n >> m;
    ll kobai, koyaku;
    int kaisu = 0;

    REP(i, n) {
        ll tmp;
        cin >> tmp;
        tmp /= 2;
        st.insert(tmp);
    }

    kaisu = kaisuu(*st.begin());
    REPN(auto s: st) {
        if(kaisu != kaisuu(s)) {
            cout << "0" << endl;
            return 0;
        }
    }

    koyaku = kobai = *st.begin();
    for(auto a: st) {
        koyaku = gcd(kobai, a);
    }

    kobai = 1;
    for(auto a: st) {
        if(kobai % (a/koyaku) != 0) kobai *= a / koyaku;
        if((kobai / (a/koyaku)) % 2 == 0) {
            cout << "0" << endl;
            return 0;
        }
    }

    if(kobai > m) {
        cout << "0" << endl;
        return 0;
    }

    //cout << kobai << endl;

    ans = (m - kobai) / (2*kobai) + 1;

    cout << ans << endl;


    return 0;
}


Compiler output:
a.cc:63:20: error: macro "REPN" requires 3 arguments, but only 1 given
   63 |     REPN(auto s: st) {
      |                    ^
a.cc:5:9: note: macro "REPN" defined here
    5 | #define REPN(i, m, n) for (ll (i) = m ; (i) < (ll)(n) ; ++(i))
      |         ^~~~
a.cc: In function 'int main()':
a.cc:63:5: error: 'REPN' was not declared in this scope
   63 |     REPN(auto s: st) {
      |     ^~~~
Language: C++

#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define repr(i,n) for(ll i=(n-1);i>=0;i--)
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define br cout << endl;
using namespace std;
const int INF = 1e9;
const int MOD = 1e9+7;
using Graph = 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;}

// 0 false, 1 true 
// stringの数字をint型にしてアスキーコードになったら -48する
// 切り上げ　ceil(a)

ll least_common_multiple(ll a, ll b){
    ll x = a * b;
    if(a < b){
        ll tmp = a;
        a = b;
        b = tmp;
    }
    ll r = a % b;
    while(r != 0){
        a = b;
        b = r;
        r = a % b;
    }
    return x / b;
}


int main() {
    ll n, m;
    cin >> n >> m;

    ll less_common = 1;
    rep(i,n){
        ll tmp;
        cin >> tmp;
        if(tmp % 2 != 0){
            cout << 0 << endl;
            exit();
        }
        tmp /= 2;
        less_common = least_common_multiple(less_common, tmp);
    }

    if((m / less_common) % 2 == 0){
        cout << m / less_common / 2 << endl;
    }else{
        cout << (m / less_common / 2) + 1 << endl;
    }

}


Compiler output:
a.cc: In function 'int main()':
a.cc:47:17: error: too few arguments to function 'void exit(int)'
   47 |             exit();
      |             ~~~~^~
In file included from /usr/include/c++/14/cstdlib:79,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:42,
                 from a.cc:1:
/usr/include/stdlib.h:756:13: note: declared here
  756 | extern void exit (int __status) __THROW __attribute__ ((__noreturn__));
      |             ^~~~
Language: C++

#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<math.h>
using namespace std;
#define N (1000000000+7)
#define INF 1e16
typedef long long ll;
typedef pair<int,int> P;

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

int main(void){
    ll n,m;
    cin>>n>>m;
    vector<ll>a(n),b(n);
    for(ll i=0;i<n;i++)cin>>a[i];
    if(n == 1){
        ll ans = m/a[0];
        ll r = m%a[0];
        if(r>=a[0]/2)ans++;
        cout<<ans-1<<endl;
        return 0;
    }
    ll ans =0;
    ll parity = 0;
    for(ll i=0;i<n;i++){
        ll x = a[i]/2;
        parity += x&1;
        b[i] = x;
    }
    if(parity!=0 && parity!=n){
        cout<<0<<endl;
        return 0;
    }
    ll g = 1;
    if(parity == 0){
        set<ll>s;
        for(ll i=0;i<n;i++){
            ll num =1;
            ll x = b[i];
            while(x%2 == 0){
                num*=2;
                x /= 2;
            }
            s.insert(num);
        }
        if(s.size()>1){
            cout<<0<<endl;
            return 0;
        }
        else{
            ll p = 0;
            for(auto itr=s.begin();itr!=s.end();++itr)p = *itr;
            for(ll i=0;i<n;i++)b[i]=b[i]/p;
            g = p;
        }
    }
    ll g *= b[0];
    for(ll i=1;i<n;i++){
        ll x = b[0];
        ll y = gcd(g,x);
        g = (g*x)/y;
        if(g>m){
            cout<<0<<endl;
            return 0;
        }
    }
    ans = m/g;
    if(ans%2 == 1){
        ans =(ans+1)/2;
    }
    else ans =ans/2;
    cout<<ans<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:72:10: error: expected initializer before '*=' token
   72 |     ll g *= b[0];
      |          ^~
Language: C++

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

int64_t gcd(int64_t A,int64_t B){
  if(B==0){return A;}
  return gcd(B,A%B);
}

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

  vector<int64_t> a(N),ord(N);
  for(int i=0;i<N;++i){
  cin>>a[i];
  }

  bool frag=true;
  for(int i=0;i<N;++i){

    int64_t n;
    n=a[i];
    int count=0;
    while(n%2==0){
      ++count;
      n=n/2;
    }
    ord[i]=count;

    if(i>=1 && ord[i]!=ord[i-1]){
      frag=false;
    }
  }

  if(!frag){
    cout<<0<<endl;
  }
  else{
    int64_t powmod=pow(2,ord[0]);
    for(int i=0;i<N;++i){
      a[i]=a[i]/powmod;
    }

    int64_t lcm=1;
    int64_t lcm2=pow(2,ord[0]-1);
    bool subfrag=true;
    for(int i=0;i<N;++i){
      lcm = (lcm/gcd(lcm,a[i]))*a[i];
      if(lcm>M){
      cout<<0<<endl;
      subfrag=false;
      break;
      }
    }

    if(subfrag){
    int64_t A=(M/lcm)/lcm2+1;
    cout<<A/2<<endl;
  }
  }


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

#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <bitset>
#include<vector>
#include<cstdlib>
#include<map>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
#define rep(i,k) for(int i=0;i<k;i++)
ll n, m, i, j, k,o,l,z;
ll a[100005], inf = 1000000000000;
map<ll, ll> b;
string s;
ll t[100005], xx[100005];
ll p[10], q[10], r[10] = {}, aa[10] = {};
ll tansaku(ll x,ll n,ll* s) {
	int max,min, mid ;
	min = 0; 	max = n + 1; 
	while (max - min > 1) {
		mid = (min + max) / 2;
		
		if (s[mid] > x) {
			max = mid;
		}
		else {
			min = mid;
		}
	//	cout << max << "\n";
	}	
	return max;

}

ll hikaku(ll* s, ll* t, ll o, ll p,ll k) {
	ll z = min((abs(s[o] - k) + abs(s[o] - t[p])), (abs(t[p] - k) + abs(s[o] - t[p])));
	ll zz = min((abs(s[o] - k) + abs(s[o] - t[p-1])), (abs(t[p-1] - k) + abs(s[o] - t[p-1])));
	ll za = min((abs(s[o - 1] - k) + abs(s[o - 1] - t[p])), (abs(t[p] - k) + abs(s[o - 1] - t[p])));
	ll zb = min((abs(s[o - 1] - k) + abs(s[o - 1] - t[p-1])), (abs(t[p-1] - k) + abs(s[o - 1] - t[p-1])));
	z = min(z, zz);
	return min(z, min(za, zb));
}


int main() {
	cin >> n >> m;

	rep(o, n) {
		cin >> k;
		k =k/ 2;
		l = 0;
		while (k % 2 == 0) { // 素数で割り切れなくなるまで割っていく
			l++;
			k /= 2;
		}
		if(o==0)z = l;
		else if (z != l) {
			cout << 0;
			return 0;
		}
		//cout << k<<" "<<l<< "\n";
		for (int i = 3; i*i <= k; i+=2) {
			l = 0;
			while (k % i == 0) { // 素数で割り切れなくなるまで割っていく
				l++;//割った個数を配列に足す
				k /= i;
			}
			b[i] = max(b[i], l);
			//cout << k << " " << l << "\n";
		}
		if(k!=1)b[k] = max(int(b[i]), 1);
	}
	ll w = 1;
	for (auto itr = b.begin(); itr != b.end(); ++itr) {
		rep(i, itr->second){
			w *= itr->first;
			if (w > m) {
				cout << 0;
				return 0;
			}
	}
	rep(i, z)w *= 2;
	ll cc = m / w;

	cc = (cc + 1) / 2;
	cout <<cc;

	return 0;
}

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

#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <bitset>
#include<vector>
#include<cstdlib>
#include<map>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
#define rep(i,k) for(int i=0;i<k;i++)
ll n, m, i, j, k,o,l,z;
ll a[100005], inf = 1000000000000;
map<ll, ll> b;
string s;
ll t[100005], xx[100005];
ll p[10], q[10], r[10] = {}, aa[10] = {};
ll tansaku(ll x,ll n,ll* s) {
	int max,min, mid ;
	min = 0; 	max = n + 1; 
	while (max - min > 1) {
		mid = (min + max) / 2;
		
		if (s[mid] > x) {
			max = mid;
		}
		else {
			min = mid;
		}
	//	cout << max << "\n";
	}	
	return max;

}

ll hikaku(ll* s, ll* t, ll o, ll p,ll k) {
	ll z = min((abs(s[o] - k) + abs(s[o] - t[p])), (abs(t[p] - k) + abs(s[o] - t[p])));
	ll zz = min((abs(s[o] - k) + abs(s[o] - t[p-1])), (abs(t[p-1] - k) + abs(s[o] - t[p-1])));
	ll za = min((abs(s[o - 1] - k) + abs(s[o - 1] - t[p])), (abs(t[p] - k) + abs(s[o - 1] - t[p])));
	ll zb = min((abs(s[o - 1] - k) + abs(s[o - 1] - t[p-1])), (abs(t[p-1] - k) + abs(s[o - 1] - t[p-1])));
	z = min(z, zz);
	return min(z, min(za, zb));
}


int main() {
	cin >> n >> m;

	rep(o, n) {
		cin >> k;
		k =k/ 2;
		l = 0;
		while (k % 2 == 0) { // 素数で割り切れなくなるまで割っていく
			l++;
			k /= 2;
		}
		if(o==0)z = l;
		else if (z != l) {
			cout << 0;
			return 0;
		}
		//cout << k<<" "<<l<< "\n";
		for (int i = 3; i*i <= k; i+=2) {
			l = 0;
			while (k % i == 0) { // 素数で割り切れなくなるまで割っていく
				l++;//割った個数を配列に足す
				k /= i;
			}
			b[i] = max(b[i], l);
			//cout << k << " " << l << "\n";
		}
		if(k!=1)b[k] = max(int(b[i]), 1);
	}
	ll w = 1;
	for (auto itr = b.begin(); itr != b.end(); ++itr) {
		rep(i, itr->second){
			w *= itr->first;
			if(w>m){
				cout << 0;
				return 0;
	}
	rep(i, z)w *= 2;
	ll cc = m / w;

	cc = (cc + 1) / 2;
	cout <<cc;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:92:2: error: expected '}' at end of input
   92 | }
      |  ^
a.cc:78:59: note: to match this '{'
   78 |         for (auto itr = b.begin(); itr != b.end(); ++itr) {
      |                                                           ^
a.cc:92:2: error: expected '}' at end of input
   92 | }
      |  ^
a.cc:49:12: note: to match this '{'
   49 | int main() {
      |            ^
Language: C++

#include <bits/stdc++.h> 

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()

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

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

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

  ull N,M;
  cin>>N>>M;
  vector<ull>a(N);
  for(int i=0;i<N;i++)cin>>a[i];
  for(int i=0;i<N;i++)a[i]/=2;
  ull L=1;
  for(auto it:a)L=lcm(L,it);
  bool ng=false;
  for(auto it:a)if((lcm/it)%2==0)ng=true;
  if(ng){
    cout<<0<<endl;
    return 0;
  }
  ll Max=*max_element(rng(a));
  ull ans=M/L;
  if(ans%2)ans++;
  ans/=2;
  cout<<ans<<endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:34:24: error: invalid operands of types '<unresolved overloaded function type>' and 'long long unsigned int' to binary 'operator/'
   34 |   for(auto it:a)if((lcm/it)%2==0)ng=true;
      |                     ~~~^~~
Language: C++

#include <bits/stdc++.h> 

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()

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

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

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

  ull N,M;
  cin>>N>>M;
  vector<ull>a(N);
  for(int i=0;i<N;i++)cin>>a[i];
  for(int i=0;i<N;i++)a[i]/=2;
  bool ng=false;
  ull L=1;
  for(auto it:a)L=lcm(L,it);
  bool ng=false;
  for(auto it:a)if((lcm/it)%2==0)ng=true;
  if(ng){
    cout<<0<<endl;
    return 0;
  }
  ll Max=*max_element(rng(a));
  ull ans=M/L;
  if(ans%2)ans++;
  ans/=2;
  cout<<ans<<endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:34:8: error: redeclaration of 'bool ng'
   34 |   bool ng=false;
      |        ^~
a.cc:31:8: note: 'bool ng' previously declared here
   31 |   bool ng=false;
      |        ^~
a.cc:35:24: error: invalid operands of types '<unresolved overloaded function type>' and 'long long unsigned int' to binary 'operator/'
   35 |   for(auto it:a)if((lcm/it)%2==0)ng=true;
      |                     ~~~^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<ll>;
template<class T> using PQ = priority_queue<T, vector<T>, greater<T>>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);++(i))
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);++(i))
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);--(i))
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);--(i))
#define each(i, a) for(auto &i : a)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
#define out(y,x) ((y) < 0 || h <= (y) || (x) < 0 || w <= (x))
#define line cout << "------------------------\n" 
#define ENDL(i,n) ((i) == (n) - 1 ? "\n" : " ")
#define stop system("pause") //comment out this on AOJ.
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
constexpr ld eps = 1e-10; //1e-9?
constexpr ld pi = 3.1415926535897932;
template<class T>inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; }return false; }
template<class T>inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; }return false; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& is, vector<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; }
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template<class T>inline vector<T> vec(size_t a) { return vector<T>(a); }
template<class T>inline vector<T> defvec(T def, size_t a) { return vector<T>(a, def); }
template<class T, class... Ts>inline auto vec(size_t a, Ts... ts) { return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...)); }
template<class T, class... Ts>inline auto defvec(T def, size_t a, Ts... ts) { return vector<decltype(defvec<T>(def, ts...))>(a, defvec<T>(def, ts...)); }

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() {
    init();

    ll n, m; cin >> n >> m;
    VL a(n); cin >> a;
    SORT(a);
    a.erase(unique(all(a)), a.end());

    n = a.size();
    ll x = 1, Max = 0;
    FOR(i, 0, n) {
        x = lcm(x, a[i]);
        chmax(Max, a[i]);
    }
    ll ans = (m - Max / 2) / x;
    if(x / 2<=m)++ans
    cout << ans << "\n";
}


Compiler output:
a.cc: In function 'int main()':
a.cc:59:22: error: expected ';' before 'cout'
   59 |     if(x / 2<=m)++ans
      |                      ^
      |                      ;
   60 |     cout << ans << "\n";
      |     ~~~~
Language: C++

#include<iostream>
#include<algorithm>
#include<cmath>
#include<map>
#include<stdio.h>
#include<vector>
using namespace std;
#define int long long
#define rep(s,i,n) for(int i=s;i<n;i++)
#define c(n) cout<<n<<endl;
#define ic(n) int n;cin>>n;
#define sc(s) string s;cin>>s;
#define mod 1000000007
#define f first
#define s second
int lcm(int x,int y){
	int aa=x,bb=y;
	rep(0,i,1000){
		aa=aa%bb;
		if(aa==0){
			return x/bb*y;
		}	
		bb=bb%aa;
		if(bb==0){
			return x/aa*y;
		}
	}
}	
int n;
char mem[114514];
char t[114514];
int a[114514];
int ans[114514];
bool search(int x){
	int l=0,r=n;
	while(r-l>=1){
		int i=(l+r)/2;
		if(a[i]==x)return true;
		else if(a[i]<x)l=i+1;
		else r=i;
	}
	return false;
}		
int b[114514];
signed main(){
	cin>>n;
	ic(m)
	rep(0,i,n){
		cin>>a[i];
		if(a[i]%2==1){
			c(0)
			return 0;
		}x
		a[i]/=2;
		b[i]=a[i];
	}
	rep(0,i,n){
		rep(0,j,30){
			if(a[i]%2==0){
				if(search(a[i]/2)==1){
					c(0)
					return 0;
				}
				a[i]/=2;
			}	
			else{
				a[i]=b[i];
				j+=45;
			}
		}
	}	
	sort(a,a+n);				
	int eru=0;	
	if(n==1){
		eru=a[0];
		c((m/eru+1)/2)
		return 0;
	}	
	ans[0]=lcm(a[0],a[1]);
	rep(1,i,n-1){
		ans[i]=lcm(ans[i-1],a[i+1]);
		if(ans[i]>m){
			c(0)
			return 0;
		}
	}	
	eru=ans[n-2];	
	c((m/eru+1)/2)
}	


Compiler output:
a.cc: In function 'int main()':
a.cc:53:18: error: 'x' was not declared in this scope
   53 |                 }x
      |                  ^
a.cc: In function 'long long int lcm(long long int, long long int)':
a.cc:28:1: warning: control reaches end of non-void function [-Wreturn-type]
   28 | }
      | ^
Language: C++

#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
#include<numeric>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define ll long long
ll gcd(ll a,ll b){
  if(b==0) return a;
  return gcd(b,a%b);
}
 
ll extgcd(ll a,ll b,ll &x,ll &y){
  ll d = a;
  if(b!=0){
    d = extgcd(b,a%b,y,x);
    y -= (a/b)*x;
  }
  else{
    x = 1;
    y = 0;
  }
  return d;
}
signed main(){
  int n,m;cin>>n>>m;
  vector<int> a(n);
  vector<int> b(n);
  rep(i,n)cin>>a[i];
  rep(i,n)b[i]=a[i]/2;
  int p=0;
  int ans,res;
  rep(i,n){
    if(b[i]%2==0)p++;
  }
  //cout<<"OK"<<endl;
  int buf=1;
  if(p>0&&p<n){
    res=0;
    goto FINE;
  }
  rep(i,n){
    buf=extgcd(buf,b[i]);
  }
  res=m/buf;
  if(res%2==0){
    res/=2;
  }
  else{
    res=res/2+1;
  }
  if(p==n){
    res=m/buf;
    res/=2;
  }
  FINE:
  cout<<res<<endl;
  //cout<<buf<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:47:15: error: too few arguments to function 'long long int extgcd(long long int, long long int, long long int&, long long int&)'
   47 |     buf=extgcd(buf,b[i]);
      |         ~~~~~~^~~~~~~~~~
a.cc:17:4: note: declared here
   17 | ll extgcd(ll a,ll b,ll &x,ll &y){
      |    ^~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<int64_t,int64_t> pll;
typedef vector<int64_t> vl;
int dx[]={1,-1,0,0,1,-1,1,-1};
int dy[]={0,0,1,-1,1,-1,-1,1};
const long double PI = acos(-1);
#define INF (2147483647)
#define mod (1000000007)
#define limit (7368791)
#define rep(i,a,b) for (int64_t i = (a); i < (b); i++)
#define REP(i,n) rep(i,0,n)
#define sz(s) (s).size()
#define ALL(a) begin(a),end(a)
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
ll r(){ll x;cin>>x;return x;}
ll gcd(ll a,ll b){
    if(!b)return a;
    return gcd(b,a%b);
}

void solve() 
{
    ll n,m,lcm=1;cin>>n>>m;
    vector<ll>a(n);
    REP(i,n)a[i]=r()/2;
    rep(i,1,n){
        lcm=lcm*a[i]/gcd(a[i],lcm);
        if(lcm>m){cout<<0<<endl;return;}
    }
    REP(i,n)if(!lcm%(2*a[i])){cout<<0<<endl;return;}
    cout<<m/lcm-m/(lcm*2)<<endl;

int main()
{
    cin.tie(0);
	ios::sync_with_stdio(false);
    solve();
    return 0;
}


Compiler output:
a.cc: In function 'void solve()':
a.cc:40:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   40 | int main()
      |         ^~
a.cc:40:9: note: remove parentheses to default-initialize a variable
   40 | int main()
      |         ^~
      |         --
a.cc:40:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:41:1: error: a function-definition is not allowed here before '{' token
   41 | {
      | ^
a.cc:46:2: error: expected '}' at end of input
   46 | }
      |  ^
a.cc:29:1: note: to match this '{'
   29 | {
      | ^
Language: C++

#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>
using namespace std;
typedef long long ll;//long long---

ll gcd(ll x,ll y){
  if(x<y) swap(x,y);
  //xの方が常に大きい
  while(y>0){
    ll r=x%y;
    x=y;
    y=r;
  }
  return x;
}

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

//n個の場合のlcmも2個で比べて順に適用していくだけ
int main(){
  ll n,m;cin >> n >> m;
  vector<ll> a(n);for(ll i=0;i<n;i++){cin >> a[i];a[i]/=2;}
  ll ans=lcm(a[0],a[1]);//cout << ans << endl;
  for(ll i=1;i<n;i++){ans=lcm(ans,a[i]);if(ans>m){cout << 0 << endl;return;}}
  //cout << ans << endl;
  ll k=ans;ll l=0;//cout << ans << endl;
  while(k%2==0){l+=1;k=ll(k/2);}
  k=ll(pow(2,l));
  //cout << l << endl;
  bool f=false;
  for(ll i=0;i<n;i++){
    if(a[i]%k!=0){f=true;break;}
  }
  if(f==false){
    cout << 0 << endl;
  }else{
    cout << floor((floor(m/ans)+1)/2) << endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:28:69: error: return-statement with no value, in function returning 'int' [-fpermissive]
   28 |   for(ll i=1;i<n;i++){ans=lcm(ans,a[i]);if(ans>m){cout << 0 << endl;return;}}
      |                                                                     ^~~~~~
Language: C++

#include <vector>
#include <algorithm>
#include <functional>
#include <utility>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include<stdio.h>
 
using namespace std;
 
#pragma GCC optimize("Ofast")
 
int main(){ 
   LL N,M;
   cin >> N >> M;
   LL a[N];
   for(int i=0;i<N;++i){
      cin >> a[i];
   }
    }

Compiler output:
a.cc: In function 'int main()':
a.cc:20:4: error: 'LL' was not declared in this scope
   20 |    LL N,M;
      |    ^~
a.cc:21:11: error: 'N' was not declared in this scope
   21 |    cin >> N >> M;
      |           ^
a.cc:21:16: error: 'M' was not declared in this scope
   21 |    cin >> N >> M;
      |                ^
a.cc:22:6: error: expected ';' before 'a'
   22 |    LL a[N];
      |      ^~
      |      ;
a.cc:24:14: error: 'a' was not declared in this scope
   24 |       cin >> a[i];
      |              ^
Language: C++

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

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

signed main(){
    ios::sync_with_stdio(false);
	cin.tie(0);
    cout << fixed << setprecision(20);

    ll n,m;
    cin>>n>>m;
    ll a;
    ll l=1;
    for(int i=0;i<n;i++){
        cin>>a;
        assert(a%2==0)
        l *= a/(gcd(a,l));
        if(l/2 > m) break;
    }
    l /= 2;
    cout << (m/l+1)/2<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:9: error: expected ';' before 'l'
   22 |         l *= a/(gcd(a,l));
      |         ^
Language: C++

#include <bits/stdc++.h>

using namespace std;

const long long MOD = 1000000007;
const long long MAX = 2000000;

template<typename T>
T gcd(T a, T b) {
    return b != 0 ? gcd(b, a % b) : a;
}

template<typename T>
T lcm(T a, T b) {
    return a * b / gcd(a, b);
}


int main() {
    long long N,M;
    cin>>N>>M;
    long long a[N];
    long long b[N];
    for(int i=0;i<N;i++){
        cin>>a[i];
        b[i]=a[i]/2;
        if(b[i]==0){
            b[i]=1;
        }

    }
    long long saidai=b[0];
  bool flag=false;
    if(N>1){
    saidai=lcm(b[0],b[1]);}
    for(int i=2;i<N;i++){
        saidai=lcm(saidai,b[i]);
      if(saidai>m){
        flag=false;
      }
    }
    sort(a,a+N);
    long long sum=0;
    /*for(int i=1;saidai*i<=M;i++){
        if((saidai*i)%a[0]!=0){
            sum++;

        }
    }*/
    long long tmp=M/saidai+1;
  
	if(flag){
    cout<<0<<endl;}else{
    cout<<tmp/2<<endl;}



}


Compiler output:
a.cc: In function 'int main()':
a.cc:38:17: error: 'm' was not declared in this scope
   38 |       if(saidai>m){
      |                 ^
Language: C++

#include <assert.h>
#include <chrono>
#include <cstdio>
#include <iostream>
#include <limits.h>
#include <mutex>
#include <thread>
#include <vector>

long long evalmod(long long a, long long b){
  long long maxval = std::max(a, b);
  long long minval = std::min(a, b);
  if (minval==0){
    return maxval;
  }
  long long tmpval = a%b;
  return evalmod(b, tmpval);
}

int main(){
  int N;
  long long M;
  scanf("%d",&N);
  scanf("%lld",&M);
  std::vector<long long > a(N);
  for (int i=0; i<N; i++){
    scanf("%lld",&a[i]);
  }
  long long mod;
  long long temp = a[0];
  int countof2=0;
  while(temp%2==0){
    temp = temp/2;
    countof2++;
  }
  bool invalid = false;
  for (int i=1; i<N; i++){
    long long temp = a[i];
    int countof2_temp = 0;
    while(temp%2==0){
      countof2_temp++;
      temp = temp/2;
    }
    if (countof2!=countof2_temp){
      invalid = true;
    }
    mod = evalmod(a[i],val);
    val = (val*a[i])/mod;
    if (val>2*M){
      invalid = true;
    }
    if (counter!=counter_temp){
      invalid = true;
    }
  }
  if (invalid){
    printf("0\n");
    return 0;
  }
  long long ans = (M+val*0.5)/val;
  //std::cout<<eval
  //printf("%lld\n",mod);
  //printf("%lld\n",val);
  printf("%lld\n",ans);
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:47:24: error: 'val' was not declared in this scope
   47 |     mod = evalmod(a[i],val);
      |                        ^~~
a.cc:52:9: error: 'counter' was not declared in this scope
   52 |     if (counter!=counter_temp){
      |         ^~~~~~~
a.cc:52:18: error: 'counter_temp' was not declared in this scope; did you mean 'countof2_temp'?
   52 |     if (counter!=counter_temp){
      |                  ^~~~~~~~~~~~
      |                  countof2_temp
a.cc:60:22: error: 'val' was not declared in this scope
   60 |   long long ans = (M+val*0.5)/val;
      |                      ^~~
Language: C++

#include <stdio.h>
#include <algorithm>
#include <stdlib.h>
#include <cstring>
#include <iostream>
#include <math.h>
using namespace std;
int main ()
{
	int n,m;
	scanf("%i %i",&n,&m);
	vector<int> a(n);
	int nzd=0;
	for(int i=0;i<n;i++) scanf("%i",&a[i]),a[i]/=2,nzd=__gcd(nzd,a[i]);
	#define ll long long
    ll nzs=1;
    for(int i=0;i<n;i++)
	{
		int g=__gcd(nzd,a[i]);
		nzs*=a[i]/g;
		if(nzs>m) return 0*printf("0\n");
		nzd/=g;
	}
	for(int i=0;i<n;i++)
	{
		if((nzs/a[i])%2==0) return 0*printf("0\n");
	}
	printf("%i\n",((m/nzs)+1)/2);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:9: error: 'vector' was not declared in this scope
   12 |         vector<int> a(n);
      |         ^~~~~~
a.cc:7:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    6 | #include <math.h>
  +++ |+#include <vector>
    7 | using namespace std;
a.cc:12:16: error: expected primary-expression before 'int'
   12 |         vector<int> a(n);
      |                ^~~
a.cc:14:42: error: 'a' was not declared in this scope
   14 |         for(int i=0;i<n;i++) scanf("%i",&a[i]),a[i]/=2,nzd=__gcd(nzd,a[i]);
      |                                          ^
a.cc:19:33: error: 'a' was not declared in this scope
   19 |                 int g=__gcd(nzd,a[i]);
      |                                 ^
a.cc:26:25: error: 'a' was not declared in this scope
   26 |                 if((nzs/a[i])%2==0) return 0*printf("0\n");
      |                         ^
Language: C++

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

int main() {
  int n, m, tmp;
  cin >> n >> m;
  vector<int> a, aHalf;
  for (int i = 0; i < n; i++) {
    cin >> tmp;
    a.push_back(tmp);
  }
  std::sort(a.begin(),a.end(),std::greater<int>());

  for (int i = 0; i < n; i++) {
    aHalf.push_back(a.at(i) / 2);
  }

  int count = 0;
  int half = (a.at(0) / 2);
  int check = 1;
  for (int x = half; x <= m; x += a.at(0)) {
    check = 1;
    for (int i = 1; i < n; i++) {
      if (a.at(i) == a.at(0)) continue;
      if ((x - aHalf.at(i)) % a.at(i) != 0) {
        check = 0;
        break;
      }
    }
    if (check == 1) count++;
  }

  cout << count << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:8: error: 'sort' is not a member of 'std'; did you mean 'qsort'?
   13 |   std::sort(a.begin(),a.end(),std::greater<int>());
      |        ^~~~
      |        qsort
Language: C++

#include <iostream>
#include <algorithm>
#include <map>
#include <vector>
#include <set>
#include <bitset>
#include <unordered_map>
#include <queue>

using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repn(i, s, n) for (int i = (int)(s); i < (int)(n); i++)

int gcd(int a, int b){
    if( a < b){
        swap(a,b);
    }
    return (a % b == 0)? b:gcd(a, a%b);
}

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

    // 4の倍数の存在、2の倍数の存在を求める
    bool two = false, four = false;
    rep(i,n){
        if( numbers[i] % 4 == 0 ){
            four = true;
        }else{
            two = true;
        }
    }

    // 2の倍数だが4の倍数ではない場合、* n.5は必ず奇数になる。
    // 4の倍数の場合必ず偶数になるため、これらが混ざっている場合一致することは永遠になく、従って半公倍数も存在しない
    if( four && two){
        cout << 0 << endl;
        return 0;
    }

    // 最小公倍数を求める
    int max_gcd = (numbers[0] * numbers[1]) / gcd(numbers[0], numbers[1]);
    repn(i, 1, n){
        max_gcd = ( max_gcd * numbers[i] ) / gcd(numbers[i], max_gcd);
    }

    // 最小の半公倍数を求める
    int min_gcd, max_number = *max_element(numbers.begin(), numbers.end());
    int multiply = 0;
    while(true){
        bool is_int = true;
        int target = max_number * (multiply + 0.5);
        rep(i,n){
            double result = target / numbers[i] * 2;
            if( floor(result) != result ){
                is_int = false;
                break;
            }
        }
        if( is_int ){
            min_gcd = target;
            break;
        }
        multiply++;
    }
    
    cout << (1 + ( (m-min_gcd) / max_gcd ) ) << endl;


}

Compiler output:
a.cc: In function 'int main()':
a.cc:61:17: error: 'floor' was not declared in this scope
   61 |             if( floor(result) != result ){
      |                 ^~~~~
Language: Java


public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = Integer.parseInt(sc.next());
		int k = Integer.parseInt(sc.next());
		
		int []a = new int [n];
		
		for(int i = 0 ; i< n ;i++) {
			a[i] = Integer.parseInt(sc.next());
			a[i] = a[i]/2;
		}
		if(Lcm(n,a) == 0) {
			System.out.println(0);
		}
		else {
		long ans = (k + Lcm(n,a)) /(2* Lcm(n,a));
		
		System.out.println(ans);
		}
	}
	
	static long Lcm(int n, int []a) {
		long lcm = a[0];
		
		for(int i = 1 ; i < n; i++) {
			if((lcm % 2) != (a[i] % 2)) {
				return 0;
			}
			else {
			long temp =gcd(lcm,(long)a[i]);
			lcm = lcm * a[i] / temp;
		}
			
			
		}
		
		return lcm;
	}

	private static long gcd(long a, long  b) {
		long  temp = 0;

		if(a == 0) {
			return b;
		}
		if(b == 0) {
			return a;
		}
		if(a != 0 || b != 0) {
		while (a % b != 0){
			temp = a;
			a = b;
			b = temp % b;
		}
		}
		return b;
	}
}



Compiler output:
Main.java:5: error: cannot find symbol
		Scanner sc = new Scanner(System.in);
		^
  symbol:   class Scanner
  location: class Main
Main.java:5: error: cannot find symbol
		Scanner sc = new Scanner(System.in);
		                 ^
  symbol:   class Scanner
  location: class Main
2 errors
Language: C++

#include <iostream>
#include <algorithm>
#include <map>
#include <vector>
#include <set>
#include <bitset>
#include <unordered_map>
#include <queue>

using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repn(i, s, n) for (int i = (int)(s); i < (int)(n); i++)

int gcd(int a, int b){
    if( a < b){
        swap(a,b);
    }
    return (a % b == 0)? b:gcd(a, a%b);
}

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

    // 4の倍数の存在、2の倍数の存在を求める
    bool two = false, four = false;
    rep(i,n){
        if( numbers[i] % 4 == 0 ){
            four = true;
        }else{
            two = true;
        }
    }

    // 2の倍数だが4の倍数ではない場合、* n.5は必ず奇数になる。
    // 4の倍数の場合必ず偶数になるため、これらが混ざっている場合一致することは永遠になく、従って半公倍数も存在しない
    if( four && two){
        cout << 0 << endl;
        return 0;
    }

    // 最小公倍数を求める
    int max_gcd = (numbers[0] * numbers[1]) / gcd(numbers[0], numbers[1]);
    repn(i, 1, n){
        max_gcd = ( max_gcd * numbers[i] ) / gcd(numbers[i], max_gcd);
    }

    // 最小の半公倍数を求める
    int min_gcd, max_number = *max_element(numbers.begin(), numbers.end());
    int multiply = 0;
    while(true){
        bool is_int = true;
        int target = max_number * (multiply + 0.5);
        rep(i,n){
            double result = target / numbers[i] * 2;
            if( floor(result) != result ){
                is_int = false;
                break;
            }
        }
        if( is_int ){
            min_gcd = target;
            break;
        }
        multiply++;
    }

    cout << min_gcd << endl;

    
    cout << (1 + ( (m-min_gcd) / max_gcd ) ) << endl;


}

Compiler output:
a.cc: In function 'int main()':
a.cc:61:17: error: 'floor' was not declared in this scope
   61 |             if( floor(result) != result ){
      |                 ^~~~~
Language: C++

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

long long gcd(long long x,long long y){
  if(y==0){
    return x;
  }
  return gcd(y,x%y);
}

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

int main() {
  int n;
  long long m;
  cin>>n>>m;
  long long a[n];
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  long long d=a[0];
  bool b=true;
  bool c=true;
  while(c){
    for(int i=0;i<n;i++){
      if(a[i]%2==0){
        a[i]/=2;
      }
      else{
        c=false;
        if(i!=0){
          b=false;
          break;
        }
        else{
          for(int i=0;i<n;i++){
            if(a[i]%2==0){
              b=false;
            }
          }
          break;
        }
      }
    }
  }
  if(!b){
    cout<<0<<endl;
  }
  else{
    m=m/(d/a[0]);
    int q=0;
    long long cur=1;
    for(int i=0;i<n;i++){
      cur=lcm(cur,a[i]);
      if(cur>2*m){
        q=1;
        break;
      }
    }
    if(q==0){
      cout<<(2*m+cur)/(2*cur)<<endl;
    }
    #include <bits/stdc++.h>
using namespace std;

long long gcd(long long x,long long y){
  if(y==0){
    return x;
  }
  return gcd(y,x%y);
}

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

int main() {
  int n;
  long long m;
  cin>>n>>m;
  long long a[n];
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  long long d=a[0];
  bool b=true;
  bool c=true;
  while(c){
    for(int i=0;i<n;i++){
      if(a[i]%2==0){
        a[i]/=2;
      }
      else{
        c=false;
        if(i!=0){
          b=false;
          break;
        }
        else{
          for(int i=0;i<n;i++){
            if(a[i]%2==0){
              b=false;
            }
          }
          break;
        }
      }
    }
  }
  if(!b){
    cout<<0<<endl;
  }
  else{
    m=m/(d/a[0]);
    int cur=1;
    for(int i=0;i<n;i++){
      cur=lcm(cur,a[i]);
    }
    cout<<(m+cur/2)/cur<<endl;
  }
}

  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:68:39: error: a function-definition is not allowed here before '{' token
   68 | long long gcd(long long x,long long y){
      |                                       ^
a.cc:75:39: error: a function-definition is not allowed here before '{' token
   75 | long long lcm(long long x,long long y){
      |                                       ^
a.cc:79:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   79 | int main() {
      |         ^~
a.cc:79:9: note: remove parentheses to default-initialize a variable
   79 | int main() {
      |         ^~
      |         --
a.cc:79:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:79:12: error: a function-definition is not allowed here before '{' token
   79 | int main() {
      |            ^