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

using System;

namespace kekW
{
    internal static class Program
    {
        private static void Main()
        {
            var nbrs = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
            var x = nbrs[0];
            var y = nbrs[1];
            int res = 0;

            if(x < y)
            {
                if(x < 0 && y < 0 || x > 0 && y > 0)
                {
                    res = y - x;
                }
                else if(x < 0 && y > 0)
                {
                    res = 1 + y - Math.Abs(x);
                }
            }
            else
            {
                if(x > 0 && y < 0)
                {
                    res = Math.Abs(x + y) + 1;
                }
                else if(x > 0 && y > 0)
                {
                    res = 2 + x - y;
                }
                else if(x < 0 && y < 0)
                {
                    res = y - x;
                }
            }

            Console.WriteLine(res);
        }
    }
}



Compiler output:
a.cc:1:7: error: expected nested-name-specifier before 'System'
    1 | using System;
      |       ^~~~~~
a.cc:5:5: error: 'internal' does not name a type
    5 |     internal static class Program
      |     ^~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep_(i, n, m) for (int i = n; i < (int)(m); i++)
#define all(v) v.begin(), v.end()
#define int long long
#define stoi stoll
//#define _GLIBCXX_DEBUG

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

Compiler output:
a.cc: In function 'int main()':
a.cc:16:3: error: expected '}' before 'else'
   16 |   else {
      |   ^~~~
a.cc:13:13: note: to match this '{'
   13 |   if(x < y) {
      |             ^
Language: C++

#include <iostream>

int iabs(int a)
{
  if (a >= 0) return a;
  else return -a;
}

int diffabs(a, b)
{
  if (a >= b) return a - b;
  else b - a;
}

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

  int ans = diffabs(iabs(a), iabs(b));
  if (((x >= 0 && y >= 0) || (x < 0 && y < 0)) && x > y)
    ans += 2;
  else if (x < 0 && y >= 0)
    ans += 1;
  else if (x >= 0 && x < 0)
    ans += 1;
}

Compiler output:
a.cc:9:13: error: 'a' was not declared in this scope
    9 | int diffabs(a, b)
      |             ^
a.cc:9:16: error: 'b' was not declared in this scope
    9 | int diffabs(a, b)
      |                ^
a.cc:9:17: error: expression list treated as compound expression in initializer [-fpermissive]
    9 | int diffabs(a, b)
      |                 ^
a.cc: In function 'int main()':
a.cc:18:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   18 |   cin >> x >> y;
      |   ^~~
      |   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:20:26: error: 'a' was not declared in this scope
   20 |   int ans = diffabs(iabs(a), iabs(b));
      |                          ^
a.cc:20:35: error: 'b' was not declared in this scope
   20 |   int ans = diffabs(iabs(a), iabs(b));
      |                                   ^
a.cc:20:37: error: 'diffabs' cannot be used as a function
   20 |   int ans = diffabs(iabs(a), iabs(b));
      |                                     ^
Language: C++

#include <bits/stdc++.h>
#include<cmath>
#define N 100005
#define A 1000005
#define MOD 1000000007 // //100000000 998244353 //
#define inf 1000000000000000000
#define ll long long
//#define M_PI 3.141592653589793238463

using namespace std;

#define pii pair<ll, ll>
#define piii pair<ll, pii>
#define ft first
#define sd second
#define pb push_back
#define rep(i, n) for(ll i = 0; i < n; i++)
#define repr(i, n) for(ll i = n-1; i >= 0; i--)
#define itr(it, x) for(auto it = x.begin(); it != x.end(); it++)
#define mem(a, b) memset(a, (ll)b, sizeof(a))
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define edge(v, x, y) v[x].pb(y); v[y].pb(x);
#define popcount __builtin_popcount
#define ANS(s) {cout << s << "\n"; return;}

//~~~~~~fancy print~~~~~~~//
#define printpii(a) cout << a.ft << " " << a.sd << endl;
#define printpiii(a) cout << a.ft << " " << a.sd.ft << " " << a.sd.sd << endl;
#define print(a, n) rep(i, n) cout << a[i] << " "; cout << endl;
#define printv(v) for(auto x: v)cout << x << " "; cout << endl;
#define printm(a, n, m) rep(i, n) { rep(j, m) cout << a[i][j] << "\t"; cout << endl;}

ll lx[4] = {0, 0, 1, -1};
ll ly[4] = {1, -1, 0, 0};
ll dx[8] = {0, 0, 1, -1, 1, -1, 1, -1};
ll dy[8] = {1, -1, 0, 0, 1, 1, -1, -1};
void fast(){ios_base::sync_with_stdio(false);cin.tie(0);cout << setprecision(12) << fixed;}
ll lcm(ll a, ll b) {return (a*b)/__gcd(a, b); }
 
ll x,y;
 
ll cal(int b1, int b2)
{
  ll xx = (b1 ? -x : x);
  ll yy = (b2 ? -y : y);
  if(xx<=yy) return yy-xx+b1+b2;
  else return INF;
}
 
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> x >> y;
  ll ans = cal(0,0);
  ans = min(ans, cal(0,1));
  ans = min(ans, cal(1,0));
  ans = min(ans, cal(1,1));
  cout << ans << endl;
  return 0;
}

