Language: C++

#include <bits/stdc++.h>
using namespace std;
#define ll long long int 
int sway[10000000001];
int tway[10000000001];
int main(){
  ll a,b,q;
  cin >> a >> b >> q;
  vector<ll> s(a);
  vector<ll> t(b);
  vector<ll> x(q);
  for(ll i = 0;i < a;i++){
    cin >> s[i];
    sway[s[i]]=1;
  }
  for(ll i = 0;i < b;i++){
    cin >> t[i];
    tway[t[i]]=1;
  }
  ll smallest = min(t[0],s[0]);
  ll biggest = max(t[b-1],s[a-1]);
  for(ll i = 0;i < q;i++){
    ll nears,neart,es,et;
    nears = a/2;
    neart = b/2
    ll answer;
    cin >> x[i];
    ll X = x[i];
    bool rights,rightt;
    while(X >= smalllest && (rights == false || rightt == false)){
        if(tway[x[i]] == 1) rightt = true;
        if(sway[x[i]] == 1) rights = true;
        if(rights == false || rightt == false) --X;
        answer++;
    }
    if(rights ==  false || rightt = false) answer = 15000000000;
    ll answer2;
    rightt = rights = false;
    X = x[i];
    while(X >= samllest && biggest >= X && (rights == false || rightt == false)){
        if(tway[x[i]] == 1) rightt = true;
        if(sway[x[i]] == 1) rights = true;
        if(rights == false && rightt == false) --X;
        else if(rightt == true || rights == true) ++X;
        answer2++;
    }
    if(rights ==  false || rightt = false) answer2 = 15000000000;
    answer = min(answer,answer2);
    rightt = rights = false;
    X = x[i];
    while(X >= samllest && biggest >= X && (rights == false || rightt == false)){
        if(tway[x[i]] == 1) rightt = true;
        if(sway[x[i]] == 1) rights = true;
        if(rights == false && rightt == false) ++X;
        else if(rightt == true || rights == true) --X;
        answer2++;
    }
    if(rights ==  false || rightt = false) answer2 = 15000000000;
    answer = min(answer,answer2);
    rightt = rights = false;
    X = x[i];
    while(X >= samllest && biggest >= X && (rights == false || rightt == false)){
        if(tway[x[i]] == 1) rightt = true;
        if(sway[x[i]] == 1) rights = true;
        if(rightt == true || rights == true) ++X;
        answer2++;
    }
    if(rights ==  false || rightt = false) answer2 = 10000000000;
    answer = min(answer,answer2);
    cout << answer << endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:25:16: error: expected ';' before 'long'
   25 |     neart = b/2
      |                ^
      |                ;
a.cc:30:16: error: 'smalllest' was not declared in this scope; did you mean 'smallest'?
   30 |     while(X >= smalllest && (rights == false || rightt == false)){
      |                ^~~~~~~~~
      |                smallest
a.cc:34:9: error: 'answer' was not declared in this scope
   34 |         answer++;
      |         ^~~~~~
a.cc:36:25: error: lvalue required as left operand of assignment
   36 |     if(rights ==  false || rightt = false) answer = 15000000000;
      |        ~~~~~~~~~~~~~~~~~^~~~~~~~~
a.cc:36:44: error: 'answer' was not declared in this scope
   36 |     if(rights ==  false || rightt = false) answer = 15000000000;
      |                                            ^~~~~~
a.cc:40:16: error: 'samllest' was not declared in this scope; did you mean 'smallest'?
   40 |     while(X >= samllest && biggest >= X && (rights == false || rightt == false)){
      |                ^~~~~~~~
      |                smallest
a.cc:47:25: error: lvalue required as left operand of assignment
   47 |     if(rights ==  false || rightt = false) answer2 = 15000000000;
      |        ~~~~~~~~~~~~~~~~~^~~~~~~~~
a.cc:48:5: error: 'answer' was not declared in this scope; did you mean 'answer2'?
   48 |     answer = min(answer,answer2);
      |     ^~~~~~
      |     answer2
a.cc:51:16: error: 'samllest' was not declared in this scope; did you mean 'smallest'?
   51 |     while(X >= samllest && biggest >= X && (rights == false || rightt == false)){
      |                ^~~~~~~~
      |                smallest
a.cc:58:25: error: lvalue required as left operand of assignment
   58 |     if(rights ==  false || rightt = false) answer2 = 15000000000;
      |        ~~~~~~~~~~~~~~~~~^~~~~~~~~
a.cc:62:16: error: 'samllest' was not declared in this scope; did you mean 'smallest'?
   62 |     while(X >= samllest && biggest >= X && (rights == false || rightt == false)){
      |                ^~~~~~~~
      |                smallest
a.cc:68:25: error: lvalue required as left operand of assignment
   68 |     if(rights ==  false || rightt = false) answer2 = 10000000000;
      |        ~~~~~~~~~~~~~~~~~^~~~~~~~~