Language: C++

#include <bits/stdc++.h>
#define PI 3.14159265359
#define NIL (-1)
#define LL long long
using namespace std;
const int64_t MOD = 1e9 + 7;
const int INF = INT_MAX;

void chmin(int64_t& a, int64_t b) {
	if (a > b) a = b;
}

int main() {
	int64_t A, B, Q;
	cin >> A >> B >> Q;

	vector<int64_t> S(A), T(B);
	for (int i = 0; i < A; i++) cin >> S[i];
	for (int i = 0; i < B; i++) cin >> T[i];

	for (int i = 0; i < Q; i++) {
		int64_t x;
		cin >> x;
		//cout << "x:" << x << endl;

		int64_t s_itr, t_itr;
		s_itr = upper_bound(S.begin(), S.end(), x) - S.begin();
		t_itr = upper_bound(T.begin(), T.end(), x) - T.begin();
		if (s_itr == A) s_itr--;
		if (t_itr == B) t_itr--;

		int64_t ans = INT64_MAX;

		for (int j = 0; j < 3; j++) {
			for (int k = 0; k < 3; k++) {
				int64_t s, t;
				s = max(0LL, s_itr - j);
				t = max(0LL, t_itr - k);

				int64_t n, m;
				n = abs(S[s] - x) + abs(S[s] - T[t]);
				m = abs(T[t] - x) + abs(S[s] - T[t]);

				chmin(ans, n);
				chmin(ans, m);
			}
		}

		cout << ans << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:40: error: no matching function for call to 'max(long long int, int64_t)'
   37 |                                 s = max(0LL, s_itr - j);
      |                                     ~~~^~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:37:40: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int64_t' {aka 'long int'})
   37 |                                 s = max(0LL, s_itr - j);
      |                                     ~~~^~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303: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:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:37:40: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   37 |                                 s = max(0LL, s_itr - j);
      |                                     ~~~^~~~~~~~~~~~~~~~
a.cc:38:40: error: no matching function for call to 'max(long long int, int64_t)'
   38 |                                 t = max(0LL, t_itr - k);
      |                                     ~~~^~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:38:40: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int64_t' {aka 'long int'})
   38 |                                 t = max(0LL, t_itr - k);
      |                                     ~~~^~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:38:40: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   38 |                                 t = max(0LL, t_itr - k);
      |                                     ~~~^~~~~~~~~~~~~~~~