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

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

#define rem (x) x % 1000000007;

#define fillInt(xs, x)        \
  for (int i = 0; i < x; i++) \
    scanf("%d", &xs[i]);
#define fillLong(xs, x)       \
  for (int i = 0; i < x; i++) \
    scanf("%ld", &xs[i]);
#define sortv(xs) sort(S.begin(), S.end());
#define lbv(xs, x) *lower_bound(xs.begin(), xs.end(), x);
#define ubv(xs, x) *upper_bound(xs.begin(), xs.end(), x);

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);

  int A, B, Q;
  cin >> A >> B >> Q;

  vector<long> S(A), T(B), X(Q);
  fillLong(S, A);
  fillLong(T, B);
  fillLong(X, Q);

  sortv(S);
  sortv(T);

  for (int i = 0; i < X.size(); i++)
  {
    long x = X[i];
    long m = LONG_MAX;

    int s = lbv(S, x);

    if (s != 0)
    {
      long s1 = S[s - 1];
      int t1 = lbv(T, s1);
      long t11 = T[max(t1 - 1, 0)];
      long t12 = T[min(t1, B - 1)];

      m = min(
          abs(s1 - x) + abs(t11 - s1),
          m);
      m = min(
          abs(s1 - x) + abs(t12 - s1),
          m);
    }

    if (s != A)
    {
      long s2 = S[s];
      int t2 = lbv(T, s2);
      long t21 = T[max(t2 - 1, 0)];
      long t22 = T[min(t2, B - 1)];

      m = min(
          abs(s2 - x) + abs(t21 - s2),
          m);
      m = min(
          abs(s2 - x) + abs(t22 - s2),
          m);
    }

    int t = lbv(T, x);

    if (t != 0)
    {
      long t1 = T[t - 1];
      int s1 = lbv(S, t1);
      long s11 = S[max(s1 - 1, 0)];
      long s12 = S[min(s1, A - 1)];

      m = min(
          abs(t1 - x) + abs(s11 - t1),
          m);
      m = min(
          abs(t1 - x) + abs(s12 - t1),
          m);
    }

    if (t != B)
    {
      long t2 = T[t];
      int s2 = lbv(S, t2);
      long s21 = S[max(s2 - 1, 0)];
      long s22 = S[min(s2, A - 1)];

      m = min(
          abs(t2 - x) + abs(s21 - t2),
          m);
      m = min(
          abs(t2 - x) + abs(s22 - t2),
          m);
    }

    printf("%ld", m);
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:54:14: error: 'LONG_MAX' was not declared in this scope
   54 |     long m = LONG_MAX;
      |              ^~~~~~~~
a.cc:16:1: note: 'LONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   15 | #include <set>
  +++ |+#include <climits>
   16 | using namespace std;
Language: C++

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

#define rem (x) x % 1000000007;

#define fillInt(xs, x)        \
  for (int i = 0; i < x; i++) \
    scanf("%d", &xs[i]);
#define fillLong(xs, x)       \
  for (int i = 0; i < x; i++) \
    scanf("%ld", &xs[i]);
#define sortv(xs) sort(S.begin(), S.end());
#define lbv(xs, x) *lower_bound(xs.begin(), xs.end(), x);
#define ubv(xs, x) *upper_bound(xs.begin(), xs.end(), x);

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);

  int A, B, Q;
  cin >> A >> B >> Q;

  vector<long> S(A), T(B), X(Q);
  fillLong(S, A);
  fillLong(T, B);
  fillLong(X, Q);

  sortv(S);
  sortv(T);

  for (int i = 0; i < size(X); i++)
  {
    long x = X[i];
    long m = LONG_MAX;

    int s = lbv(S, x);

    if (s != 0)
    {
      long s1 = S[s - 1];
      int t1 = lbv(T, s1);
      long t11 = T[max(t1 - 1, 0)];
      long t12 = T[min(t1, B - 1)];
      m = min({abs(s1 - x) + abs(t11 - s1),
               abs(s1 - x) + abs(t12 - s1),
               m});
    }

    if (s != A)
    {
      long s2 = S[s];
      int t2 = lbv(T, s2);
      long t21 = T[max(t2 - 1, 0)];
      long t22 = T[min(t2, B - 1)];
      m = min({abs(s2 - x) + abs(t21 - s2),
               abs(s2 - x) + abs(t22 - s2),
               m});
    }

    int t = lbv(T, x);

    if (t != 0)
    {
      long t1 = T[t - 1];
      int s1 = lbv(S, t1);
      long s11 = S[max(s1 - 1, 0)];
      long s12 = S[min(s1, A - 1)];
      m = min({abs(t1 - x) + abs(s11 - t1),
               abs(t1 - x) + abs(s12 - t1),
               m});
    }

    if (t != B)
    {
      long t2 = T[t];
      int s2 = lbv(S, t2);
      long s21 = S[max(s2 - 1, 0)];
      long s22 = S[min(s2, A - 1)];
      m = min({abs(t2 - x) + abs(s21 - t2),
               abs(t2 - x) + abs(s22 - t2),
               m});
    }

    printf("%ld", m);
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:54:14: error: 'LONG_MAX' was not declared in this scope
   54 |     long m = LONG_MAX;
      |              ^~~~~~~~
a.cc:16:1: note: 'LONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   15 | #include <set>
  +++ |+#include <climits>
   16 | using namespace std;
Language: C++

import bisect
A, B, Q = map(int, input().split())
INF = 10 ** 18
s = [-INF] + [int(input()) for i in range(A)] + [INF]
t = [-INF] + [int(input()) for i in range(B)] + [INF]
for q in range(Q):
　　x = int(input())
　　b, d = bisect.bisect_right(s, x), bisect.bisect_right(t, x)
　　res = INF
　　for S in [s[b - 1], s[b]]:
　　　　for T in [t[d - 1], t[d]]:
　　　　　　d1, d2 = abs(S - x) + abs(T - S), abs(T - x) + abs(S - T)
　　　　　　res = min(res, d1, d2)
　　print(res)

Compiler output:
a.cc:7:1: error: extended character 　 is not valid in an identifier
    7 | 　　x = int(input())
      | ^
a.cc:7:1: error: extended character 　 is not valid in an identifier
a.cc:8:1: error: extended character 　 is not valid in an identifier
    8 | 　　b, d = bisect.bisect_right(s, x), bisect.bisect_right(t, x)
      | ^
a.cc:8:1: error: extended character 　 is not valid in an identifier
a.cc:9:1: error: extended character 　 is not valid in an identifier
    9 | 　　res = INF
      | ^
a.cc:9:1: error: extended character 　 is not valid in an identifier
a.cc:10:1: error: extended character 　 is not valid in an identifier
   10 | 　　for S in [s[b - 1], s[b]]:
      | ^
a.cc:10:1: error: extended character 　 is not valid in an identifier
a.cc:11:1: error: extended character 　 is not valid in an identifier
   11 | 　　　　for T in [t[d - 1], t[d]]:
      | ^
a.cc:11:1: error: extended character 　 is not valid in an identifier
a.cc:11:1: error: extended character 　 is not valid in an identifier
a.cc:11:1: error: extended character 　 is not valid in an identifier
a.cc:12:1: error: extended character 　 is not valid in an identifier
   12 | 　　　　　　d1, d2 = abs(S - x) + abs(T - S), abs(T - x) + abs(S - T)
      | ^
a.cc:12:1: error: extended character 　 is not valid in an identifier
a.cc:12:1: error: extended character 　 is not valid in an identifier
a.cc:12:1: error: extended character 　 is not valid in an identifier
a.cc:12:1: error: extended character 　 is not valid in an identifier
a.cc:12:1: error: extended character 　 is not valid in an identifier
a.cc:13:1: error: extended character 　 is not valid in an identifier
   13 | 　　　　　　res = min(res, d1, d2)
      | ^
a.cc:13:1: error: extended character 　 is not valid in an identifier
a.cc:13:1: error: extended character 　 is not valid in an identifier
a.cc:13:1: error: extended character 　 is not valid in an identifier
a.cc:13:1: error: extended character 　 is not valid in an identifier
a.cc:13:1: error: extended character 　 is not valid in an identifier
a.cc:14:1: error: extended character 　 is not valid in an identifier
   14 | 　　print(res)
      | ^
a.cc:14:1: error: extended character 　 is not valid in an identifier
a.cc:1:1: error: 'import' does not name a type
    1 | import bisect
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int A,B,Q;

int binary_search(int key,vector<ll> l){
  int left = 0, right = l.size()-1, mid;
  while( l[right-1] > key){
    mid = (left +  right)/2;
    if(l[mid] > key) right = mid;
    else left = mid;
  }
  return right;
}

int main(void){
  cin >> A >> B >> Q;
  int i;
  ll x;
  for(i=0,i<Q;i++){
    cin >> x;
    cout << x << endl;
  }
// vector<ll> s(A+2),t(B+2);
// ll x;
// int i;
// for(i=1;i<=A;i++) cin >> s[i];
// for(i=1;i<=B;i++) cin >> t[i];
// s[0] = -1e18;
// t[0] = -1e18;
// s[A+1] = 1e18;
// t[B+1] = 1e18;
// int s_index,t_index;
// ll d,dist,j,k,ds,dt;
// ll s_1,s_2,t_1,t_2;
// for(i=0;i<Q;i++){
//   cin >> x;
//   s_index = binary_search(x,s);
//   t_index = binary_search(x,t);
//   d = 1e18;
//   for(j = -1; j<=0 ;j++){
//     for(k=-1; k<=0 ;k++){
//       ds = abs(x-s[s_index+j]);
//       dt = abs(x-t[t_index+k]);
//       dist = abs(s[s_index+j]-t[t_index+k]) + ds + dt - max(ds,dt);
//       d = min(d,dist);
//     }
//   }
//   cout << d << endl;
// }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:18: error: expected ';' before ')' token
   20 |   for(i=0,i<Q;i++){
      |                  ^
      |                  ;
Language: C++

#include <algorithm>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <set>
#include <vector>
 
#define REP(I, S, E) for (decltype(S + E) I = (S), _E = (E); I < _E; ++I)
#define REP_REV(I, S, E) for (decltype(S + E) I = (E)-1, _S = (S); I >= _S; --I)
 
using namespace std;
using ll = long long;
 
int A, B, Q;
 
ll S[100000];
ll T[100000];
ll X[100000];
pair<ll, int> Y[100000];
ll D[100000];
 
auto main() -> int {
    scanf("%d %d %d", &A, &B, &Q);
 
    REP(si, 0, A) { scanf("%lld", &S[si]); }
    REP(ti, 0, B) { scanf("%lld", &T[ti]); }
    REP(xi, 0, Q) { scanf("%lld", &X[xi]); }
 
    REP(q, 0, Q) { Y[q] = {X[q], q}; }
    sort(Y, Y + Q); // 開始位置のリストを事前にソート
 
    // 位置 x からみてすぐ右にある神社の番号 (なければ A)
    auto si = 0;
    auto ti = 0;
 
    */ 線形探索 /*

    REP(yi, 0, Q) {
        auto x = Y[yi].first;
        auto q = Y[yi].second;
 
        while (si < A && S[si] < x) {
            si += 1;
        }
        while (ti < B && T[ti] < x) {
            ti += 1;
        }
 
        auto min_dist = 1LL << 60;
        REP(s, max(0, si - 1), min(A, si + 1)) {
            REP(t, max(0, ti - 1), min(B, ti + 1)) {
                auto ds = abs(S[s] - x);
                auto dt = abs(T[t] - x);
                auto dist = abs(S[s] - T[t]) + ds + dt - max(ds, dt);
                min_dist = min(min_dist, dist);
            }
        }
 
        D[q] = min_dist;
    }
 
    REP(q, 0, Q) { printf("%lld\n", D[q]); }
    return 0;
}

Compiler output:
a.cc:37:17: error: unterminated comment
   37 |     */ 線形探索 /*
      |                 ^
a.cc: In function 'int main()':
a.cc:37:6: error: expected primary-expression before '/' token
   37 |     */ 線形探索 /*
      |      ^
a.cc:37:8: error: '\U00007dda\U00005f62\U000063a2\U00007d22' was not declared in this scope
   37 |     */ 線形探索 /*
      |        ^~~~~~~~
a.cc:37:16: error: expected '}' at end of input
   37 |     */ 線形探索 /*
      |                ^
a.cc:23:20: note: to match this '{'
   23 | auto main() -> int {
      |                    ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int A,B,Q;

int binary_search(int key,vector<ll> l){
  int left = 0, right = l.size()-1, mid, i = 0;
  while( l[right-1] > key i>20){
    mid = (left +  right)/2;
    if(l[mid] > key) right = mid;
    else left = mid;
    i++;
  }
  return right;
}

int main(void){
  cin >> A >> B >> Q;
  vector<ll> s(A+2),t(B+2),x(Q);
  int i;
  for(i=1;i<=A;i++) cin >> s[i];
  for(i=1;i<=B;i++) cin >> t[i];
  s[0] = -1e18;
  t[0] = -1e18;
  s[A+1] = 1e18;
  t[B+1] = 1e18;
  int s_index,t_index;
  ll d,s_1,s_2,t_1,t_2;
  for(i=0;i<Q;i++){
    cin >> x[i];
    s_index = binary_search(x[i],s);
    t_index = binary_search(x[i],t);
    s_1 = abs(x[i]-s[s_index-1]);
    t_1 = abs(x[i]-t[t_index-1]);
    s_2  = abs(x[i]-s[s_index]);
    t_2  = abs(x[i]-t[t_index]);
    d = min(
          min(
            max(s_1,t_1),
            max(s_2,t_2)
            ),
          min(
            s_1+t_2+min(s_1,t_2),
            s_2+t_1+min(s_2,t_1)
            )
        );
    cout << d << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int binary_search(int, std::vector<long long int>)':
a.cc:8:26: error: expected ')' before 'i'
    8 |   while( l[right-1] > key i>20){
      |        ~                 ^~
      |                          )
a.cc:8:31: error: expected ';' before ')' token
    8 |   while( l[right-1] > key i>20){
      |                               ^
      |                               ;
Language: C++

#include <iostream>
#include <array>
using namespace std;

int a, b, q;
long s[100000], t[100000], x[100000];

array<long, 2> min_max(long x, long array[], int n){
  std::array<long, 2> minmax = {0, 0};
  int i = upper_bound(array.begin(),array.end(),x) - array.begin();
  if(i!=n) minmax[1] = array[i];
  if(i!=0) minmax[0] = array[i-1];
  return minmax;
}

long solution(long x){
  array<long, 2> shrine_mm = min_max(x, s, a);
  array<long, 2> temple_mm = min_max(x, t, b);
  long distance_temp = 100000000000;
  long distance_temp2;
  for (size_t i = 0; i < 2; i++) {
    for (size_t j = 0; j < 2; j++) {
      if (shrine_mm[i]!=0&&temple_mm[j]!=0) {
        distance_temp2 = min(abs(x - shrine_mm[i]) + abs(shrine_mm[i] - temple_mm[j]), abs(shrine_mm[i] - temple_mm[j]) + abs(x - temple_mm[j]));
        if(distance_temp2 < distance_temp) distance_temp = distance_temp2;
      }
    }
  }
  return distance_temp;
}

int main() {
  cin >> a >> b >> q;
  int i;
  for (i = 0; i < a; i++) {
    cin >> s[i];
  }
  for (i = 0; i < b; i++) {
    cin >> t[i];
  }
  for (i = 0; i < q; i++) {
    cin >> x[i];
    cout << solution(x[i]) << endl;
  }
}
/*
  for文の()内のミスに気づかず相当時間とかして虚無になった。
*/

Compiler output:
a.cc: In function 'std::array<long int, 2> min_max(long int, long int*, int)':
a.cc:10:29: error: request for member 'begin' in 'array', which is of non-class type 'long int*'
   10 |   int i = upper_bound(array.begin(),array.end(),x) - array.begin();
      |                             ^~~~~
a.cc:10:43: error: request for member 'end' in 'array', which is of non-class type 'long int*'
   10 |   int i = upper_bound(array.begin(),array.end(),x) - array.begin();
      |                                           ^~~
a.cc:10:11: error: 'upper_bound' was not declared in this scope
   10 |   int i = upper_bound(array.begin(),array.end(),x) - array.begin();
      |           ^~~~~~~~~~~
a.cc:10:60: error: request for member 'begin' in 'array', which is of non-class type 'long int*'
   10 |   int i = upper_bound(array.begin(),array.end(),x) - array.begin();
      |                                                            ^~~~~
Language: C++

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

int binarysearch(vector<long>v, long x){
    int ok = 0;
    int ng = v.size()-1;
    while(abs(ok-ng) > 1){
        int mid = (ng + ok) / 2;
        if (v[mid] >= x){
            ng = mid;
        } else {
            ok = mid;
        }
    }
    return ok;
}

long calc(vector<long>s, vector<long>t, long x){
    vector<long>a, b;
    long min = 1e+18;
    for(int i=0;i<2;i++){
        if(i==0){
            a=s;b=t;
        } else{
            a=t;b=s;
        }
        int a_pos = binarysearch(a,x)
        for(int j=0;j<2;j++){
            a_pos += j;
            long ax = a[a_pos];
            //cout << endl << "ax"<<ax<<endl;
            int b_pos = binarysearch(b, ax);
            for(int k=0;k<2;k++){
                b_pos += k;
                long bx = b[b_pos];
                //cout << endl << "bx"<<bx<<endl;
                long d = abs(bx-x) + abs(ax-bx);
                //cout <<endl<< "abs(bx-x)"<<abs(bx-x) <<endl<< "abs(ax-bx)"<<abs(ax-bx)<<endl;
                //cout <<endl<< "d" << d << endl;
                if(d < min and d >0){
                    min = d;
                    // cout << "min" << min << endl;
                }
            }
        }
    }
    return min;
}

int main(void){
    int A, B, Q;cin>>A>>B>>Q;A+=2;B+=2;
    vector<long>s(A), t(B);
    long v;
    long x;
    s[0] = -1e+18;
    s[A-1] = 1e+18;
    for(int i=1;i<A-1;i++){
        cin>>s[i];
    }
    t[0] = - 1e+18;
    t[B-1] = 1e+18;
    for(int i=1;i<B-1;i++){
        cin>>t[i];
    }
    for(int i=0;i<Q;i++){
        cin >> x;
        v= calc(s, t, x);
        cout << v << endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'long int calc(std::vector<long int>, std::vector<long int>, long int)':
a.cc:28:9: error: expected ',' or ';' before 'for'
   28 |         for(int j=0;j<2;j++){
      |         ^~~
a.cc:28:21: error: 'j' was not declared in this scope
   28 |         for(int j=0;j<2;j++){
      |                     ^
Language: Java

import java.util.*;
import java.io.*;

public class dfs{



    public static void main(String[] args) {
        FastReader in = new FastReader();
        TreeSet<Long> shrines = new TreeSet<Long>(), temples = new TreeSet<Long>();
        int a = in.nextInt(), b = in.nextInt(), q = in.nextInt();
        for (int l = 0; l < a; ++l){
            shrines.add(in.nextLong());
        }
        for (int l = 0; l < b; ++l){
            temples.add(in.nextLong());
        }
        for (int l = 0; l < q; ++ l){
            long x = in.nextLong();
            Long lshrine = shrines.floor(x);
            lshrine = (lshrine == null?(1L<<60):x - lshrine);
            Long rshrine = shrines.ceiling(x);
            rshrine = (rshrine == null?(1L<<60):rshrine - x);
            Long ltemple = temples.floor(x);
            ltemple = (ltemple == null?(1L<<60):x - ltemple);
            Long rtemple = temples.ceiling(x);
            rtemple = (rtemple == null?(1L<<60):rtemple - x);
            //System.out.println(lshrine + " " + rshrine + " " + ltemple + " " + rtemple);
            System.out.println(Math.min(Math.min(Math.max(lshrine, ltemple), Math.max(rshrine, rtemple)),
                               Math.min(Math.min(lshrine*2+rtemple, ltemple*2+rshrine),
                               Math.min(lshrine+2*rtemple, ltemple+2*rshrine))));
        }

    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        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:4: error: class dfs is public, should be declared in a file named dfs.java
public class dfs{
       ^
1 error
Language: Java

import java.util.*;
import java.io.*;

public class dfs{



    public static void main(String[] args) {
        FastReader in = new FastReader();
        TreeSet<Long> shrines = new TreeSet<Long>(), temples = new TreeSet<Long>();
        int a = in.nextInt(), b = in.nextInt(), q = in.nextInt();
        for (int l = 0; l < a; ++l){
            shrines.add(in.nextLong());
        }
        for (int l = 0; l < b; ++l){
            temples.add(in.nextLong());
        }
        for (int l = 0; l < q; ++ l){
            long x = in.nextLong();
            Long lshrine = shrines.floor(x);
            lshrine = (lshrine == null?(1L<<60):x - lshrine);
            Long rshrine = shrines.ceiling(x);
            rshrine = (rshrine == null?(1L<<60):rshrine - x);
            Long ltemple = temples.floor(x);
            ltemple = (ltemple == null?(1L<<60):x - ltemple);
            Long rtemple = temples.ceiling(x);
            rtemple = (rtemple == null?(1L<<60):rtemple - x);
            System.out.println(Math.min(Math.min(Math.max(lshrine, ltemple), Math.max(rshrine, rtemple)),
                               Math.min(Math.min(lshrine*2+rtemple, ltemple*2+rshrine),
                               Math.min(lshrine+2*rtemple, ltemple+2*rtemple))));
        }

    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        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:4: error: class dfs is public, should be declared in a file named dfs.java
public class dfs{
       ^
1 error
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <limits>
#include <algorithm>
using namespace std;

typedef long long LL;
typedef vector<LL> VLL;
const LL LLMAX = numeric_limits<LL>::max();

LL st(VLL &t, int start) {
  LL ret = LLMAX;
  j = lower_bound(t.begin(), t.end(), start) - t.begin();
  if (j < t.size()) ret = min(ret, abs(start - t[j]));
  if (j > 0) ret = min(ret, abs(start - t[j - 1]));
  return ret;
}

LL xst(VLL &s, VLL &t, int start) {
  LL ret = LLMAX;
  j = lower_bound(s.begin(), s.end(), start) - s.begin();
  if (j < A) ret = min(ret, abs(s[j] - start) + st(t, s[j]));
  if (j > 0) ret = min(ret, abs(s[j - 1] - start) + st(t, s[j - 1]));
  return ret;
}

LL solve(VLL& s, VLL &t, int start) {
  return min(xst(s, t, start), xst(t, s, start));
}

int main()
{
  // Read inputs
  
  int A, B, Q;
  cin >> A >> B >> Q;

  VLL s(A), t(B), x(Q);
  for (int i = 0; i < A; ++i) cin >> s[i]; sort(s.begin(), s.end());
  for (int i = 0; i < B; ++i) cin >> t[i]; sort(t.begin(), t.end());
  for (int i = 0; i < Q; ++i) cin >> x[i];

  // Create tables of distances to nearest next points
  VLL st(A, LLMAX), ts(B, LLMAX);
  int j;
  for (int i = 0; i < A; ++i) {
    j = lower_bound(t.begin(), t.end(), s[i]) - t.begin();
    if (j < B) st[i] = min(st[i], abs(s[i] - t[j]));
    if (j > 0) st[i] = min(st[i], abs(s[i] - t[j - 1]));
  }
  for (int i = 0; i < B; ++i) {
    j = lower_bound(s.begin(), s.end(), t[i]) - s.begin();
    if (j < A) ts[i] = min(ts[i], abs(t[i] - s[j]));
    if (j > 0) ts[i] = min(ts[i], abs(t[i] - s[j - 1]));
  }
  
  // Solve each cases
  for (int i = 0; i < Q; ++i) {
    cout << solve(s, t, x[i]) << endl;
  }

  return 0;
}


Compiler output:
a.cc: In function 'LL st(VLL&, int)':
a.cc:14:3: error: 'j' was not declared in this scope
   14 |   j = lower_bound(t.begin(), t.end(), start) - t.begin();
      |   ^
a.cc: In function 'LL xst(VLL&, VLL&, int)':
a.cc:22:3: error: 'j' was not declared in this scope
   22 |   j = lower_bound(s.begin(), s.end(), start) - s.begin();
      |   ^
a.cc:23:11: error: 'A' was not declared in this scope
   23 |   if (j < A) ret = min(ret, abs(s[j] - start) + st(t, s[j]));
      |           ^
Language: C++

#include<iostream>
using namespace std;
const long int INF = 100000000000000;
long int min (long int a,long int b) {
  if (a < b) return a;
  else return b;
}
long int max (long int a,long int b) {
  return a + b - min(a, b);
}
long int min4 (long int a,long int b,long int c,long int d) {
  long int k, j;
  k = min(a, b);
  j = min(c, d);
  return min(k, j);
}
long int min6 (long int a,long int b,long int c,long int d,long int e,long int f) {
  long int k, j;
  k = min(a, b);
  j = min4(c, d, e, f);
  return min(k, j);
}
int main () {
  int A, B, Q;
  cin >> A >> B >>Q;
  long int shr[100000];
  long int tem[100000];
  int sm, tm, sp, tp;
  sm = tm = sp = tp = 0;
  for (int i = 0; i < A; i ++) cin >> shr[i];
  for (int i = 0; i < B; i ++) cin >> tem[i];
  shr[100000] = tem[100000] = INF;
  for (int i = 0; i < Q; i ++) {
    int x;
    cin >> x;
    while(shi[sp] < x) sp ++;
    sm = sp - 1;
    while(tem[tp] < x) tp ++;
    tm = tp - 1;
    long int a, b, c, d;
    a = max(shr[sp], tem[tp]) - x;
    b = min(shr[sm], tem[tm]) - x;
    c = tem[tp] * 2 - (x + shr[sm]);
    d = shr[sp] * 2 - (x + tem[tm]);
    e = (x + shr[sp]) - tem[tm] * 2;
    f = (x + tem[tp]) - shr[sm] * 2;
    cout << min6(a, b, c, d, e, f) << endl;
  }
}
 
  


Compiler output:
a.cc: In function 'int main()':
a.cc:36:11: error: 'shi' was not declared in this scope; did you mean 'shr'?
   36 |     while(shi[sp] < x) sp ++;
      |           ^~~
      |           shr
a.cc:45:5: error: 'e' was not declared in this scope
   45 |     e = (x + shr[sp]) - tem[tm] * 2;
      |     ^
a.cc:46:5: error: 'f' was not declared in this scope
   46 |     f = (x + tem[tp]) - shr[sm] * 2;
      |     ^
Language: C++

#include <iostream>
#include <vector>
using namespace std;
 
typedef long long ll;
#define INF 1000000000000000ll
 
ll calc(vector<ll>& s, vector<ll>& t,ll x);
 
ll A, B, Q;
vector<ll> si, ti, xi;
 
int main() {
  cin >> A >> B >> Q;
  si = vector<ll>(A+2);
  ti = vector<ll>(B+2);
  xi = vector<ll>(Q);
  si[0] = - INF;
  si[A+1] = INF;
  ti[0] = - INF;
  ti[B+1] = INF;
  for (ll i=0;i<A;i++){
    cin >> si[i+1];
  }
  for (ll i=0;i<B;i++){
    cin >> ti[i+1];
  }
  for (ll i=0;i<Q;i++){
    cin >> xi[i];
    cout << calc(si, ti, xi[i]) << endl;
  }
}
 

ll calc(vector<ll>& s, vector<ll>& t, ll x) {
 
	ll ans = LLONG_MAX;
 
	for (int i = 0; i < 2; i++) {
		vector<ll> &a = (i == 0) ? s : t;
		vector<ll> &b = (i == 0) ? t : s;
 
		for (int j = 0; j < 2; j++) {
			int apos = lower_bound(a.begin(), a.end(), x) - a.begin() - j;
			ll ax = a[apos];
			for (int k = 0; k < 2; k++) {
				int bpos = lower_bound(b.begin(), b.end(), x) - b.begin() - k;
				ll bx = b[bpos];
				ll d = max(x - ax, ax - x) + max(ax - bx, bx - ax);
				if (ans > d) { ans = d; }
			}
		}
	}
	return ans;
 
}

Compiler output:
a.cc: In function 'll calc(std::vector<long long int>&, std::vector<long long int>&, ll)':
a.cc:37:18: error: 'LLONG_MAX' was not declared in this scope
   37 |         ll ans = LLONG_MAX;
      |                  ^~~~~~~~~
a.cc:3:1: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    2 | #include <vector>
  +++ |+#include <climits>
    3 | using namespace std;
Language: C++

#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

typedef long long ll;

vector<ll>s;
vector<ll>t;

int binary_search(vector<ll> a,ll x) {
	int ok = 0;
	int ng = a.size();

	int mid;

	while (max(ok-ng,ng-ok)>1) {
		mid = (ok+ng) / 2;
		if (a[mid] <= x) { ok = mid; }
		else { ng = mid; }
	}
	return ok;
}

ll calc(ll x) {

	vector<ll>a, b;

	ll ans = LLONG_MAX;

	for (int i = 0; i < 2; i++){
		if (i == 0) { a = s; b = t; }
		else { a = t; b = s; }

		for (int j = 0; j < 2; j++) {
			int apos = binary_search(a,x)+j;
			ll ax = a[apos];
			for (int k = 0; k < 2; k++) {
				int bpos = binary_search(b, ax) + k;
				ll bx = b[bpos];
				ll d = max(x-ax,ax-x)+max(ax-bx,bx-ax);
				if (ans > d) { ans = d; }
			}
		}
	}
	return ans;

}
int main() {

	int A, B, Q;

	scanf("%d %d %d", &A, &B, &Q);

	int i;

	for (i = 0; i < A; i++) {
		ll si;
		scanf("%lld", &si);
		s.push_back(si);
	}
	for (i = 0; i < B; i++) {
		ll ti;
		scanf("%lld", &ti);
		t.push_back(ti);
	}


	for (i = 0; i < Q; i++) {
		ll xi;
		scanf("%lld", &xi);
		printf("%lld\n",calc(xi));
	}

	return 0;
}


Compiler output:
a.cc: In function 'll calc(ll)':
a.cc:31:18: error: 'LLONG_MAX' was not declared in this scope
   31 |         ll ans = LLONG_MAX;
      |                  ^~~~~~~~~
a.cc:5:1: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    4 | #include <vector>
  +++ |+#include <climits>
    5 |
Language: C++

#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;

int A, B, Q;
long int s[100010], t[100010], x[100010];
long int ns[100010], nt[100010];

long int search_(long int p, long int *q, int qn){
  if( p<q[0] )    return q[0]-p;
  else break;

  if( p>q[qn-1] ) return p-q[qn-1];
  else break;

  for(int j=0; j<qn-1; j++){
    if( p-q[j+1]<=0 ){
      if( p*2 >= q[j]+q[j+1] ) return q[j+1]-p;
        else  return p-q[j];
        break;
      }
  }

}

long int search_leng(long int *p, long int *q, long int *nq, int pn, int qn, long int *x, int i){
  long int leng0;
  if     ( x[i]<p[0] )    leng0 = p[0]-x[i]    + nq[0];
  else if( x[i]>p[pn-1] ) leng0 = x[i]-p[pn-1] + nq[pn-1];
  else{
    for(int j=0; j<pn-1; j++){
      if( x[i]-p[j+1]<=0 ){
        leng0 = min(p[j+1]-x[i] + nq[j+1], x[i]-p[j] + nq[j]);
        break;
      }
    }
  }
  return leng0;
}

int main(){
  cin >> A >> B >> Q;
  int i;
  for(i=0; i<A; i++) cin >> s[i];
  for(i=0; i<B; i++) cin >> t[i];
  for(i=0; i<Q; i++) cin >> x[i];

  for(i=0; i<A; i++){
    nt[i] = search_(s[i], t, B); // s , nearest temple
  }

  for(i=0; i<B; i++){
    ns[i] = search_(t[i], s, A); // t , nearest shrine
  }

  for(i=0; i<Q; i++){
    cout << min(search_leng(s, t, nt, A, B, x, i)
              , search_leng(t, s, ns, B, A, x, i)) << endl;
  }

  return 0;

}


Compiler output:
a.cc: In function 'long int search_(long int, long int*, int)':
a.cc:12:8: error: break statement not within loop or switch
   12 |   else break;
      |        ^~~~~
a.cc:15:8: error: break statement not within loop or switch
   15 |   else break;
      |        ^~~~~
a.cc:25:1: warning: control reaches end of non-void function [-Wreturn-type]
   25 | }
      | ^
Language: C++

#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;

int A, B, Q;
long int s[100010], t[100010], x[100010];
long int ns[100010], nt[100010];

void search_(long int p, long int *q, int qn){
  if( p<q[0] )    return q[0]-p;
  else break;

  if( p>q[qn-1] ) return p-q[qn-1];
  else break;

  for(int j=0; j<qn-1; j++){
    if( p-q[j+1]<=0 ){
      if( p*2 >= q[j]+q[j+1] ) return q[j+1]-p;
        else  return p-q[j];
        break;
      }
  }

}

long int search_leng(long int *p, long int *q, long int *nq, int pn, int qn, long int *x, int i){
  long int leng0;
  if     ( x[i]<p[0] )    leng0 = p[0]-x[i]    + nq[0];
  else if( x[i]>p[pn-1] ) leng0 = x[i]-p[pn-1] + nq[pn-1];
  else{
    for(int j=0; j<pn-1; j++){
      if( x[i]-p[j+1]<=0 ){
        leng0 = min(p[j+1]-x[i] + nq[j+1], x[i]-p[j] + nq[j]);
        break;
      }
    }
  }
  return leng0;
}

int main(){
  cin >> A >> B >> Q;
  int i;
  for(i=0; i<A; i++) cin >> s[i];
  for(i=0; i<B; i++) cin >> t[i];
  for(i=0; i<Q; i++) cin >> x[i];

  for(i=0; i<A; i++){
    search_(s[i], t, B); // s , nearest temple
  }

  for(i=0; i<B; i++){
    search_(t[i], s, A); // t , nearest shrine
  }

  for(i=0; i<Q; i++){
    cout << min(search_leng(s, t, nt, A, B, x, i)
              , search_leng(t, s, ns, B, A, x, i)) << endl;
  }

  return 0;

}


Compiler output:
a.cc: In function 'void search_(long int, long int*, int)':
a.cc:11:30: error: return-statement with a value, in function returning 'void' [-fpermissive]
   11 |   if( p<q[0] )    return q[0]-p;
      |                          ~~~~^~
a.cc:12:8: error: break statement not within loop or switch
   12 |   else break;
      |        ^~~~~
a.cc:14:27: error: return-statement with a value, in function returning 'void' [-fpermissive]
   14 |   if( p>q[qn-1] ) return p-q[qn-1];
      |                          ~^~~~~~~~
a.cc:15:8: error: break statement not within loop or switch
   15 |   else break;
      |        ^~~~~
a.cc:19:45: error: return-statement with a value, in function returning 'void' [-fpermissive]
   19 |       if( p*2 >= q[j]+q[j+1] ) return q[j+1]-p;
      |                                       ~~~~~~^~
a.cc:20:23: error: return-statement with a value, in function returning 'void' [-fpermissive]
   20 |         else  return p-q[j];
      |                      ~^~~~~
Language: C++

#include <bits/stdc++.h>
#define ll long long
#define sll static long long
#define INF 1e15
using namespace std;

ll i,j;
ll num1,num2;
ll temp_ans=0;
ll zinja_ans=0;
ll ans1=0,ans2=0,ans3=0,ans4=0;
ll A,B,N,Q;	
ll s[100000]={INF};
ll t[100000]={INF};
ll x[100000]={INF};
int main()
{
	ll *mi;
	ll me;
	ll copy;
	ll distance=0;
	temp_ans=LLONG_MAX;
	zinja_ans=LLONG_MAX;
	cin>>A>>B>>Q;
	for(i=0;i<A;i++) cin>>s[i];
	for(i=0;i<B;i++) cin>>t[i];
	for(i=0;i<Q;i++) cin>>x[i];
	sort(s,s+A);
	sort(t,t+B);
	cout<<endl;
	for(i=0;i<Q;i++){
		copy=x[i];
		/*神社からめぐる場合*/

		/*1つめ*/
		mi=lower_bound(s,s+A,x[i]);
		me=mi-s;		
		if(me==0) me++;
		if(s[me]==0)	s[me]=s[me-1];
		zinja_ans=abs(s[me]-x[i]);
		ans1=zinja_ans;
		x[i]=s[me];			
		mi=lower_bound(t,t+B,x[i]);
		me=mi-t;	
		if(me==0) me++;
		if(t[me]==0)	 t[me]=t[me-1];
		temp_ans=min(abs(t[me]-x[i]),abs(x[i]-t[me-1]));
		ans1+=temp_ans;

		x[i]=copy;
		/*2つめ*/
		mi=lower_bound(s,s+A,x[i]);
		me=mi-s;		
		if(me==0) me++;
		if(s[me]==0)	s[me]=s[me-1];
		zinja_ans=abs(s[me-1]-x[i]);
		ans2=zinja_ans;
		x[i]=s[me-1];	
		mi=lower_bound(t,t+B,x[i]);
		me=mi-t;	
		if(me==0) me++;
		if(t[me]==0)	 t[me]=t[me-1];
		temp_ans=min(abs(t[me]-x[i]),abs(x[i]-t[me-1]));
		ans2+=temp_ans;	
	
	
		/*寺からめぐる場合*/
		x[i]=copy;

		mi=lower_bound(t,t+B,x[i]);
		me=mi-t;		
		if(me==0) me++;
		if(t[me]==0)	 t[me]=t[me-1];
		temp_ans=abs(t[me]-x[i]);
		ans3=temp_ans;
		x[i]=t[me];			
		mi=lower_bound(s,s+A,x[i]);
		me=mi-s;	
		if(me==0) me++;
		if(s[me]==0)	s[me]=s[me-1];
		zinja_ans=min(abs(s[me]-x[i]),abs(x[i]-s[me-1]));
		ans3+=zinja_ans;
		
		x[i]=copy;
			
		mi=lower_bound(t,t+B,x[i]);
		me=mi-t;		
		if(me==0) me++;
		if(t[me]==0)	 t[me]=t[me-1];
		temp_ans=abs(t[me-1]-x[i]);
		ans4=temp_ans;
		x[i]=t[me-1];	
		mi=lower_bound(s,s+B,x[i]);
		me=mi-s;	
		if(me==0) me++;
		if(s[me]==0)	s[me]=s[me-1];
		zinja_ans=min(abs(s[me]-x[i]),abs(x[i]-s[me-1]));
		ans4+=zinja_ans;	

		//cout<<ans1<<"and"<<ans2<<"and"<<ans3<<"and"<<ans4<<endl;
		cout<<min(min(min(ans1,ans2),ans3),ans4)<<endl;
		ans1=ans2=ans3=ans4=INF;
	}
	return 0;
}


Compiler output:
a.cc:4:13: error: narrowing conversion of '1.0e+15' from 'double' to 'long long int' [-Wnarrowing]
    4 | #define INF 1e15
      |             ^~~~
a.cc:13:15: note: in expansion of macro 'INF'
   13 | ll s[100000]={INF};
      |               ^~~
a.cc:4:13: error: narrowing conversion of '1.0e+15' from 'double' to 'long long int' [-Wnarrowing]
    4 | #define INF 1e15
      |             ^~~~
a.cc:14:15: note: in expansion of macro 'INF'
   14 | ll t[100000]={INF};
      |               ^~~
a.cc:4:13: error: narrowing conversion of '1.0e+15' from 'double' to 'long long int' [-Wnarrowing]
    4 | #define INF 1e15
      |             ^~~~
a.cc:15:15: note: in expansion of macro 'INF'
   15 | ll x[100000]={INF};
      |               ^~~
Language: Java

import java.util.Scanner;

public class Main{
  static int A,B,Q;
  static Long[] S,T,X;
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    A = sc.nextInt();
    B = sc.nextInt();
    Q = sc.nextInt();
    S = new Long[A+2];
    T = new Long[B+2];
    X = new Long[Q];
    for(int i=1;i<=A;i++){
      S[i]=sc.nextLong();
    }
    S[0]=-100000000000000000L;
    S[A + 1]=100000000000000000L;
    for(int i=1;i<=B;i++){
      T[i]=sc.nextLong();
    }
    T[0]=-100000000000000000L;
    T[B + 1]=100000000000000000L;
    for(int i=0;i<Q;i++){
      X[i]=sc.nextLong();
    }
    for(int i=0;i<Q;i++){
      System.out.println(Qanswer(i));
    }
  }



  static int binary_search(Long[] Array,Long key,int r,int l){
    int mid = 0;
    if(l-r<=1){
      if(Math.abs(key-Array[r])>=Math.abs(key-Array[l])){
        return l;
      }
      else{
        return r;
      }
      //return Math.min(Math.abs(key-Array[r]),Math.abs(key-Array[l]));
    }
    else{
      if(Math.abs(r-l)%2==0){
        mid = (r+l)/2;
      }
      else{
        mid = (r+l)/2+1;
      }
      if(Array[mid]<=key){
        return binary_search(Array,key,mid,l);
      }
      else{
        return binary_search(Array,key,r,mid-1);
      }
    }
  }

  static Long Qanswer(int i){
    int Snear = binary_search(S,X[i],0,S.length-1);
    int Tnear = binary_search(T,X[i],0,T.length-1);

    /* ======== DEBUG ======== */
    //System.out.println("[" + S[Snear] + ", " + X[i] + ", " + S[Snear + 1] + "]");
    //System.out.println("[" + T[Tnear] + ", " + X[i] + ", " + T[Tnear + 1] + "]");
    /* ======== /DEBUG ======== */

    return minimum(caliculate(i,Snear,Tnear),caliculate(i,Snear,Tnear+1),caliculate(i,Snear+1,Tnear),caliculate(i,Snear+1,Tnear+1));
    /*if((Snear<=X[i] && Tnear<=X[i]) || (Snear>=X[i] && Tnear>=X[i])){
      return Math.max(Math.abs(X[i]-Snear),Math.abs(X[i]-Tnear));
    }
    else{
    return Math.max(Math.abs(X[i]-Snear),Math.abs(X[i]-Tnear))+2*Math.min(Math.abs(X[i]-Snear),Math.abs(X[i]-Tnear));
    }
    */
  }

  static Long caliculate(int i,int r,int l){
    if((S[r]<=X[i] && T[l]<=X[i]) || (S[r]>=X[i] && T[l]>=X[i])){
      /* ======== DEBUG ======== */
      //System.out.println("1: " + Math.abs(X[i] - S[r]) + ", " + Math.abs(X[i] - T[l]));
      //return Math.max(Math.abs(X[i]-S[r]),Math.abs(X[i]-T[l]));
      /* ======== /DEBUG ======== */
    }
    else{
      /* ======== DEBUG ======== */
      //Long t = Math.max(Math.abs(X[i]-S[r]),Math.abs(X[i]-T[l])) + 2*Math.min(Math.abs(X[i]-S[r]),Math.abs(X[i]-T[l]));
      //System.out.println("2: " + t);
      /* ======== /DEBUG ======== */
      return Math.max(Math.abs(X[i]-S[r]),Math.abs(X[i]-T[l]))+2*Math.min(Math.abs(X[i]-S[r]),Math.abs(X[i]-T[l]));
    }
  }

  static Long minimum(Long a,Long b,Long c,Long d){
    Long ans = 100000000000000000L;
    Long[] Arra= new Long[4];
    Arra[0] = a;
    Arra[1] = b;
    Arra[2] = c;
    Arra[3] = d;
    for(int i=0;i<4;i++){
      if(ans>=Arra[i]){
        ans = Arra[i];
      }
    }
    return ans;
  }

}

Compiler output:
Main.java:94: error: missing return statement
  }
  ^
1 error
Language: C++

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

typedef long long ll;
#define INF 1000000000000000ll

ll calc(vector<ll> s, vector<ll> t,ll x);

ll A, B, Q;
vector<ll> si, ti, xi;

int main() {
  cin >> A >> B >> Q;
  si = vector<ll>(A+2);
  ti = vector<ll>(B+2);
  xi = vector<ll>(Q);
  si[0] = - INF;
  si[A+1] = INF;
  ti[0] = - INF;
  ti[B+1] = INF;
  for (ll i=0;i<A;i++){
    cin >> si[i+1];
  }
  for (ll i=0;i<B;i++){
    cin >> ti[i+1];
  }
  for (ll i=0;i<Q;i++){
    cin >> xi[i];
    cout << calc(si, ti, xi[i]) << endl;
  }
}

ll calc(vector<ll>& s, vector<ll>& t,ll x){
  vector<ll> a, b;
  ll m = INF;
  for (ll i=0;i<2;i++){
    if (i==0){
      a = s;
      b = t;
    }else{
      a = t;
      b = s;
    }
    for (ll j=0;j<2;j++){
      ll aidx = lower_bound(a.begin(),a.end(),x) - a.begin() -j;
      ll ax = a[aidx];
      for (ll k=0;k<2;k++){
        ll bidx = lower_bound(b.begin(),b.end(),x) - b.begin() -k;
        ll bx = b[bidx];
        m = min(m, abs(x - ax) + abs(ax - bx));
      }
    }
  }
  return m;
}


Compiler output:
/usr/bin/ld: /tmp/ccyaWdH5.o: in function `main':
a.cc:(.text+0x32f): undefined reference to `calc(std::vector<long long, std::allocator<long long> >, std::vector<long long, std::allocator<long long> >, long long)'
collect2: error: ld returned 1 exit status
Language: C++

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e12;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1

ll sq(ll num) { return num*num; }
ll mod_pow(ll x, ll n) {
	if (n == 0)return 1;
	if (n == 1)return x%MOD;
	ll res = sq(mod_pow(x, n / 2));
	res %= MOD;
	if (n % 2 == 1) {
		res *= x;
		res %= MOD;
	}
	return res;
}
ll mod_add(ll a, ll b) { return (a + b) % MOD; }
ll mod_sub(ll a, ll b) { return (a - b + MOD) % MOD; }
ll mod_mul(ll a, ll b) { return a*b % MOD; }

ll n,a,b;

int main(){
	cin >> a >> b >> n;
	vector<ll> s(200000,INF),taa(200000,INF);
	s[0] = 0;
	t[0] = 0;
	rep(i,a)cin >> s[i+1];
	rep(i,b)cin >> t[i+1];
	rep(i,n){
		ll x;
		cin >> x;
		vector<ll>::iterator snx = upper_bound(ALL(s),x);
		vector<ll>::iterator tnx = upper_bound(ALL(t),x);
		vector<ll>::iterator sit = snx;
		vector<ll>::iterator tit = tnx;
		sit--; tit--;
		// cout << *sit << " " << *snx << " " << *tit << " " << *tnx << endl;
		ll p = x - *sit;
		if(*sit == 0)p = INF;
		ll q = *snx - x;
		if(*snx == INF)q = INF;
		ll r = x - *tit;
		if(*tit == 0)r = INF;
		ll s = *tnx - x;
		if(*tnx == INF)s = INF;
		// cout << "!" << p << " " << q << " " << r << " " << s << endl;
		cout << min(min(max(p,r),max(q,s)),min(p,r)+min(q,s)+min(min(p,r),min(q,s))) << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:48:9: error: 't' was not declared in this scope
   48 |         t[0] = 0;
      |         ^
Language: Java

import java.util.Scanner;

public class main {

    static long[] A, B, Q;

    public static void main(String[] args) {

        int a, b, q;

        Scanner sc = new Scanner(System.in);

        a = sc.nextInt();
        b = sc.nextInt();
        q = sc.nextInt();

        A = new long[a];
        B = new long[b];
        Q = new long[q];

        for(int i = 0; i < a; i++){

            A[i] = sc.nextLong();
        }

        for(int i = 0; i < b; i++){

            B[i] = sc.nextLong();
        }

        for(int i = 0; i < q; i++){

            Q[i] = sc.nextLong();
        }

        //

        for(int i = 0; i < q; i++){

            long a1,b1;
            long a2,b2;

            long x1,x2;

            a1 = hikaku(Q[i],A,a);
            b1 = hikaku(Q[i],B,b);


                a2 = atai(Q[i],A,a);
                b2 = atai(a2,B,b);

                x1 = Math.abs(Q[i] - a2) + Math.abs(a2 - b2);


                b2 = atai(Q[i],B,b);
                a2 = atai(b2,A,a);

                x2 = Math.abs(Q[i] - b2) + Math.abs(b2 - a2);


            if(x1 < x2){

                System.out.println(x1);
            }
            else {

                System.out.println(x2);
            }

        }
    }

    public static long hikaku(long q, long[] n,int y){

        long a = (long) Math.pow(10, 10);

        for(int i = 0; i < y; i++){

            if( Math.abs(n[i] - q) < a){

                a = Math.abs(n[i] - q);
            }
        }

        return a;
    }

    public static long atai(long q, long[] n,int y){

        long a = (long) Math.pow(10, 10);
        int x = 0;

        for(int i = 0; i < y ; i++){

            if( Math.abs(n[i] - q) < a){

                a = Math.abs(n[i] - q);
                x = i;
            }
        }

        return n[x];
    }

}

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

import bisect as bi
a, b, q = map(int, input().split())
s = [int(input()) for i in range(a)]
t = [int(input()) for i in range(b)]
u = [int(input()) for i in range(q)]

for x in u:
    c = []
    d = []
    tmp = bi.bisect_left(s, x)
    if tmp != a : c.append(s[tmp])
    if tmp != 0 : c.append(s[tmp-1])
    tmp = bi.bisect_left(t, x)
    if tmp != b : d.append(t[tmp])
    if tmp != 0 : d.append(t[tmp-1])
    ans = 2**64
    for e in c:
        for f in d:
            g = abs(x-e)
            h = abs(x-f)
            if (x-e)*(x-f) > 0:
                ans = min(ans, max(g, h))
            else:
                if g > h : g,h = h,g
                ans = min(ans, 2*g+h)
    print(ans)


Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import bisect as bi
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define lint long long
//#define P pair<int, int>

lint Len(lint a, lint b, lint x){
    return abs(a - b) + abs(b - x);
}

int main(){
    int A, B, Q;
    cin >> A >> B >> Q;
    
    vector<lint> s(A), t(B), x(Q);
    
    for(int i = 0; i < A; ++i){
        cin >> s[i];
    }
    for(int i = 0; i < B; ++i){
        cin >> t[i];
    }
    for(int i = 0; i < Q; ++i){
        cin >> x[i];
    }
    
    
    for(int i = 0; i < Q; ++i){
        auto its = lower_bound(s.begin(), s.end(), x[i]);
        auto itt = lower_bound(t.begin(), t.end(), x[i]);
        lint s1, s2, t1, t2;
        
        s1 = *(max(its - 1, s.begin()));
        s2 = *(min(its, s.end() - 1));
        
        t1 = *(max(itt - 1, t.begin()));
        t2 = *(min(itt, t.end() - 1));
        
        vector<lint> List = {Len(s1, t1, x[i]), Len(s1, t2, x[i]), Len(s2, t1, x[i]), Len(s2, t2, x[i]), Len(t1, s1, x[i]), Len(t1, s2, x[i]), Len(t2, s1, x[i]), Len(t2, s2, x[i])};
        
        cout << *min_element(List.begin(), List.end()) << endl;
    }
}}

Compiler output:
a.cc:42:2: error: expected declaration before '}' token
   42 | }}
      |  ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define lint long long
//#define P pair<int, int>

int main(){
    int A, B, Q;
    cin >> A >> B >> Q;
    
    vector<lint> s(A), t(B), x(Q);
    
    for(int i = 0; i < A; ++i){
        cin >> s[i];
    }
    for(int i = 0; i < B; ++i){
        cin >> t[i];
    }
    for(int i = 0; i < Q; ++i){
        cin >> x[i];
    }
    
    
    for(int i = 0; i < Q; ++i){
        auto its = lower_bound(s.begin(), s.end(), x[i]);
        lint s1, s2;
        s1 = *(max(its - 1, s.begin()));
        s2 = *(min(its, s.end() - 1));
        
        
        auto itt1 = lower_bound(t.begin(), t.end(), s1);
        lint t11, t12, t21, t22;
        t11 = *(max(itt1 - 1, t.begin()));
        t12 = *(min(itt1, t.end() - 1));
        lint ans = min(abs(t11 - s1), abs(t12 - s1)) + abs(s1 - x[i]);
        
        auto itt2 = lower_bound(t.begin(), t.end(), s2);
        t21 = *(max(itt2 - 1, t.begin()));
        t22 = *(min(itt2, t.end() - 1));
        ans = min(ans, min(abs(t21 - s2), abs(t22 - s2)) + abs(s2 - x[i]));
        
        
        auto itt = lower_bound(t.begin(), t.end(), x[i]);
        lint t1, t2;
        t1 = *(max(itt - 1, t.begin()));
        t2 = *(min(itt, t.end() - 1));
        
        lint s11, s12, s21, s22;
        auto its1 = lower_bound(s.begin(), s.end(), t1);
        s11 = *max(its1 - 1, s.begin());
        s12 = *max(its1, s.end() - 1);
        ans = min(ans, min(abs(s11 - t1), abs(s12 - t1)) + abs(t1 - x[i]));
        
        auto its2 = lower_bound(s.begin(), s.end(), t2);
        s21 = *max(its2 - 1, s.begin());
        s22 = *max(its2, s.end() - 1);
        ans = min(ans, min(abs(s21 - t2), abs(s22 - t2)) + abs(t2 - x[i]));
        
//        cerr << x[i] << " " << s1 << " " << s2 << " " << t11 << " " << t12 << " " << t21 << " " << t22 << " ";
        cout << ans << endl;
        
    }

Compiler output:
a.cc: In function 'int main()':
a.cc:61:6: error: expected '}' at end of input
   61 |     }
      |      ^
a.cc:6:11: note: to match this '{'
    6 | int main(){
      |           ^