criyle/codenet-compile-errors huggingface dataset:
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define all(x) (x).begin(),(x).end()
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
using Graph = vector<vector<int>>;
double nCk(int n, int k) {
double res=1.0;
for(int i=0; i<n; i++){
res*=0.5;}
for(int i=0; i<k; i++){
res*=(double)(n-i);
res/=(double)(k-i);
}
return res;}
struct edge{ll to, cost;};
typedef pair<ll,ll> P;
struct graph{
  ll V;
  vector<vector<edge> > G;
  vector<ll> d;

  graph(ll n){
    init(n);
  }

  void init(ll n){
    V = n;
    G.resize(V);
    d.resize(V);
    rep(i,V){
      d[i] = INF;
    }
  }

  void add_edge(ll s, ll t, ll cost){
    edge e;
    e.to = t, e.cost = cost;
    G[s].push_back(e);
  }

  void dijkstra(ll s){
    rep(i,V){
      d[i] = INF;
    }
    d[s] = 0;
    priority_queue<P,vector<P>, greater<P> > que;
    que.push(P(0,s));
    while(!que.empty()){
      P p = que.top(); que.pop();
      ll v = p.second;
      if(d[v]<p.first) continue;
      for(auto e : G[v]){
        if(d[e.to]>d[v]+e.cost){
          d[e.to] = d[v]+e.cost;
          que.push(P(d[e.to],e.to));
        }
      }
    }
  }
};
int main(){
  ll a,b,q; cin>>a>>b>>q;
  ll s[a]={};
  ll t[b]={};
  ll x[q]={};
  rep(i,a){
    cin>>s[i];}
  rep(i,b) cin>>t[i];
  rep(i,q) cin>>x[i];
  rep(i,q){
    ll xa,xb,ta,tb;
    xa = lower_bound(s,s+a,x[i]);
    ta = lower_bound(t,t+b,x[i]);
    xb = upper_bound(s,s+a,x[i]);
    tb = upper_bound(t,t+b,x[i]);
    ll ca = min(xa,ta);
    ll cb = min(xb,tb);
    ca = min(ca,cb);
    cb = 0;
    cb = min(xa+tb,ta+xb);
    ca = min(ca,cb);
    cout << ca << endl;}
  }


Compiler output:
a.cc: In function 'int main()':
a.cc:88:21: error: invalid conversion from 'long long int*' to 'll' {aka 'long long int'} [-fpermissive]
   88 |     xa = lower_bound(s,s+a,x[i]);
      |          ~~~~~~~~~~~^~~~~~~~~~~~
      |                     |
      |                     long long int*
a.cc:89:21: error: invalid conversion from 'long long int*' to 'll' {aka 'long long int'} [-fpermissive]
   89 |     ta = lower_bound(t,t+b,x[i]);
      |          ~~~~~~~~~~~^~~~~~~~~~~~
      |                     |
      |                     long long int*
a.cc:90:21: error: invalid conversion from 'long long int*' to 'll' {aka 'long long int'} [-fpermissive]
   90 |     xb = upper_bound(s,s+a,x[i]);
      |          ~~~~~~~~~~~^~~~~~~~~~~~
      |                     |
      |                     long long int*
a.cc:91:21: error: invalid conversion from 'long long int*' to 'll' {aka 'long long int'} [-fpermissive]
   91 |     tb = upper_bound(t,t+b,x[i]);
      |          ~~~~~~~~~~~^~~~~~~~~~~~
      |                     |
      |                     long long int*
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 1000000007;

int main(){
  ll a,b,q;
  cin >> a >> b >> q;
  vector<ll>s(a),t(b),x(q);
  for(int i=0; i<a; i++) cin >> s[i];
  for(int i=0; i<b; i++) cin s>> t[i];
  for(int i=0; i<q; i++) cin >> x[i];
  sort(s.begin(),s.end());
  sort(t.begin(),t.end());
  
  for(int i=0; i<q; i++){
    auto Iter1 = lower_bound(s.begin(),s.end(),x[i])-s.begin();
    auto Iter2 = lower_bound(t.begin(),t.end(),x[i])-t.begin();
    
    double ans;
    ans = pow(pow(t[Iter2] - s[Iter1],2),0.5) + pow(pow(s[Iter1] - x[i],2),0.5);
    ans = min(ans,pow(pow(t[Iter2] - s[Iter1],2),0.5) + pow(pow(t[Iter2] - x[i],2),0.5));
    if(Iter1 >0 && Iter2>0) ans = min(ans,pow(pow(t[Iter2-1] - s[Iter1-1],2),0.5) + pow(pow(t[Iter2-1] - x[i],2),0.5));
    if(Iter1 >0 && Iter2>0) ans = min(ans,pow(pow(t[Iter2-1] - s[Iter1-1],2),0.5) + pow(pow(s[Iter1-1] - x[i],2),0.5));
    if(Iter1 >0) ans = min(ans,pow(pow(t[Iter2] - s[Iter1-1],2),0.5) + pow(pow(s[Iter1-1] - x[i],2),0.5));
    if(Iter1 >0) ans = min(ans,pow(pow(t[Iter2] - s[Iter1-1],2),0.5) + pow(pow(t[Iter2] - x[i],2),0.5));
    if(Iter2 >0) ans = min(ans,pow(pow(t[Iter2-1] - s[Iter1],2),0.5) + pow(pow(t[Iter2-1] - x[i],2),0.5));
    if(Iter2 >0) ans = min(ans,pow(pow(t[Iter2-1] - s[Iter1],2),0.5) + pow(pow(s[Iter1] - x[i],2),0.5));
    
    cout << ans << endl;
  }
  
}
  


Compiler output:
a.cc: In function 'int main()':
a.cc:11:29: error: expected ';' before 's'
   11 |   for(int i=0; i<b; i++) cin s>> t[i];
      |                             ^~
      |                             ;
