Language: C++

#include <bits/stdc++.h>

//press B 0 or 1 time, then press A 0 or more times, then press B 0 or 1 time

int main(){
	int x, y;
	cin >> x >> y;
	ll ans = 1e16;
	//0...0
	if(x <= y) ans = min(ans, y - x);
	//0...1
	if(x <= -y) ans = min(ans, -y - x + 1);
	//1...0
	if(-x <= y) ans = min(ans, y + x + 1);
	//1...1
	if(-x <= -y) ans = min(ans, -y + x + 2);
	cout<< ans << '\n';
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    7 |         cin >> x >> y;
      |         ^~~
      |         std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
                 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:8:9: error: 'll' was not declared in this scope
    8 |         ll ans = 1e16;
      |         ^~
a.cc:10:20: error: 'ans' was not declared in this scope; did you mean 'abs'?
   10 |         if(x <= y) ans = min(ans, y - x);
      |                    ^~~
      |                    abs
a.cc:10:26: error: 'min' was not declared in this scope; did you mean 'std::min'?
   10 |         if(x <= y) ans = min(ans, y - x);
      |                          ^~~
      |                          std::min
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: 'std::min' declared here
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
a.cc:12:21: error: 'ans' was not declared in this scope; did you mean 'abs'?
   12 |         if(x <= -y) ans = min(ans, -y - x + 1);
      |                     ^~~
      |                     abs
a.cc:12:27: error: 'min' was not declared in this scope; did you mean 'std::min'?
   12 |         if(x <= -y) ans = min(ans, -y - x + 1);
      |                           ^~~
      |                           std::min
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: 'std::min' declared here
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
a.cc:14:21: error: 'ans' was not declared in this scope; did you mean 'abs'?
   14 |         if(-x <= y) ans = min(ans, y + x + 1);
      |                     ^~~
      |                     abs
a.cc:14:27: error: 'min' was not declared in this scope; did you mean 'std::min'?
   14 |         if(-x <= y) ans = min(ans, y + x + 1);
      |                           ^~~
      |                           std::min
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: 'std::min' declared here
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
a.cc:16:22: error: 'ans' was not declared in this scope; did you mean 'abs'?
   16 |         if(-x <= -y) ans = min(ans, -y + x + 2);
      |                      ^~~
      |                      abs
a.cc:16:28: error: 'min' was not declared in this scope; did you mean 'std::min'?
   16 |         if(-x <= -y) ans = min(ans, -y + x + 2);
      |                            ^~~
      |                            std::min
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: 'std::min' declared here
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
a.cc:17:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   17 |         cout<< ans << '\n';
      |         ^~~~
      |         std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:17:16: error: 'ans' was not declared in this scope; did you mean 'abs'?
   17 |         cout<< ans << '\n';
      |                ^~~
      |                abs