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

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

#define BUF_SIZE 30

int get_int2(int *a1, int *a2) {
#ifdef BUF_SIZE
  char line[BUF_SIZE];
  if(!fgets(line, BUF_SIZE, stdin)) return -1;
  sscanf(line, "%d %d", a1, a2);
#else
#error
#endif
  return 0;
}

// <arr[0]> <arr[1]> .. <arr[size-1]>
int fget_array_half(int *arr, int size) {
#ifdef BUF_SIZE
    char line[BUF_SIZE];
    char *tmpbuf = line;
    int i;
    if(!fgets(line, BUF_SIZE, stdin)) return -1;
    for(i = 0; i < size; i++) {
        char *tmp = strtok(tmpbuf, " ");
        arr[i] = strtol(tmp, NULL, 10);
        arr[i] /= 2;
        tmpbuf = NULL;
    }
#else
#error
#endif
    return 0;
}

#define ARR_MAX 100000
#define ULIMIT_MAX 1000000000 // 1-billion

// assume that a <= b
int gcd(int a, int b) {
    if(a==0) return b;
    return gcd(b%a, a);
}

int desc(const void *a, const void *b) {
    return *(int*)b - *(int*)a;
}

int main(void) {
    int size, ulimit;
    int arr[ARR_MAX];
    get_int2(&size, &ulimit);
    fget_array_half(arr, size);
    qsort(arr, size, sizeof(size), desc);

    uint64_t res = arr[0]; // largest
    int i;
    for(i = 1; i < size; i++) {
        // ensure that arr[i] <= res
        int g = gcd(arr[i], res);
        res = (res/g)*arr[i]; // calc lcm
        if(res > ULIMIT_MAX) break;
    }
#ifdef DEBUG
    printf("ans: %llu(lcm)*(odd number)\n", res);
#endif
    uint64_t div = ulimit/res;
    // answer should be integer
    printf("%d\n", (int)(div+1)/2);
    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:57:5: error: unknown type name 'uint64_t'
   57 |     uint64_t res = arr[0]; // largest
      |     ^~~~~~~~
main.c:4:1: note: 'uint64_t' is defined in header '<stdint.h>'; this is probably fixable by adding '#include <stdint.h>'
    3 | #include <stdlib.h>
  +++ |+#include <stdint.h>
    4 | 
main.c:68:5: error: unknown type name 'uint64_t'
   68 |     uint64_t div = ulimit/res;
      |     ^~~~~~~~
main.c:68:5: note: 'uint64_t' is defined in header '<stdint.h>'; this is probably fixable by adding '#include <stdint.h>'
Language: C++

#include <bits/stdc++.h>
using namespace std;
 unsigned euclidean_gcd(unsigned a, unsigned b) {
  if(a < b) return euclidean_gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}
int main() {
  long long a,b;
cin >> a >> b;
  vector<long long> c(a);
  long long n = 1;
    for(int i = 0;i < a;i++){
     cin >> c.at(i);
      int g = n.at(i)/2;
    n = n * g / euclidean_gcd(n,g);
    if(n > 100000000000)break;}
  long long ans = 0;
  b += n;
  if(n % 2 == 1){
   ans = b / n / 2;}
  
  

cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:17: error: request for member 'at' in 'n', which is of non-class type 'long long int'
   19 |       int g = n.at(i)/2;
      |                 ^~
Language: C++

#include <bits/stdc++.h>
#include <boost/range/irange.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/math/common_factor_rt.hpp>
using namespace std;
using namespace boost::range;
using namespace boost::math;
using boost::irange;

using ll = int64_t;
constexpr char LN = '\n';
template<class T> bool chmax(T& a, const T& b) {if(a<b){a=b;return true;}else{return false;}}
template<class T> bool chmin(T& a, const T& b) {if(b<a){a=b;return true;}else{return false;}}

#ifdef LOCAL
template<class H> void dump_(const char* s, H h) {cout<<s<<"="<<h<<LN; }
template<class H, class... T> void dump_(const char* s, H h, T... t) {for(;*s!=',';++s){cout<<*s;}cout<<"="<<h<<",";dump_(++s,t...);}
#define dump(...) dump_(#__VA_ARGS__, __VA_ARGS__)
#else
#define dump(...)
#endif

struct init_ {init_(){ 
    cin.tie(nullptr); ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
}} init_;

template<class C> C scan(size_t n) {C c(n);for(auto& v:c){cin>>v;}return c;}
template<class C> C scan(size_t n, size_t m) {C vss(n);for(auto& vs:vss){vs.resize(m);for(auto& v:vs){cin>>v;}}return vss;}

template<class R> struct Joined { const R& r; const char* s; };
template<class R> Joined<R> joined(const R& r, const char* s = " ") {return{r,s};}
template<class R> ostream& operator<<(ostream& out, Joined<R> j) {bool f=true;for(const auto& v:j.r){if(f){f=false;}else{out<<j.s;}out<<v;}return out;}

template<class T> using matrix = vector<vector<T>>;
template<class T> matrix<T> make_matrix(size_t n, size_t m, const T& init = T()) {matrix<T> vss(n);for(auto& vs:vss){vs.resize(m,init);}return vss;}
template<class T> ostream& operator<<(ostream& out, Joined<matrix<T>> j) {bool a=true;for(const auto& vs:j.r){if(a){a=false;}else{out<<LN;}bool f=true;for(const auto& v:vs){if(f){f=false;}else{out<<j.s;}out << v;}}return out;}

int main() {
    ll N, M;
    cin >> N >> M;
    auto a = scan<vector<ll>>(N);
    for_each(a, [](ll& x){ x /= 2; });
    auto lcm = lcm_range(a.begin(), a.end()).first;
    dump(lcm);
    int count = 0;
    for (ll i = 1; i * lcm <= M; i++) {
        if ((i * lcm) % 2 != 0) {
            count++;
        }
    }
    cout << count << LN;
}


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

#include <bits/stdc++.h>
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)
#define rep(i,n) for(int i=0;i<int(n);i++)
#define rep1(i,n) for(int i=1;i<=int(n);i++)
#define per(i,n) for(int i=int(n)-1;i>=0;i--)
#define per1(i,n) for(int i=int(n);i>0;i--)
#define foreach(i,n) for(auto &&i:n)
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort(all(x))
#define REV(x) reverse(all(x))
#define MAX(x) *max_element(all(x))
#define MIN(x) *min_element(all(x))
#define LOWitr(x, n) lower_bound(all(x), n)
#define UPRitr(x, n) upper_bound(all(x), n)
#define cii(x) int x;cin >> x
#define cill(x) LL x;cin >> x
#define cis(x) string x;cin >> x
#define co(x) cout << x << endl
#define dump(x)  cout << #x << " = " << (x) << endl
#define truecheck assert
#define pb push_back
#define mp make_pair
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef long long int64;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
template<class T,class U>bool chmax(T &a, const U &b) { if (a<b) { a=b; return true; } return false; }
template<class T,class U>bool chmin(T &a, const U &b) { if (b<a) { a=b; return true; } return false; }
template<class T,class U>void cinpb(T &v, U n) { rep(i, n){cill(a);v.pb(a);} }
const int INF = 1e9, MOD = 1e9 + 7;
const LL LLINF = 1e16;

int main() {
    fastcin();
    cout << fixed << setprecision(10);
    function<int64(int64, int64)> gcd = [&gcd](int64 x, int64 y){
        if (x < y) swap(x, y);
        if (x % y == 0) return y;
        return gcd(y, x % y);
    };
    function<int64(int64, int64)> lcm = [&gcd](int64 x, int64 y){
        return x * y / gcd(x, y);
    };
    cill(n);
    cill(m);
    LL vl[n+1];
    LL lc = 1;
    rep(i, n){cill(a);vl[i]=a/2);lc = lcm(lc, vl[i]);}
    rep(i, n){
        if (lc / vl[i] % 2 == 0){
            co(0);
            return 0;
        }
    }
    LL ans = (m / lc + 1) / 2;
    co(ans);
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:54:32: error: expected ';' before ')' token
   54 |     rep(i, n){cill(a);vl[i]=a/2);lc = lcm(lc, vl[i]);}
      |                                ^
      |                                ;