Language: C++

#include <bits/stdc++.h>
using namespace std;

#define INF (1<<31)-1
#define LINF (1LL<<63)-1LL
#define MOD 1000000007
#define MOD2 998244353

template<class T,class U>bool chmax(T &a, const U &b){if(a<b){a=b;return 1;}return 0;}
template<class T,class U>bool chmin(T &a, const U &b){if(b<a){a=b;return 1;}return 0;}

#define rep(i,n) for(int i=0,_i=(n);i<_i;++i)
#define rep1(i,a,b) for(int a_=(a),b_=(b),i=a_;i<b_;++i)
#define repr(i,n) for(int _i=(n),i=_i;i>0;--i)

#define db(x) cerr<<#x<<" = "<<x<<" ";
#define db2(x,y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<") ";
#define db3(x,y,z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = ("<<x<<", "<<y<<", "<<z<<") ";
#define ln cout<<endl;

#define all(a)  (a).begin(),(a).end()
#define dig(n)  to_string(n).length()

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define se second
#define fi first

typedef long long ll;

typedef pair<int,int> P;
typedef pair<int,P> iP;
typedef pair<P,P> PP;

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return (a*b)/gcd(a,b);}

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int main(){

    bool flag=false;
    ll ans=0,sum=0;

    int a,b,q;
    cin>>a>>b>>q;

    vector<ll> s(a+1);
    vector<ll> t(b+1);

    s[0] = (1LL<<62);t[0] = (1LL<<62);

    rep(i,a)cin>>s[i+1];
    rep(i,b)cin>>t[i+1];

    s.eb(-(1LL<<62));t.eb(-(1LL<<62));

    rep(i,q){
        ll x;
        cin>>x;

        int p = lower_bound(all(s),x)-s.begin();
        int q = lower_bound(all(t),x)-t.begin();


        ll tmp = LINF;

        rep1(i , max(0,p-1) , min(p+2,a+1)){
            rep1(j, max(0,q-1) , min(q+2,b+1)){
                ll si = s[i];
                ll ti = t[j];

                if(((si==x) || (ti==x))){
                    chmin( tmp , abs(si-x)+abs(ti-x) );
                }else if( (si<x)!=(ti<x) ){
                    chmin( tmp , abs(si-x)+abs(ti-x) + min(abs(si-x),abs(ti-x)) )
                }else{
                    chmin( tmp , max(abs(si-x),abs(ti-x)) );
                }
            }
        }

        cout << tmp << endl;
    }

    //cout <<fixed<<setprecision(16)<< << endl;

    //if(flag)cout << "Yes" <<endl;
    //else cout << "No" <<endl;

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:5:23: warning: integer overflow in expression of type 'long long int' results in '9223372036854775807' [-Woverflow]
    5 | #define LINF (1LL<<63)-1LL
      |              ~~~~~~~~~^~~~
a.cc:68:18: note: in expansion of macro 'LINF'
   68 |         ll tmp = LINF;
      |                  ^~~~
a.cc:78:82: error: expected ';' before '}' token
   78 |                     chmin( tmp , abs(si-x)+abs(ti-x) + min(abs(si-x),abs(ti-x)) )
      |                                                                                  ^
      |                                                                                  ;
   79 |                 }else{
      |                 ~
Language: C++

#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(n);i++)
using namespace std;
using P=pair<long long,long long>;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
const ll MOD=1e9+7;
const ll INF=1e18;
const int MAX=510000;
const double pi=acos(-1);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

ll gcd(ll x, ll y){
  if(x%y==0)return y;
  return gcd(y,x%y);
}
ll lcm(ll x,ll y){
  return x/gcd(x,y)*y;
}
vector<vector<ll>>G(MAX);
vector<bool>seen(MAX,false);
vector<ll> ans(MAX);

void dfs(int p,int v){
  seen[v]=true;
  if(v!=0)ans[v]+=ans[p];
  for(auto nv:G[v]){
    if(!seen[nv]) dfs(v,nv);
  }
}
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);  
  
  int a,b,q;
  cin >> a >> b >> q;
  vector<ll>s(a+2);
  vector<ll>t(b+2);
  rep(i,a) cin >> s[i];
  rep(i,b) cin >> t[i];
  s[a]=INF,s[a+1]=-INF;
  t[b]=INF,t[b+1]=-INF;
  sort(s.begin(),s.end());
  sort(t.begin(),t.end());
  rep(i,q){
    ll x;
    cin >> x;
    ll ans=INF;
    ll rs=abs(*lower_bound(s.begin(),s.end(),x)-x);
    ll rt=abs(*lower_bound(t.begin(),t.end(),x)-x);
    ll ls=abs(x-*(upper_bound(s.begin(),s.end(),x)-1));
    ll lt=abs(x-*(upper_bound(t.begin(),t.end(),x)-1));
    if(ls>=lt && rs<=rt){
      ans=min({rt,rs*2+lt,lt*2+rs,ls});
    }
    if(ls>=lt && rs<=rt){
      ans=min({rs,ls});
    }
    if(lt>=ls && rs<=rt){
      ans=min({rt,lt});
    }
    if{lt>=ls && rt<=rs){
      ans=min({rs,rt*2+ls,ls*2+rt,lt});
    }
    cout << ans << endl;
    
  }
    
  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:67:7: error: expected '(' before '{' token
   67 |     if{lt>=ls && rt<=rs){
      |       ^
      |       (
a.cc:75:2: error: expected '}' at end of input
   75 | }
      |  ^
a.cc:36:11: note: to match this '{'
   36 | int main(){
      |           ^
Language: Java

import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int q = sc.nextInt();
    long[] s = new long[a + 1];
    long[] t = new long[b + 1];
    for(int i = 0; i < a; i++) {
      s[i] = sc.nextLong();
    }
    s[a] = Long.MAX_VALUE;
    for(int i = 0; i < b; i++) {
      t[i] = sc.nextLong();
    }
    t[b] = Long.MAX_VALUE;
    for(int i = 0; i < q; i++) {
      long x = sc.nextLong();
      int sx = -1;
      int tx = -1;
      int left = 0;
      int right = a;
      while(left < right) {
        int med = (left + right) / 2;
        if(s[med] <= x) {
          sx = med;
          left = med + 1;
        } else {
          right = med;
        }
      }
      left = 0;
      right = b;
      while(left < right) {
        int med = (left + right) / 2;
        if(t[med] <= x) {
          tx = med;
          left = med + 1;
        } else {
          right = med;
        }        
      }
      long ans = 0;
      if(sx == -1) {
        if(tx == -1) {
          ans = Math.max(s[0] - x, t[0] - x);
        } else {
          ans = Math.min(s[0] - x + s[0] - t[tx], x - t[tx] + s[0] - t[tx]);
          ans = Math.min(ans, Math.max(s[0] - x, t[tx + 1] - x));
        }
      } else {
        if(tx == -1) {
          ans = Math.max(t[0] - x, s[sx + 1] - x);
          ans = Math.min(ans, t[0] - s[sx] + Math.min(t[0] - x, x - s[sx]));
        } else {
          ans = Math.max(x - s[sx], x - t[tx]);
          ans = Math.min(ans, s[sx + 1] - x, t[tx + 1] - x);
          ans = Math.min(ans, s[sx + 1] - t[tx] + Math.min(s[sx + 1] - x, x - t[tx]));
          ans = Math.min(ans, t[tx + 1] - s[sx] + Math.min(t[tx + 1] - x, x - s[sx]));
        }        
      }
      System.out.println(ans);
    }
  }
}

