Language: C++

#include<iostream>
#include <algorithm>
#include <functional>
#include<vector>
#include<math.h>
#include<bitset>
#include<string>
#include <deque>
#include<queue>
#include <iomanip>
#include<map>
#include <random>
#include<type_traits>
#include<stack>
using namespace std;


#define ll long long int
#define all(v) begin(v), end(v)
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for(int i = (int)(s); i < (int)(n); i++)
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
typedef pair<int, int> Edge;



int main() {
	long long int  q,x,l1,l2,l3,l4,X;
	int a,b,s0, s1, t0, t1;
	vector<long long int> s, t;
	cin >> a >> b >> q;
	for (int i = 0; i < a; i++) {
		cin >>X ;
		s.push_back(X);
	}
	for (int i = 0; i < b; i++) {
		cin >> X;
		t.push_back(X);
	}


	for ( int i = 0; i < q; i++) {
		cin >> x;
		s1 = min(lower_bound(s.begin(), s.end(), x) - s.begin(),a-1);
		t1=min(lower_bound(t.begin(), t.end(), x) - t.begin(),b-1);
		s0 = max(s1 - 1,0);
		t0 = max(t1 - 1,0);
		l1 = abs(s[s0] - t[t0]) + min(abs(x - s[s0]), abs(x - t[t0]));
		l2 = abs(s[s1] - t[t0]) + min(abs(x - s[s1]), abs(x - t[t0]));
		l3 = abs(s[s0] - t[t1]) + min(abs(x - s[s0]), abs(x - t[t1]));
		l4 = abs(s[s1] - t[t1]) + min(abs(x - s[s1]), abs(x - t[t1]));
		l1 = min(l1, l2);
		l3=min( l3, l4);
		cout << min(l1, l3) <<endl;
	}

}


Compiler output:
a.cc: In function 'int main()':
a.cc:46:25: error: no matching function for call to 'min(__gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >::difference_type, int)'
   46 |                 s1 = min(lower_bound(s.begin(), s.end(), x) - s.begin(),a-1);
      |                      ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/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:46:25: note:   deduced conflicting types for parameter 'const _Tp' ('long int' and 'int')
   46 |                 s1 = min(lower_bound(s.begin(), s.end(), x) - s.begin(),a-1);
      |                      ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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,
                 from a.cc:2:
/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:46:25: note:   mismatched types 'std::initializer_list<_Tp>' and 'long int'
   46 |                 s1 = min(lower_bound(s.begin(), s.end(), x) - s.begin(),a-1);
      |                      ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:47:23: error: no matching function for call to 'min(__gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >::difference_type, int)'
   47 |                 t1=min(lower_bound(t.begin(), t.end(), x) - t.begin(),b-1);
      |                    ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:47:23: note:   deduced conflicting types for parameter 'const _Tp' ('long int' and 'int')
   47 |                 t1=min(lower_bound(t.begin(), t.end(), x) - t.begin(),b-1);
      |                    ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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
/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:47:23: note:   mismatched types 'std::initializer_list<_Tp>' and 'long int'
   47 |                 t1=min(lower_bound(t.begin(), t.end(), x) - t.begin(),b-1);
      |                    ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~