Language: C++

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

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

ll solve(ll N,ll M, vector<ll> &res) {
    while(res.at(0) % 2 == 0) {
        for(int i = 0; i < N; i++) {
            if(res.at(i) % 2 != 0) return 0;
            else {
                res.at(i) /= 2;
            }
        }
        M /= 2;
    }

    ll lcm = 1;
    for(int i = 0; i < N; i++) {
        lcm = (lcm * res.at(i)) / gcd(lcm,res.at(i));
        if(lcm > M) return 0;
    }
    return (M/lcm + 1) / 2;
}

int main() {
    ll N,M; cin >> N >> M;
    vector<ll> res(N);
    for(int i = 0; i < N; i++){ 
        cin >> res.at(i);
        res.at(i) /= 2;
    }


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

#include<iostream>
#include<math.h>
#include<algorithm>
#include<stdint.h>
#include<vector>
#include<string>
#include<time.h>
#include<random>
using namespace std;




//最大公約数
template<typename T>
constexpr T gcd(T a, T b)
{
	if (a % b == 0)
	{
		return(b);
	}
	else
	{
		return(gcd<T>(b, a % b));
	}
}

//最小公倍数
template<typename T>
constexpr T lcm(T a, T b)
{
	return a * b / gcd(a, b);
}

//素因数pの数
template<typename T>
constexpr long long prime_factor_count(T a, long long p) {
	long long c = 0;
	T aa = a;
	while (true)
	{
		if (aa % p != 0) return c;

		aa /= p;
		++c;
	}
}

int main() {

	long long n;
	cin >> n;

	long long m;
	cin >> m;

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

	if (n == 1) {
		if (a[0] % 2 == 1) {
			cout << 0 << endl;
		}
		else {
			cout << (long long)floor(((double)m / (double)a[0]) - 0.5) << endl;
		}
		return 0;
	}

	for (long long i = 0; i < n - 1; ++i) {
		if (prime_factor_count(a[i], 2) != prime_factor_count(a[i + 1], 2)) {
			cout << 0 << endl;
			return 0;
		}
	}

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

	double M = m;

	double ret = floor((m * 0.5 / beta) - 0.5);

	cout << long long(ret) + 1<< endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:88:17: error: expected primary-expression before 'long'
   88 |         cout << long long(ret) + 1<< endl;
      |                 ^~~~
Language: C++

#include<iostream>
#include<math.h>
#include<algorithm>
#include<stdint.h>
#include<vector>
#include<string>
#include<time.h>
#include<random>
using namespace std;




//最大公約数
template<typename T>
constexpr T gcd(T a, T b)
{
	if (a % b == 0)
	{
		return(b);
	}
	else
	{
		return(gcd<T>(b, a % b));
	}
}

//最小公倍数
template<typename T>
constexpr T lcm(T a, T b)
{
	return a * b / gcd(a, b);
}

//素因数pの数
template<typename T>
constexpr long long prime_factor_count(T a, long long p) {
	long long c = 0;
	T aa = a;
	while (true)
	{
		if (aa % p != 0) return c;

		aa /= p;
		++c;
	}
}

long long main() {

	long long n;
	cin >> n;

	long long m;
	cin >> m;

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

	if (n == 1) {
		if (a[0] % 2 == 1) {
			cout << 0 << endl;
		}
		else {
			cout << (long long)floor(((double)m / (double)a[0]) - 0.5) << endl;
		}
		return 0;
	}

	for (long long i = 0; i < n - 1; ++i) {
		if (prime_factor_count(a[i], 2) != prime_factor_count(a[i + 1], 2)) {
			cout << 0 << endl;
			return 0;
		}
	}

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

	double M = m;

	double ret = floor((m * 0.5 / beta) + 0.5);

	cout << long long(ret) << endl;

	return 0;
}

Compiler output:
cc1plus: error: '::main' must return 'int'
a.cc: In function 'int main()':
a.cc:88:17: error: expected primary-expression before 'long'
   88 |         cout << long long(ret) << endl;
      |                 ^~~~
Language: C++

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

int main() {
	int n, m, mcd = 0, mcm = 1;
	ll ans;
	vector <int> a;
	cin >> n >> m;
	a.resize(n);
	for(int i = 0; i < n; i++) {
		cin >> a[i];
		mcd = __gcd(mcd, a[i]);
	}
	for(int i = 0; i < n; i++) {
		a[i] /= mcd;
		if (a[i] % 2 == 0) {
			printf("%d\n", 0);
			return 0;
		}
	}
	mcm = a[0];
	for(int i = 1; i < n; i++) {
		mcm = a[i] * mcm / __gcd(a[i], mcm);
		if (mcm > 2 * m / mcd) {
			printf("%d\n", 0);
			return 0;
		}
		
	}
	
	ans = (2ll * m / (1ll * mcm * mcd) + 1) / 2;
	printf("%d\n", ans);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:9: error: 'll' was not declared in this scope
    6 |         ll ans;
      |         ^~
a.cc:31:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   31 |         ans = (2ll * m / (1ll * mcm * mcd) + 1) / 2;
      |         ^~~
      |         abs
Language: C++

#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < n; i++)
#define repr(i, n) for(ll i = n; i >= 0; i--)
#define inf LLONG_MAX
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;

ll lcm(ll a, ll b) {
    ll _a = a, _b = b;
    if (_a < _b) swap(_a, _b);
    while (_b) {
        ll x = _a, y = _b;
        _a = y;
        _b = x % y;
    }
    return a * b / _a;
}

int main()
{
    ll n, m; cin >> n >> m;
    ll dividend;
    rep(i, n) {
        ll num; cin >> num; num /= 2;
        if (i == 0) {
            dividend = num;
        } else {
            dividend = lcm(dividend, num);
        }
        if (dividend > 1e9) {
            cout << 0 << endl;
            return 0;
        }
    }

    ll num = m / dividend;
    cout << (m + lcm) / (2 * lcm) << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:40:16: error: invalid operands of types 'll' {aka 'long long int'} and '<unresolved overloaded function type>' to binary 'operator+'
   40 |     cout << (m + lcm) / (2 * lcm) << endl;
      |              ~~^~~~~
a.cc:40:28: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator*'
   40 |     cout << (m + lcm) / (2 * lcm) << endl;
      |                          ~~^~~~~
Language: C++

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

//解答方針
//２で割り切れる回数を調べる　一つでも異なるものがあったらアウト
//x / (2**w)
//LCM(a_1,,,a_n)をとる
//1 <= x <= m''の中に, L=LCM(a_1,,,,a_n)の奇数倍のものは何個ある？
//切り上げ処理を行う
long long gcd(long long a, long long b){
    if (a < b) swap(a, b);
    
    if (b == 0) return a;
    else return gcd(b, a%b);
}

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

int countDivision(long long a){
    if (a % 2 == 1) return 0;
    int res = 0;
    while(a%2 == 0){
        a /= 2;
        res++;
    }
    return res;
    
}

int main(void){
    int n, m;
    cin >> n >> m;
    
    vector<long long> a(n);
    rep(i, n){
        cin >> a[i];
        a[i] /= 2;
    } 
    
    //２で割り切れる回数を調べる　一つでも異なるものがあったらアウト
    int comparison = countDivision(a[0]);
    
    rep(i, n){
        if (countDivision(a[i]) != comparison){
            cout << 0 << endl;
            return 0;
        }
    }
    
    // / (2**w)
    m /= pow(2, comparison);
    
    //LCM(a_1,,,a_n)をとる
    
    long long l = lcm(a[0], a[1]);
    
    rep(i, n){
        l = lcm(l, a[i]);
    }
    
    //1 <= x <= m''の中に, L=LCM(a_1,,,,a_n)の奇数倍のものは何個ある？
    //切り上げ処理を行う
    int ans = ((m / l) + 1) / 2;
    cout << ans << endl;
}


atcoder-tools: The pre-rendered templates are not found.

Compiler output:
a.cc:73:1: error: 'atcoder' does not name a type
   73 | atcoder-tools: The pre-rendered templates are not found.
      | ^~~~~~~
Language: C++

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

template<typename T>
T gcd(T a, T b){
    if(a < b){
        swap(a, b);
    }
    T r;
    while(r=a%b){
        a = b;
        b = r;
    }
    return b;
}

int main(){
    ll n, m, tem1, tem2, gd, i;
    cin >> n >> m;
    ill a[n];
    for(i=0; i<n; i++){
        cin >> a[i];
        if(a[i]%2 == 1){
            cout << 0;
            return 0;
        }
        a[i] /= 2;
    }
    sort(a, a+n);
    tem1 = a[0];
    for(i=1; i<n; i++){
        gd = gcd(tem1, a[i]);
        tem1 = tem1 * a[i] / gd;
    }
    cout << (a[n]+tem1)/(tem1*2)-(a[0]+tem1)/(tem1*2);
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:5: error: 'ill' was not declared in this scope; did you mean 'll'?
   22 |     ill a[n];
      |     ^~~
      |     ll
a.cc:24:16: error: 'a' was not declared in this scope
   24 |         cin >> a[i];
      |                ^
a.cc:31:10: error: 'a' was not declared in this scope
   31 |     sort(a, a+n);
      |          ^
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();
    long M = sc.nextLong();
    long[] A = new long[N];
    boolean hantei = false;
    long amari = 0;
    long a = 0, b = 0, swap=0, r=0, x=0;
    for(int i=0; i<N; i++){
    	A[i] =sc.nextLong();
        if(i == 0) amari = A[i] % 2;
        else{
        	if(A[i] % 2 != amari){ hantei =true; break;}
        }  　
    }
    long max = A[0]; //最小公倍数
    
    //最小公倍数を求める
    if(hantei == false){
    for(int i=1; i < N; i++){
      a = max;
      b = A[i];
      x = a * b;
      if (a < b){ swap = a; a = b; b = swap;}
      r = a % b;
      while(r!=0){
    		a = b;
   			b = r;
   			r = a % b;
  	  }
      max = x/b; 
    }
    }
    
    if( max > M * 2 ||  hantei == true) System.out.println(0);
    else{
      long ans = (M-(max/2)) / max + (long)1;
      System.out.println(ans);   
    }
  }
}


Compiler output:
Main.java:16: error: illegal character: '\u3000'
        }  ?
           ^
1 error
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();
    long M = sc.nextLong();
    long[] A = new long[N];
    boolean second = false
    long a = 0, b = 0, swap=0, r=0, x=0;
    for(int i=0; i<N; i++){
    	A[i] =sc.nextLong();
    }
    long max = A[0]; //最小公倍数
    if(max == 2) second = true;
    
    //最小公倍数を求める
    for(int i=1; i < N; i++){
      a = max;
      b = A[i];
      if (b == 2) second = true;
      x = a * b;
      if (a < b){ swap = a; a = b; b = swap;}
      r = a % b;
      while(r!=0){
    		a = b;
   			b = r;
   			r = a % b;
  	  }
      max = x/b; 
    }
    
    if( max > M * 2 || (second == true && max % 2 == 0)) System.out.println(0);
    else{
      long ans = (M-(max/2)) / max + (long)1;
      System.out.println(ans);   
    }
  }
}