Compiler output:
Main.java:59: error: no suitable method found for min(long,long,long)
          ans = Math.min(ans, s[sx + 1] - x, t[tx + 1] - x);
                    ^
    method Math.min(int,int) is not applicable
      (actual and formal argument lists differ in length)
    method Math.min(long,long) is not applicable
      (actual and formal argument lists differ in length)
    method Math.min(float,float) is not applicable
      (actual and formal argument lists differ in length)
    method Math.min(double,double) is not applicable
      (actual and formal argument lists differ in length)
1 error
Language: C++

#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (int)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
using vc = vector<char>;
using vvc = vector<vc>;
ll dx[4]={0,1,0,-1};
ll dy[4]={1,0,-1,0};
int main(){
  ll a,b,q;
  cin>>a>>b>>q;
  vll s(a),t(b),x(q);
  rep(i,a)cin>>s[i];
  rep(i,b) cin>>t[i];
  rep(i,q) cin>>x[i];
  sort(all(s));
  sort(all(t));
  ll ans=0;
  rep(i,q){
    ll cu=INF;
    vll k(2),vll u(2);
     k[0]=lower_bound(all(s),x[i])-s.begin()-1;
     k[1]=upper_bound(all(s),x[i])-s.begin();
     u[0]=lower_bound(all(t),x[i])-t.begin()-1;
     u[1]=upper_bound(all(t),x[i])-t.begin();
    rep(j,2){
      rep(r,2){
        if((j==0&&k[j]<0)||(j==1&&k[j]==a)||(r==0&&u[r]<0)||(r==1&&u[r]==b))continue;
        cu=min(cu,abs(s[k[j]]-x[i])+abs(t[u[r]]-x[i]));
      }
    }
    ans=min(ans,cu);
  }
  COUT(ans);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:54:18: error: expected initializer before 'u'
   54 |     vll k(2),vll u(2);
      |                  ^
a.cc:57:6: error: 'u' was not declared in this scope
   57 |      u[0]=lower_bound(all(t),x[i])-t.begin()-1;
      |      ^
Language: C++

#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (int)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
using vc = vector<char>;
using vvc = vector<vc>;
ll dx[4]={0,1,0,-1};
ll dy[4]={1,0,-1,0};
int main(){
  ll a,b,q;
  cin>>a>>b>>q;
  vll s(a),t(b),x(q);
  rep(i,a)cin>>s[i];
  rep(i,b) cin>>t[i];
  rep(i,q) cin>>x[i];
  sort(all(s));
  sort(all(t));
  ll ans=0;
  rep(i,q){
    ll cu=INF;
    vll k(2),vllu(2);
    ll k[0]=lower_bound(all(s),x[i])-s.begin()-1;
    ll k[1]=upper_bound(all(s),x[i])-s.begin();
    ll u[0]=lower_bound(all(t),x[i])-t.begin()-1;
    ll u[1]=upper_bound(all(t),x[i])-t.begin();
    rep(j,2){
      rep(r,2){
        if((j==0&&k[j]<0)||(j==1&&k[j]==a)||(r==0&&u[r]<0)||(r==1&&u[r]==b))continue;
        cu=min(cu,abs(s[k[j]]-x[i])+abs(t[u[r]]-x[i]));
      }
    }
    ans=min(ans,cu);
  }
  COUT(ans);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:55:8: error: conflicting declaration 'long long int k [0]'
   55 |     ll k[0]=lower_bound(all(s),x[i])-s.begin()-1;
      |        ^
a.cc:54:9: note: previous declaration as 'vll k'
   54 |     vll k(2),vllu(2);
      |         ^
a.cc:56:8: error: conflicting declaration 'long long int k [1]'
   56 |     ll k[1]=upper_bound(all(s),x[i])-s.begin();
      |        ^
a.cc:54:9: note: previous declaration as 'vll k'
   54 |     vll k(2),vllu(2);
      |         ^
a.cc:57:47: error: array must be initialized with a brace-enclosed initializer
   57 |     ll u[0]=lower_bound(all(t),x[i])-t.begin()-1;
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
a.cc:58:8: error: conflicting declaration 'long long int u [1]'
   58 |     ll u[1]=upper_bound(all(t),x[i])-t.begin();
      |        ^
a.cc:57:8: note: previous declaration as 'long long int u [0]'
   57 |     ll u[0]=lower_bound(all(t),x[i])-t.begin()-1;
      |        ^
Language: C++

def main():
    import numpy as np
    import sys
    input=sys.stdin.readline
    inf=10**11
    
    a,b,q=map(int,input().split())
    S=np.array([-inf]+[int(input()) for _ in range(a)]+[inf])
    T=np.array([-inf]+[int(input()) for _ in range(b)]+[inf])
    Q=np.array([int(input()) for _ in range(q)])
    idxs=np.searchsorted(S,Q)
    idxt=np.searchsorted(T,Q)
    
    for i in range(q):
        x=Q[i]
        s=idxs[i]
        t=idxt[i]
        ans=max(T[t],S[s])-x
        ans=min(ans,S[s]-T[t-1]+min(S[s]-x,x-T[t-1]))
        ans=min(ans,x-min(S[s-1],T[t-1]))
        ans=min(ans,T[t]-S[s-1]+min(T[t]-x,x-S[s-1]))
        print(ans)
        
if __name__=='__main__':
    main()

Compiler output:
a.cc:24:14: warning: multi-character literal with 8 characters exceeds 'int' size of 4 bytes
   24 | if __name__=='__main__':
      |              ^~~~~~~~~~
a.cc:1:1: error: 'def' does not name a type
    1 | def main():
      | ^~~
Language: C++

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<deque>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#include<functional>
#include<unordered_set>
#include<iomanip>
#include<cassert>
#include<regex>
#include<bitset>
#include<complex>
#include<chrono>
#include<random>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(),x.end()
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;

ll gcd(ll n, ll m) {
	ll tmp;
	while (m!=0) {
		tmp = n % m;
		n = m;
		m = tmp;
	}
	return n;
}

ll lcm(ll n, ll m) {
	return abs(n * m) / gcd(n, m);//gl=xy
}
 
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
 
using namespace std;
//ここから

void solve(){
  int a,b,q;
  cin>>a>>b>>q;
  vector<ll>s(a),t(b);
  ll x;
  rep(i,a)cin>>s[i];
  rep(i,b)cin>>t[i];
  rep(i,q){
    cin>>x;
    ll ans=INF;
    int sr=lower_bound(all(s),x)-s.begin();
    int tr=lower_bound(all(t),x)-t.begin();
    int sl=max(0,sr-1);
    int tl=max(0,tr-1);
    chmin(ss,a-1);
    chmin(tt,b-1);
    chmin(ans,abs(s[sl]-t[tl])+min(abs(x-s[sl]),abs(x-t[tl])));
    chmin(ans,abs(s[sl]-t[tr])+min(abs(x-s[sl]),abs(x-t[tr])));
    chmin(ans,abs(s[sr]-t[tl])+min(abs(x-s[sr]),abs(x-t[tl])));
    chmin(ans,abs(s[sr]-t[tr])+min(abs(x-s[sr]),abs(x-t[tr])));
    cout<<ans<<"\n";
  }
}

int main(){
	ios::sync_with_stdio(false);
  cin.tie(0);
	cout<<fixed<<setprecision(15);
  solve();
	return 0;
}


Compiler output:
a.cc: In function 'void solve()':
a.cc:78:11: error: 'ss' was not declared in this scope; did you mean 'sl'?
   78 |     chmin(ss,a-1);
      |           ^~
      |           sl
a.cc:79:11: error: 'tt' was not declared in this scope; did you mean 'tl'?
   79 |     chmin(tt,b-1);
      |           ^~
      |           tl
Language: Java

import java.util.*;
import java.io.*;
public class dfs{
    static class Event implements Comparable<Event>{
        long x;
        int i;
        public Event(long _x, int _i){
            x = _x;
            i = _i;
        }
        public int compareTo(Event other){
            return x-other.x>0?1:x-other.x<0?-1:0;
        }
        
    }

    public static void main(String[] args) {
        FastReader in = new FastReader(System.in);
        int a = in.nextInt(), b = in.nextInt(), q = in.nextInt();
        long[] s = new long[100005], t = new long[100005];
        Event[] x = new Event[100005];
        s[0] = -(long)(1e11);
        s[a+1] = (long)(1e11);
        for (int l = 1; l <= a; ++l){
            s[l] = in.nextLong();
        }
        t[0] = -(long)(1e11);
        t[b+1] = (long)(1e11);
        for (int l = 1; l <= b; ++l){
            t[l] = in.nextLong();
        }
        for (int l = 0; l < q; ++l){
            x[l] = new Event(in.nextLong(), l);
        }
        Arrays.sort(x, 0, q);


        int posS = 1, posT = 1;
        long[] answer = new long[100005];
        for (int l = 0; l < q; ++l){
            while(s[posS] < x[l].x) posS++;
            while(t[posT] < x[l].x) posT++;
            answer[x[l].i] = Math.min(
               Math.min(
                   Math.max(s[posS], t[posT]) - x[l].x,
                   x[l].x - Math.min(s[posS-1], t[posT-1])
               ),
               Math.min(
                   Math.min(
                       s[posS] - x[l].x + s[posS] - t[posT-1],
                       t[posT] - x[l].x + t[posT] - s[posS-1]
                   ),
                   Math.min(
                       x[l].x - s[posS-1] + t[posT] - s[posS-1],
                       x[l].x - t[posT-1] + s[posS] - t[posT-1]
                   )
               )
            );
        }
        for (int l = 0; l < q; ++l){
            System.out.println(answer[l]);
        }
    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader(InputStream I) {
            br = new BufferedReader(new InputStreamReader(I));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }

}

Compiler output:
Main.java:3: error: class dfs is public, should be declared in a file named dfs.java
public class dfs{
       ^
1 error
Language: C++

// https://atcoder.jp/contests/abc119/tasks/abc119_d

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

#define REP(i,n)   for(int i=0; i<(int)(n); i++)
#define FOR(i,b,e) for(int i=(b); i<=(int)(e); i++)
#define DUMP(a, n) REP(_i, n) printf("%d%c", a[_i], _i + 1 == n ? '\n' : ' ')
#define DUMP2D(a, n, m) REP(_i, n) REP(_j, m) printf("%d%c", a[_i][_j], _j + 1 == m ? '\n' : ' '); puts("")

const int A_MAX = 1e5;
const int B_MAX = 1e5;
const int Q_MAX = 1e5;
const ll S_A_MAX = 1e10;
const ll T_B_MAX = 1e10;
const ll X_I_MAX = 1e10;
const ll INF = 1e12;

int A, B, Q;
ll s[A_MAX];
ll t[B_MAX];
ll x[Q_MAX];

void solve() {
  REP(i, Q) {
    int i1 = lower_bound(s, s + A, x[i]) - s;
    int i0 = i1 - 1;
    ll s0 = i0 >= 0 ? s[i0] : -INF;
    ll s1 = i1 < A ? s[i1] : INF;
    int j1 = lower_bound(t, t + B, x[i]) - t;
    int j0 = j1 - 1;
    ll t0 = j0 >= 0 ? t[j0] : -INF;
    ll t1 = j1 < B ? t[j1] : INF;
    // printf("x:%lld s:%lld_%lld t:%lld_%lld\n", x[i], s0, s1, t0, t1);
    ll ans = INF;
    ans = min(ans, x[i] - min(s0, t0));
    ans = min(ans, max(s1, t1) - x[i]);
    ans = min(ans, s1 - t0 + min(x[i] - t0, s1 - x[i]));
    ans = min(ans, t1 - s0 + min(x[i] - s0, t1 - x[i]));a
    printf("%lld\n", ans);
  }
}

void input() {
  scanf("%d%d%d", &A, &B, &Q);
  REP(i, A) scanf("%lld", s + i);
  REP(i, B) scanf("%lld", t + i);
  REP(i, Q) scanf("%lld", x + i);
}

int main() {
  input();
  solve();
  return 0;
}


Compiler output:
a.cc: In function 'void solve()':
a.cc:42:57: error: 'a' was not declared in this scope
   42 |     ans = min(ans, t1 - s0 + min(x[i] - s0, t1 - x[i]));a
      |                                                         ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
#define Priq priority_queue<int,vi,greater<int>>
#define pb push_back
#define mp make_pair
signed main(){
  int N,M,Q; cin>>N>>M>>Q;
  vi A(N),B(M);
  rep(i,0,N) cin>>A[i];
  rep(i,0,M) cin>>B[i];
  A.pb(MOD);
  B.pb(MOD);
  int C(N),D(M);
  rep(i,0,N){
    int K=dislow(B,A[i]);
    C[i]=B[K]-A[i];
    if(K>0)
      C[i]=min(C[i],A[i]-B[K-1]);
  }
  rep(i,0,M){
    int K=dislow(A,B[i]);
    D[i]=A[K]-B[i];
    if(K>0)
      D[i]=min(D[i],B[i]-A[K-1]);
  }
  rep(_,0,Q){
    int X; cin>>X;
    int Y=dislow(A,X);
    int ans=A[Y]-X+C[Y];
    if(Y>0)
      ans=min(ans,X-A[Y-1]+C[Y-1]);
    Y=dislow(B,X);
    ans=min(ans,B[Y]-X+D[Y]);
    if(Y>0)
      ans=min(ans,X-B[Y-1]+D[Y-1]);
    cout<<ans<<endl;
  }
  }


Compiler output:
a.cc: In function 'int main()':
a.cc:28:6: error: invalid types 'long long int[long long int]' for array subscript
   28 |     C[i]=B[K]-A[i];
      |      ^
a.cc:30:8: error: invalid types 'long long int[long long int]' for array subscript
   30 |       C[i]=min(C[i],A[i]-B[K-1]);
      |        ^
a.cc:30:17: error: invalid types 'long long int[long long int]' for array subscript
   30 |       C[i]=min(C[i],A[i]-B[K-1]);
      |                 ^
a.cc:34:6: error: invalid types 'long long int[long long int]' for array subscript
   34 |     D[i]=A[K]-B[i];
      |      ^
a.cc:36:8: error: invalid types 'long long int[long long int]' for array subscript
   36 |       D[i]=min(D[i],B[i]-A[K-1]);
      |        ^
a.cc:36:17: error: invalid types 'long long int[long long int]' for array subscript
   36 |       D[i]=min(D[i],B[i]-A[K-1]);
      |                 ^
a.cc:41:21: error: invalid types 'long long int[long long int]' for array subscript
   41 |     int ans=A[Y]-X+C[Y];
      |                     ^
a.cc:43:29: error: invalid types 'long long int[long long int]' for array subscript
   43 |       ans=min(ans,X-A[Y-1]+C[Y-1]);
      |                             ^
a.cc:45:25: error: invalid types 'long long int[long long int]' for array subscript
   45 |     ans=min(ans,B[Y]-X+D[Y]);
      |                         ^
a.cc:47:29: error: invalid types 'long long int[long long int]' for array subscript
   47 |       ans=min(ans,X-B[Y-1]+D[Y-1]);
      |                             ^
Language: C++

#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
#define dbg(x) cerr << #x << ": " << x << endl

const ll INF = 100000000005;
int main() {
  int a, b, q;
  cin >> a >> b >> q;

  vector<ll> S, T;
  S.push_back(-INF);
  T.push_back(-INF);
  rep(i, a) {
    ll s;
    cin >> s;
    S.push_back(s);
  }
  rep(j, b) {
    ll t;
    cin >> t;
    T.push_back(t);
  }
  S.push_back(INF);
  T.push_back(INF);

  vector<ll> x(q);
  rep(k, q) cin >> x[k];

  rep(k, q) {
    auto ubs = upper_bound(all(S), x[k]);
    auto ubt = upper_bound(all(T), x[k]);

    ll ans = INF;
    for(ll s : {*(lbs - 1), *lbs})
      for(ll t : {*(lbt - 1), *lbt}) {
        ll D[2] = {abs(s - x[k]) + abs(t - s),
                   abs(t - x[k]) + abs(s - t)};
        for(ll d : D) ans = min(ans, d);
      }
    cout << ans << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:39:19: error: 'lbs' was not declared in this scope; did you mean 'ubs'?
   39 |     for(ll s : {*(lbs - 1), *lbs})
      |                   ^~~
      |                   ubs
a.cc:39:33: error: unable to deduce 'std::initializer_list<auto>&&' from '{<expression error>, <expression error>}'
   39 |     for(ll s : {*(lbs - 1), *lbs})
      |                                 ^
a.cc:40:21: error: 'lbt' was not declared in this scope; did you mean 'ubt'?
   40 |       for(ll t : {*(lbt - 1), *lbt}) {
      |                     ^~~
      |                     ubt
a.cc:40:35: error: unable to deduce 'std::initializer_list<auto>&&' from '{<expression error>, <expression error>}'
   40 |       for(ll t : {*(lbt - 1), *lbt}) {
      |                                   ^
Language: Java

import java.util.*;

public class ABC119D {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int s = in.nextInt();
        int t = in.nextInt();
        int q = in.nextInt();
        TreeSet<Long> shrines = new TreeSet<Long>();
        TreeSet<Long> temples = new TreeSet<Long>();
        for( int i = 0; i < s; i++ ) shrines.add(in.nextLong());
        for( int i = 0; i < t; i++ ) temples.add(in.nextLong());
        shrines.add(Long.MIN_VALUE);
        shrines.add(Long.MAX_VALUE);
        temples.add(Long.MAX_VALUE);
        temples.add(Long.MIN_VALUE);
        for( int i = 0; i < q; i++ ) {
            long temp = in.nextLong();
            long[] dists = new long[4];
            dists[0] = shrines.floor(temp);
            dists[1] = shrines.ceiling(temp);
            dists[2] = temples.floor(temp);
            dists[3] = temples.ceiling(temp);
            long ans = Long.MAX_VALUE;
            for( int j = 0; j < 2; j++ ) {
                for( int k = 2; k < 4; k++ ) {
                    // shrine closest left or right
                    long a = Math.abs(dists[j]-temp)+Math.abs(dists[k]-dists[j]);
                    // temple closest left or right
                    long b = Math.abs(dists[k]-temp)+Math.abs(dists[j]-dists[k]);
                    if( a > 0 ) ans = Math.min(ans, Math.abs(dists[j]-temp)+Math.abs(dists[k]-dists[j]));
                    if( b > 0 ) ans = Math.min(ans, Math.abs(dists[k]-temp)+Math.abs(dists[j]-dists[k]));
                }
            }
            System.out.println(ans);
        }
    }
}

Compiler output:
Main.java:3: error: class ABC119D is public, should be declared in a file named ABC119D.java
public class ABC119D {
       ^
1 error
Language: C++

#include<algorithm>//sort(all(変数),greater<型名>())　で降順に
#include<cmath>//切り上げceil(値)
#include<deque>
#include<iomanip>//setprecision(数字)
#include<iostream>
#include<list>
#include<map>
#include<numeric> //xとyの最大公約数は__gcd(x,y),xとyの最小公倍数は(x*y)/__gcd
#include<queue>//priority_queue<型名> 変数：優先度付きキュー　最大値の探索が早い
#include<set>
#include<stack>
#include<string>
#include<vector>

#include<bits/stdc++.h>
#include<cstdio>
#include<cstdlib>
#include<tuple>
#include<utility>
#define rep0(i,n)  for(ll i=0; i<n; i++)
#define rrep0(i,n) for(ll i=n-1; 0<=i; i--)
#define rep1(i,n)  for(ll i=1; i<=n; i++)
#define rrep1(i,n) for(ll i=n; 1<=i; i--)
#define vll vector<ll>
#define vi vector<int>
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
using ll = long long;
using namespace std;

int main(){
  ll a,b,q;  cin >> a >> b >> q;
  vll s(a),t(b),x(q);
  rep0(i,a){ cin >> s[i]; }
  rep0(i,b){ cin >> t[i]; }
  rep0(i,q){ cin >> x[i]; }

  rep0(i,q){
    ll ans = 10000;
    vll m,n;
    rep0(j,2){
      if(j == 0){ m = s;  n = t; }
      else{ m = t;  n = s; }
      rep0(k,2){
        auto apos = lower_bound(all(m),x[i]) - k;
        ll ax = m[*apos];
        rep0(l,2){
          auto bpos = lower_bound(all(n),ax) - l;
          ll bx = b[*bpos];
          ans = min(ans,abs(x[i]-ax)+abs(ax-bx));
        }
      }
    }
    cout << ans << endl;
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:49:20: error: invalid types 'll {aka long long int}[long long int]' for array subscript
   49 |           ll bx = b[*bpos];
      |                    ^
Language: C++

#include<algorithm>//sort(all(変数),greater<型名>())　で降順に
#include<cmath>//切り上げceil(値)
#include<deque>
#include<iomanip>//setprecision(数字)
#include<iostream>
#include<list>
#include<map>
#include<numeric> //xとyの最大公約数は__gcd(x,y),xとyの最小公倍数は(x*y)/__gcd
#include<queue>//priority_queue<型名> 変数：優先度付きキュー　最大値の探索が早い
#include<set>
#include<stack>
#include<string>
#include<vector>

#include<bits/stdc++.h>
#include<cstdio>
#include<cstdlib>
#include<tuple>
#include<utility>
#define rep0(i,n)  for(ll i=0; i<n; i++)
#define rrep0(i,n) for(ll i=n-1; 0<=i; i--)
#define rep1(i,n)  for(ll i=1; i<=n; i++)
#define rrep1(i,n) for(ll i=n; 1<=i; i--)
#define vll vector<ll>
#define vi vector<int>
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
using ll = long long;
using namespace std;

int main(){
  ll a,b,q;  cin >> a >> b >> q;
  vll s(a),t(b),x(q);
  rep0(i,a){ cin >> s[i]; }
  rep0(i,b){ cin >> t[i]; }
  rep0(i,q){ cin >> x[i]; }

  rep0(i,q){
    ll ans = 10000;
    vll m,n;
    rep0(j,2){
      if(j == 0){ m = s;  n = t; }
      else{ m = t;  n = s; }
    }
    rep0(k,2){
      ll apos = lower_bound(all(m),x[i]) + k;
      ll ax = m[apos];
      rep0(l,2){
        ll bpos = lower_bound(all(n),ax) + l;
        ll bx = n[bpos];
        ans = min(ans,abs(x[i]-ax)+abs(ax-bx));
      }
    }
    cout << ans << endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:46:42: error: cannot convert '__gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >' to 'll' {aka 'long long int'} in initialization
   46 |       ll apos = lower_bound(all(m),x[i]) + k;
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~^~~
      |                                          |
      |                                          __gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >
a.cc:49:42: error: cannot convert '__gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >' to 'll' {aka 'long long int'} in initialization
   49 |         ll bpos = lower_bound(all(n),ax) + l;
      |                   ~~~~~~~~~~~~~~~~~~~~~~~^~~
      |                                          |
      |                                          __gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N=1e5+7;
const ll inf=1e18;
int a,b,q;
ll s[N],t[N],x;
int binary(ll *p,int m)
{
    int l=1,r=m,ans;
    while(l<=r)
    {
        int mid=(l+r)>>1;
        if(p[mid]<=x)
            l=mid+1;
        else
            r=mid-1;
    }
        return l;
}
int main()
{
    scanf("%d%d%d",&a,&b,&q);
    int j,k;
    for(int i=1;i<=a;i++)
        scanf("%lld",&s[i])
    for(int i=1;i<=b;i++)
        scanf("%lld",&t[i])
        s[0]=-1*inf,s[a+1]=inf;
        t[0]=-1*inf,t[b+1]=inf;
    for(int i=1;i<=q;i++)
    {
        ll ans=0;
        scanf("%d",&x);
        j=binary(s,a);
        k=binary(t,b);
        ans=min(max(s[j],t[k])-x,x-min(s[j-1],t[k-1]));
        ans=min(ans,min(2*t[k]-s[j-1]-x,t[k]-2*s[j-1]+x));
        ans=min(ans,min(2*s[j]-t[k-1]-x,s[j]-2*t[k-1]+x));
        printf("%d\n",ans);
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:26:28: error: expected ';' before 'for'
   26 |         scanf("%lld",&s[i])
      |                            ^
      |                            ;
   27 |     for(int i=1;i<=b;i++)
      |     ~~~                     
a.cc:27:17: error: 'i' was not declared in this scope
   27 |     for(int i=1;i<=b;i++)
      |                 ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N=1e5+7;
const ll inf=1e18;
ll a,b,q;
ll s[N],t[N],x;
int binary(ll *p,int m)
{
    int l=1,r=m,ans;
    while(l<=r)
    {
        int mid=(l+r)>>1;
        if(p[mid]<=x)
            l=mid+1;
        else
            r=mid-1;
    }
        return l;
}
int main()
{
    scanf("%d%d%d",&a,&b,&q);
    int j,k;
    for(int i=1;i<=a;i++)
        cin>>s[i];
    for(int i=1;i<=b;i++)
        cin>>t[i];
        s[0]=-1*inf,s[a+1]=inf;
        t[0]=-1*inf,t[b+1]=inf;
    for(int i=1;i<=q;i++)
    {
        ll ans=0;
        scanf("%d",&x)
        j=binary(s,a);
        k=binary(t,b);
        ans=min(max(s[j],t[k])-x,x-min(s[j-1],t[k-1]));
        ans=min(ans,min(2*t[k]-s[j-1]-x,t[k]-2*s[j-1]+x));
        ans=min(ans,min(2*s[j]-t[k-1]-x,s[j]-2*t[k-1]+x));
        printf("%d\n",ans);
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:34:23: error: expected ';' before 'j'
   34 |         scanf("%d",&x)
      |                       ^
      |                       ;
   35 |         j=binary(s,a);
      |         ~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,b) for(int i=(a); i<(b); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;
const ll inf = 1LL<<18;
template<class T> int former(const vector<T> &v, T x) {
    return upper_bound(v.begin(), v.end(), x) - v.begin() - 1;
}
template<class T> int latter(const vector<T> &v, T x) {
    return lower_bound(v.begin(), v.end(), x) - v.begin();
}

int main(){
    int a,b,q; cin >> a >> b >> q;
    vector<ll> s(a);
    rep(i,a) cin >> s[i];
    vector<ll> t(b);
    rep(i,b) cin >> t[i];
    s.push_back(-inf); s.push_back(inf);
    t.push_back(-inf); t.push_back(inf);
    sort(ALL(s)); sort(ALL(t));

    rep(kai,q){
        ll x; cin >> x;
        ll ans = inf;
        rep(i,2){
            ll first = (i ? s[former(s, x)] : s[latter(s, x)]);
            rep(j,2){
                ll second = (j ? t[former(t, first)] : t[latter(t, first)]);
                ans = min(ans, abs(x - first)) + abs(first - second);
            }
        }

        rep(i,2){
            ll first = (i ? t[former(t, x)] : t[latter(t, x)]);
            rep(j,2){
                ll second = (j ? s[former(s, first)] : s[latter(s, first)]);
                ans = min(ans, abs(x - first)) + abs(first - second));
            }
        }
        cout << ans << endl;
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:40:69: error: expected ';' before ')' token
   40 |                 ans = min(ans, abs(x - first)) + abs(first - second));
      |                                                                     ^
      |                                                                     ;
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fo(a,b) for(int a=0;a<b;a++)
#define Sort(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
 int wari(int a,int b) {
   if(a%b==0)
     return a/b;
   else
     return a/b+1;
 }
 int keta(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
 }
 int souwa(int a){
  return a*(a+1)/2;
 }
 int lcm(int a,int b){
  int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return d*e/f;
    }
  int gcm(int a,int b){
      int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return f;
  }
 bool prime(int a){
   if(a<2)
     return false;
   else if(a==2)
     return true;
   else if(a%2==0)
     return false;
   double b=sqrt(a);
    for(int i=3;i<=b;i+=2){
      if(a%i==0){
        return false;
      }
    }
   return true;
 }
signed main(){
  int a,b,c;
  cin>>a>>b>>c;
  vector<int> d(a),e(b),f(c);
  fo(i,a)
    cin>>d[i];
  fo(j,b)
    cin>>e[j];
  d.insert(d.begin(),-100000000000);
  e.insert(e.begin(),-100000000000);
  d.push_back(100000000000000);
  e.push_back(100000000000000);
  fo(k,c)
    cin>>f[k];
  int l1,l2,r1,r2,A,B,C
  fo(i,c){
    l1=0,l2=0,r1=a,r2=b;
    fo(j,30){
      if(d[(l1+r1)/2]>f[i]&&d[(l1+r1)/2-1]<f[i])
        break;
      else if(d[(l1+r1)/2-1]>f[i])
        r1=(l1+r1)/2;
      else
        l1=(l1+r1)/2;
    }
    A=(l1+r1)/2;
    fo(j,30){
      if(e[(l2+r2)/2]>f[i]&&e[(l2+r2)/2-1]<f[i])
        break;
      else if(e[(l2+r2)/2-1]>f[i])
        r2=(l2+r2)/2;
      else
        l2=(l2+r2)/2;
    }
    B=(l2+r2)/2;
    C=abs<int>(f[i]-d[A])+abs(d[A]-e[B]);
    C=min(C,abs<int>(f[i]-d[A-1])+abs(d[A-1]-e[B]));
    C=min(C,abs<int>(f[i]-d[A-1])+abs(d[A-1]-e[B-1]));
    C=min(C,abs<int>(f[i]-d[A])+abs(d[A]-e[B-1]));
    C=min(C,abs<int>(f[i]-d[B])+abs(d[B]-e[A]));
    C=min(C,abs<int>(f[i]-d[B])+abs(d[B]-e[A-1]));
    C=min(C,abs<int>(f[i]-d[B-1])+abs(d[B-1]-e[A]));
    C=min(C,abs<int>(f[i]-d[B-1])+abs(d[B-1]-e[A-1]));
    cout<<C<<endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:17: error: expected initializer before 'for'
    4 | #define fo(a,b) for(int a=0;a<b;a++)
      |                 ^~~
a.cc:88:3: note: in expansion of macro 'fo'
   88 |   fo(i,c){
      |   ^~
a.cc:88:6: error: 'i' was not declared in this scope
   88 |   fo(i,c){
      |      ^
a.cc:4:29: note: in definition of macro 'fo'
    4 | #define fo(a,b) for(int a=0;a<b;a++)
      |                             ^
Language: C++

#include <bits/stdc++.h>

using namespace std;

int main() {
  int a, b, q;
  cin >> a >> b >> q;
  vector<long long> c(a), d(b);
  for (auto &x : c) cin >> x;
  for (auto &x : d) cin >> x;
  sort(c.begin(), c.end());
  sort(d.begin(), d.end());
  while(q--) {
    long long z;
    cin >> z;
    long long a = lower_bound(c.begin(), c.end(), z);
    a = max(a, lower_bound(d.begin(), d.end(), z));
    cout << a - z << endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:30: error: cannot convert '__gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >' to 'long long int' in initialization
   16 |     long long a = lower_bound(c.begin(), c.end(), z);
      |                   ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
      |                              |
      |                              __gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >
a.cc:17:12: error: no matching function for call to 'max(long long int&, __gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >)'
   17 |     a = max(a, lower_bound(d.begin(), d.end(), z));
      |         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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:17:12: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >')
   17 |     a = max(a, lower_bound(d.begin(), d.end(), z));
      |         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:17:12: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   17 |     a = max(a, lower_bound(d.begin(), d.end(), z));
      |         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>

using namespace std;

int main() {
  int a, b, q;
  cin >> a >> b >> q;
  vector<long long> c(a), d(b);
  for (auto &x : c) cin >> x;
  for (auto &x : d) cin >> x;
  sort(c.begin(), c.end());
  sort(d.begin(), d.end());
  while(q--) {
    long long z;
    cin >> z;
    long long a = lower_bound(c.begin(), c.end(), z);
    a = max(a, lower_bound(d.begin(), d.end(), z));
    cout << a - z << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:30: error: cannot convert '__gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >' to 'long long int' in initialization
   16 |     long long a = lower_bound(c.begin(), c.end(), z);
      |                   ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
      |                              |
      |                              __gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >
a.cc:17:12: error: no matching function for call to 'max(long long int&, __gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >)'
   17 |     a = max(a, lower_bound(d.begin(), d.end(), z));
      |         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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:17:12: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >')
   17 |     a = max(a, lower_bound(d.begin(), d.end(), z));
      |         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:17:12: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   17 |     a = max(a, lower_bound(d.begin(), d.end(), z));
      |         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~