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

#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; i++ )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
int dx[4]={1,0,-1,0} , dy[4]={0,1,0,-1} ;

int n,m,cnt;
vector<int> v[101010];
ll a[101010];
int color[101010];
map<pint,ll> mp;
bool nibu;

void dfs(int x){
    for(auto to:v[x]){
        if(!color[to]){
            a[to]=mp[{x,to}]-a[x];
            color[to]=-color[x];
            dfs(to);
        }
        else{
            else{
                nibu=false;
                if(mp[{to,x}]==a[to])continue;
                if(cnt==0){
                    if((mp[{to,x}]-a[to]-a[x])%2)ok=false;
                    else {
                        cnt++;
                        ll r=(mp[{to,x}]-a[to]-a[x])/2+a[x];
                        rep(i,n)color[i]=0;
                        rep(i,n)a[i]=0;
                        a[x]=r;
                        color[x]=1;
                        dfs(x);
                    }
                }
            }
        }
    }
}

int main(){
   cin>>n>>m;
   rep(i,m){
       int x,y,z;
       cin>>x>>y>>z;
       x--;y--;
       v[x].push_back(y);
       v[y].push_back(x);
       mp[{x,y}]=z;
       mp[{y,x}]=z;
   }
   a[0]=1;
   color[0]=1;
   nibu=true;
   dfs(0);
   for(auto x:mp){
       if(a[x.first.first]+a[x.first.second]!=x.second){
           cout<<0<<endl;
           return 0;
       }
   }
   if(nibu){
       ll mi1=longinf,mi0=longinf;
       rep(i,n){
           if(color[i]==1)mi1=min(mi1,a[i]);
           if(color[i]==-1)mi0=min(mi0,a[i]);
       }
       cout<<max(0LL,mi1+mi0-1)<<endl;
   }
   else{
       ll mi=longinf;
       rep(i,n)mi=min(mi,a[i]);
       if(mi>0)cout<<1<<endl;
       if(mi<=0)cout<<0<<endl;
   }
   return 0;
}