Compiler output:
Main.java:8: error: ';' expected
    boolean second = false
                          ^
1 error
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();
    long M = sc.nextLong();
    long[] A = new long[N];
    boolean second = false
    long a = 0, b = 0, swap=0, r=0, x=0;
    for(int i=0; i<N; i++){
    	A[i] =sc.nextLong();
    }
    long max = A[0]; //最小公倍数
    if(max == 2) second = true;
    
    //最小公倍数を求める
    for(int i=1; i < N; i++){
      a = max;
      b = A[i];
      if (b == 2) second = true;
      x = a * b;
      if (a < b){ swap = a; a = b; b = swap;}
      r = a % b;
      while(r!=0){
    		a = b;
   			b = r;
   			r = a % b;
  	  }
      max = x/b; 
    }
    
    if( max > M * 2 || (second == true && max/2 % == 0)) System.out.println(0);
    else{
      long ans = (M-(max/2)) / max + (long)1;
      System.out.println(ans);   
    }
  }
}


Compiler output:
Main.java:8: error: ';' expected
    boolean second = false
                          ^
Main.java:32: error: illegal start of expression
    if( max > M * 2 || (second == true && max/2 % == 0)) System.out.println(0);
                                                  ^
2 errors
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();
    long M = sc.nextLong();
    long[] A = new long[N];
    long a = 0;
    long b = 0;
    long swap = 0;
    long r = 0;
    long x = 0;
    for(int i=0; i<N; i++){
    	A[i] =sc.nextLong();
    }
    long max = A[0]; //最小公倍数
    
    //最小公倍数を求める
    for(int i=1; i<N; i++){
      a = max;
      b = A[i];
      x = a * b;
      if (a < b){ swap = a; a = b; b = swap;}
      r = a % b;
      while(r!=0){
    		a = b;
   			b = r;
   			r = a % b;
  	  }
      max = x/b; 
    }
    if( max > M * 2 ) System.out.println(0);
    else{
      int ans = M / max + (long)1;
      System.out.println(ans);   
    }
  }
}


