Language: C++

#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define rep(i,n) for (int i=0;i<(int)(n);i++)
#define codefor int test;scanf("%d",&test);while(test--)
#define yn(ans) if(ans)printf("Yes\n");else printf("No\n")
#define YN(ans) if(ans)printf("YES\n");else printf("NO\n")
#define umap unordered_map
#define uset unordered_set
using namespace std;
using ll = long long;
const int MOD=1000000007;
//入力系
void scan(int& a){scanf("%d",&a);}
void scan(long long& a){scanf("%lld",&a);}
template<class T> void scan(T& a){cin>>a;}
template<class T> void scan(vector<T>& vec){for(auto&& it:vec)scan(it);}
void in(){}
template <class Head, class... Tail> void in(Head& head, Tail&... tail){scan(head);in(tail...);}
//出力系
void print(const int& a){printf("%d",a);}
void print(const long long& a){printf("%lld",a);}
void print(const double& a){printf("%.15lf",a);}
template<class T> void print(const T& a){cout<<a;}
template<class T> void print(const vector<T>& vec){if(vec.empty())return;print(vec[0]);for(auto it=vec.begin();++it!= vec.end();){putchar(' ');print(*it);}}
void out(){putchar('\n');}
template<class T> void out(const T& t){print(t);putchar('\n');}
template <class Head, class... Tail> void out(const Head& head,const Tail&... tail){print(head);putchar(' ');out(tail...);}
//デバッグ系
template<class T> void dprint(const T& a){cerr<<a;}
template<class T> void dprint(const vector<T>& vec){if(vec.empty())return;cerr<<vec[0];for(auto it=vec.begin();++it!= vec.end();){cerr<<" "<<*it;}}
void debug(){cerr<<endl;}
template<class T> void debug(const T& t){dprint(t);cerr<<endl;}
template <class Head, class... Tail> void debug(const Head& head, const Tail&... tail){dprint(head);cerr<<" ";debug(tail...);}

#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define rep(i,n) for (int i=0;i<(int)(n);i++)
#define codefor int test;scanf("%d",&test);while(test--)
#define yn(ans) if(ans)printf("Yes\n");else printf("No\n")
#define YN(ans) if(ans)printf("YES\n");else printf("NO\n")
#define umap unordered_map
#define uset unordered_set
using namespace std;
using ll = long long;
const int MOD=1000000007;
//入力系
void scan(int& a){scanf("%d",&a);}
void scan(long long& a){scanf("%lld",&a);}
template<class T> void scan(T& a){cin>>a;}
template<class T> void scan(vector<T>& vec){for(auto&& it:vec)scan(it);}
void in(){}
template <class Head, class... Tail> void in(Head& head, Tail&... tail){scan(head);in(tail...);}
//出力系
void print(const int& a){printf("%d",a);}
void print(const long long& a){printf("%lld",a);}
void print(const double& a){printf("%.15lf",a);}
template<class T> void print(const T& a){cout<<a;}
template<class T> void print(const vector<T>& vec){if(vec.empty())return;print(vec[0]);for(auto it=vec.begin();++it!= vec.end();){putchar(' ');print(*it);}}
void out(){putchar('\n');}
template<class T> void out(const T& t){print(t);putchar('\n');}
template <class Head, class... Tail> void out(const Head& head,const Tail&... tail){print(head);putchar(' ');out(tail...);}
//デバッグ系
template<class T> void dprint(const T& a){cerr<<a;}
template<class T> void dprint(const vector<T>& vec){if(vec.empty())return;cerr<<vec[0];for(auto it=vec.begin();++it!= vec.end();){cerr<<" "<<*it;}}
void debug(){cerr<<endl;}
template<class T> void debug(const T& t){dprint(t);cerr<<endl;}
template <class Head, class... Tail> void debug(const Head& head, const Tail&... tail){dprint(head);cerr<<" ";debug(tail...);}
 
