Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MM 1000000000
#define MOD MM+7
#define MAX 101000
#define MAP 110
#define initial_value -1
#define Pair pair<int,int>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
ll INF = 1e18;
int dx[4] = {-1,0,1,0};
int dy[4] = {0,-1,0,1};
ll A,B,Q;

int main(){
    cin >> A >> B >> Q;
    vector<ll> s(A+2),t(B+2);
    ll x;
    s[0] = -INF; s[A+1] = INF;
    for(ll i = 1; i <= A; i++) cin >> s[i];
    t[0] = -INF; t[B+1] = INF;
    for(ll i = 1; i <= B; i++) cin >> t[i];
    for(ll i = 0; i < Q; i++){
        cin >> x;
        ll u = lower_bound(s.begin(),s.end(),x);
        ll v = lower_bound(t.begin(),t.end(),x);

        d[0] = x - min(*(u-1),*(v-1));
        d[1] = x - *(u-1) + *v - *(u-1);
        d[2] = x - *(v-1) + *u - *(v-1);
        d[3] = max(*v,*u) - x;
        d[4] = *v - x + *v - *(u-1);
        d[5] = *u - x + *u - *(v-1);

        ll ans = d[0];
        for(ll j = 1; j <= 5; j++){
            ans = min(ans, d[i]);
        }
        cout << ans << endl;
    }
    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:27:27: error: cannot convert '__gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >' to 'll' {aka 'long long int'} in initialization
   27 |         ll u = lower_bound(s.begin(),s.end(),x);
      |                ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
      |                           |
      |                           __gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >
a.cc:28:27: error: cannot convert '__gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >' to 'll' {aka 'long long int'} in initialization
   28 |         ll v = lower_bound(t.begin(),t.end(),x);
      |                ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
      |                           |
      |                           __gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >
a.cc:30:9: error: 'd' was not declared in this scope
   30 |         d[0] = x - min(*(u-1),*(v-1));
      |         ^
a.cc:30:24: error: invalid type argument of unary '*' (have 'll' {aka 'long long int'})
   30 |         d[0] = x - min(*(u-1),*(v-1));
      |                        ^~~~~~
a.cc:30:31: error: invalid type argument of unary '*' (have 'll' {aka 'long long int'})
   30 |         d[0] = x - min(*(u-1),*(v-1));
      |                               ^~~~~~
a.cc:31:20: error: invalid type argument of unary '*' (have 'll' {aka 'long long int'})
   31 |         d[1] = x - *(u-1) + *v - *(u-1);
      |                    ^~~~~~
a.cc:31:29: error: invalid type argument of unary '*' (have 'll' {aka 'long long int'})
   31 |         d[1] = x - *(u-1) + *v - *(u-1);
      |                             ^~
a.cc:31:34: error: invalid type argument of unary '*' (have 'll' {aka 'long long int'})
   31 |         d[1] = x - *(u-1) + *v - *(u-1);
      |                                  ^~~~~~
a.cc:32:20: error: invalid type argument of unary '*' (have 'll' {aka 'long long int'})
   32 |         d[2] = x - *(v-1) + *u - *(v-1);
      |                    ^~~~~~
a.cc:32:29: error: invalid type argument of unary '*' (have 'll' {aka 'long long int'})
   32 |         d[2] = x - *(v-1) + *u - *(v-1);
      |                             ^~
a.cc:32:34: error: invalid type argument of unary '*' (have 'll' {aka 'long long int'})
   32 |         d[2] = x - *(v-1) + *u - *(v-1);
      |                                  ^~~~~~
a.cc:33:20: error: invalid type argument of unary '*' (have 'll' {aka 'long long int'})
   33 |         d[3] = max(*v,*u) - x;
      |                    ^~
a.cc:33:23: error: invalid type argument of unary '*' (have 'll' {aka 'long long int'})
   33 |         d[3] = max(*v,*u) - x;
      |                       ^~
a.cc:34:16: error: invalid type argument of unary '*' (have 'll' {aka 'long long int'})
   34 |         d[4] = *v - x + *v - *(u-1);
      |                ^~
a.cc:34:25: error: invalid type argument of unary '*' (have 'll' {aka 'long long int'})
   34 |         d[4] = *v - x + *v - *(u-1);
      |                         ^~
a.cc:34:30: error: invalid type argument of unary '*' (have 'll' {aka 'long long int'})
   34 |         d[4] = *v - x + *v - *(u-1);
      |                              ^~~~~~
a.cc:35:16: error: invalid type argument of unary '*' (have 'll' {aka 'long long int'})
   35 |         d[5] = *u - x + *u - *(v-1);
      |                ^~
a.cc:35:25: error: invalid type argument of unary '*' (have 'll' {aka 'long long int'})
   35 |         d[5] = *u - x + *u - *(v-1);
      |                         ^~
a.cc:35:30: error: invalid type argument of unary '*' (have 'll' {aka 'long long int'})
   35 |         d[5] = *u - x + *u - *(v-1);
      |                              ^~~~~~