Compiler output:
Main.java:34: error: incompatible types: possible lossy conversion from long to int
      int ans = M / max + (long)1;
                        ^
1 error
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();
    long M = sc.nextLong();
    long[] A = new long[N];
    long a = 0;
    long b = 0;
    long swap = 0;
    long r = 0;
    for(int i=0; i<N; i++){
    	A[i] =sc.nextLong();
    }
    long max = A[0]; //最小公倍数
    
    //最小公倍数を求める
    for(int i=1; i<N; i++){
      a = max;
      b = A[i];
      x = a * b;
      if (a < b){ swap = a; a = b; b = swap;}
      r = a % b;
      while(r!=0){
    		a = b;
   			b = r;
   			r = a % b;
  	  }
      max = x/b; 
    }
    if( max > M * 2 ) System.out.println(0);
    else{
      int ans = M / max + 1;
      System.out.println(ans);   
    }
  }
}


Compiler output:
Main.java:21: error: cannot find symbol
      x = a * b;
      ^
  symbol:   variable x
  location: class Main
Main.java:29: error: cannot find symbol
      max = x/b; 
            ^
  symbol:   variable x
  location: class Main
Main.java:33: error: incompatible types: possible lossy conversion from long to int
      int ans = M / max + 1;
                        ^
3 errors
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();
    long M = sc.nextLong();
    long[] A = new long[N];
    long num1 = 0;
    long num2 = 0;
    long swap = 0;
    long r = 0;
    for(int i=0; i<N; i++){
    	A[i] =sc.nextLong();
    }
    long max = A[0]; //最小公倍数
    
    //最小公倍数を求める
    for(int i=1; i<N; i++){
      a = max;
      b = A[i];
      x = a * b;
      if (){ swap = a; a = b; b = swap;}
      r = a % b;
      while(r!=0){
    		a = b;
   			b = r;
   			r = a % b;
  	  }
      max = x/b; 
    }
    if( max > M * 2 ) System.out.println(0);
    else{
      int ans = M / max + 1;
      System.out.println(ans);   
    }
  }
}

Compiler output:
Main.java:22: error: illegal start of expression
      if (){ swap = a; a = b; b = swap;}
          ^
1 error
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define pb push_back;
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<char, char> c_c;
typedef pair<int, int> i_i;
typedef pair<ll, ll> l_l;
const int INF = 1e9;
const ll LLINF = 1e16;

int gcd(int x, int y){
	if(x>y) swap(x, y);
	while(1){
		y %= x;
		swap(x, y);
		if(x==0) return y;
	}
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n;
    ll m;
    cin >> n >> m;
    vector<int> a(n);
    for(int i=0; i<n; i++) cin >> a[i];
    set<int> s;
    vector<int> b(n);
    b = a;
    for(int i=0; i<n; i++){
        int cnt = 0;
        while(a[i]%2 == 0){
            a[i] /= 2;
            cnt++;
        }
        s.insert(cnt);
        //b[i] = a[i];
    }
    ll sum = b[0];
    if (s.size() != 1){
        cout << 0 << endl;
        return 0;
    }
    else{
        //cout << LC << endl;
        for(int i=1; i<n; i++){
            sum = (sum*b[i])/(gcd(sum, b[i]));
        }
        sum /= 2;//LCM求め終わり
        //sum *= (*begin(s));
    }
    if(sum>m){
        cout << 0 << endl;
        return 0;
    }
    }
    int ans = 0;
    //cout << sum << endl;
    ll tot = sum;
    while(tot <= m){
        ans++;
        tot += sum*2;
    }
    cout << ans << endl;
}

Compiler output:
a.cc:63:14: error: 'sum' was not declared in this scope
   63 |     ll tot = sum;
      |              ^~~
a.cc:64:5: error: expected unqualified-id before 'while'
   64 |     while(tot <= m){
      |     ^~~~~
a.cc:68:5: error: 'cout' does not name a type
   68 |     cout << ans << endl;
      |     ^~~~
a.cc:69:1: error: expected declaration before '}' token
   69 | }
      | ^
Language: C++