int main(){
    ll x,y;
    in(x,y);
    ll ans=0;
    if(y==0){
        if(x>0){
            ans=x+1;
        }else{
            ans=-x;
        }
    }else if(abs(y)>=abs(x)){
        if(x>=0&&y>=0){
            ans=y-x;
        }
        if(x<0&&y>=0){
            ans=y+x+1;
        }
        if(x>=0&&y<0){
            ans=-y-x+1;
        }
        if(x<0&&y<0){
            ans=-y+x+2;
        }
        if(x==0&&y>0)ans=y;
        if(x==0&&y<0)ans=-y+1;
    }else{
        if(x>=0&&y>=0){
            ans=x+y+1;
        }
        if(x<0&&y>=0){
            ans=y-x;
        }
        if(x>=0&&y<0){
            ans=x+y+1;
        }
        if(x<0&&y<0){
            ans=y-x;
        }
        if(x==0&&y>0)ans=y;
        if(x==0&&y<0)ans=-y+1;
    }
    out(ans);
}

Compiler output:
a.cc:47:11: error: redefinition of 'const int MOD'
   47 | const int MOD=1000000007;
      |           ^~~
a.cc:12:11: note: 'const int MOD' previously defined here
   12 | const int MOD=1000000007;
      |           ^~~
a.cc:49:6: error: redefinition of 'void scan(int&)'
   49 | void scan(int& a){scanf("%d",&a);}
      |      ^~~~
a.cc:14:6: note: 'void scan(int&)' previously defined here
   14 | void scan(int& a){scanf("%d",&a);}
      |      ^~~~
a.cc:50:6: error: redefinition of 'void scan(long long int&)'
   50 | void scan(long long& a){scanf("%lld",&a);}
      |      ^~~~
a.cc:15:6: note: 'void scan(long long int&)' previously defined here
   15 | void scan(long long& a){scanf("%lld",&a);}
      |      ^~~~
a.cc:51:24: error: redefinition of 'template<class T> void scan(T&)'
   51 | template<class T> void scan(T& a){cin>>a;}
      |                        ^~~~
a.cc:16:24: note: 'template<class T> void scan(T&)' previously declared here
   16 | template<class T> void scan(T& a){cin>>a;}
      |                        ^~~~
a.cc:52:24: error: redefinition of 'template<class T> void scan(std::vector<_Tp>&)'
   52 | template<class T> void scan(vector<T>& vec){for(auto&& it:vec)scan(it);}
      |                        ^~~~
a.cc:17:24: note: 'template<class T> void scan(std::vector<_Tp>&)' previously declared here
   17 | template<class T> void scan(vector<T>& vec){for(auto&& it:vec)scan(it);}
      |                        ^~~~
a.cc:53:6: error: redefinition of 'void in()'
   53 | void in(){}
      |      ^~
a.cc:18:6: note: 'void in()' previously defined here
   18 | void in(){}
      |      ^~
a.cc:54:43: error: redefinition of 'template<class Head, class ... Tail> void in(Head&, Tail& ...)'
   54 | template <class Head, class... Tail> void in(Head& head, Tail&... tail){scan(head);in(tail...);}
      |                                           ^~
a.cc:19:43: note: 'template<class Head, class ... Tail> void in(Head&, Tail& ...)' previously declared here
   19 | template <class Head, class... Tail> void in(Head& head, Tail&... tail){scan(head);in(tail...);}
      |                                           ^~
a.cc:56:6: error: redefinition of 'void print(const int&)'
   56 | void print(const int& a){printf("%d",a);}
      |      ^~~~~
a.cc:21:6: note: 'void print(const int&)' previously defined here
   21 | void print(const int& a){printf("%d",a);}
      |      ^~~~~
a.cc:57:6: error: redefinition of 'void print(const long long int&)'
   57 | void print(const long long& a){printf("%lld",a);}
      |      ^~~~~
a.cc:22:6: note: 'void print(const long long int&)' previously defined here
   22 | void print(const long long& a){printf("%lld",a);}
      |      ^~~~~
a.cc:58:6: error: redefinition of 'void print(const double&)'
   58 | void print(const double& a){printf("%.15lf",a);}
      |      ^~~~~
a.cc:23:6: note: 'void print(const double&)' previously defined here
   23 | void print(const double& a){printf("%.15lf",a);}
      |      ^~~~~
a.cc:59:24: error: redefinition of 'template<class T> void print(const T&)'
   59 | template<class T> void print(const T& a){cout<<a;}
      |                        ^~~~~