Compiler output:
a.cc: In function 'long long int cal(int, int)':
a.cc:48:15: error: 'INF' was not declared in this scope
   48 |   else return INF;
      |               ^~~
Language: C++

#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
#include <cassert>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2100000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int x, y;
    cin >> x >> y;
    int ans = INF;
    int d = abs(abs(x) - abs(y));
    if(x + d == y) {
        ans = min(ans, d);
    }
    if(-x + d == y) {
        ans = min(ans, d + 1);
    }
    if(abs(-x + d) == y) {
        ans = min(ans, d + 2);
    }
    if(x - d == y) {
        ans = min(ans, d + 2)
    };
    if(-(x + d) == y) {
        ans = min(ans, d + 1);
    }
    assert(ans < INF);
    cout << ans << endl;

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:46:30: error: expected ';' before '}' token
   46 |         ans = min(ans, d + 2)
      |                              ^
      |                              ;
   47 |     };
      |     ~
Language: C++

#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
#include <assert>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2100000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int x, y;
    cin >> x >> y;
    int ans = INF;
    int d = abs(abs(x) - abs(y));
    if(x + d == y) {
        ans = min(ans, d);
    } else if(-x + d == y) {
        ans = min(ans, d + 1);
    } else if(abs(-x + d) == y) {
        ans = min(ans, d + 2);
    } else if(x - d == y) {
        ans = min(ans, d + 2);
    }
    assert(ans < INF);
    cout << ans << endl;

    return 0;
}


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

#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <iomanip>
using namespace std;
#define int long long

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


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

    int x,y; cin >> x >> y;
    if(y >= x && y >0 && x < 0 && abs(y)> abs(x)) cout << 1 + y + x << endl;
    else if()
    else if(y >= x) cout << y - x << endl;
    else if(y >= 0) cout << 1 + y + x << endl;
    else if(x >= 0 && abs(x) >= abs(y)) cout << 1 + abs(x) - abs(y) << endl;
    else if(x >= 0) cout << abs(y) - abs(x) + 1 << endl;
    else cout << 1 + abs(y) - abs(x) + 1 << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:38:13: error: expected primary-expression before ')' token
   38 |     else if()
      |             ^
a.cc:39:5: error: expected primary-expression before 'else'
   39 |     else if(y >= x) cout << y - x << endl;
      |     ^~~~
Language: C++

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

ll a , b;

int main(){
    migmig
    ll ans = 1e18;
    cin >> a >> b;
    if(a <= b)ans = min(ans , b-a);
    if(-a <= b)ans = min(ans ,b+a+1);
    if(-a <= -b)ans = min(ans ,a-b+2);
    if(a <= -b)ans = min(ans , -b-a+1);
    cout << ans;
    return(0);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:5: error: 'migmig' was not declared in this scope
   10 |     migmig
      |     ^~~~~~
a.cc:13:15: error: 'ans' was not declared in this scope; did you mean 'abs'?
   13 |     if(a <= b)ans = min(ans , b-a);
      |               ^~~
      |               abs
a.cc:14:16: error: 'ans' was not declared in this scope; did you mean 'abs'?
   14 |     if(-a <= b)ans = min(ans ,b+a+1);
      |                ^~~
      |                abs
a.cc:15:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   15 |     if(-a <= -b)ans = min(ans ,a-b+2);
      |                 ^~~
      |                 abs
a.cc:16:16: error: 'ans' was not declared in this scope; did you mean 'abs'?
   16 |     if(a <= -b)ans = min(ans , -b-a+1);
      |                ^~~
      |                abs
a.cc:17:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   17 |     cout << ans;
      |             ^~~
      |             abs
Language: C++

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int  ,int > pii;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ll maxn  = 3e6;
const ll mod =1e9+7;
const ld PI = acos((ld)-1);

#define pb push_back
#define endl '\n'
#define dokme(x) return(cout << x , 0);
#define migmig ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ms(x , y) memset(x , y , sizeof x);
#define file_init freopen("input.txt", "r+", stdin); freopen("output.txt", "w+", stdout);
ll pw(ll a, ll b, ll md = mod){ll res = 1;while(b){if(b&1){res=(a*res)%md;}a=(a*a)%md;b>>=1;}return(res);}

ll a , b;

ll s1(){
	if(a<=b)
		return(b - a);
	return(1e18);
}

ll s2(){
	ll boz = -a;
	if(a <= b)
		return(b - a + 1);
	return(1e18);
}

ll s3(){
	ll boz = -b;
	if(-a <= boz)
		return(boz +a a + 2);
	return(1e18);
}

int main(){
    migmig
    cin >> a >> b;
    ll ans = 1e18;
    ans = min(ans , s1());
    ans = min(ans , s2());
    ans = min(ans , s3());
    cout << ans;
    return(0);
}

Compiler output:
a.cc: In function 'll s3()':
a.cc:41:30: error: expected ')' before 'a'
   41 |                 return(boz +a a + 2);
      |                       ~      ^~
      |                              )
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <time.h>
#define ll long long
#define double long double
#define itn int
#define endl '\n'
#define co(ans) cout<<ans<<endl
#define COYE cout<<"YES"<<endl
#define COYe cout<<"Yes"<<endl
#define COye cout<<"yes"<<endl
#define CONO cout<<"NO"<<endl
#define CONo cout<<"No"<<endl
#define COno cout<<"no"<<endl
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define INF ((1LL<<62)-(1LL<<31))
#define EPS 1e-10
#define PI 3.141592653589793238
#define MOD 1000000007
#define MAX 5100000
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
bool CAN=true;
using namespace std;