#include <iostream>
using namespace std;
typedef long long LL;

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

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


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

  ll a[N];
  rep(i, N)
    cin >> a[i];

  int count = -1;
  ll lcm = 1;
  rep(i, N) {
    int c = 1;
    while (a[i] % 2 == 0) {
      a[i] /= 2;
      c *= 2;
    }
    if (count == -1)
      count = c;
    else if (count != c) {
      cout << 0 << endl;
      return 0;
    }
    lcm = lcm / gcd(lcm, a[i]) * a[i];
    if (lcm > M) {
      cout << 0 << endl;
      return 0;
    }
  }
  cout << (M / (count/2 * lcm) + 1) / 2 << endl;

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:3: error: 'll' was not declared in this scope; did you mean 'LL'?
   13 |   ll a[N];
      |   ^~
      |   LL
a.cc:15:12: error: 'a' was not declared in this scope
   15 |     cin >> a[i];
      |            ^
a.cc:18:5: error: expected ';' before 'lcm'
   18 |   ll lcm = 1;
      |     ^~~~
      |     ;
a.cc:21:12: error: 'a' was not declared in this scope
   21 |     while (a[i] % 2 == 0) {
      |            ^
a.cc:31:5: error: 'lcm' was not declared in this scope
   31 |     lcm = lcm / gcd(lcm, a[i]) * a[i];
      |     ^~~
a.cc:31:26: error: 'a' was not declared in this scope
   31 |     lcm = lcm / gcd(lcm, a[i]) * a[i];
      |                          ^
a.cc:37:27: error: 'lcm' was not declared in this scope
   37 |   cout << (M / (count/2 * lcm) + 1) / 2 << endl;
      |                           ^~~
Language: C++

#include <bits/stdc++.h>

 using namespace std;
int N;
int M;
int gcd(int x,int y){
  if(y==0)return x;
  return gcd(y,x%y);
}
int lcm(int x,int y){
  return x/gcd(x,y)*y;
}

int main(){
  cin>>N>>M;
  vector<int>a(N);
  int LCM=1;
  bool zero=false;
  for(int i=0;i<N;i++)cin>>a[i];
  for(int i=0;i<N;i++)a[i]/=2;
  for(int i=0;i<N;i++){
    LCM=lcm(LCM,a[i]);
    if(LCM>M){
      zero=true;
      break;
    }
  }
  
    
 bool zero_2=false;   
    
  if(zero)cout<<0<<endl;
  else{
    for(int i=0;i<N;i++){
      int x=a[i]%2;
   
      if(a[i]%2!==lcm%2)zero_2=true;
    }
    if(zero_2)cout<<0<<endl;
    else{
    M-=LCM;
    M/=2;
    int64_t ans=1;
    ans+=M/LCM;
    cout<<ans<<endl;
    }
  }
}
  
    
  
  
  




Compiler output:
a.cc: In function 'int main()':
a.cc:37:18: error: expected primary-expression before '=' token
   37 |       if(a[i]%2!==lcm%2)zero_2=true;
      |                  ^
a.cc:37:22: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator%'
   37 |       if(a[i]%2!==lcm%2)zero_2=true;
      |                   ~~~^~
Language: C++

#include <bits/stdc++.h> 
using namespace std;
 
typedef long long ll;
#define pa pair<int, int> 
#define pal pair<long long, long long>
#define pad pair<double, double>
#define pb push_back
#define mp make_pair
#define VIN(v) for(int64_t i=0;i<(v).size();i++){cin >> (v).at(i);}
 
typedef vector<bool> bvec;
typedef vector<int> ivec;
typedef vector<long long> lvec;
typedef vector<double> dvec;
typedef vector<pa> pvec;
 
typedef vector< vector<bool> > bmat;
typedef vector< vector<int> > imat;
typedef vector<string> svec;
typedef vector< vector<string> > smat;
const ll infll = (1LL << 60) - 1;
const int inf = (1 << 30) - 1;
 
ll gcd(ll x, ll y){
    if(x%y == 0) return y;
    else return gcd(y, x%y);
}
 
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll  n, m;
    cin >> n >> m;
    lvec a(n), aa;
    for (ll i = 0; i < n; i++) cin >> a[i];
    sort(a.rbegin(), a.rend());
    aa.push_back(a[0]/2);
    for (ll i = 1; i < n; i++){
        if(a[i] == a[i-1]) continue;
        else aa.push_back(a[i]/2);
    }
    ll g = aa[0];
    for (ll &x : aa) {
        g = gcd(max(g, x), min(g, x));
    }
    ll mm =  1;
    for (ll &x : aa) {
        x /= g;
        mm *= x;
        if (x%2 == 0) {
            cout << 0 << endl;
            return 0;
        }
    }
    mm *= g;
  	if (m < mm) {
      cout << 0 << endl;
      return 0;
    }
    cout << ((m/mm) + 1)/2  << endl;

Compiler output:
a.cc: In function 'int main()':
a.cc:61:37: error: expected '}' at end of input
   61 |     cout << ((m/mm) + 1)/2  << endl;
      |                                     ^
a.cc:30:11: note: to match this '{'
   30 | int main(){
      |           ^
Language: C++

#include <bits/stdc++.h> 
using namespace std;
 
typedef long long ll;
#define pa pair<int, int> 
#define pal pair<long long, long long>
#define pad pair<double, double>
#define pb push_back
#define mp make_pair
#define VIN(v) for(int64_t i=0;i<(v).size();i++){cin >> (v).at(i);}
 
typedef vector<bool> bvec;
typedef vector<int> ivec;
typedef vector<long long> lvec;
typedef vector<double> dvec;
typedef vector<pa> pvec;
 
typedef vector< vector<bool> > bmat;
typedef vector< vector<int> > imat;
typedef vector<string> svec;
typedef vector< vector<string> > smat;
const ll infll = (1LL << 60) - 1;
const int inf = (1 << 30) - 1;
 
ll gcd(ll x, ll y){
    if(x%y == 0) return y;
    else return gcd(y, x%y);
}
 
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll  n, m;
    cin >> n >> m;
    lvec a(n), aa;
    for (ll i = 0; i < n; i++) cin >> a[i];
    sort(a.rbegin(), a.rend());
    aa.push_back(a[0]/2);
    for (ll i = 1; i < n; i++){
        if(a[i] == a[i-1]) continue;
        else aa.push_back(a[i]/2);
    }
    ll g = aa[0];
    for (ll &x : aa) {
        g = gcd(max(g, x), min(g, x));
    }
    ll mm =  1;
    for (ll &x : aa) {
        x /= g;
        mm *= x;
        if (x%2 == 0) {
            cout << 0 << endl;
            return 0;
        }
    }
    mm *= g;
  	if (m < mm) {
      cout << 0 << endl;
      return 0
    }
    cout << ((m/mm) + 1)/2  << endl;


Compiler output:
a.cc: In function 'int main()':
a.cc:59:15: error: expected ';' before '}' token
   59 |       return 0
      |               ^
      |               ;
   60 |     }
      |     ~          
a.cc:61:37: error: expected '}' at end of input
   61 |     cout << ((m/mm) + 1)/2  << endl;
      |                                     ^
a.cc:30:11: note: to match this '{'
   30 | int main(){
      |           ^
Language: C++

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

#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define endl '\n'
#define fcin ios::sync_with_stdio(false); cin.tie(nullptr);
#define INF 0x3f3f3f3f
#define all(x) x.begin(), x.end()
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef unsigned long long ll;
typedef pair<int, int> pii;

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

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

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

    vector<ll> a(n);
    for(ll i = 0; i < n; i++) cin >> a[i];

    ll L = a[0]/2;
    for(ll i = 1; i < n; i++) L = lcm(L, a[i]/2);
    
    ll ans = 0;
    for(ll i = 0; i < n; i++) if((LCM / (a[i] / 2)) % 2 == 0) return cout << 0, 0;

    for(ll i = L; i <= m; i += 2LL*L) ans++;

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



Compiler output:
a.cc: In function 'int main()':
a.cc:37:35: error: 'LCM' was not declared in this scope
   37 |     for(ll i = 0; i < n; i++) if((LCM / (a[i] / 2)) % 2 == 0) return cout << 0, 0;
      |                                   ^~~
Language: C++

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

int n,k,gcd,lcd,num,flag=1ll;
int a[100005];

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

int cal_gcd(int a,int b)
{
	return __gcd(a,b);
}

int with(int a,int b)
{
	if (b%2ll==1ll)  return false;
	if (a%b==0ll)  return false;
	if (a%(b/2ll)!=0ll)  return false;
	return true;
}

int main()
{
	cin>>n>>k;
	for (int i=1;i<=n;i++)  cin>>a[i];
	gcd=lcd=a[1];
	for (int i=2;i<=n;i++)  gcd=cal_gcd(gcd,a[i]);
	for (int i=2;i<=n;i++)  lcd=cal_lcd(lcd,a[i]);
	num=lcd/gcd;
	
	for (int i=1;i<=n;i++)
	{
		if (!with(num,a[i]))
		{
			flag=0ll;
			break;
		}
	}
	if (flag==0)
	{
		cout<<0<<endl;
		return 0;
	}
	
	cout<<((k-num)/(2ll*num))+1ll<<endl;
	return 0;
}

Compiler output:
cc1plus: error: '::main' must return 'int'
a.cc: In function 'int main()':
a.cc:30:9: error: reference to 'gcd' is ambiguous
   30 |         gcd=lcd=a[1];
      |         ^~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:58,
                 from a.cc:1:
/usr/include/c++/14/numeric:173:5: note: candidates are: 'template<class _Mn, class _Nn> constexpr std::common_type_t<_Mn, _Nn> std::gcd(_Mn, _Nn)'
  173 |     gcd(_Mn __m, _Nn __n) noexcept
      |     ^~~
a.cc:5:9: note:                 'long long int gcd'
    5 | int n,k,gcd,lcd,num,flag=1ll;
      |         ^~~
a.cc:31:33: error: reference to 'gcd' is ambiguous
   31 |         for (int i=2;i<=n;i++)  gcd=cal_gcd(gcd,a[i]);
      |                                 ^~~
/usr/include/c++/14/numeric:173:5: note: candidates are: 'template<class _Mn, class _Nn> constexpr std::common_type_t<_Mn, _Nn> std::gcd(_Mn, _Nn)'
  173 |     gcd(_Mn __m, _Nn __n) noexcept
      |     ^~~
a.cc:5:9: note:                 'long long int gcd'
    5 | int n,k,gcd,lcd,num,flag=1ll;
      |         ^~~
a.cc:31:45: error: reference to 'gcd' is ambiguous
   31 |         for (int i=2;i<=n;i++)  gcd=cal_gcd(gcd,a[i]);
      |                                             ^~~
/usr/include/c++/14/numeric:173:5: note: candidates are: 'template<class _Mn, class _Nn> constexpr std::common_type_t<_Mn, _Nn> std::gcd(_Mn, _Nn)'
  173 |     gcd(_Mn __m, _Nn __n) noexcept
      |     ^~~
a.cc:5:9: note:                 'long long int gcd'
    5 | int n,k,gcd,lcd,num,flag=1ll;
      |         ^~~
a.cc:33:17: error: reference to 'gcd' is ambiguous
   33 |         num=lcd/gcd;
      |                 ^~~
/usr/include/c++/14/numeric:173:5: note: candidates are: 'template<class _Mn, class _Nn> constexpr std::common_type_t<_Mn, _Nn> std::gcd(_Mn, _Nn)'
  173 |     gcd(_Mn __m, _Nn __n) noexcept
      |     ^~~
a.cc:5:9: note:                 'long long int gcd'
    5 | int n,k,gcd,lcd,num,flag=1ll;
      |         ^~~
Language: C++

#include<bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; i++)
#define repo(i, n) for(int i=1; i<=n; i++)
#define MAX 200005
#define INF 200005

using namespace std;
using ull = unsigned long long;
using ll = long long;
using P = pair<int, int>;
const int mod = 1000000007;

ll lcm(ll i,ll j){
  if(i<j){
    swap(i, j);
  }
  ll r=i%j;
  ll x=i*j;
  while(r!=0){
    i=j;
    j=r;
    r=i%j;
  }
  return x/j;
}

int twofac(ll a){
  int f=0;
  while(a%2=0){
    a/=2;
    f++;
  }
  return f;
}

int main(){
  int n, m;

  cin >> n >> m;
  vector<ll> a(n);
  rep(i, n){
    cin >> a[i];
    a[i]/=2;
  }
  int oe=twofac(a[i]);
  repo(i, n-1){
    if(oe!=twofac(a[i])){
      cout << 0 << endl;
      return 0;
    }
  }
  ll l=1;
  rep(i, n){
    l=lcm(l, a[i]);
  }
  ll x=l, ans=0;
  while(x<=m){
    ans++;
    x+=2*l;
  }
  cout << ans << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int twofac(ll)':
a.cc:29:10: error: lvalue required as left operand of assignment
   29 |   while(a%2=0){
      |         ~^~
a.cc: In function 'int main()':
a.cc:45:19: error: 'i' was not declared in this scope
   45 |   int oe=twofac(a[i]);
      |                   ^
Language: C++

//includes
#include<iostream>
#include<vector>
#include<set>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<string>
#include<stack>
#include<map>
#include<queue>
#include<iomanip>
#include<numeric>
#include<assert.h>
#include<cstring>
#include<unordered_map>
#include<bitset>

//macros and consts
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define all(a) (a).begin(),(a).end()
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define FORE(i,a) for(auto &i : a)
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define accm accumulate
#define Fi first
#define Se second
#define INF 1e9
#define llINF (1LL<<60)
#define mINF -1e9
#define mllINF -(1LL<<60)
#define endl "\n"
#define CONT continue
#define BRK break
#define modulo(n, m) (((n)%(m)+(m))%m)
#define int long

//shorter types
using namespace std;
using ll = long long;
using vi = std::vector<int>;
using vc = std::vector<char>;
using vll = std::vector<long long>;
using vs = std::vector<string>;
using Mi = map<int,int>;
using Mll = map<ll,ll>;
using UMi = unordered_map<int,int>;
using UMll = unordered_map<ll,ll>;
using Pi = pair<int,int>;
using Pll = pair<ll,ll>;
using vPi = vector<Pi>;
using vPll = vector<Pll>;
using vvi = vector<vector<int>>;
using vvll = vector<vector<ll>>;
using vvc = vector<vector<char>>;
using vvs = vector<vector<string>>;
using pqgi = priority_queue<int,vector<int>,greater<int>>;
using pqsi = priority_queue<int,vector<int>,less<int>>;
using pqgll = priority_queue<int,vector<int>,greater<int>>;
using pssll = priority_queue<int,vector<int>,less<int>>;
template<class T>
using vec = vector<T>;


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

int findlcm(vector<int> arr, int n){
	int ans = arr[0];
	for(int i = 1 ; i < n ; i++){
		ans = (arr[i] * ans) / gcd(arr[i],ans);
	}
	return ans;
}

//here begins your code
signed main(){
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  long N;
  long M;

  cin >> N >> M;

  vector<long> a;
  a.resize(N);
  for(int i = 0 ; i < N ; i++){
  	cin >> a[i];
  	a[i] = a[i] / 2;
  }
  int lcm = findlcm(a,N);
  if(lcm > M){
    cout << 0 << endl;
    return 0;
  }

  for(auto i : a){
    if(lcm / i % 2 == 0){
      cout << 0 << endl;
      return 0;
    }
  }
  cout << 1 + (m - lcm) / (2 * lcm) << endl;
  //check types
  //do not eb if you resize
  //resize before you access by idx
  return 0;
} 

Compiler output:
a.cc: In function 'int main()':
a.cc:109:16: error: 'm' was not declared in this scope
  109 |   cout << 1 + (m - lcm) / (2 * lcm) << endl;
      |                ^
Language: C++

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

// 2 で割り切れる回数を返す
int f(int x) {
 int res = 0;
 while (x % 2 == 0) {
   x /= 2;
   res++;
 }
 return res;
}

// 最大公約数を返す
long long gcd(long long a, long long b) {
 if (b == 0) {
   return a;
 }
 return gcd(b, a % b);
}

// 最小公倍数を返す
long long lcm(long long a, long long b) {
 return a / gcd(a, b) * b;
}

int main() {

 int N, M;
 cin >> N >> M;

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

 // 入力を 2 で割る
 for (int i = 0; i < N; i++) {
   if (a[i] % 2 == 1) {
     cout << 0 << endl;
     return 0;
   }
   a[i] /= 2;
 }

 // 2 で割り切れる回数が a[0] から a[N - 1] まで、全部同じじゃないとダメ
 // 同じ場合は、2^t で割る
 int t = f(a[0]);
 for (int i = 0; i < N; i++) {
   if (f(a[i]) != t) {
     cout << 0 << endl;
     return 0;
   }
   // a[i] /= 2^t
   a[i] >>= t;
 }

 // M /= 2^t
 M >>= t;

 // 2^t で割った a[0] から a[N - 1] までの lcm を求める。
 // lcm が M を超えるとダメ
 long long lcm_ = 1;
 for (int i = 0; i < N; i++) {
   lcm_ = lcm(lcm_, a[i]);
   if (M < lcm_) {
     cout << 0 << endl;
     return 0;
   }
 }

 // 2^t で割った M = lcm * answer を満たす必要があり、
 // answer は奇数じゃないとダメなので、奇数の個数が答えになる
 M /= lcm_;
 int answer = (M + 1) / 2;
 
 cout << answer << endl;
 
 return 0;

}

Submission #9415956 

Compiler output:
a.cc:83:12: error: stray '#' in program
   83 | Submission #9415956
      |            ^
a.cc:83:1: error: 'Submission' does not name a type
   83 | Submission #9415956
      | ^~~~~~~~~~
Language: C++

#include <iostream>
#include<vector>
#include<algorithm>
 
using namespace std;
 
int gcd(int a, int b){
  if(a < b) swap(a,b);
  if(a % b == 0) return a / b;
  else return gcd(b, a%b);
}
 
int main(){
  int n; cin >> n;
  int m; cin >> m;
  vector<int> a(n); 
  for(int i=0;i<n;i++) cin >> a[i];
  int lc = 1;
  for(int i=0;i<n;i++){
    a[i] = a[i] / 2;
  	int t = gcd(lc, a[i]);
    lc = (lc * a[i]) / t
  }
  for(int i=0;i<n;i++){
    if((lc / a[i]) % 2 ==0){cout << 0 << endl; return 0;}
  }
  cout << (m / lc + 1) / 2 << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:25: error: expected ';' before '}' token
   22 |     lc = (lc * a[i]) / t
      |                         ^
      |                         ;
   23 |   }
      |   ~
Language: C++

#include <iostream>
#include<vector>
#include<algorithm>

using namespace std;

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

int main(){
  int n; cin >> n;
  int m; cin >> m;
  vector<int> a(n); 
  for(int i=0;i<n;i++) cin >> a[i];
  int lc = 1;
  for(int i=0;i<n;i++){
    a[i] = a[i] / 2;
  	int t = gcd(lc, a[i]);
    lc = (lc * a[i]) / t
  }
  for(int i=0;i<n;i++) if((lc / a[i]) % 2 ==0){cout << 0 << endl; return 0;}
  
  cout << (m / lc + 1) / 2 << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:25: error: expected ';' before '}' token
   22 |     lc = (lc * a[i]) / t
      |                         ^
      |                         ;
   23 |   }
      |   ~
Language: C++

#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <set>
 
using namespace std;
 
#define PB push_back
#define MP make_pair
#define REP(i,n) for(int i=0;i<(n);i++)
long long gcd(long long a,long long b){
    if(a<b)return gcd(b,a);
    if(b==0)return a;
    return gcd(b,a%b);
}
long long lcm(long long a,long long b){
    return a*b/gcd(a,b);
}
int main()
{
    int n,m,a[100100];
    cin>>n>>m;
    REP(i,n)
    {
        cin>>a[i];
        a[i]/=2;
    }

    long long ans=1;
    REP(i,n)
    {
        ans=ans*a[i]/__gcd(ans,a[i]);
    }
    REP(i,n)
    {
        if(ans/a[i]%2==0)
        {
            cout<<0<<endl;
            return 0;
        }
    }
    // cout<<ans<<endl;
    cout<<(m/ans+1)/2<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:35:27: error: no matching function for call to '__gcd(long long int&, int&)'
   35 |         ans=ans*a[i]/__gcd(ans,a[i]);
      |                      ~~~~~^~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
                 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:35:27: note:   deduced conflicting types for parameter '_EuclideanRingElement' ('long long int' and 'int')
   35 |         ans=ans*a[i]/__gcd(ans,a[i]);
      |                      ~~~~~^~~~~~~~~~
Language: C++

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

Compiler output:
a.cc:3:1: error: 'll' does not name a type
    3 | ll gcd(ll a,ll b)
      | ^~
a.cc:7:1: error: 'll' does not name a type
    7 | ll lcm(ll a,ll b){ return a * b / gcd(a,b);}
      | ^~
a.cc: In function 'int main()':
a.cc:10:5: error: 'll' was not declared in this scope
   10 |     ll n,m;
      |     ^~
a.cc:11:12: error: 'n' was not declared in this scope; did you mean 'yn'?
   11 |     cin >> n >> m;
      |            ^
      |            yn
a.cc:11:17: error: 'm' was not declared in this scope; did you mean 'tm'?
   11 |     cin >> n >> m;
      |                 ^
      |                 tm
a.cc:21:7: error: expected ';' before 'k'
   21 |     ll k = a[0];
      |       ^~
      |       ;
a.cc:24:9: error: 'k' was not declared in this scope
   24 |         k = lcm(k,a[i]);
      |         ^
a.cc:27:7: error: expected ';' before 'ans'
   27 |     ll ans = m / k ;
      |       ^~~~
      |       ;
a.cc:28:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
   28 |     ans = (ans + 1) / 2;
      |     ^~~
      |     abs
Language: Java

import java.io.*;
import java.util.*;

public class  gym{
	static long gcd(long a,long b) {
		return b==0?a:gcd(b,a%b);
	}
	static long lcm(long a,long b) {
		return (a/gcd(a,b))*b;
	}
	public static void main(String[] args) throws Exception{
		MScanner sc=new MScanner(System.in);
		PrintWriter pw=new PrintWriter(System.out);
		int n=sc.nextInt(),m=sc.nextInt();
		int cnt2=0;
		int[]in=new int[n];
		for(int i=0;i<n;i++) {
			int x=sc.nextInt()/2;
			in[i]=x;
			int cnt=0;
			while(x%2==0) {
				x/=2;
				cnt++;
			}
			if(i==0)cnt2=cnt;
			else {
				if(cnt2!=cnt) {
					pw.println(0);
					pw.flush();
					return;
				}
			}
		}
		long lcm=1;
		for(int i=0;i<n;i++) {
			lcm=lcm(in[i],lcm);
			if(lcm>m) {
				pw.println(0);
				pw.flush();
				return;
			}
		}
		long cnt=m/lcm;
		pw.println((cnt+1)/2);
		pw.flush();
	}
	static class MScanner {
		StringTokenizer st;
		BufferedReader br;
		public MScanner(InputStream system) {
			br = new BufferedReader(new InputStreamReader(system));
		}
 
		public MScanner(String file) throws Exception {
			br = new BufferedReader(new FileReader(file));
		}
 
		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}
		public int[] takearr(int n) throws IOException {
	        int[]in=new int[n];for(int i=0;i<n;i++)in[i]=nextInt();
	        return in;
		}
		public long[] takearrl(int n) throws IOException {
	        long[]in=new long[n];for(int i=0;i<n;i++)in[i]=nextLong();
	        return in;
		}
		public Integer[] takearrobj(int n) throws IOException {
	        Integer[]in=new Integer[n];for(int i=0;i<n;i++)in[i]=nextInt();
	        return in;
		}
		public Long[] takearrlobj(int n) throws IOException {
	        Long[]in=new Long[n];for(int i=0;i<n;i++)in[i]=nextLong();
	        return in;
		}
		public String nextLine() throws IOException {
			return br.readLine();
		}
 
		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}
 
		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}
 
		public char nextChar() throws IOException {
			return next().charAt(0);
		}
 
		public Long nextLong() throws IOException {
			return Long.parseLong(next());
		}
 
		public boolean ready() throws IOException {
			return br.ready();
		}
 
		public void waitForInput() throws InterruptedException {
			Thread.sleep(3000);
		}
	}
}

Compiler output:
Main.java:4: error: class gym is public, should be declared in a file named gym.java
public class  gym{
       ^
1 error
Language: C++

#include <bits/stdc++.h>
using namespace std;
int gcd(int64_t a,int64_t b) {
  if (a % b == 0) {
    return b;
  }
  else {
  return gcd(b, a % b);
  }
}
int lcm(int64_t a,int64_t b) {
  return a * b / gcd(a,b);
}
int main() {
  lnt64_t N,M;
  cin >> N >> M;
  vector<int64_t> a(N);
  for (int64_t i = 0; i < N; i++) { 
    cin >> a.at(i);
  }
  int64_t curlcm = 1;
  for (int64_t i = 0; i < N; i++) {
    curlcm = lcm(curlcm,a.at(i));
  }
  if (M / (curlcm / 2) % 2 == 0) {
    cout << M / curlcm << endl;
  }
  else {
    cout << M / curlcm + 1 << endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:3: error: 'lnt64_t' was not declared in this scope; did you mean 'int64_t'?
   15 |   lnt64_t N,M;
      |   ^~~~~~~
      |   int64_t
a.cc:16:10: error: 'N' was not declared in this scope
   16 |   cin >> N >> M;
      |          ^
a.cc:16:15: error: 'M' was not declared in this scope
   16 |   cin >> N >> M;
      |               ^