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

#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
using namespace std;
#define ll long long;
#define MM = 1000000000;
#define mod = MM + 7;
#define INF (ll)1e18
#define pi acos(-1.0)
#define MAX 100005
#define NIL -1
int main(){
    ll x, y; cin >> x >> y;
    ll ans = 0;
    if(x <= y){
        if(x >= 0 && y >= 0){
            ans = y-x;
        }
        else if(x <= 0 && y <= 0){
            ans = y-x;
        }
        else {
            if(abs(x) <= abs(y)){
                ans = y-abs(x)+1;
            }
            else {
                ans = y-x;
            }
        }
    } else {
        if(x >= 0 && y >= 0){
            ans = y+x+1;
        }
        else if(x <= 0 && y <= 0){
            ans = abs(x)+abs(y)+1;
        }
        else {
            if(x >= abs(y)){
                ans = abs(y)-x+1;
            }
            else {
                ans = x-abs(y)+1;
            }
        }
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:17: error: declaration does not declare anything [-fpermissive]
    6 | #define ll long long;
      |                 ^~~~
a.cc:14:5: note: in expansion of macro 'll'
   14 |     ll x, y; cin >> x >> y;
      |     ^~
a.cc:14:8: error: 'x' was not declared in this scope
   14 |     ll x, y; cin >> x >> y;
      |        ^
a.cc:14:11: error: 'y' was not declared in this scope
   14 |     ll x, y; cin >> x >> y;
      |           ^
a.cc:6:17: error: declaration does not declare anything [-fpermissive]
    6 | #define ll long long;
      |                 ^~~~
a.cc:15:5: note: in expansion of macro 'll'
   15 |     ll ans = 0;
      |     ^~
a.cc:15:8: error: 'ans' was not declared in this scope; did you mean 'abs'?
   15 |     ll ans = 0;
      |        ^~~
      |        abs
Language: C++

#include<bits/stdc++.h>
#define lli long long int
#define MOD 1000000007
#define FOR(i,n) for(int i=0;i<(int)n;i++)
#define ALL(x) (x).begin(),(x).end()
using namespace std;

inline lli getint(){
    lli n;
    scanf("%lld",&n);
    return n;
}

inline vector<lli> getints(int n){
    vector<lli> a(n);
    for(int i=0;i<n;i++)scanf("%lld",&a[i]);
    return a;
}

inline string getstr(){
  string s;
  cin>>s;
  return s;
}

inline string slice(string s,int a,int b){
  return s.substr(a,b-a-1);
}
void dumpints(vector<lli> a){
  cout<<"[";
  for(int i=0;i<a.size()-1;i++){
    cout<<a[i]<<",";
  }
  cout<<a[a.size()-1]<<"]"<<endl;
}

template<class T> bool ifinclude(vector<T> a,T x){
    auto itr=find(a.begin(),a.end(),x);
    return distance(a.begin(),itr)!=a.size();
}

int main(void){
  int x=getint(),y=getint();
  int ans;
  if(x==y){
    ans=0;
  }else if(x==-y){
    ans=1;
  }else if(x>=0&&y>=0){
    if(x<y){
      ans=y-x;
    }else{
      ans=x+y+1;
    }
  }else if(x>=0&&y<0){
    ans=abs(x+y)+1;
  }else if(x<0&&y>0){
    ans=abs(y+x)+1;
  }else if(x<0&&y==0){
    ans=-x;
  }
  }else{
    if(x<y){
      ans=y-x;
    }else{
      ans=x-y+2;
    }
  }
  cout<<ans<<endl;
  return 0;
}


Compiler output:
a.cc:62:4: error: expected unqualified-id before 'else'
   62 |   }else{
      |    ^~~~
a.cc:69:3: error: 'cout' does not name a type
   69 |   cout<<ans<<endl;
      |   ^~~~
a.cc:70:3: error: expected unqualified-id before 'return'
   70 |   return 0;
      |   ^~~~~~
a.cc:71:1: error: expected declaration before '}' token
   71 | }
      | ^
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <deque>
#include <cctype>
#include <cstdio>
#include <math.h>
using namespace std;
int main(){
    long long x,y;
    cin >> x >> y;
    long long ans=0;
    if(abs(x)<abs(y)){
        ans+=abs((abs(y)-abs(x));
        if(x<0){
            ans++;
        }
        if(y<0){
            ans++;
        }
    }else if(abs(x)==abs(y)){
        if(x*y>0){
            ans=0;
        }else{
            ans++;
        }
    }else{
        if(y<0){
            ans+=abs(abs(x)-abs(y));
            if(x>0){
                ans++;
            }
        }else{
            ans+=abs(abs(x)+abs(y));
            if(x>0){
                ans++;
            }
        }
    }
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:33: error: expected ')' before ';' token
   16 |         ans+=abs((abs(y)-abs(x));
      |                 ~               ^
      |                                 )
Language: C++

#include <stdio.h>

int solve(int x, int y) {
  int ay = y > 0 ? y : -y;
  int ax = x > 0 ? x : -x;
  if(ax == ay) return x != y;
  if(ay < ax) return (x > 0) + ax - ay + (y > 0));
  return (x < 0) + ay - ax + (y < 0);
}

int main(){
  int x, y;
  scanf("%d %d", &x, &y);
  printf("%d\n", solve(x, y));
  return 0;
}

Compiler output:
a.cc: In function 'int solve(int, int)':
a.cc:7:49: error: expected ';' before ')' token
    7 |   if(ay < ax) return (x > 0) + ax - ay + (y > 0));
      |                                                 ^
      |                                                 ;
a.cc:7:49: error: expected primary-expression before ')' token
Language: C++

#define dbg(x) do { std::cerr << #x << ": " << x << std::endl; } while (0)

using namespace std;

