Language: C++

#include<iostream>
using namespace std;
const long int INF = 100000000000000;
long int min (long int a, b) {
  if (a < b) return a;
  else return b;
}
long int max (long int a, b) {
  return a + b - min(a, b);
}
long int min4 (long int a, b, c, d) {
  long int k, j;
  k = min(a, b);
  j = min(c, d);
  return min(k, j);
}
long int min6 (long int a, b, c, d, e, 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:4:27: error: 'b' has not been declared
    4 | long int min (long int a, b) {
      |                           ^
a.cc: In function 'long int min(long int, int)':
a.cc:5:11: error: 'b' was not declared in this scope
    5 |   if (a < b) return a;
      |           ^
a.cc: At global scope:
a.cc:8:27: error: 'b' has not been declared
    8 | long int max (long int a, b) {
      |                           ^
a.cc: In function 'long int max(long int, int)':
a.cc:9:14: error: 'b' was not declared in this scope
    9 |   return a + b - min(a, b);
      |              ^
a.cc: At global scope:
a.cc:11:28: error: 'b' has not been declared
   11 | long int min4 (long int a, b, c, d) {
      |                            ^
a.cc:11:31: error: 'c' has not been declared
   11 | long int min4 (long int a, b, c, d) {
      |                               ^
a.cc:11:34: error: 'd' has not been declared
   11 | long int min4 (long int a, b, c, d) {
      |                                  ^
a.cc: In function 'long int min4(long int, int, int, int)':
a.cc:13:14: error: 'b' was not declared in this scope
   13 |   k = min(a, b);
      |              ^
a.cc:14:11: error: 'c' was not declared in this scope
   14 |   j = min(c, d);
      |           ^
a.cc:14:14: error: 'd' was not declared in this scope
   14 |   j = min(c, d);
      |              ^
a.cc: At global scope:
a.cc:17:28: error: 'b' has not been declared
   17 | long int min6 (long int a, b, c, d, e, f) {
      |                            ^
a.cc:17:31: error: 'c' has not been declared
   17 | long int min6 (long int a, b, c, d, e, f) {
      |                               ^
a.cc:17:34: error: 'd' has not been declared
   17 | long int min6 (long int a, b, c, d, e, f) {
      |                                  ^
a.cc:17:37: error: 'e' has not been declared
   17 | long int min6 (long int a, b, c, d, e, f) {
      |                                     ^
a.cc:17:40: error: 'f' has not been declared
   17 | long int min6 (long int a, b, c, d, e, f) {
      |                                        ^
a.cc: In function 'long int min6(long int, int, int, int, int, int)':
a.cc:19:14: error: 'b' was not declared in this scope
   19 |   k = min(a, b);
      |              ^
a.cc:20:12: error: 'c' was not declared in this scope
   20 |   j = min4(c, d, e, f);
      |            ^
a.cc:20:15: error: 'd' was not declared in this scope
   20 |   j = min4(c, d, e, f);
      |               ^
a.cc:20:18: error: 'e' was not declared in this scope
   20 |   j = min4(c, d, e, f);
      |                  ^
a.cc:20:21: error: 'f' was not declared in this scope
   20 |   j = min4(c, d, e, f);
      |                     ^
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;
      |     ^