Language: C++

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

typedef long long int64_t;

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

	vector<int64_t> p = { x, y, -x, -y };

	int64_t g[4][4];
	for (int i = 0; i < 4; i++) {
		for (int j = 0; j < 4; j++) {
			g[i][j] = 1e15;
			if (i == j) {
				g[i][j] = 0;
			}
			if (p[i] == -p[j]) {
				g[i][j] = min(g[i][j], 1LL);
			}
			if (p[i] <= p[j]) {
				g[i][j] = min(g[i][j], p[j] - p[i]);
			}
		}
	}

	for (int k = 0; k < 4; k++) {
		for (int i = 0; i < 4; i++) {
			for (int j = 0; j < 4; j++) {
				g[i][j] = min(g[i][j], g[i][k] + g[k][j]);
			}
		}
	}

	cout << g[0][1] << endl;
}


Compiler output:
a.cc:4:19: error: conflicting declaration 'typedef long long int int64_t'
    4 | typedef long long int64_t;
      |                   ^~~~~~~
In file included from /usr/include/x86_64-linux-gnu/sys/types.h:155,
                 from /usr/include/stdlib.h:514,
                 from /usr/include/c++/14/cstdlib:79,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:42,
                 from a.cc:1:
/usr/include/x86_64-linux-gnu/bits/stdint-intn.h:27:19: note: previous declaration as 'typedef __int64_t int64_t'
   27 | typedef __int64_t int64_t;
      |                   ^~~~~~~
a.cc: In function 'int main()':
a.cc:20:46: error: no matching function for call to 'min(int64_t&, long long int)'
   20 |                                 g[i][j] = min(g[i][j], 1LL);
      |                                           ~~~^~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/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:   template argument deduction/substitution failed:
a.cc:20:46: note:   deduced conflicting types for parameter 'const _Tp' ('long int' and 'long long int')
   20 |                                 g[i][j] = min(g[i][j], 1LL);
      |                                           ~~~^~~~~~~~~~~~~~
/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, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:20:46: note:   mismatched types 'std::initializer_list<_Tp>' and 'long int'
   20 |                                 g[i][j] = min(g[i][j], 1LL);
      |                                           ~~~^~~~~~~~~~~~~~