a.cc:24:24: note: 'template<class T> void print(const T&)' previously declared here
   24 | template<class T> void print(const T& a){cout<<a;}
      |                        ^~~~~
a.cc:60:24: error: redefinition of 'template<class T> void print(const std::vector<_Tp>&)'
   60 | template<class T> void print(const vector<T>& vec){if(vec.empty())return;print(vec[0]);for(auto it=vec.begin();++it!= vec.end();){putchar(' ');print(*it);}}
      |                        ^~~~~
a.cc:25:24: note: 'template<class T> void print(const std::vector<_Tp>&)' previously declared here
   25 | template<class T> void print(const vector<T>& vec){if(vec.empty())return;print(vec[0]);for(auto it=vec.begin();++it!= vec.end();){putchar(' ');print(*it);}}
      |                        ^~~~~
a.cc:61:6: error: redefinition of 'void out()'
   61 | void out(){putchar('\n');}
      |      ^~~
a.cc:26:6: note: 'void out()' previously defined here
   26 | void out(){putchar('\n');}
      |      ^~~
a.cc:62:24: error: redefinition of 'template<class T> void out(const T&)'
   62 | template<class T> void out(const T& t){print(t);putchar('\n');}
      |                        ^~~
a.cc:27:24: note: 'template<class T> void out(const T&)' previously declared here
   27 | template<class T> void out(const T& t){print(t);putchar('\n');}
      |                        ^~~
a.cc:63:43: error: redefinition of 'template<class Head, class ... Tail> void out(const Head&, const Tail& ...)'
   63 | template <class Head, class... Tail> void out(const Head& head,const Tail&... tail){print(head);putchar(' ');out(tail...);}
      |                                           ^~~
a.cc:28:43: note: 'template<class Head, class ... Tail> void out(const Head&, const Tail& ...)' previously declared here
   28 | template <class Head, class... Tail> void out(const Head& head,const Tail&... tail){print(head);putchar(' ');out(tail...);}
      |                                           ^~~
a.cc:65:24: error: redefinition of 'template<class T> void dprint(const T&)'
   65 | template<class T> void dprint(const T& a){cerr<<a;}
      |                        ^~~~~~
a.cc:30:24: note: 'template<class T> void dprint(const T&)' previously declared here
   30 | template<class T> void dprint(const T& a){cerr<<a;}
      |                        ^~~~~~
a.cc:66:24: error: redefinition of 'template<class T> void dprint(const std::vector<_Tp>&)'
   66 | template<class T> void dprint(const vector<T>& vec){if(vec.empty())return;cerr<<vec[0];for(auto it=vec.begin();++it!= vec.end();){cerr<<" "<<*it;}}
      |                        ^~~~~~
a.cc:31:24: note: 'template<class T> void dprint(const std::vector<_Tp>&)' previously declared here
   31 | template<class T> void dprint(const vector<T>& vec){if(vec.empty())return;cerr<<vec[0];for(auto it=vec.begin();++it!= vec.end();){cerr<<" "<<*it;}}
      |                        ^~~~~~
a.cc:67:6: error: redefinition of 'void debug()'
   67 | void debug(){cerr<<endl;}
      |      ^~~~~
a.cc:32:6: note: 'void debug()' previously defined here
   32 | void debug(){cerr<<endl;}
      |      ^~~~~
a.cc:68:24: error: redefinition of 'template<class T> void debug(const T&)'
   68 | template<class T> void debug(const T& t){dprint(t);cerr<<endl;}
      |                        ^~~~~
a.cc:33:24: note: 'template<class T> void debug(const T&)' previously declared here
   33 | template<class T> void debug(const T& t){dprint(t);cerr<<endl;}
      |                        ^~~~~
a.cc:69:43: error: redefinition of 'template<class Head, class ... Tail> void debug(const Head&, const Tail& ...)'
   69 | template <class Head, class... Tail> void debug(const Head& head, const Tail&... tail){dprint(head);cerr<<" ";debug(tail...);}
      |                                           ^~~~~
a.cc:34:43: note: 'template<class Head, class ... Tail> void debug(const Head&, const Tail& ...)' previously declared here
   34 | template <class Head, class... Tail> void debug(const Head& head, const Tail&... tail){dprint(head);cerr<<" ";debug(tail...);}
      |                                           ^~~~~