int main(){
    ll x,y;
    ci>>x>>y;
    ll d=abs(y)-abs(x);
    ll ans=0;
    if(d>=0){
        ans+=abs(d);
        if(x<0)ans++;
        if(y<0)ans++;
    }
    else {
        ans+=abs(d);
        if(x>0)ans++;
        if(y>0)ans++;
    }
    cout <<ans <<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:51:5: error: 'ci' was not declared in this scope; did you mean 'co'?
   51 |     ci>>x>>y;
      |     ^~
      |     co
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
long long H,W; cin>>H>>W;
if(H==W){
cout<<0<<endl;}
else if(W==0){
if(H>0){
cout<<1+H;}
else
cout<<abs(H);
else if(H<W){
if(0<=H){
cout<<W-H<<endl;}
else if(W<0)
cout<<abs(abs(W)-abs(H));
else
cout<<1+abs(abs(H)-W);}
else{
if(W>=0){
cout<<2+H-W<<endl;}
else if(H<0){
cout<<2+abs(abs(W)-abs(H));}
else
cout<<1+abs(abs(W)-H);}}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:1: error: expected '}' before 'else'
   12 | else if(H<W){
      | ^~~~
a.cc:7:14: note: to match this '{'
    7 | else if(W==0){
      |              ^
Language: C++



#include <bits/stdc++.h>

using namespace std;

int _x;
int _y;
int _ans;

void CParseIn () {
    cin >> _x >> _y;
}

void Core () {
    if (_x / _y >= 0) {
        _ans = abs(_x - _y);
        return;
    }
    
    if (_x < 0 && _y > _abs(_x)) {
        _ans = 1 + _y - _x;
        return;
    }
    
    if (_x < 0 && _y <= _abs(_x)) {
        _ans = _y - _x;
        return;
    }
    
    if (_x > 0 && _y < -_x) {
        _ans = 1 - _y - _x;
        return;
    }
    
    _ans = 1 + _y + _x;
}

void CWriteOut () {
    printf("%d\n", _ans);
}

int main () {
    
    CParseIn();
    Core();
    CWriteOut();
    
    return 0;
}

Compiler output:
a.cc: In function 'void Core()':
a.cc:21:24: error: '_abs' was not declared in this scope; did you mean 'labs'?
   21 |     if (_x < 0 && _y > _abs(_x)) {
      |                        ^~~~
      |                        labs
a.cc:26:25: error: '_abs' was not declared in this scope; did you mean 'labs'?
   26 |     if (_x < 0 && _y <= _abs(_x)) {
      |                         ^~~~
      |                         labs
Language: C++

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

#include <algorithm>
#include <cassert>
#include <cfloat>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define repLRE(i, l, r) for (ll i = (l); i <= (r); ++i)
#define rrepLRE(i, l, r) for (ll i = (l); i >= (r); --i)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define Lower_bound(v, x) \
  distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) \
  distance(v.begin(), upper_bound(v.begin(), v.end(), x))

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;
using T = tuple<ll, ll, ll>;
using vll = vector<ll>;
using vP = vector<P>;
using vT = vector<T>;
using vvll = vector<vector<ll>>;
using vvP = vector<vector<P>>;
using dqll = deque<ll>;

ll dx[9] = {-1, 1, 0, 0, -1, -1, 1, 1, 0};
ll dy[9] = {0, 0, -1, 1, -1, 1, -1, 1, 0};

/* Macros reg. ends here */

const ll INF = 1LL << 50;

int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cout << fixed << setprecision(15);

  ll x, y;
  cin >> x >> y;

  ll cnt = 0;
  if(y == 0){
    if (x <= 0) cnt = y - x;
    else {
      cnt++;
      x *= -1;
      cnt += y - x;
    }
  } else if (y > 0) {
    if (x <= -y) {
      cnt += -y - x;
      cnt++;
    } else if (x < 0) {
      cnt++;
      x *= -1;
      cnt += y - x;
    } else if (x <= y) {
      cnt += y - x;
    } else {
      cnt++;
      x *= -1;
      cnt += -y - x;
      cnt++;
    }
  } else {
    if (x <= y) {
      cnt += y - x;
    } else if (x < 0) {
      x *= -1;
      cnt++;
      cnt += -y - x;
      cnt++;
    } else if (x <= -y) {
      cnt += -y - x;
      cnt++;
    } else {  // -y < x
      cnt++;
      x *= -1;
      cnt += y - x;
    }
  }

  cout << cnt << endl;

  return 0;
}
g

Compiler output:
a.cc:109:1: error: 'g' does not name a type
  109 | g
      | ^
Language: C++

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

int main() {
  ll A, B;
  cin >> A >> B;
  ll ans;
  if (A*B < 0) ans = abs(A+B)+1;
  else {
    if (A < B) ans = B-A;
    else {
      ans = A-B+2;
      if (A*B == 0) ans -= 1;
    }
  }
  
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:3: error: 'll' was not declared in this scope
    5 |   ll A, B;
      |   ^~
a.cc:6:10: error: 'A' was not declared in this scope
    6 |   cin >> A >> B;
      |          ^
a.cc:6:15: error: 'B' was not declared in this scope
    6 |   cin >> A >> B;
      |               ^
a.cc:7:5: error: expected ';' before 'ans'
    7 |   ll ans;
      |     ^~~~
      |     ;
a.cc:8:16: error: 'ans' was not declared in this scope; did you mean 'abs'?
    8 |   if (A*B < 0) ans = abs(A+B)+1;
      |                ^~~
      |                abs
a.cc:10:16: error: 'ans' was not declared in this scope; did you mean 'abs'?
   10 |     if (A < B) ans = B-A;
      |                ^~~
      |                abs
a.cc:12:7: error: 'ans' was not declared in this scope; did you mean 'abs'?
   12 |       ans = A-B+2;
      |       ^~~
      |       abs
a.cc:17:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
   17 |   cout << ans << endl;
      |           ^~~
      |           abs
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b;
  cin>>a>>b;
  int ans=abs(abs(a)-abs(b));
  if(a*b>){
    if(a>b)ans+=2;
  }
  else ans++;
  cout<<ans<<endl;
  return 0;
}
  

Compiler output:
a.cc: In function 'int main()':
a.cc:7:10: error: expected primary-expression before ')' token
    7 |   if(a*b>){
      |          ^
Language: C++

	int x, y;
	cin >> x >> y;
	int ans = abs(abs(x) - abs(y));
	if (x < 0 && y < 0)
		ans += 2;
	if ((x < 0 && y>0) || (x > 0 && y < 0))
		ans++;
	if (x > 0 && y>0 && x>y)
		ans += 2;
	if (x == 0 && y < 0)
		ans++;
	cout << ans;

Compiler output:
a.cc:2:9: error: 'cin' does not name a type
    2 |         cin >> x >> y;
      |         ^~~
a.cc:3:23: error: 'abs' was not declared in this scope; did you mean 'ans'?
    3 |         int ans = abs(abs(x) - abs(y));
      |                       ^~~
      |                       ans
a.cc:3:32: error: 'abs' was not declared in this scope; did you mean 'ans'?
    3 |         int ans = abs(abs(x) - abs(y));
      |                                ^~~
      |                                ans
a.cc:3:19: error: 'abs' was not declared in this scope; did you mean 'ans'?
    3 |         int ans = abs(abs(x) - abs(y));
      |                   ^~~
      |                   ans
a.cc:4:9: error: expected unqualified-id before 'if'
    4 |         if (x < 0 && y < 0)
      |         ^~
a.cc:6:9: error: expected unqualified-id before 'if'
    6 |         if ((x < 0 && y>0) || (x > 0 && y < 0))
      |         ^~
a.cc:8:9: error: expected unqualified-id before 'if'
    8 |         if (x > 0 && y>0 && x>y)
      |         ^~
a.cc:10:9: error: expected unqualified-id before 'if'
   10 |         if (x == 0 && y < 0)
      |         ^~
a.cc:12:9: error: 'cout' does not name a type
   12 |         cout << ans;
      |         ^~~~
Language: C++

using namespace std;

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

Compiler output:
a.cc: In function 'int main()':
a.cc:5:3: error: 'cin' was not declared in this scope
    5 |   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 | using namespace std;
a.cc:7:5: error: 'cout' was not declared in this scope
    7 |     cout << y-x << endl;
      |     ^~~~
a.cc:7:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:7:20: error: 'endl' was not declared in this scope
    7 |     cout << y-x << endl;
      |                    ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | using namespace std;
a.cc:9:5: error: 'cout' was not declared in this scope
    9 |     cout << x-y+2 << endl;
      |     ^~~~
a.cc:9:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:9:22: error: 'endl' was not declared in this scope
    9 |     cout << x-y+2 << endl;
      |                      ^~~~
a.cc:9:22: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
a.cc:12:5: error: 'cout' was not declared in this scope
   12 |     cout << x+y+1 << endl;
      |     ^~~~
a.cc:12:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:12:22: error: 'endl' was not declared in this scope
   12 |     cout << x+y+1 << endl;
      |                      ^~~~
a.cc:12:22: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
a.cc:14:5: error: 'cout' was not declared in this scope
   14 |     cout << 1-x-y << endl;
      |     ^~~~
a.cc:14:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:14:22: error: 'endl' was not declared in this scope
   14 |     cout << 1-x-y << endl;
      |                      ^~~~
a.cc:14:22: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
Language: C++

int main() {
  int x,y;
  cin >> x >> y;
    cout << 1-x-y << endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:3:3: error: 'cin' was not declared in this scope
    3 |   cin >> x >> y;
      |   ^~~
a.cc:4:5: error: 'cout' was not declared in this scope
    4 |     cout << 1-x-y << endl;
      |     ^~~~
a.cc:4:22: error: 'endl' was not declared in this scope
    4 |     cout << 1-x-y << endl;
      |                      ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define re(i,n) for(ll i=0;i<n;++i)
#define ocut cout
#define ouct cout
#define itn int
struct Union{
  vector<int> par;
  Union(int a){
  par=vector<int>(a,-1);
  }
  int find(int a){
    if(par[a]<0){
      return a;
    }
    else{
      return par[a]=find(par[a]);
    }
  }
  bool same(int a,int b){
    return (find(a)==find(b));
  }
  int size(int a){
    return -par[find(a)];
  }
  void unite(int a,int b){
    int c=find(a),d=find(b);
    if(c==d)
      return;
    if(size(c)<size(d)){
      swap(c,d);
    }
    par[c]+=par[d];
    par[d]=c;
  }
};
int main(){
  int x,y;
  cin >> x >> y;
  if(x>y&&y>0)cout << x-y+2;
  else if(x>y&&y=0)cout << x+1;
  else if(x<y&&x>0)cout << y-x;
  else if(x<y&&x=0)cout << y;
  else if(x>y&&x<0)cout << x-y+2;
  else if(x<y&&y<0)cout << y-x;
  else if(x<y)cout << abs(y)-abs(x)+1;
  else cout << abs(x)-abs(y)+1;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:43:14: error: lvalue required as left operand of assignment
   43 |   else if(x>y&&y=0)cout << x+1;
      |           ~~~^~~
a.cc:45:14: error: lvalue required as left operand of assignment
   45 |   else if(x<y&&x=0)cout << y;
      |           ~~~^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define re(i,n) for(ll i=0;i<n;++i)
#define ocut cout
#define ouct cout
#define itn int
struct Union{
  vector<int> par;
  Union(int a){
  par=vector<int>(a,-1);
  }
  int find(int a){
    if(par[a]<0){
      return a;
    }
    else{
      return par[a]=find(par[a]);
    }
  }
  bool same(int a,int b){
    return (find(a)==find(b));
  }
  int size(int a){
    return -par[find(a)];
  }
  void unite(int a,int b){
    int c=find(a),d=find(b);
    if(c==d)
      return;
    if(size(c)<size(d)){
      swap(c,d);
    }
    par[c]+=par[d];
    par[d]=c;
  }
};
int main(){
  int x,y;
  cin >> x >> y;
  else if(x>y&&y>0)cout << x-y+2;
  else if(x<y&&x>0)cout << y-x;
  else if(x>y&&x<0)cout << x-y+2;
  else if(x<y&&y>0)cout << y-x;
  else if(x<y)cout << y-x+1;
  else cout << x-y+1;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:42:3: error: 'else' without a previous 'if'
   42 |   else if(x>y&&y>0)cout << x-y+2;
      |   ^~~~
Language: C++

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

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


Compiler output:
a.cc: In function 'int main()':
a.cc:9:3: error: 'else' without a previous 'if'
    9 |   else if(abs(y) > abs(x) && x >= 0) cout << -x-y+1 << endl;
      |   ^~~~
Language: C++

#include<stdio.h>
#include<algorithm>
using namespace std;
int s(int x,int y){
    if(x<=y) return y-x;
        else return x-y+2;
}
int main(){
    int x,y;
    scanf("%d%d",&x,&y);
    printf("%d\n",min(s(x,y),min(s(-x,y)+1,min(s(x,-y)+1,s(-x,-y)+2))));
    return 0;


Compiler output:
a.cc: In function 'int main()':
a.cc:12:14: error: expected '}' at end of input
   12 |     return 0;
      |              ^
a.cc:8:11: note: to match this '{'
    8 | int main(){
      |           ^
Language: C++

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:25:26: error: expected ';' before '}' token
   25 |         else ans = -y + 1
      |                          ^
      |                          ;
   26 |     }
      |     ~
Language: C++

#include <bits/stdc++.h>

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define F first
#define S second
#define mp make_pair
#define eb emplace_back
#define pii pair<int, int>
#define pll pair<ll, ll>

using namespace std;

typedef long long ll;

/* --- INFやMODの値が適切か確認する --- */
// const int INF = 1 << 30;
// const ll INF = 1LL << 60;
// const ll MOD = 1000000007;

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

  if (x <= y) {
    if ((x >= 0 && y >= 0) || (x <= 0 && y <= 0)) {
      cout << (y - x) << endl;
    } else {
      cout << abs(abs(x) - y) + 1 << endl;
    }
  } else {
    if ((x >= 0 && y >= 0) || (x <= 0 && y <= 0)) {
      cout << x - y + (x == 0 || y == 0) ? 1 : 2 << endl;
    } else {
      cout << abs(abs(y) - x) + 1 << endl;
    }
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:39:50: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'
   39 |       cout << x - y + (x == 0 || y == 0) ? 1 : 2 << endl;
      |                                                ~~^~~~~~~
Language: C++

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

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

	long long ans = abs( abs( y - abs( x ) );
	if( x * y < 0 || x < 0 && y < 0 && abs( Y ) < abs( x ) ) ans++;
	else if( x < 0 && y < 0 && abs( Y ) >= abs( x ) || x > 0 && y > 0 && abs( Y ) < abs( x ) ) ans += 2;

	cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:49: error: expected ')' before ';' token
    9 |         long long ans = abs( abs( y - abs( x ) );
      |                            ~                    ^
      |                                                 )
a.cc:10:49: error: 'Y' was not declared in this scope
   10 |         if( x * y < 0 || x < 0 && y < 0 && abs( Y ) < abs( x ) ) ans++;
      |                                                 ^
Language: C

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

int main()
{
    int x,y;
    scanf("%d %d",&x,&y);

    int ans = abs(abs(x) - abs(y));

    if(y > x)
    {
        if(x < 0 && y > 0)
        {
            ans += 1;
        }
    }
    else
    {
        if(x < 0 && y > 0)
        {
            ans += 2;
        }
        else
        {
            ans += ;
        }
    }

    printf("%d",ans);
}

Compiler output:
main.c: In function 'main':
main.c:26:20: error: expected expression before ';' token
   26 |             ans += ;
      |                    ^
Language: C++

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

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

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

//C
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

//ここまで毎回include
//以下プログラム

using namespace std;

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

Compiler output:
a.cc: In function 'int main()':
a.cc:104:57: error: expected ')' before ';' token
  104 |                         result += (y * (-1) - (x * (-1));
      |                                   ~                     ^
      |                                                         )
Language: C++

#include <bits/stdc++.h>
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); i++) 
#define FOR(i, a, b) for(int (i) = a; (i) < (int)b; i++)
#define RREP(i, n) for(int (i)=((int)(n)-1); (i)>=0; i--)
#define RFOR(i, a, b) for(int (i) =((int)(b)-1); (i)>=(int)a; i--)
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007
#define NIL -1
#define FI first
#define SE second
#define MP make_pair
#define PB push_back
#define SZ(x)  (int)x.size()
#define SP(x)  setprecision((int)x)


using namespace std ;
typedef long long ll;
typedef vector<int> vint;
typedef vector<vint> vvint;
typedef vector<string> vstr;
typedef pair<int, int> pii;
const int INF = 1e9;
const ll LINF = 1e18;
const double EPS = 1e-9;
ll gcd(ll a, ll b) {return b ? gcd(b, a % b) : a;} //最大公約数
ll lcm(ll a, ll b) {return a / gcd(a, b) * b;} //最小公倍数

//-------------------------------------------------
//



//-------------------------------------------------


int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int x, y ;
  cin >> x >> y ;
  int ans = 0 ;
  if(abs(x)==abs(y)){
    if(x!=y){
      ans++ ;
    }
  }
  else if(abs(x)<abs(y)){
    if(x<0){
      ans++ ;
    }
    if(y<0){
      ans++ ;
    }
    cnt += (abs(y)-abs(x)) ;
  }
  else{
    if(x<0){
      ans += y-x ;
    }
    else if(x>0){
      ans++ ;
      ans += x+y ;
    }
    else{
      if(y<0){
        ans++ ;
      }
      ans += abs(y) ;
    }
  }
  
  cout <<ans <<endl ;
      
  
  
  
  
  return 0 ;
}




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

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:23:26: error: expected ';' before '}' token
   23 |         cout<<2+x-y<<endl
      |                          ^
      |                          ;
   24 |       }
      |       ~
Language: C++

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

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

    if(x==y){
        cout << 0 << endl;
        return 0;
    }

    if(x==0){
        if(y<0) {cout << -y+1LL << endl; return 0;}
        else {cout << y << endl; return 0;}
    }

    if(y==0){
        if(x<0) {cout << -x << endl; return 0;}
        if(x>0) {cout << x+1LL << endl; return 0;}
    }


    if(x < 0 && y < x){
        cout << (x-y) + 2LL << endl;
    }
    else if(x < 0 && y < 0){
        cout << (y-x) << endl;
    }
    else if(x < 0 && y > 0 && -x < y){
        cout << y + x + 1LL<< endl;
    }
    else if(x < 0 && y > 0 && -x > y){
        cout << -x - y + 1LL << endl;
    }
    
    if(x > 0 && y > x){
        cout << y - x << endl;
    }
    else if(x > 0 && 0 < y){
        cout << x - y + 2LL << endl;
    }
    else if(x > 0 && y < 0 && -y > x){
        cout << -y - x + 1LL << endl;
    }
    else if(x > 0 && y < 0 && -y < x){
        cout << x + y + 1Ll << endl;
    }   
}

Compiler output:
a.cc: In function 'int main()':
a.cc:49:25: error: unable to find numeric literal operator 'operator""Ll'
   49 |         cout << x + y + 1Ll << endl;
      |                         ^~~
Language: C++

#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
 
const int MOD=1000000007;
const int INF=0x3f3f3f3f;
const ll INFL=0x3f3f3f3f3f3f3f3f;
ll gcd(ll x, ll y){
  if(y==0) return x;
  else return gcd(y, x%y);
}
ll lcm(ll x,ll y){
  ll g=gcd(x,y);
  return x/g*y;
}

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


Compiler output:
a.cc: In function 'int main()':
a.cc:27:3: error: expected '}' before 'else'
   27 |   else{
      |   ^~~~
a.cc:22:10: note: to match this '{'
   22 |   if(x<y){
      |          ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#define rep(i,n) for(int i=0;i<n;i++)
const long long MOD = 1000000007;
typedef pair<int,int> P;
typedef long long ll;
ll n,m,k,ans;
string s;


int main(){
  long long x,y; cin >> x >> y;
  if( x < y ) {
    if( x*y > 0 ) cout << y-x << "\n";
    else if( abs(x) < abs(y) ) cout << abs(y)-abs(x)+1 << "\n";
    else cout << y-x << "\n";
  }else (x > y){
    if(x*y > 0 && x < 0) cout << x-y+2 << "\n";
    else if(x*y > 0 && x > 0) cout << x+y+1 << "\n";
    else if(abs(x) < abs(y) ) cout << -y-x+1 <<  "\n";
    else cout << y+x+1 << "\n";
  }else {
    cout << 0 << "\n";
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:16: error: expected ';' before '{' token
   18 |   }else (x > y){
      |                ^
      |                ;
a.cc:23:4: error: 'else' without a previous 'if'
   23 |   }else {
      |    ^~~~
Language: C++

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

#define rep(i, N) for (int i = 0; i < (int)N; i++)
const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;


int main() {
  ll x, y; cin >> x >> y;
  ll result = 0;
  if (x<0) {
    if (y<0) {
      if (x>y) result = x-y+2;
      else result = y-x;
    }
    else {
      result = abs(x+y)+1;
    }
  }
  else if (x>0){
    if (y<0) {
      result = abs(x+y)+1;
    }
    else {
      if (x>y) result = x+y+1;
      else result = y-x;
    }
  }
  else {
    reuslt = (y>0) ? y : y+1;
  }
  cout << result << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:5: error: 'reuslt' was not declared in this scope; did you mean 'result'?
   34 |     reuslt = (y>0) ? y : y+1;
      |     ^~~~~~
      |     result
Language: Java

// x < y
//   x < 0 && y < 0 || x > 0 && y > 0 : y-x
//   x < 0 && y > 0
//      |x| < |y| : y+x+1
//      |y| < |x| : -y-x+1
// y < x
//   y < 0 && x < 0 : +2
//   y > 0 && x > 0 : +2
//   y < 0 && x > 0
//      |x| < |y| : +1
//      |y| < |x| : +1

import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int x = sc.nextInt();
    int y = sc.nextInt();
    int A = Math.abs(Math.abs(x)-Math.abs(y));
    int B = 0;
    if (x == 0 || y == 0) {
      B = 0;
    } else if (x > y) {
      B = (long)x*y < 0 ? 1 : 0;
    } else if (y < x) {
      B = (long)x*y > 0 ? 2 : 1;
    }
    Systrm.out.println(A+B);
  }
}

Compiler output:
Main.java:29: error: package Systrm does not exist
    Systrm.out.println(A+B);
          ^
1 error
Language: Java

// x < y
//   x < 0 && y < 0 || x > 0 && y > 0 : y-x
//   x < 0 && y > 0
//      |x| < |y| : y+x+1
//      |y| < |x| : -y-x+1
// y < x
//   y < 0 && x < 0 : +2
//   y > 0 && x > 0 : +2
//   y < 0 && x > 0
//      |x| < |y| : +1
//      |y| < |x| : +1

import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int x = sc.nextInt();
    int y = sc.nextInt();
    int A = Math.abs(Math.abs(x)-Math.abs(y));
    int B = 0;
    if (x == 0 || y == 0) {
      B = 0;
    } else if (x > y) {
      B = (long)x*y < 0 ? 1 : 0;
    } else if (y < x) {
      B = (long)x*y > 0 : 2 : 1;
    }
    Systrm.out.println(A+B);
  }
}

Compiler output:
Main.java:27: error: ';' expected
      B = (long)x*y > 0 : 2 : 1;
                       ^
1 error
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
long long int a,b;
  cin >> a >> b;
  
  if (a>=0 && a<b) {
    cout << b-a <<endl;
  }else if (a>=0 && b>0){ cout <<2+a-b<< endl;
        }else if (b<=0 && a<b){ cout << b-a <<endl;
             }else if (a<0 && b<a) cout << 2+a-b <<endl;
} else{ cout << 1+abs(abs(a)-abs(b)) <<endl;
      }
}


Compiler output:
a.cc:12:3: error: expected unqualified-id before 'else'
   12 | } else{ cout << 1+abs(abs(a)-abs(b)) <<endl;
      |   ^~~~
a.cc:14:1: error: expected declaration before '}' token
   14 | }
      | ^
Language: C++

#include <bits/stdc++.h>
#define ll long long
#define rep(i, n) for(ll i=0; i<n; i++)
#define repr(i, s, e) for(ll i=s; i>=e; i--)
#define reps(i, s, e) for(ll i=s; i<=e; i++)
#define inf 1e18
#define all(v) v.begin(),v.end()
#define vsort(v) sort(v.begin(), v.end())
#define vsortr(v) sort(v.begin(), v.end(), greater<ll>())
#define sz(x) x.size()
#define ceil(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
#define sp << " " <<
using namespace std;
template<typename T> inline bool chmax(T &a, T b){ if(a<b){ a=b; return true; } return false; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a){ a=b; return true; } return false; }
template<typename T> T gcd(T a, T b){ if(b==0) return a; return gcd(b, a%b); }
template<typename T> T lcm(T a, T b){ return a*(b/gcd(a, b)); }
template<typename T> T keta(T num){ T k=0; while(num>0){ num/=10; k++; } return k; }
template<typename T> void vdebug(vector<T> v){ for(auto vv : v){ cout << vv << " "; } cout << endl; }
template<typename T> void adebug(T arr[], ll n){ reps(i, 0, n){ cout << arr[i] << " "; } cout << endl; }
void ans(bool b){ if(b) cout << "Yes" << endl; else cout << "No" << endl; }
void ans2(bool b){ if(b) cout << "YES" << endl; else cout << "NO" << endl; }
int dx[] = {1, -1, 0, 0, 1, -1, 1, -1};
int dy[] = {0, 0, 1, -1, 1, -1, -1, 1};


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

    ll x, y;
    cin >> x >> y;

    ll res = 0;
    if(y > x){
        if(y*x >= 0){
            res = y-x;
        }else{
            if(abs(y) > abs(x)){
                res = y-abs(x)+1;
            }else if(abs(y) < abs(x)){
                res = abs(x)-y+1;
            }else{
                res = 1;
            }
        }
    }else{
        if(abs(x) > abs(y)){
            res = abs(x)-abs(y)+1
        }else if(abs(x) < abs(y)){
            if(x >= 0){
                res = abs(y)-x+1;
            }else{
                res = abs(y)-abs(x)+2;
            }
        }else{
            res = 1;
        }
    }

    cout << res << endl;

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:50:34: error: expected ';' before '}' token
   50 |             res = abs(x)-abs(y)+1
      |                                  ^
      |                                  ;
   51 |         }else if(abs(x) < abs(y)){
      |         ~
Language: C++

#include <iostream>
using namespace std;

int main() {
  long long int x, y;
  cin >> x >> y;
  long long int ans = 1LL << 60;
  if (x <= y) ans = min(res, y-x);
  if (-x <= y) ans = min(ans, y+x+1);
  if (x <= -y) ans = min(ans, -y-x+1);
  if (-x <= -y)
    ans = min(ans, -y + x + 2);
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:25: error: 'res' was not declared in this scope
    8 |   if (x <= y) ans = min(res, y-x);
      |                         ^~~
Language: C++

#include <bits/stdc++.h>
#define INF INT_MAX
#define ll  long long
#define ull unsigned long long
#define rep(i,n) for(ll i=0; i<n; ++i)
#define FOR(i, s, e) for(ll i=s; i<e; ++i)
#define MOD 1000000007
using namespace std;
template<class T> inline bool chmin(T& a, T b) { if(a>b) {a=b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) { if(a<b) {a=b; return true;} return false;}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int X, Y; cin >> X >> Y;
  if(X<0&&Y<X)ans+=2;
  else if(X>0&&Y>0&&X>Y)ans+=2;
  else if(X<0&&Y<=0&&X<Y)ans+=0;
  else if(X<0&&Y<0&&X<Y)ans++;
  else if((X<0&&Y>0)||(X>0&&Y<0))ans++;
  else if(X==0&&Y<0)ans++;
  else if(X>0&&Y==0)ans++;
  cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:15: error: 'ans' was not declared in this scope; did you mean 'abs'?
   16 |   if(X<0&&Y<X)ans+=2;
      |               ^~~
      |               abs
a.cc:17:25: error: 'ans' was not declared in this scope; did you mean 'abs'?
   17 |   else if(X>0&&Y>0&&X>Y)ans+=2;
      |                         ^~~
      |                         abs
a.cc:18:26: error: 'ans' was not declared in this scope; did you mean 'abs'?
   18 |   else if(X<0&&Y<=0&&X<Y)ans+=0;
      |                          ^~~
      |                          abs
a.cc:19:25: error: 'ans' was not declared in this scope; did you mean 'abs'?
   19 |   else if(X<0&&Y<0&&X<Y)ans++;
      |                         ^~~
      |                         abs
a.cc:20:34: error: 'ans' was not declared in this scope; did you mean 'abs'?
   20 |   else if((X<0&&Y>0)||(X>0&&Y<0))ans++;
      |                                  ^~~
      |                                  abs
a.cc:21:21: error: 'ans' was not declared in this scope; did you mean 'abs'?
   21 |   else if(X==0&&Y<0)ans++;
      |                     ^~~
      |                     abs
a.cc:22:21: error: 'ans' was not declared in this scope; did you mean 'abs'?
   22 |   else if(X>0&&Y==0)ans++;
      |                     ^~~
      |                     abs
a.cc:23:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   23 |   cout<<ans<<endl;
      |         ^~~
      |         abs