Compiler output:
a.cc: In function 'void dfs(int)':
a.cc:38:13: error: 'else' without a previous 'if'
   38 |             else{
      |             ^~~~
a.cc:42:50: error: 'ok' was not declared in this scope
   42 |                     if((mp[{to,x}]-a[to]-a[x])%2)ok=false;
      |                                                  ^~
Language: C++

#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <stack>

using namespace std;

typedef long long ll;
typedef pair<int, ll> P;

#define fs first
#define sc second

int n, m2;
struct edge{
    int to;
    ll s;
    ll ord;
};

vector<edge> e[100010];
int e_check[100100], v_check[100100][2];
ll v_value[100100][2];

void dfs(int s, ll a, int pm){
    if(v_check[s][pm] == 1) return;

    v_check[s][pm] = 1;
    v_value[s][pm] = a;
    for(int i = 0; i < e[s].size(); i++){
        int dis = e[s][i].to;
        ll cost = e[s][i].s;
        dfs(dis, cost-a, 1-pm);
    }

}

int main(){
    cin >> n >> m2;
    for(int i = 0; i < m2; i++){
        int u, v, s;    cin >> u >> v >> s;
        u--; v--;
        edge ee, ee2;
        ee.to = v; ee.s = s; ee.ord = i;
        ee2.to = u; ee2.s = s; ee2.ord = i;
        e[u].emplace_back(ee);
        e[v].emplace_back(ee2);
    }

    fill(v_check[0], v_check[0]+n, 0);
    fill(v_check[1], v_check[1]+n, 0);

    dfs(0, 0, 0);

    ll t = -1;
    ll ub = 1LL << 60, lb = 1LL;
    for(int i = 0; i < n; i++){
        if(v_check[i][0] == 1 && v_check[i][1]){
            ll a = v_check[i][0], b = v_check[i][1];
            if((a + b) % 2 == 1){
                cout << 0 << endl;
                return 0;
            }
            else if(t != -1 && t != (a+b)/2){
                cout << 0 << endl;
                return 0;
            }
            else{
                t = (a+b)/2;
            }
        }
        else{
            if(v_check[i][0] == 1) lb = max(1-v_value[i][0], lb);
            if(v_check[i][1] == 1) ub = min(v_value[i][1]+1, ub);
        }
    }
    if(t != -1){
        if(t >= lb && t <= ub)  cout << 1 << endl;
        else cout << 0 << endl;
    }
    else{
        else cout << max(0LL, ub - lb + 1) << endl;
    }



    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:89:9: error: 'else' without a previous 'if'
   89 |         else cout << max(0LL, ub - lb + 1) << endl;
      |         ^~~~
Language: C++

#include<iostream>
#include<math.h>
using namespace std;

int main()
{
  unsigned n,m,u[10001],v[10001],s[10001],num[10001],ans=0,st=0;
  bool nflg[10001],mflg[10001],flg,ok;
  cin >> n >> m;
  for(int i=0;i<m;i++){cin >> u[i] >> v[i] >> s[i];if(s[i]<s[st]){st=i;}}
  for(unsigned i=1;i<min;i++)
  {
    ok=true;
    for(int j=1;j<=n;j++)nflg[j]=false;
    nflg[u[st]]=nflg[v[st]]=true;
    num[u[st]]=i;
    num[v[st]]=min-i;
    for(int j=1;j<=m;j++)mflg[j]=false;
    mflg[st]=true;
    while(ok)
    {
      for(int j=0;j<m;j++)
      {
        if(nflg[u[j]])
          if(nflg[v[j]])
            if(mflg[j]);
            else if(num[u[j]]+num[v[j]]==s[j])
              mflg[j]=true;
            else
              ok=false;
          else if(num[u[j]]>=s[j])ok=false;
          else {num[v[j]]=s[j]-num[u[j]];nflg[v[j]]=true;mflg[j]=true;}
        else if(nflg[v[j]])
          if(num[v[j]]>=s[j])ok=false;
          else {num[u[j]]=s[j]-num[v[j]];nflg[u[j]]=true;mflg[j]=true;}
      }
      flg=true;
      for(int j=1;j<=m;j++)if(!mflg[j]){flg=false;break;}
      if(flg){ans++;break;}
    }
  }
  cout << ans << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:21: error: invalid operands of types 'unsigned int' and '<unresolved overloaded function type>' to binary 'operator<'
   11 |   for(unsigned i=1;i<min;i++)
      |                    ~^~~~
a.cc:17:19: error: invalid operands of types '<unresolved overloaded function type>' and 'unsigned int' to binary 'operator-'
   17 |     num[v[st]]=min-i;
      |                ~~~^~
Language: C++

#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,lint> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
//問題文および制約はちゃんと確認しよう！
//サイズは10^5じゃなくて2×10^5とかかもしれないし、重要な制約・条件を見落としているかも
//とりあえずサンプルを読んでから解法を考えよう？
vector<pint> gr[100100];
int pat[100100];lint dp[100100];
int n1=-1,n2=-1;
int ok=1;
void dfs(int v,int p,lint nu){
	if(pat[v]>=0){
		if(dp[v]!=nu) ok=0;return 0;
	}
	dp[v]=nu;pat[v]=p;
	rep(i,gr[v].size()){
		int np=1-p,nv=gr[v][i].fi;
		if(pat[nv]!=-1){
			if(pat[nv]!=np && n1<0) n1=v,n2=nv;
		}
		dfs(nv,np,gr[v][i].se-nu);
	}
}
void dfs2(int v,lint nu){
	if(nu<=0){
		ok=0;return;
	}
	if(dp[v]>=0){
		if(nu<=0 || dp[v]!=nu){
			ok=0;
		}
		return;
	}
	dp[v]=nu;
	rep(i,gr[v].size()) dfs2(gr[v][i].fi,gr[v][i].se-nu);
}
int main()
{
	int n,m,u,v,s;
	cin>>n>>m;
	rep(i,m){
		cin>>u>>v>>s;u--;v--;
		gr[u].pb(mp(v,s));
		gr[v].pb(mp(u,s));
	}
	memset(pat,-1,sizeof(pat));
	dfs(0,0,0);
	if(ok==0){
		cout<<0<<endl;return 0;
	}
	if(n1<0){
		lint p0=123456789012345678LL,p1=123456789012345678LL;
		rep(i,n){
			assert(pat[i]==0 || pat[i]==1);
			if(pat[i]==0) p0=min(p0,dp[i]);else p1=min(p1,dp[i]);
		}
		cout<<max(0LL,p0+p1-1LL)<<endl;
		return 0;
	}
	lint t=-1;
	rep(i,gr[n1].size()){
		if(gr[n1][i].fi==n2) t=gr[n1][i].se;
	}
	if((t+dp[n1]-dp[n2])%2!=0LL){
		cout<<0<<endl;return 0;
	}
	lint x=(t+dp[n1]-dp[n2])/2;
	memset(dp,-1,sizeof(dp));
	dfs2(n1,x);
	cout<<ok<<endl;
}


Compiler output:
a.cc: In function 'void dfs(int, int, lint)':
a.cc:43:43: error: return-statement with a value, in function returning 'void' [-fpermissive]
   43 |                 if(dp[v]!=nu) ok=0;return 0;
      |                                           ^
Language: C++

 
#include <cstdio>
#include <vector>
#include <string>
#include <queue>
#include <cstring>
using namespace std;

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

bool found_odd = false;
vector<int> values_odd;
int pos_odd;

int dfs(int n, vector<pii> e[], pii seen[], vector<int>& values, int pos, int dep, int tmp[], int tmp2[]) {
  fprintf(stderr, "pos: %d dep: %d\n", pos, dep);
  for (const pii& edge : e[pos]) {
    int next_pos = edge.first;
    int next_dep = dep + 1;
    if (next_pos == seen[pos].second) continue;

    if (seen[next_pos].first != -1) {
      if ((next_dep - seen[next_pos].first) % 2 && !found_odd) {
        int cur_pos = pos;
        values.push_back(edge.second);
        vector<int> poses;
        while(cur_pos != next_pos) {
          poses.push_back(cur_pos);
          fprintf(stderr, "cur_pos: %d next_pos: %d\n", cur_pos, next_pos);
          cur_pos = seen[cur_pos].second;
        }
        found_odd = true;
        values_odd = values;
        pos_odd = pos;
      }
    } else {
      fprintf(stderr, "pushing next_pos: %d\n", next_pos);
      values.push_back(edge.second);
      seen[next_pos] = make_pair(next_dep, pos);
      tmp[next_pos] = edge.second - tmp[pos];
      tmp2[next_pos] = edge.second - tmp2[pos];
      dfs(n, e, seen, values, next_pos, next_dep, tmp, tmp2);
    }
  }
  return 0;
}

int main() {
  int n, m; scanf("%d%d", &n, &m);
  vector<pii> e[n];
  for (int i = 0; i < m; ++i) {
     int u, v, s; scanf("%d%d%d", &u, &v, &s); u--; v--;
     e[u].push_back(make_pair(v, s));
     e[v].push_back(make_pair(u, s));
  }

  pii seen[n]; memset(seen, -1, sizeof(seen)); // dep, prev
  int tmp[n], tmp2[n];
  vector<int> values;
  tmp[0] = 1;
  tmp2[0] = 2;
  seen[0] = make_pair(0, -1);
  dfs(n, e, seen, values, 0, 0, tmp, tmp2);

#if 1
  for (int i = 0; i < n; ++i) {
    printf("tmp[%d]: %d %d\n", i, tmp[i], tmp2[i]);
  }
#endif

  if (found_odd == false) {
    int minv = -0x3fffffff;
    int maxv =  0x3fffffff;
    for (int i = 0; i < n; ++i) {
      if (tmp[i] < tmp2[i]) minv = max(minv, 1 - tmp[i]);
      if (tmp[i] > tmp2[i]) maxv = min(maxv, tmp[i] - 1);
#if 0
      if (tmp[i] < tmp2[i]) printf("minv: %d\n", 1 - tmp[i]);
      if (tmp[i] > tmp2[i]) printf("maxv: %d\n", tmp[i] - 1);
#endif
    }
#if 0
    printf("%d %d / ", maxv, minv);
#endif
    printf("%lld\n", max<ll>(0, (ll)maxv - minv + 1));
  } else {
    int sum = 0;
    for (int i = 0; i < values_odd.size(); ++i) {
      if (i % 2) {
        sum -= values_odd[i];
      } else {
        sum += values_odd[i];
      }
    }
    if (sum % 2 == 1) {
      puts("1");
      return 0;
    }
    int diff = tmp[i] - sum/2;
    for (int i = 0; i < n; ++i) {
      tmp[i] += diff;
    }
    bool okay = true;
    for (int i = 0; i < n; ++i) {
      for (const pii& edge : e[i]) {
        if (tmp[i] + tmp[edge.first] != edge.second) okay = false;
      }
    }
    printf("%d\n", okay ? 1 : 0);
  }
  return 0;
}
	 

Compiler output:
a.cc: In function 'int main()':
a.cc:101:20: error: 'i' was not declared in this scope
  101 |     int diff = tmp[i] - sum/2;
      |                    ^
Language: C++

#include <iostream>
#include <vector>
#include <cmath>
#define ll long long int

using namespace std;

int u[100001], v[100001], s[100001], par[100001];
typedef pair<int, int> P;
vector<P> vec[100001];
int em[100001];

int main(int argc, char const* argv[])
{
	int n, m;
	cin >> n >> m;
	for(int i = 0; i < m; i++){
			cin >> u[i] >> v[i] >> s[i];
			u[i]--;
			v[i]--;
			vec[u[i]].push_back(make_pair(v[i], s[i]));
			vec[v[i]].push_back(make_pair(u[i], s[i]));
	}
	for(int i = 0; i < n; i++){
			for(int j = 0; j < vec[i].size(); j++){
					em[i] = max(em[i], vec[i][j].second);
			}
	}
	int res = 1e9;
	for(int i = 0; i < n; i++){
			int mini = 0
			for(int j = 0; j < vec[i].size(); j++){
					int to = vec[i][j].first;
					int cost = vec[i][j].second;
					for(int k = 0; k < vec[j].size(); k++){
							if(k != i){
									if(cost >= vec[j][k].second){
											mini = max(mini, cost - vec[j][k].second + 1);
									}
							}
					}
			}
			res = min(res, em[i] - mini + 1);
	}
	cout << res << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:32:25: error: expected ',' or ';' before 'for'
   32 |                         for(int j = 0; j < vec[i].size(); j++){
      |                         ^~~
a.cc:32:40: error: 'j' was not declared in this scope
   32 |                         for(int j = 0; j < vec[i].size(); j++){
      |                                        ^
Language: C++

#include<bits/stdc++.h>
#define all(vec) vec.begin(),vec.end()
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const ll MOD=1000000007;
const ll INF=1000000010;
const ll LINF=4000000000000000010;
int dx[5]={0,1,0,-1,0};
int dy[5]={1,0,-1,0,0};
struct edge{
    int to,cost;
};
vector<edge> G[100010];
int num[100010];
bool dfs(int v){
    bool res=true;
    for(auto e:G[v]){
        if(num[e.to]>0){
            if(num[e.to]+num[v]!=e.cost){
                res=false;
            }
        }else{
            if(num[v]>=e.cost){
                res=false;
            }else{
                num[e.to]=e.cost-num[v];
                res&=dfs(e.to);
            }
        }
    }
    return res;
}
int main(){
    int n,m;cin>>n>>m;
    for(int i=0;i<m;i++){
        int u,v,s;cin>>u>>v>>s;u--;v--;
        G[u].push_back({v,s});
        G[v].push_back({u,s});
    }
    int s=0;
    int ok=0;
    int ng=INF;
    if(!dfs2(0,0)){
        cout<<0<<endl;
        return 0;
    }
    while(ng-ok>1){
        int mid=(ng+ok)/2;
        fill(num,num+n,0);
        num[s]=mid;
        if(dfs(s)){
            ok=mid;
        }else{
            ng=mid;
        }
    }
    if(ok==0){
        cout<<0<<endl;
        return 0;
    }
    int ok1=ok;
    ng=0;
    while(ok-ng>1){
        int mid=(ng+ok)/2;
        fill(num,num+n,0);
        num[s]=mid;
        if(dfs(s)){
            ok=mid;
        }else{
            ng=mid;
        }
    }
    if(ok==0){
        ok++;
    }
    cout<<ok1-ok+1<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:44:9: error: 'dfs2' was not declared in this scope; did you mean 'dfs'?
   44 |     if(!dfs2(0,0)){
      |         ^~~~
      |         dfs
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1e9+7,MAXL=1LL<<60,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<ll,ll> P;

ll d[111111][5];
P p[111111];
vector<P> v[111111];
ll ans=MAXL;

void dfs(ll x,ll t,ll l,ll r) {
  if(t>5||d[x][t]) return;
  p[x].F=max(p[x].F,l);
  p[x].S=min(p[x].S,r);
  ans=min(M,p[x].S-p[x].F+1);
  d[x][t]=1;
  rep(i,v[x].size()) {
    ll y=v[x][i].F,z=v[x][i].S;
    ll d1=z-r,d2=z-l;
    if(d2<=0) {
      ans=0;
      return;
    } else d1=max(d1,1LL);
    if(d[y][t]) dfs(y,t+1,d1,d2);
    else dfs(y,t,d1,d2);
  }
}

void Main() {
  ll n,m;
  cin >> n >> m;
  rep(i,n)p[i]=P(1,MAXL);
  rep(i,m) {
    ll x,y,z;
    cin >> x >> y >> z;
    x--,y--;
    v[x].pb(P(y,z));
    v[y].pb(P(x,z));
    p[x].S=min(p[x].S,z-1);
    p[y].S=min(p[y].S,z-1);
  }
  dfs(0,0,1,MAXL);
  ans=max(ans,0LL);
  pr(ans);
}

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

Compiler output:
a.cc: In function 'void dfs(long long int, long long int, long long int, long long int)':
a.cc:37:11: error: 'M' was not declared in this scope
   37 |   ans=min(M,p[x].S-p[x].F+1);
      |           ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1e9+7,MAXL=1LL<<60,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<ll,ll> P;

ll d[111111][5];
P p[111111];
vector<P> v[111111];
ll ans=MAXL;

void dfs(ll x,ll t,ll l,ll r) {
  if(t>5||d[x][t]) return;
  p[x].F=max(p[x].F,l);
  p[x].S=min(p[x].S,r);
  M=min(M,p[x].S-p[x].F+1);
  d[x][t]=1;
  rep(i,v[x].size()) {
    ll y=v[x][i].F,z=v[x][i].S;
    ll d1=z-r,d2=z-l;
    if(d2<=0) {
      ans=0;
      return;
    } else d1=max(d1,1LL);
    if(d[y][t]) dfs(y,t+1,d1,d2);
    else dfs(y,t,d1,d2);
  }
}

void Main() {
  ll n,m;
  cin >> n >> m;
  rep(i,n)p[i]=P(1,MAXL);
  rep(i,m) {
    ll x,y,z;
    cin >> x >> y >> z;
    x--,y--;
    v[x].pb(P(y,z));
    v[y].pb(P(x,z));
    p[x].S=min(p[x].S,z-1);
    p[y].S=min(p[y].S,z-1);
  }
  dfs(0,0,1,MAXL);
  ans=max(ans,0LL);
  pr(ans);
}

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

Compiler output:
a.cc: In function 'void dfs(long long int, long long int, long long int, long long int)':
a.cc:37:3: error: 'M' was not declared in this scope
   37 |   M=min(M,p[x].S-p[x].F+1);
      |   ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main()
{
    ll N, M;
    cin >> N >> M;
    vector<vector<pair<ll, ll>>> g(N);
    using P = pair<ll, ll>;
    constexpr P NOT = {0, 0};
    vector<P> w(N, NOT);
    for (ll i = 0; i < M; i++) {
        ll u, v;
        ll s;
        cin >> u >> v >> s;
        u--, v--;
        g[u].push_back({v, s}), g[v].push_back({u, s});
    }
    ll ans = 0;
    auto dfs = [&](auto&& self, const ll s, const ll v, const ll par) -> void {
        w[s] = {v, par};
        for (const auto& e : g[s]) {
            const ll sum = e.second;
            const ll to = e.first;
            if (w[to] != NOT) {
                if (w[to].second == par) {
                    ll n = sum - v - w[to].first;
                    if (par == 1) {
                        if (n % 2 != 0 or n <= 0) {
                            ans = -1;
                        } else if (ans == 0) {
                            ans = n / 2;
                        } else {
                            if (ans != n / 2) { ans = -1; }
                        }
                    } else if (par == -1) {
                        n = -n;
                        if (n % 2 != 0 or n <= 0) {
                            ans = -1;
                        } else if (ans == 0) {
                            ans = n / 2;
                        } else {
                            if (ans != n / 2) { ans = -1; }
                        }
                    } else {
                        assert(false);
                    }
                } else {
                    if (v + w[to].first != sum) { ans = -1; }
                }
            } else {
                self(self, to, sum - v, -par);
            }
        }
    };
    dfs(dfs, 0, 0, 1);
    if (ans != 0) {
        if (ans == -1) {
            cout << 0 << endl;
            return 0;
        } else {
            
            for(int i = 0; i < N; i++){
                if(w[i].first+w[i].second*ans<= 0){cout << 0 << endl;return 0;x}
                
            }
            cout << 1 << endl;
            return 0;
        }
    }
    ll inf = 1, sup = 1000000000;
    for (ll i = 0; i < N; i++) {
        if (w[i].second == 1) {
            inf = max(inf, -w[i].first + 1LL);
        } else {
            sup = min(sup, w[i].first - 1LL);
        }
    }
    cout << max(0LL, sup - inf + 1LL) << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:64:79: error: 'x' was not declared in this scope
   64 |                 if(w[i].first+w[i].second*ans<= 0){cout << 0 << endl;return 0;x}
      |                                                                               ^
Language: C++

/// Zhupengfei 2018
/// Hereby declare: this program is in public domain.

/// Solution for problem: Soundhound E
#include <bits/stdc++.h>

#ifdef LOCAL
#pragma GCC poison printf // To avoid fastio problems
#pragma GCC poison scanf
#endif

using namespace std;

struct rec{
	int v, s;
};

int limit[100001]={};
bool flag[100001]={};
bool v[100001]={};
int value[100001]={};
vector<rec> sons[100001]={}; 
int n, m;
int minx=0, maxx=1e9;

void check(int, int);

void dfs(int x, int c, int parent) {
	v[x]=1;
	for(const auto& it: sons[x]) {
		if(v[it.v] && it.v!=parent) { // loop found, can calc determined x
			bool tobeflag=!flag[x];
			int tobelimit=it.s-limit[x];
			if(tobeflag==flag[it.v] && tobelimit!=limit[it.v]) {
				cout<<0<<endl;
				return 0;
			} else if(tobeflag==flag[it.v]) continue; // useless loop
			int decidex;
			if(!tobeflag) { //to be is false
				decidex=(-tobelimit+limit[it.v])/2;
			} else {
				decidex=(tobelimit-limit[it.v])/2;
			}
			value[x]=decidex;
			check(1, decidex);
			cout<<1<<endl;
			exit(0);
		} else if(it.v!=parent) { // normal
			flag[it.v]=!flag[x];
			limit[it.v]=it.s-limit[x];
			if(flag[it.v]) {
				maxx=min(maxx, limit[it.v]);
			} else {
				minx=max(minx, -limit[it.v]);
			}
			if(minx>=maxx) {
				cout<<0<<endl;
				exit(0);
			}
			dfs(it.v, c+1, x);
		}
	}
}

void check(int u, int x) { // I have decided the x! I'm super powerful!
	v[u]=1;
	for(const auto& it: sons[u]) {
		if(!v[it.v]){
			value[it.v]=it.s-value[u];
			if(value[it.v]<=0) {
				cout<<0<<endl;
				exit(0);
			} else {
				check(it.v, x);
			}
		}
	}
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	
	cin>>n>>m;
	int u, v, s;
	for(int i=1;i<=m;i++) {
		cin>>u>>v>>s;
		sons[u].push_back({v, s});
		sons[v].push_back({u, s});
	}
	flag[1]=false; // false: positive, true: negative
	dfs(1, 1, 0);
	cout<<maxx-minx-1<<endl;
	return 0;
}



Compiler output:
a.cc: In function 'void dfs(int, int, int)':
a.cc:36:40: error: return-statement with a value, in function returning 'void' [-fpermissive]
   36 |                                 return 0;
      |                                        ^
Language: C++

#inlcude <iostream>
using namespace std;
int main() {
cout << 0;
return 0;
}

Compiler output:
a.cc:1:2: error: invalid preprocessing directive #inlcude; did you mean #include?
    1 | #inlcude <iostream>
      |  ^~~~~~~
      |  include
a.cc: In function 'int main()':
a.cc:4:1: error: 'cout' was not declared in this scope
    4 | cout << 0;
      | ^~~~
a.cc:1:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | #inlcude <iostream>
Language: C++

#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#define SF scanf
#define PF printf
#define MAXN 100010
#define INF 1000000000000000ll
using namespace std;
typedef long long ll;
int n,m;
vector<int> a[MAXN];
vector<ll> val[MAXN];
ll sum[MAXN];
int tim[MAXN];
bool vis[MAXN],flag;
ll minl,maxl,now;
void upd(ll x,int ts){
	if(ts<0)
		maxl=min(maxl,x-1);
	else
		minl=max(minl,-x+1);
}
void updx(ll valx,ll valy,ll sumv,int tims){
	//PF("{%lld %lld %lld %d}",valx,valy,sumv,tims);
	if(tims>0){
		if(sumv-valx-valy<=0||(sumv-valx-valy)%2ll!=0)
			flag=1;
		else{
			if(now!=-1&&now!=(sumv-valx-valy)/2ll)
				flag=1;	
			else
				now=(sumv-valx-valy)/2ll;
		}
	}
	else{
		if(-sumv+valx+valy<=0||(-sumv+valx+valy)%2ll!=0)
			flag=1;
		else{
			if(now!=-1&&now!=(-sumv+valx+valy)/2ll)
				flag=1;	
			else
				now=(-sumv+valx+valy)/2ll;
		}
	}
}
void dfs(int x){
	vis[x]=1;
	//PF("{%d %lld %d}\n",x,sum[x],tim[x]);
	for(int i=0;i<a[x].size();i++){
		int u=a[x][i];
		upd(val[x][i]-sum[x],-tim[x]);
		if(vis[u]==1){
			if(tim[x]!=tim[u]){
				if(sum[x]+sum[u]!=val[x][i])
					flag=1;	
			}
			else{
				updx(sum[x],sum[u],val[x][i],tim[x]);
			}
		}
		else{
			sum[u]=val[x][i]-sum[x];
			tim[u]=-tim[x];
			dfs(u);	
		}
	}
}
int main(){
	now=-1;
	SF("%d%d",&n,&m);
	int u,v;
	ll w;
	for(int i=1;i<=m;i++){
		SF("%d%d%lld",&u,&v,&w);	
		a[u].push_back(v);
		a[v].push_back(u);
		val[u].push_back(w);
		val[v].push_back(w);
	}
	sum[1]=0;
	tim[1]=1;
	minl=1,maxl=INF;
	dfs(1);
	//PF("{%lld %lld %lld}",now,minl,maxl);
	if(flag==1)
		PF("0");
	else if(now!=-1){
		if(now>=minl&&now<=maxl)
			PF("1");
		else
			PF("0");	
	}
	else 
		PF("%lld",max(0ll,maxl-minl));
}


Compiler output:
a.cc:12:1: error: 'vector' does not name a type
   12 | vector<int> a[MAXN];
      | ^~~~~~
a.cc:13:1: error: 'vector' does not name a type
   13 | vector<ll> val[MAXN];
      | ^~~~~~
a.cc: In function 'void dfs(int)':
a.cc:50:23: error: 'a' was not declared in this scope
   50 |         for(int i=0;i<a[x].size();i++){
      |                       ^
a.cc:52:21: error: 'val' was not declared in this scope
   52 |                 upd(val[x][i]-sum[x],-tim[x]);
      |                     ^~~
a.cc: In function 'int main()':
a.cc:76:17: error: 'a' was not declared in this scope
   76 |                 a[u].push_back(v);
      |                 ^
a.cc:78:17: error: 'val' was not declared in this scope
   78 |                 val[u].push_back(w);
      |                 ^~~
Language: C

#include<iostream>
 
using namespace std;
 
int main(){
    long long n;
    cin >> n;
    if(n%2==1)printf("%lld\n", n*2);
    else printf("%lld\n", n);
    return 0;
}

Compiler output:
main.c:1:9: fatal error: iostream: No such file or directory
    1 | #include<iostream>
      |         ^~~~~~~~~~
compilation terminated.
Language: C

#include<stdio.h>

int main(void){
  int n;
  scanf("%d",&n)+
    if(n%2==0){
      printf("%d\n",n);
    }else{
      printf("%d\n",2*n);
    }
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:6:5: error: expected expression before 'if'
    6 |     if(n%2==0){
      |     ^~
Language: C++

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

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

    if(N % 2 == 0){
        cout << N << endl;
    }
    else{
        cout << N * 2 << ensl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:26: error: 'ensl' was not declared in this scope
   12 |         cout << N * 2 << ensl;
      |                          ^~~~
Language: C++

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

int main() {
  ll n;
  cin>>n;
  if (n%2) n*=2;
  cout<<n;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:3: error: 'll' was not declared in this scope
    5 |   ll n;
      |   ^~
a.cc:6:8: error: 'n' was not declared in this scope; did you mean 'yn'?
    6 |   cin>>n;
      |        ^
      |        yn
Language: C++

#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i, n) for (int i = 0, i##_len = (int)(n); i < i##_len; i++)
#define reps(i, n) for (int i = 1, i##_len = (int)(n); i <= i##_len; i++)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define repi(i, x) \
	for (auto i = (x).begin(), i##_fin = (x).end(); i != i##_fin; i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a) ? "Yes" : "No")
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int, int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long, long long> P;
typedef vector<P> VP;
template <class T>
inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return 1;
	}
	return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return 1;
	}
	return 0;
}
const long long INFLL = 1LL << 60;
const int INF         = 1 << 30;
const double PI       = acos(-1);
int main() {
	ll ans = 0;
	ll n;
	cin >> n;

	cout << (n%2==0)?n:n*2 << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:48:32: error: invalid operands of types 'll' {aka 'long long int'} and '<unresolved overloaded function type>' to binary 'operator<<'
   48 |         cout << (n%2==0)?n:n*2 << endl;
      |                            ~~~~^~~~~~~
Language: C++

#include<iostream>
using namespace std;
int main(){
  int N;
  cin >> N;
  if(N%2 == 0){
    printf(N);
  }else{
    printf(2*N)
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:12: error: invalid conversion from 'int' to 'const char*' [-fpermissive]
    7 |     printf(N);
      |            ^
      |            |
      |            int
In file included from /usr/include/c++/14/cstdio:42,
                 from /usr/include/c++/14/ext/string_conversions.h:45,
                 from /usr/include/c++/14/bits/basic_string.h:4154,
                 from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/stdio.h:363:43: note:   initializing argument 1 of 'int printf(const char*, ...)'
  363 | extern int printf (const char *__restrict __format, ...);
      |                    ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
a.cc:9:13: error: invalid conversion from 'int' to 'const char*' [-fpermissive]
    9 |     printf(2*N)
      |            ~^~
      |             |
      |             int
/usr/include/stdio.h:363:43: note:   initializing argument 1 of 'int printf(const char*, ...)'
  363 | extern int printf (const char *__restrict __format, ...);
      |                    ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
a.cc:9:16: error: expected ';' before '}' token
    9 |     printf(2*N)
      |                ^
      |                ;
   10 |   }
      |   ~
Language: Java

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scan=new Scanner (System.in);
		int n=scan.nextInt();
		int s=0;
		if(n%2==0 ) {
			System.out.println(n);
		}
		else {
			System.out.println(2*n);
		}
	}

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

#include<bits\stdc++.h>
using namespace std;
int main()
{
    int a;
    cin>>a;
    if(a%2==0)
    {
        cout<<a<<endl;
    }
    else{cout<<a*2<<endl;}
    return 0;
}


Compiler output:
a.cc:1:9: fatal error: bits\stdc++.h: No such file or directory
    1 | #include<bits\stdc++.h>
      |         ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include<bits\stdc++.h>
using namespace std;
int main()
{
    long long n;
    cin>>n;
    if(n%2==0)
    {
        cout<<n<<endl;
    }
    else
    {
        cout<<2*n<<endl;
    }
}


Compiler output:
a.cc:1:9: fatal error: bits\stdc++.h: No such file or directory
    1 | #include<bits\stdc++.h>
      |         ^~~~~~~~~~~~~~~
compilation terminated.
Language: C

#include<stdio.h>
int main()
{
	long long int N,a;
	scanf("%lld",&N)
	
	if(N%2==0)
	{
		printf("%lld", N);
	}
	else
	{
		a=N*2;
		printf("ll%d",a);
	}
	
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:5:25: error: expected ';' before 'if'
    5 |         scanf("%lld",&N)
      |                         ^
      |                         ;
    6 | 
    7 |         if(N%2==0)
      |         ~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(void){
int n,i=2;cin>>n;
while(true){
  if(i%2==0&&i%n==0)
    (cout<<i<<endl;return 0;)
  i+=1;
return 0;}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:19: error: expected ')' before ';' token
    7 |     (cout<<i<<endl;return 0;)
      |     ~             ^
      |                   )
a.cc:7:29: error: expected primary-expression before ')' token
    7 |     (cout<<i<<endl;return 0;)
      |                             ^
a.cc:9:11: error: expected '}' at end of input
    9 | return 0;}
      |           ^
a.cc:3:15: note: to match this '{'
    3 | int main(void){
      |               ^
Language: Java

import java.util.Arrays;
import java.util.Scanner;

public class LinearApproximation {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] arr = new int[n];
        long sum = 0;
        int median;
        for (int i = 0; i < n; i++) {
            arr[i] = sc.nextInt() - (i + 1);
            sum += arr[i];
        }

        Arrays.sort(arr);
        if (n % 2 == 0)
            median = (arr[(n - 1) / 2] + arr[n / 2]) / 2;
        else
            median = arr[n / 2];

        sum = 0;
        for (int i = 0; i < n; i++) {
            sum += Math.abs(arr[i] - median);
        }
        System.out.println(sum);
    }
}


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

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

int main(void){
    
    int n;
    cin >> n;
    
    if(N%2 == 0){
        cout << n <<endl;
    }
    else{
        cout << 2*n <<endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:8: error: 'N' was not declared in this scope
    9 |     if(N%2 == 0){
      |        ^
Language: C++

#include<iostream>
#include<math.h>
using namespace std;
int main(){
  int n;cin>>n;
  cout<<__lcm(2,n)<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:9: error: '__lcm' was not declared in this scope
    6 |   cout<<__lcm(2,n)<<endl;
      |         ^~~~~
Language: C++

#include<iostream>

int main(){
  long long int N;
  cin >> N;
  if(N % 2 == 0){
  	cout >> N >> endl; 
  }
  else{
    cout >> N * 2 >> endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:5:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    5 |   cin >> N;
      |   ^~~
      |   std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:7:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
    7 |         cout >> N >> endl;
      |         ^~~~
      |         std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:7:22: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
    7 |         cout >> N >> endl;
      |                      ^~~~
      |                      std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
a.cc:10:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   10 |     cout >> N * 2 >> endl;
      |     ^~~~
      |     std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:10:22: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   10 |     cout >> N * 2 >> endl;
      |                      ^~~~
      |                      std::endl
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C++

#include<iostream>

int main(){
  ll N;
  cin >> N;
  if(N % 2 == 0){
  	cout >> N >> endl; 
  }
  else{
    cout >> N * 2 >> endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:4:3: error: 'll' was not declared in this scope
    4 |   ll N;
      |   ^~
a.cc:5:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    5 |   cin >> N;
      |   ^~~
      |   std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:5:10: error: 'N' was not declared in this scope
    5 |   cin >> N;
      |          ^
a.cc:7:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
    7 |         cout >> N >> endl;
      |         ^~~~
      |         std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:7:22: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
    7 |         cout >> N >> endl;
      |                      ^~~~
      |                      std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
a.cc:10:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   10 |     cout >> N * 2 >> endl;
      |     ^~~~
      |     std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:10:22: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   10 |     cout >> N * 2 >> endl;
      |                      ^~~~
      |                      std::endl
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: Java

import java.util.*;
 
public class Main{
  
  	public static void main(String[] args){
      	
      	Scanner sc = new Scanner(System.in);
      	int N = sc.nextInt();
      	if(N%2==0){
          System.out.println(N);
        }else{
          System.out.println(N*2)
        }
    }
}

Compiler output:
Main.java:12: error: ';' expected
          System.out.println(N*2)
                                 ^
1 error
Language: Java

import java.until.*;
 
public class Main{
  
  	public static void main(String[] args){
      	
      	Scanner sc = new Scanner(System.in);
      	int N = sc.nextInt();
      	if(N%2==0){
          System.out.println(N);
        }else{
          System.out.println(N*2);
        }
    }
}

Compiler output:
Main.java:1: error: package java.until does not exist
import java.until.*;
^
Main.java:7: error: cannot find symbol
      	Scanner sc = new Scanner(System.in);
      	^
  symbol:   class Scanner
  location: class Main
Main.java:7: error: cannot find symbol
      	Scanner sc = new Scanner(System.in);
      	                 ^
  symbol:   class Scanner
  location: class Main
3 errors
Language: Java

import java.until.*;

public class Main{
  
  	public static void main(String[] args){
      	
      	Scanner sc = new Scanner(System.in);
      	int N = sc.nextInt();
      	if(N%2==0){
          System.out.println(N);
        }else{
          System.out.println(N*2)
        }
    }
}

Compiler output:
Main.java:12: error: ';' expected
          System.out.println(N*2)
                                 ^
1 error
Language: C++

#include <iostram>

using namespace std;

int main()
{
  long long int n = 0;
  
  cin >> n;
  
  if (n%2) {
    cout << n*2 << endl;
  }
  else {
    cout << n << endl;
  }
}

Compiler output:
a.cc:1:10: fatal error: iostram: No such file or directory
    1 | #include <iostram>
      |          ^~~~~~~~~
compilation terminated.
Language: C++

#include<iostream>
#include<conio.h>
using namespace std;

int main()
{
	int n;
	cin>>n;
	if(n%2!=0){cout<<n*2;}
	else {cout<<n;}}


Compiler output:
a.cc:2:9: fatal error: conio.h: No such file or directory
    2 | #include<conio.h>
      |         ^~~~~~~~~
compilation terminated.
Language: C++

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

int main(){
    int N;
    cin >> N;
    if(N%2){
        cout << N*2:
    }else{
        cout << N;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:20: error: expected ';' before ':' token
   12 |         cout << N*2:
      |                    ^
      |                    ;
Language: C++

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll,ll>;
using vl = vector<ll>;
using Map = map<ll,ll>;
using Tup = tuple<ll,ll,ll>;
using vvl = vector<vector<ll>>;
#define all(v) v.begin(), v.end()
#define prt(v) cout<<(v)<<"\n";
#define fl cout<<flush;
#define fi(v) get<0>(v)
#define se(v) get<1>(v)
#define th(v) get<2>(v)
#define endl "\n"
template <typename T> bool chmax(T &a, const T &b){if (a<b){a=b;return 1;}return 0;}
template <typename T> bool chmin(T &a, const T &b){if (a>b){a=b;return 1;}return 0;}
const ll INF=1LL<<60;
const ll MOD=1000000007;

signed main(void){
    cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    prt(N*2/__gcd(2,N))

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:26:18: error: no matching function for call to '__gcd(int, ll&)'
   26 |     prt(N*2/__gcd(2,N))
      |             ~~~~~^~~~~
a.cc:11:23: note: in definition of macro 'prt'
   11 | #define prt(v) cout<<(v)<<"\n";
      |                       ^
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h:1137:5: note: candidate: 'template<class _EuclideanRingElement> _EuclideanRingElement std::__gcd(_EuclideanRingElement, _EuclideanRingElement)'
 1137 |     __gcd(_EuclideanRingElement __m, _EuclideanRingElement __n)
      |     ^~~~~
/usr/include/c++/14/bits/stl_algo.h:1137:5: note:   template argument deduction/substitution failed:
a.cc:26:18: note:   deduced conflicting types for parameter '_EuclideanRingElement' ('int' and 'long long int')
   26 |     prt(N*2/__gcd(2,N))
      |             ~~~~~^~~~~
a.cc:11:23: note: in definition of macro 'prt'
   11 | #define prt(v) cout<<(v)<<"\n";
      |                       ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    if(n%2==0)cout << n << endl;
    else cout << 2:n << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:19: error: expected ';' before ':' token
    7 |     else cout << 2:n << endl;
      |                   ^
      |                   ;
Language: Java

import java.util.Scanner;
  public class Main{
    public static void main(String[] args){
     Scanner sc = new Scanner(System.in);
     int n = sc.nextInt();
  //  int n =10;
    int max = 999999999;
    int answer = 0;
    Boolean i = true;
    while(i){
      if((i%n == 0) && (i%2 == 0)){
        answer = i;
        i=false;
      }
    }
    System.out.println(answer);
  }
}


Compiler output:
Main.java:11: error: bad operand types for binary operator '%'
      if((i%n == 0) && (i%2 == 0)){
           ^
  first type:  Boolean
  second type: int
Main.java:11: error: bad operand types for binary operator '%'
      if((i%n == 0) && (i%2 == 0)){
                         ^
  first type:  Boolean
  second type: int
Main.java:12: error: incompatible types: Boolean cannot be converted to int
        answer = i;
                 ^
3 errors
Language: Java

import java.util.Scanner;
  public class Main{
    public static void main(String[] args){
     Scanner sc = new Scanner();
     int n = sc.nextInt();
    //int n = 40;
    int max = 1000;
    int answer = 0;
    for(int i = 1;i<max;i++){
      if((i%n == 0) && (i%2 == 0)){
        answer = i;
        break;
      }
    }
    System.out.println(answer);
  }
}


Compiler output:
Main.java:4: error: no suitable constructor found for Scanner(no arguments)
     Scanner sc = new Scanner();
                  ^
    constructor Scanner.Scanner(Readable,Pattern) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(Readable) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(InputStream) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(InputStream,String) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(InputStream,Charset) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(File) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(File,String) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(File,Charset) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(File,CharsetDecoder) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(Path) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(Path,String) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(Path,Charset) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(String) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(ReadableByteChannel) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(ReadableByteChannel,String) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(ReadableByteChannel,Charset) is not applicable
      (actual and formal argument lists differ in length)
1 error