Language: C++

#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define fi first
#define se second
#define mp make_pair
#define itrfor(itr,A) for(auto itr = A.begin(); itr !=A.end();itr++)
template <class T> using reversed_priority_queue = priority_queue<T, vector<T>, greater<T> >;
typedef long long llong;
char moji[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
char moji2[26]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
char moji3[10]={'0','1','2','3','4','5','6','7','8','9'};
#define Sort(a) sort(a.begin(),a.end());
#define Reverse(a) reverse(a.begin(),a.end());
#define print(a) cout << a << endl;
#define MOD llong(1e9+7)
#define MAX int( 1e5 +5)
#define debug(x)  cout << #x << " = " << (x) << endl;
#define pi acos(-1.0)
#define int llong
#define INF llong(1e17);


signed main(){
    int a,b,q;
    cin >> a >> b >> q;
    pair<int,int> A[MAX],B[MAX];
    REP(i,a){
        scanf("%lld",&(A[i+1].fi) );
    }
    REP(i,b) scanf("%lld",& (B[i+1].fi) );
    A[0].fi = -INF;
    B[0].fi = - INF;
    A[0].se = INF;
    B[0].se = INF;
    A[a+1].fi = INF;
    B[b+1].fi = INF;
    A[a+1].se = INF;
    B[b+1].se = INF;

    int id = 0;
    while( A[1].fi > B[id + 1].fi ) id ++;
    FOR(i,1,a+1){
        if( A[i].fi > B[id+1].fi) id ++;
        A[i].se = ( abs (A[i].fi - B[id].fi) , abs(A[i].fi - B[id +1].fi))
    }



    id = 0;
    while( B[1].fi > A[id + 1].fi ) id ++;
    FOR(i,1,b+1){
        if( B[i].fi > A[id+1].fi) id ++;
        B[i].se = ( abs (B[i].fi - A[id].fi)  , abs(B[i].fi - A[id +1].fi))
    }








    REP(i,q){
        int tmp;
        scanf("%lld",&tmp);
        int ng = 0,ok = a+1;
        while(ng + 1 < ok){
            int mid = (ng + ok)/ 2;
            if( A[mid].fi < tmp) ng = mid;
            else ok = mid; 
        }
        int a_id = ok-1;
        ng = 0;
        ok = b+1;
        while(ng + 1 < ok){
            int mid = (ng + ok)/ 2;
            if( B[mid].fi < tmp) ng = mid;
            else ok = mid; 
        }        
        int b_id = ok-1;

        int ans = min( abs(tmp-A[a_id].fi) + A[a_id].se , abs(tmp-B[b_id].fi) + B[b_id].se);
        ans = min( ans , abs(tmp - A[a_id +1].fi) + A[a_id +1].se);
        ans = min( ans , abs(tmp-B[b_id +1].fi) + B[b_id+1].se );
/*
        int ans = INF;
        FOR(j,a_id , a_id +2){
            FOR(k,b_id , b_id + 2){
                int res = min( abs(A[j].fi-tmp) + abs(A[j].fi - B[k].fi), abs(B[k].fi-tmp)+ abs(A[j].fi - B[k].fi) );
                ans = min(ans,res);
            }
        } 
*/ 
        printf("%lld\n",ans);
    }

}

Compiler output:
a.cc: In function 'int main()':
a.cc:47:75: error: expected ';' before '}' token
   47 |         A[i].se = ( abs (A[i].fi - B[id].fi) , abs(A[i].fi - B[id +1].fi))
      |                                                                           ^
      |                                                                           ;
   48 |     }
      |     ~                                                                      
a.cc:56:76: error: expected ';' before '}' token
   56 |         B[i].se = ( abs (B[i].fi - A[id].fi)  , abs(B[i].fi - A[id +1].fi))
      |                                                                            ^
      |                                                                            ;
   57 |     }
      |     ~