int main() {
//    freopen("a.inp", "r", stdin);
    long long x, y;
    cin >> x >> y;
    int xx = abs(x), yy = abs(y);
//    dbg(xx);
//    dbg(yy);
    if (xx > yy) xx = -xx, yy = -yy;
    int ans = 0;
    if (xx != x) ++ans;
    if (yy != y) ++ans;
//    dbg(ans);
//    dbg(abs(abs(x)-abs(y)));
    cout << ans + abs(abs(x)-abs(y));
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:5: error: 'cin' was not declared in this scope
    8 |     cin >> x >> y;
      |     ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | #define dbg(x) do { std::cerr << #x << ": " << x << std::endl; } while (0)
a.cc:9:14: error: 'abs' was not declared in this scope
    9 |     int xx = abs(x), yy = abs(y);
      |              ^~~
a.cc:12:14: error: 'yy' was not declared in this scope; did you mean 'y'?
   12 |     if (xx > yy) xx = -xx, yy = -yy;
      |              ^~
      |              y
a.cc:15:9: error: 'yy' was not declared in this scope; did you mean 'y'?
   15 |     if (yy != y) ++ans;
      |         ^~
      |         y
a.cc:18:5: error: 'cout' was not declared in this scope
   18 |     cout << ans + abs(abs(x)-abs(y));
      |     ^~~~
a.cc:18:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: C++

#include<cstdio>
using namespace std;
int main(){
  int x,y,ans=2000000003;
  scanf("%d %d",&x,&y);
  if(x<=y)
    ans=y-x;
  if(-1*x<=y)
    ans=min(ans,y+x+1);
  if(x<=-1*y)
    ans=min(ans,-1*y-x+1);
  if(-1*x<=-1*y)
    ans=min(ans,-1*y+x+2);
  printf("%d\n",ans);
}
  

Compiler output:
a.cc: In function 'int main()':
a.cc:9:9: error: 'min' was not declared in this scope; did you mean 'main'?
    9 |     ans=min(ans,y+x+1);
      |         ^~~
      |         main
a.cc:11:9: error: 'min' was not declared in this scope; did you mean 'main'?
   11 |     ans=min(ans,-1*y-x+1);
      |         ^~~
      |         main
a.cc:13:9: error: 'min' was not declared in this scope; did you mean 'main'?
   13 |     ans=min(ans,-1*y+x+2);
      |         ^~~
      |         main
Language: C++

#include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;

int main()
{
    int x, y;
    cin >> x >> y;
    int b = max(abs(x), abs(y)),
        s = min(abs(x), abs(y));
    if(y - x >= 0){
        if(x * y >= 0){
            cout << y - x << endl;
            return 0;
        }
    }
    if(x * y =< 0){
        cout << b - s + 1 << endl;
        return 0;
    }
    cout << b - s + 2 << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:15: error: expected primary-expression before '<' token
   18 |     if(x * y =< 0){
      |               ^
Language: C++

#include<bits/stdc++.h>
using namespace std;int a,b;main(){cin>>a>>b;cout<<(a<b)?min(b-a,abs(b+a)+1):min(1+a-b,abs(a+b))+1;


Compiler output:
a.cc:2:29: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    2 | using namespace std;int a,b;main(){cin>>a>>b;cout<<(a<b)?min(b-a,abs(b+a)+1):min(1+a-b,abs(a+b))+1;
      |                             ^~~~
a.cc: In function 'int main()':
a.cc:2:100: error: expected '}' at end of input
    2 | using namespace std;int a,b;main(){cin>>a>>b;cout<<(a<b)?min(b-a,abs(b+a)+1):min(1+a-b,abs(a+b))+1;
      |                                   ~                                                                ^
Language: C++

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

#define rp(i,n) for(int i=0;i<n;i++)
#define rep(i,m,n) for(int i=m;i<=n;i++)
#define llrp(i,n) for(long long i=0;i<n;i++)
#define llrep(i,m,n) for(long long i=m;i<=n;i++)
#define sort(a) sort(a.begin(),a.end())
#define reverse(a) reverse(a.begin(),a.end())
#define pb push_back
#define elif else if
#define vcin(a); rp(i,a.size()){cin>>a[i];}
#define vcout(a); rp(i,a.size()){cout<<a[i]<<endl;}
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<string> vs;
typedef vector<char> vc;
typedef long long ll;
typedef string S;
typedef pair<int,int> P;

bool isOK(int index, int key,vi a) {
    if (a[index] >= key) return true;
    else return false;
}

int binary_search(int key,vi a) {
    int left = -1;
    int right = (int)a.size();
    while (right - left > 1) {
        int mid = left + (right - left) / 2;
        
        if (isOK(mid, key,a)) right = mid;
        else left = mid;
    }
    return right;
}

int modpow(int a,int b,int p){
    if(b==0){
        return 1;
    }elif(b%2==0){
        return modpow((a*a)%p,b/2,p);
    }else{
        return (a*modpow(a,b-1,p))%p;
    }
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,m;
    cin >> n >> m;
    if(n<=m){
        if(m>0&&n<0){
            cout << min(ans,m+n+1) << endl;
        }else{
            cout << m-n << endl;
        }
    }elif(n>0&&m<0){
        if(-n<m){
            cout << n+m+1 << endl;
        }else{
            cout << -n-m+1 << endl;
        }
    }elif(n<0&&m<0){
        cout << n-m+2 << endl;
    }elif(n>0&&m>0){
        cout << n-m+2 << endl;
    }else{
        if(n==0){
            cout << -m+1 << endl;
        }elif(m==0){
            cout << n+1 << endl;
        }
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:56:25: error: 'ans' was not declared in this scope; did you mean 'abs'?
   56 |             cout << min(ans,m+n+1) << endl;
      |                         ^~~
      |                         abs
Language: C++

#include<algorithm>
#include<iostream>
#include<vector>
#include<string>
#include<cstring>
#include<utility>
#include<queue>
using namespace std;
#define REP(i, a,b) for(i=a;i<b;i++) 
#define REP1(i,b,a) for(i=b-1;i>=a;i--)
#define output(x) cout<<x<<endl;
#define pb(x) push_back(x);
typedef long long int ll;
const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

long long ruijyo(ll n, ll k) {
	if (k == 0) {
		return 1;
	}
	ll sum = 1;
	ll i;
	REP(i, 0, k) {
		sum *= n;
		sum %= MOD;
	}
	return sum;
}

int main()
{
	ll  i, j, k, l, m,n, sum, flag, N,  M, K, H, W, B,C,D;
	sum = 0;
	flag = 0;
	ll A[7];
	
	REP(i, 0, 7) {
		cin >> A[i];
	}
	ll ans,ans1;
	ans =ans1= 0;
	ans += 3;
	ans += ((A[0] - 1) / 2) * 2 + (A[1]) + ((A[3] - 1) / 2) * 2 + ((A[4] - 1) / 2) * 2;
	ans1 += (A[0] / 2) * 2 + (A[1]) + (A[3] / 2) * 2 + (A[4] / 2) * 2;
		k = fmax(ans, ans1);
	output(k);
	
	return 0;
	

	
}













Compiler output:
a.cc: In function 'int main()':
a.cc:66:21: error: 'fmax' was not declared in this scope
   66 |                 k = fmax(ans, ans1);
      |                     ^~~~
Language: C++

#include<cstdio>
#include<iostream>
using namespace std;
int x,y,ans=0;
inline int abs(int x) {return x<0 ? -x:x;}
int main() {
    cin>>x>>y
    if(x==-y) ans=1;
    else if(abs(x)<abs(y)) ans=abs(y)-abs(x)+(x<0)+(y<0);
    else ans=abs(x)-abs(y)+(x>0)+(y>0);
    printf("%d\n",ans);
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:14: error: expected ';' before 'if'
    7 |     cin>>x>>y
      |              ^
      |              ;
    8 |     if(x==-y) ans=1;
      |     ~~        
a.cc:9:5: error: 'else' without a previous 'if'
    9 |     else if(abs(x)<abs(y)) ans=abs(y)-abs(x)+(x<0)+(y<0);
      |     ^~~~
Language: C++

#include<iostream>
using namespace std;

int main(){
    int X=0;
    int Y=0;


    cin>>X;
    cin>>Y;

    int ans=abs(abs(X)-abs(Y));

    if(Y>X&&X>0||0>=&&Y>X){
    }else if(Y>=0&&X>Y||0>=X&&X<Y){
        ans+=2;
    }else{
        ans+=1;
    }

    cout<<ans<<endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:19: error: ordered comparison of pointer with integer zero ('int' and 'void*')
   14 |     if(Y>X&&X>0||0>=&&Y>X){
      |                  ~^~~~~
a.cc:14:23: error: label 'Y' used but not defined
   14 |     if(Y>X&&X>0||0>=&&Y>X){
      |                       ^
Language: C++

#include <iostream>

using namespace std;

int f(int x, int y) {
  if (x > y) return 2e9+50;
  return y - x;
}

int main() {
  int x, y;
  cin >> x >> y;
  cout << min({f(x,y),1+f(x,-y),1+f(-x,y),2+f(-x,-y)}) << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:14: error: no matching function for call to 'min(<brace-enclosed initializer list>)'
   13 |   cout << min({f(x,y),1+f(x,-y),1+f(-x,y),2+f(-x,-y)}) << endl;
      |           ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 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/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 1 provided
Language: C++

#include<iostream>
using namespace std;

typedef long long ll;

int main(){
  ll a, b, ans = LLONG_MAX;
  cin >> a >> b;
  for(int i = 0; i < 4; i++){
    ll tmp = 0;
    if(1&i){
      a = -a;
      tmp++;
    }

    if(i&2){
      b = -b;
      tmp++;
    }
    
    if(a <= b){
      tmp += b - a;
      ans = min(ans, tmp);
    }
    
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:18: error: 'LLONG_MAX' was not declared in this scope
    7 |   ll a, b, ans = LLONG_MAX;
      |                  ^~~~~~~~~
a.cc:2:1: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    1 | #include<iostream>
  +++ |+#include <climits>
    2 | using namespace std;
a.cc:27:2: error: expected '}' at end of input
   27 | }
      |  ^
a.cc:6:11: note: to match this '{'
    6 | int main(){
      |           ^
Language: C

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

int main(void){
    int x,y;
    scanf("%d%d",&x,&y);
    if (x*y>0){
        if(x<y){
            printf("%d\n",y-x);
        } else {
            printf("%d\n",x-y+2));
        }
    } else {
            printf("%d\n",abs(abs(x)-abs(y))+1);
    }
	return 0 ;
}

Compiler output:
main.c: In function 'main':
main.c:11:33: error: expected ';' before ')' token
   11 |             printf("%d\n",x-y+2));
      |                                 ^
      |                                 ;
main.c:11:33: error: expected statement before ')' token
Language: C++

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

int main(){
  int x, y; cin >> x >> y;
  if(x*y==0){
    if(x>0) cout << abs(x)+1;
    else cout << abs(x);
  }
  else (x*y<0){
    cout << abs(abs(y)-abs(x))+1;
  }
  else{
    if(x<y) cout << y-x;
    else cout << 2+y-x;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:15: error: expected ';' before '{' token
   11 |   else (x*y<0){
      |               ^
      |               ;
a.cc:14:3: error: 'else' without a previous 'if'
   14 |   else{
      |   ^~~~
Language: C++

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

int main(){
  int x, y; cin >> x >> y;
  if(x*y==0){
    if(x) cout << x+1;
    else cout << y;
  }
  else (x*y<0){
    cout << abs(y)-abs(x)+1;
  }
  else{
    if(x<y) cout << y-x;
    else cout << 2+y-x;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:15: error: expected ';' before '{' token
   11 |   else (x*y<0){
      |               ^
      |               ;
a.cc:14:3: error: 'else' without a previous 'if'
   14 |   else{
      |   ^~~~
Language: C++

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

signed main(){
  int x,y;
  cin>>x>>y;
  if(x>0){
    if(y>0){
      if(x<y)cout<<max(x-y,y-x)<<endl;
      else cout<<max(x-y,y-x)+2<<endl;
    else cout<<max(x+y,-x-y)+1<<endl;
  }
  if(x==0){
    if(y>=0)cout<<y<<endl;
    else cout<<1-y<<endl;
  }
  if(x<0){
    if(y>0)cout<<max(x+y,-x-y)+1<<endl;
    if(y==0)cout<<-x<<endl;
    if(y<0){
      if(x>y)cout<<x-y+2<<endl;
      else cout<<y-x<<endl;
    }
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:5: error: expected '}' before 'else'
   12 |     else cout<<max(x+y,-x-y)+1<<endl;
      |     ^~~~
a.cc:9:12: note: to match this '{'
    9 |     if(y>0){
      |            ^
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <cmath>
#include <queue>
using namespace std;
#define FOR(i,a,b) for(int (i)=(a);(i)<=(b);(i)++)
#define rep(i,n) FOR(i,0,n-1)
#define ll long long
#define MOD 998244353
#define MAXN  100005
#define P pair<int,int>

vector<string> v;

signed main(){
	
	int x,y;cin >>x>>y;
	
	ans = abs(abs(x) - abs(y));
	if(x<0)ans++;
	if(y<0)ans++;
	
	cout << ans << endl;
	
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   22 |         ans = abs(abs(x) - abs(y));
      |         ^~~
      |         abs
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <cmath>
#include <queue>
using namespace std;
#define FOR(i,a,b) for(int (i)=(a);(i)<=(b);(i)++)
#define rep(i,n) FOR(i,0,n-1)
#define ll long long
#define MOD 998244353
#define MAXN  100005
#define P pair<int,int>

vector<string> v;

signed main(){
	
	int x,y;
	
	ans = abs(abs(x) - abs(y));
	if(x<0)ans++;
	if(y<0)ans++;
	
	cout << ans << endl;
	
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   22 |         ans = abs(abs(x) - abs(y));
      |         ^~~
      |         abs
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <limits>
#define REP(i,n) for(long (i)=0;(i)<(n);(i)++)
#define REPI(i,a,b) for(long (i)=(a);(i)<(b);(i)++)
#define INF numeric_limits<double>::infinity()
constexpr long MOD = 998244353;
using namespace std;
using P = pair<long, long>;
using VI = vector<long>;

int main() {
    long x, y;
    cin >> x >> y;
    
    // 8 cases
    if (y >= 0) {
        if (x >= 0 && x <= y) {
            cout << y - x << endl;
            return 0;
        }
        if (x >= y) {
            cout << x - y + 2 << endl;
            return 0;
        }
        if (x <= 0 && -x <= y) {
            cout << y - (-x) + 1 << endl;
            return 0;
        }
        assert(x <= 0 && -x >= y);
        cout << -x - y + 1 << endl;
        return 0;
    }
    if (y <= 0) {
        if (y <= x && x <= 0) {
            cout << -y - (-x) + 2 << endl;
            return 0;
        }
        if (x <= y) {
            cout << y - x << endl;
            return 0;
        }
        if (x >= 0 && x >= -y) {
            cout << x - (-y) + 1 << endl;
            return 0;
        }
        assert(x >= 0 && x <= -y);
        cout << -y - x + 1 << endl;
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:33:9: error: 'assert' was not declared in this scope
   33 |         assert(x <= 0 && -x >= y);
      |         ^~~~~~
a.cc:6:1: note: 'assert' is defined in header '<cassert>'; this is probably fixable by adding '#include <cassert>'
    5 | #include <queue>
  +++ |+#include <cassert>
    6 | #include <limits>
a.cc:50:9: error: 'assert' was not declared in this scope
   50 |         assert(x >= 0 && x <= -y);
      |         ^~~~~~
a.cc:50:9: note: 'assert' is defined in header '<cassert>'; this is probably fixable by adding '#include <cassert>'
Language: C++

#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stdio.h>
using namespace std;
using ll = long long;
map <int ,int> mpa,mpb;

int main(){
  ll x,y;
  cin >>x >>y;
  ll ans=0;
  if(x=0 ||y=0){
    ans=max(abs(x),abs(y));
    if(x<0 || y<0) ans++;
    cout << ans;
    return 0;
  }
  else if(x*y>0 && x<=y){
    cout << y-x;
    return 0;
  }
  else if(x*y>0 && x>y){
    cout << x-y+2;
    return 0;
  }
  else if(x*y<0){
    cout << abs(x+y)+1;
    return 0;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:10: error: lvalue required as left operand of assignment
   19 |   if(x=0 ||y=0){
      |        ~~^~~
Language: C++

#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stdio.h>
using namespace std;
using ll = long long;
map <int ,int> mpa,mpb;

int main(){
  ll x,y;
  cin >>x >>y;
  ll ans=0;
  if(x*y=0){
    ans=max(abs(x),abs(y));
    if(x<0 || y<0) ans++;
    cout << ans;
    return 0;
  }
  else if(x*y>0 && x<=y){
    cout << y-x;
    return 0;
  }
  else if(x*y>0 && x>y){
    cout << x-y+2;
    return 0;
  }
  else if(x*y<0){
    cout << abs(x+y)+1;
    return 0;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:7: error: lvalue required as left operand of assignment
   19 |   if(x*y=0){
      |      ~^~
Language: C++

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <functional>
using namespace std;

#define Rep(b, e, i) for(int i = b; i <= e; i++)
#define Repr(e, b, i) for(int i = e; i >= b; i--)
#define rep(n, i) Rep(0, n-1, i)
#define repr(n, i) Repr(n-1, 0, i)
#define all(v) (v).begin(), (v).end()
#define pb(v) push_back(v)
#define uniq(v) (v).erase(unique(all(v)),(v).end())
#define bitcnt(x) __builtin_popcount(x)

typedef long long ll;
typedef pair<ll, ll> llP;
typedef pair<int, int> intP;
typedef std::priority_queue<int> IntPrioQueue; //Z->A
typedef std::priority_queue<int, std::vector<int>, std::greater<int> > IntReversePrioQueue; //A->Z

//vector の中身を出力
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

void solve(void){
    int N, M;
    cin >> N >> M;
    if (N > M) {
        if (M > 0) {
            cout << N - M + 2 << endl;
            return;
        }
        if (N > 0) {
            cout << abs(M + N) + 1 << endl;
            return;
        }
        else {
            cout << abs(M - N) + 2 << endl;
            return;
        }
    }
    else {
        else cout << min(abs(M - N), abs(M+N)+1) << endl;
        return;
    }
}

int main(void){
  solve();
  //cout << "yui(*-v・)yui" << endl;
  return 0;
}


Compiler output:
a.cc: In function 'void solve()':
a.cc:54:9: error: 'else' without a previous 'if'
   54 |         else cout << min(abs(M - N), abs(M+N)+1) << endl;
      |         ^~~~
Language: C++

#include <iostream>
#include <algorithm>
#include <set>
#include <cstring>
using namespace std;
typedef long long ll;
int x,y;
int main(void){
   scanf("%d%d",&x,&y);
   if((x>=0&&y>0)||(x<=0&&y<0)){
       if(x<=y)printf("%d\n",y-x);
       else printf("%d\n",x-y+2);
   }else{
       else printf("%d\n",abs(abs(x)-abs(y))+1);
   }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:8: error: 'else' without a previous 'if'
   14 |        else printf("%d\n",abs(abs(x)-abs(y))+1);
      |        ^~~~
Language: C++

#include<bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
#define LL  long long
const LL LINF = 1e18;
using namespace std;
#define COUT(v) cout<<(v)<<endl
#define CIN(n)  int(n);cin >> (n)
#define YES(n) cout<<((n)? "YES" : "NO")<<endl
#define Yes(n) cout<<((n)? "Yes" : "No")<<endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) <<endl

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)

#define FOREACH(x,a) for(auto& (x) : (a) )

#define ALL(obj) (obj).begin(),(obj).end()

#define P pair<int,int>
#define I vector<int>
#define S set<int>
#define pb(v) push_back(v)
#define V vector
#define rt return

pair<int,int> A,B;

int main(){
    CIN(B);CIN(A);
    LL ans1,ans2,ans3,ans4;
    V<LL>;
    ans1 = (-A>=B?-A-B:INF)+1;
    ans2 = (A>=B?A-B:INF);
    ans3 = (-A>=-B?(-A)-(-B):INF)+2;
    ans4 = (A>=-B?A-(-B):INF)+1;
    v.pb(ans1);
    v.pb(ans2);
    v.pb(ans3);
    v.pb(ans4);
    sort(ALL(v));
    COUT(v.at(0));
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:26:11: error: declaration does not declare anything [-fpermissive]
   26 | #define V vector
      |           ^
a.cc:34:5: note: in expansion of macro 'V'
   34 |     V<LL>;
      |     ^
a.cc:39:5: error: 'v' was not declared in this scope
   39 |     v.pb(ans1);
      |     ^
Language: Java

import java.util.Scanner;

public class AGC08a{
    static int calc(int init, int goal){
        if(goal * init < 0){
            return Math.abs(goal + init) + 1;
        }
        else if(init > 0 && goal > 0){
            int ret;
            if(init > goal){
                ret = init - goal + 2;
            }else{
                ret = goal - init;
            }
            return ret;
        }else{
            return calc(-goal, -init);
        }
            
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int init;
        int goal;
        init = Integer.parseInt(sc.next());
        goal = Integer.parseInt(sc.next());
        sc.close();
        System.out.println(calc(init, goal));
        
    }
}

Compiler output:
Main.java:3: error: class AGC08a is public, should be declared in a file named AGC08a.java
public class AGC08a{
       ^
1 error
Language: Java

import java.util.*;
public class AGC08a{
    static int init;
    static int goal;
    static int calc(int init, int goal){
        int ret = 0;
        if(goal * init < 0){
            ret = Math.abs(goal + init) + 1;
        }
        else if(init > 0 && goal > 0){
            if(init > goal){
                ret = init - goal + 2;
            }else{
                ret = goal - init;
            }
        }else{
            ret = calc(-goal, -init);
        }
            
        return ret;
    }
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int init;
        int goal;

        init = Integer.parseInt(sc.next());
        goal = Integer.parseInt(sc.next());
        System.out.println(calc(init, goal));
        
    }
}

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

#include<bits/stdc++.h>

#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define ALL(x) x.begin(),x.end()
#define EPS (1e-8)
#define equals(a,b) (fabs((a)-(b))<EPS)

using namespace std;

typedef long long ll;

inline bool LT(double a,double b) { return !equals(a,b) && b < b; }
inline bool LTE(double a,double b) { return equals(a,b) || b < b; }

void compute() {

}

int main() {
  int x,y;
  cin >> x >> y;
  int ans = abs( abs(x) - abs(y) ); 
  if( x == 0 ) {
    if( x != y && y < 0 ) ans += 1;
  } else if( y == 0 ) {
    if( x != y && x > 0 ) ans += 1;
  } else {
    if( abs(x) == abs(y) ) {
      if( x != y ) ans += 1;
    } else 

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

#include <iostream>
#include <set>
#include <queue>
#include <algorithm>
#include <vector>
using namespace std;

typedef long long i64;

i64 x,y;

i64 dif;

int main()
{
	cin >> x >> y;

	dif = abs(x - y);

	typedef pair<i64,i64> P;
	priority_queue<P> que;
	que.push({0,x});

	while(!que.empty())
	{
		i64 v= que.front().first;
		i64 d = que.front().second;
		que.pop();
		if(v == y)
		{
			cout << d << endl;
			return 0;
		}

		que.push({d + dif , v + dif});
		que.push({d + 1,v * -1});
	}
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:26:28: error: 'class std::priority_queue<std::pair<long long int, long long int> >' has no member named 'front'
   26 |                 i64 v= que.front().first;
      |                            ^~~~~
a.cc:27:29: error: 'class std::priority_queue<std::pair<long long int, long long int> >' has no member named 'front'
   27 |                 i64 d = que.front().second;
      |                             ^~~~~
Language: C++

#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}

using namespace std;

typedef long long ll;

typedef pair<int,int> P1;
typedef pair<int,P1> P2;
const ll inf=100000000000000;
struct edge{
	int to,cost;
};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

#define MAX_N 200002
int dp[26][MAX_N]={};
bool d[MAX_N]={};
int pa[MAX_N];
vector<edge> G[MAX_N];
P1 cost[MAX_N]={};
vector<int> child[MAX_N];
vector<int> ra[MAX_N];
int x[MAX_N]={};
priority_queue<P2,vector<P2>,greater<P2>> que;
ll x[200001]={};
ll y[200001]={};
int main() {
	ll x,y;
	int t=0;
	
	cin>>x>>y;
	if(abs(x)>abs(y)){
		if(x>0)t++;
		t+=abs(x)-abs(y);
		if(y>0)t++;		
	}else{
		if(x<0)t++;
		t+=abs(y)-abs(x);
		if(y<0)t++;
	}
	cout<<t<<endl;
	return 0;
}





Compiler output:
a.cc:29:4: error: conflicting declaration 'll x [200001]'
   29 | ll x[200001]={};
      |    ^
a.cc:27:5: note: previous declaration as 'int x [200002]'
   27 | int x[MAX_N]={};
      |     ^
Language: Java

x,y = gets.split.map &:to_i

add = 0
if y<0
  add = 1
  y = -y
end

p [y-x, y+x+1].min + add

Compiler output:
Main.java:1: error: class, interface, enum, or record expected
x,y = gets.split.map &:to_i
^
1 error
Language: C++

#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#define MOD 1000000007LL
using namespace std;

int main(){
	int x, y;
	cin >> x >> y;
	if(x > 0){
		if(y <= ((-1) * x)) cout << 1 - x - y << endl;
		else if(y < x) cout << 1 + x + y << endl;
		else cout << y - x << endl;
	}
	else if(x < 0){ 
		if(y < x) cout << 2 - y + x << endl;
		else if(y < ((-1) * x)) cout << y - x << endl;
		else cout << 1 + x + y << endl;
	}
	else{
		if(y > 0) cout << y << endl;
		else cout << 1 - y << endl;
	}
	}
	return 0;
}


Compiler output:
a.cc:29:9: error: expected unqualified-id before 'return'
   29 |         return 0;
      |         ^~~~~~
a.cc:30:1: error: expected declaration before '}' token
   30 | }
      | ^
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <bitset>
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;

using ll = long long;
using P = pair<int, int>;

const int INF = INT_MAX - 10;
const int MOD = 1e9 + 7;

// 4近傍、8近傍
int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};

int f(int x, int y) {
  if (x <= y) {
    return y - x;
  } else {
    return INF;
  }
}

int main() {
  // 入力
  int x, y;
  cin >> x >> y;

  int ans = f(x, y);
  ans = min(ans, f(-x, y) + 1);
  ans = min(ans, f(-x, -y) + 2);
  ans = min(ans, f(x, -y) + 1);

  // 解答
  cout << ans << endl;

  return 0;
}


Compiler output:
a.cc:18:17: error: 'INT_MAX' was not declared in this scope
   18 | const int INF = INT_MAX - 10;
      |                 ^~~~~~~
a.cc:13:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   12 | #include <cmath>
  +++ |+#include <climits>
   13 | using namespace std;
Language: C++


#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
using namespace std;

#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define int long long int

template<typename T> void chmax(T &a, T b) {a = max(a, b);}


int main() {
    int I, O, T, J, L, S, Z;
    cin >> I >> O >> T >> J >> L >> S >> Z;
    int ans = 0;
    if(I && J && L) {
        int ni = I-1, nj = J-1, nl = L-1;
        int temp = 0;
        temp += ni / 2;
        temp += nj / 2;
        temp += nl / 2;
        chmax(ans, temp * 2 + 3);
    }
    int temp = 0;
    temp += I / 2;
    temp += L / 2;
    temp += J / 2;
    chmax(ans, temp * 2);

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


Compiler output:
a.cc:31:23: error: '::main' must return 'int'
   31 | #define int long long int
      |                       ^~~
a.cc:36:1: note: in expansion of macro 'int'
   36 | int main() {
      | ^~~
Language: C++

#include <bits/stdc++.h>

using namespace std;
int x , y;
int main()
{
    cin >> x >> y;
    if(x >= 0 && x <= y)
    {
        cout << y - x;
        return 0;
    }
    int diff = abs(abs(x) - abs(y));
    int ans = diff;
    if(x >= 0 && y >= 0 && y < x)
    {
        cout << ans + 1 + (y > 0);
        return 0;
    }
    if(x < 0 && y < 0 && y < x)
    {
        cout << ans + 2;
        return 0;
    }
    if(x < 0 && y < 0 && y >= x)
    {
        cout << ans;
        return 0;
    }
    if((x >= 0 && y < 0))
    {
        cout << ans + 1;
        return 0;
    }
    if(y >= 0 && x < 0)
    {
        cout << ans + (y > 0);
        return 0;
    }
    return 0;
}
#include <bits/stdc++.h>

using namespace std;
int x , y;
int main()
{
    cin >> x >> y;
    if(x >= 0 && x <= y)
    {
        cout << y - x;
        return 0;
    }
    int diff = abs(abs(x) - abs(y));
    int ans = diff;
    if(x >= 0 && y >= 0 && y < x)
    {
        cout << ans + 1 + (y > 0);
        return 0;
    }
    if(x < 0 && y < 0 && y < x)
    {
        cout << ans + 2;
        return 0;
    }
    if(x < 0 && y < 0 && y >= x)
    {
        cout << ans;
        return 0;
    }
    if((x >= 0 && y < 0))
    {
        cout << ans + 1;
        return 0;
    }
    if(y >= 0 && x < 0)
    {
        cout << ans + (y > 0);
        return 0;
    }
    return 0;
}


Compiler output:
a.cc:45:5: error: redefinition of 'int x'
   45 | int x , y;
      |     ^
a.cc:4:5: note: 'int x' previously declared here
    4 | int x , y;
      |     ^
a.cc:45:9: error: redefinition of 'int y'
   45 | int x , y;
      |         ^
a.cc:4:9: note: 'int y' previously declared here
    4 | int x , y;
      |         ^
a.cc:46:5: error: redefinition of 'int main()'
   46 | int main()
      |     ^~~~
a.cc:5:5: note: 'int main()' previously defined here
    5 | int main()
      |     ^~~~
Language: Java

public class Example05 {

	public static void main(String[] args) {

		// 画面の初期値
		int x = Integer.parseInt(args[0]);
		// 目標の画面の値
		int y = Integer.parseInt(args[1]);

		// ボタン最小押下回数
		long count = 1;

		// [x]と[y]の絶対値が同一の場合は何もしない
		if (Math.abs(x) != Math.abs(y)) {

			// 変数x,yがどちらも0以上
			if (x >= 0 && y >= 0) {
				if (x < y) {
					count = y - x;
				} else {
					count = x + y + 1;
				}
			} else if (x < 0 && y >= 0) {
				// 変数xが負数で変数yが0以上
				if (Math.abs(x) < y) {
					count = y - Math.abs(x) + 1;
				} else {
					count = Math.abs(x) - y + 1;
				}
			} else if (x >= 0 && y < 0) {
				// 変数xが0以上で変数yが負数
				if (x < Math.abs(y)) {
					count = Math.abs(y) - x + 1;
				} else {
					count = x - Math.abs(y) + 1;
				}
			} else {
				// 変数x,yがどちらも負数
				if (Math.abs(x) < Math.abs(y)) {
					count = Math.abs(y) - Math.abs(x) + 2;
				} else {
					count = Math.abs(x) - Math.abs(y);
				}
			}
		} else {
			;// do nothing
		}

		// ボタン最小押下回数出力
		System.out.println(count);
	}

}

Compiler output:
Main.java:1: error: class Example05 is public, should be declared in a file named Example05.java
public class Example05 {
       ^
1 error
Language: Java

    public static void main(String[] args) throws Exception {
        // Here your code !
        BufferedReader br = new BufferedReader(new
InputStreamReader(System.in));
        String[] lineArray = br.readLine().split(" ", 0);
        long x = Integer.parseInt(lineArray[0]);
        long y = Integer.parseInt(lineArray[1]);
        int cnt =0;

        if (y<x){
            x=x*(-1);
            cnt++;
        }
        while(x<y){
            x++;
            cnt++;
            if(x*(-1)==y){
                cnt++;
                break;
            }
        }
        System.out.println(cnt);
    }

Compiler output:
Main.java:1: error: unnamed classes are a preview feature and are disabled by default.
    public static void main(String[] args) throws Exception {
                  ^
  (use --enable-preview to enable unnamed classes)
1 error
Language: C

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

int main()
{

   long x, y, kaisu;

   cin >> x;
   cin >> y;

   kaisu = 0;

   if ((x >= 0 && y >= 0 ) || ((x < 0) && (y < 0))){
      if(y > x){
         kaisu = y - x;
      } else {
         if (y == 0){
            kaisu = x - y + 1;
         } else {
            kaisu = x - y + 2;
         }
      }
   } else {
      x = x * -1;
      if(y > x){
         kaisu = y - x + 1;
      } else {
         if (y == 0){
            kaisu = x - y;
         } else {
            kaisu = x - y + 1;
         }
      }
   }
   cout << kaisu;

   return 0;
}

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

import java.util.*;
import java.io.*;
public class gg {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer stk = new StringTokenizer(br.readLine());
		long x = Long.parseLong(stk.nextToken());
		long y = Long.parseLong(stk.nextToken());
		long rta = 0;
		if(x < 0){
			if(y<0){
				if(x<y){
					System.out.println(Math.abs((y*-1) -(x*-1)));
				}else{
					System.out.println(Math.abs((y*-1) -(x*-1))+2);
				}
			}else{
				if(x*-1<y){
					System.out.println(Math.abs((y) -(x*-1))+1);
				}else if(x*-1==y){
					System.out.println(1);
				}else{
					System.out.println(Math.abs((x*-1) -(y))+1);
				}
			}
		}else{
			if(y<0){
				if(x<y*-1){
					System.out.println(Math.abs((y*-1) -(x))+1);
				}else if(x==y*-1){
					System.out.println(1);
				}else{
					System.out.println(Math.abs(x-(y*-1))+1);
				}
			}else{
				if(x>y){
					if(y==0) System.out.println(x+1);  
					else System.out.println(Math.abs((y)-(x))+2);
				}else{
					System.out.println(Math.abs((y)-(x)));
				}
			}
		}
		/*if(x > y){
			if(x < 0 && y < 0)
				rta+=1;
			rta += Math.abs(Math.abs(x) - Math.abs(y));
			rta+=1;
		}
		else if(x < y){
			if(x < 0 && y > 0)
				rta+=1;
			if(x <0 && Math.abs(x) > Math.abs(y))
				rta+=1;
			rta += Math.abs(Math.abs(x) - Math.abs(y));
		}
		if(x == 0 || y == 0)
			rta = Math.abs(Math.abs(x) - Math.abs(y));
		System.out.println(rta);*/
	}

}


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

#include <bits/stdc++.h>

using namespace std;

#define forn(i, s, f) for(int i = (s); i <= (f); ++i)
#define for1(i, f, s) for(int i = (f); i >= (s); --i)
#define fora(i, x) for (auto i : x)
#define show(x) cout << #x << " = " << x << " ";
#define skip continue;
#define pb push_back
#define _1 first
#define _2 second

typedef long long ll;

const int N3 = 1e3 + 5;
const int N4 = 1e4 + 5;
const int N5 = 1e5 + 5;
const int N6 = 1e6 + 5;
const int N7 = 1e7 + 5;
const int N8 = 1e8 + 5;
const int N9 = 1e9 + 5;
const int mod = N9 + 2;

#define int ll

int a, b, ans;

main()
{
    cin >> a >> b;
    ans = abs(abs(a) - abs(b));

    if (a == 0)
    {
        cout << (b > 0 ? ans : ans + 1);
        return 0;
    }
    else if (b == 0)
    {
        cout << (a > 0 ? ans + 1 : ans)
    }
    else if (a > 0 && b > 0 && a > b)
        cout << ans + 2;
    else if (a < 0 && b < 0 && a > b)
        cout << ans + 2;
    else if (a > 0 && b > 0 && a < b)
        cout << ans;
    else if (a < 0 && b < 0 && a < b)
        cout << ans;
    else if (a > 0 && b < 0)
        cout << ans + 1;
    else if (a < 0 && b > 0)
        cout << ans + 1;
}


Compiler output:
a.cc:29:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   29 | main()
      | ^~~~
a.cc: In function 'int main()':
a.cc:41:40: error: expected ';' before '}' token
   41 |         cout << (a > 0 ? ans + 1 : ans)
      |                                        ^
      |                                        ;
   42 |     }
      |     ~
Language: C++

#include <bits/stdc++.h>

using namespace std;

#define forn(i, s, f) for(int i = (s); i <= (f); ++i)
#define for1(i, f, s) for(int i = (f); i >= (s); --i)
#define fora(i, x) for (auto i : x)
#define show(x) cout << #x << " = " << x << " ";
#define skip continue;
#define pb push_back
#define _1 first
#define _2 second

typedef long long ll;

const int N3 = 1e3 + 5;
const int N4 = 1e4 + 5;
const int N5 = 1e5 + 5;
const int N6 = 1e6 + 5;
const int N7 = 1e7 + 5;
const int N8 = 1e8 + 5;
const int N9 = 1e9 + 5;
const int mod = N9 + 2;

#define int ll

int a, b, ans;

main()
{
    cin >> a >> b;

    ans = abs(abs(a) - abs(b));
//    if (a > 0 && b > 0 && a > b)
//        cout << ans + 2;
    else if (a > 0 && b > 0 && a < b)
        cout << ans;
//    else if (a < 0 && b < 0 && a > b)
//        cout << ans + 2;
//    else if (a < 0 && b < 0 && a < b)
//        cout << ans;
//    else if (a > 0 && b < 0)
//        cout << ans + 1;
//    else if (a < 0 && b > 0)
//        cout << ans + 1;
}


Compiler output:
a.cc:29:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   29 | main()
      | ^~~~
a.cc: In function 'int main()':
a.cc:36:5: error: 'else' without a previous 'if'
   36 |     else if (a > 0 && b > 0 && a < b)
      |     ^~~~
Language: C++

#include <bits/stdc++.h>

using namespace std;

#define forn(i, s, f) for(int i = (s); i <= (f); ++i)
#define for1(i, f, s) for(int i = (f); i >= (s); --i)
#define fora(i, x) for (auto i : x)
#define show(x) cout << #x << " = " << x << " ";
#define skip continue;
#define pb push_back
#define _1 first
#define _2 second

typedef long long ll;

const int N3 = 1e3 + 5;
const int N4 = 1e4 + 5;
const int N5 = 1e5 + 5;
const int N6 = 1e6 + 5;
const int N7 = 1e7 + 5;
const int N8 = 1e8 + 5;
const int N9 = 1e9 + 5;
const int mod = N9 + 2;

#define int ll

int a, b;

main()
{
    cin >> a >> b;
    if (a * -1 == b)
    {
        cout << 1;
        return 0;
    }
    ans = abs(abs(a) - abs(b));
    if (a > 0 && b > 0 && a > b)
        cout << ans + 2;
    if (a > 0 && b > 0 && a < b)
        cout << ans;
    if (a < 0 && b < 0 && a > b)
        cout << ans + 2;
    if (a < 0 && b < 0 && a < b)
        cout << ans;
    if (a > 0 && b < 0)
        cout << ans + 1;
    if (a < 0 && b > 0)
        cout << ans + 1;
}


Compiler output:
a.cc:29:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   29 | main()
      | ^~~~
a.cc: In function 'int main()':
a.cc:37:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
   37 |     ans = abs(abs(a) - abs(b));
      |     ^~~
      |     abs
Language: C

	long long x,y;
	scanf("%lld %lld",&x,&y);

	int kaisu;
	if(x<y){
		if(x*y>=0)kaisu=y-x;
		if(x*y<0){
			if(x*-1<y)kaisu=y-x*-1+1
			if(x*-1==y)kaisu=1;
			if(x*-1>y)kaisu=x*-1-y+1;		
		}
	}
	if(x>y){
		if(x*y>0){
			if(y>0)kaisu=x-y+2;
			if(y<0)kaisu=y*-1+x+2;
		}
		if(x*y<0){
			if(x<y*-1)kaisu=y*-1-x+1;
			if(x==y*-1)kaisu=1;
			if(x>y*-1)kaisu=x-y*-1+1;
		}
		if(x==0){
			kaisu=y*-1+1;
		}
		if(y==0){
			kaisu=x+1;
		}

	}
	printf("%d",kaisu);

}

Compiler output:
main.c:2:15: error: expected declaration specifiers or '...' before string constant
    2 |         scanf("%lld %lld",&x,&y);
      |               ^~~~~~~~~~~
main.c:2:27: error: expected declaration specifiers or '...' before '&' token
    2 |         scanf("%lld %lld",&x,&y);
      |                           ^
main.c:2:30: error: expected declaration specifiers or '...' before '&' token
    2 |         scanf("%lld %lld",&x,&y);
      |                              ^
main.c:5:9: error: expected identifier or '(' before 'if'
    5 |         if(x<y){
      |         ^~
main.c:13:9: error: expected identifier or '(' before 'if'
   13 |         if(x>y){
      |         ^~
main.c:31:16: error: expected declaration specifiers or '...' before string constant
   31 |         printf("%d",kaisu);
      |                ^~~~
main.c:31:21: error: expected declaration specifiers or '...' before 'kaisu'
   31 |         printf("%d",kaisu);
      |                     ^~~~~
main.c:33:1: error: expected identifier or '(' before '}' token
   33 | }
      | ^
Language: C++

x, y = map(int, raw_input().split())

if x == y:
    print 0
elif x == -y:
    print 1
else:
    if abs(y) > abs(x):
        print (x < 0) + (y < 0) + abs(y) - abs(x)
    else:
        print (x > 0) + (y > 0) + abs(x) - abs(y)


Compiler output:
a.cc:1:1: error: 'x' does not name a type
    1 | x, y = map(int, raw_input().split())
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define REP(i,b) FOR(i,0,b)
#define INF 1e9

int main(){
  int x,y,n;
  cin>>x>>y>>n; 

  if (y >= x) {
    if (x >= 0) { //1,2
      n = y-x; //B*0
    } else {
      if (y >= 0) {
        if (y >= -x) { //-1,5
          n = y+x+1; //B+A...
        } else { //-6, 5
          n = x-y+1;
        }
      } else {
        n = y-x; //B*0
      }
    }
  } else {
    if (y >= 0) { //2,1
      n = x-y+2; //B+A+...+A+B
    } else {
      if (x >= 0) {
        if (x >= -y) { //5,-1
          n = y+x+1; //B+A...
        } else { //6, -5
          n = x+y+1;
        }
      } else {
        n = y-x; //B*0
      }
  }


  cout<<n;

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:44:2: error: expected '}' at end of input
   44 | }
      |  ^
a.cc:7:11: note: to match this '{'
    7 | int main(){
      |           ^