Language: C++

#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>

std::pair<long, long> search(const int n, std::vector<long> v, long x)
{
    if (v.at(0) > x) {
        std::pair<long, long> res;
        res.first = 372036854775807;
        res.second = v.at(0) - x;
        return res;
    }
    if (v.at(n - 1) < x) {
        std::pair<long, long> res;
        res.second = 372036854775807;
        res.first = x - v.at(n - 1);
        return res;
    }
    int sup = n - 1;
    int inf = 0;
    int p = (sup + inf) / 2;
    while (sup - inf != 1) {
        if (v.at(p) > x) {
            sup = p;
            p = (sup + inf) / 2;
        } else if (v.at(p + 1) < x) {
            inf = p + 1;
            p = (sup + inf) / 2;
        } else {
            inf = p;
            sup = p + 1;
        }
    }
    std::pair<long, long> res;
    res.first = x - v.at(inf);
    res.second = v.at(sup) - x;
    return res;
}

int main()
{
    int A, B, Q;
    std::cin >> A >> B >> Q;
    std::vector<long> s(A);
    std::vector<long> t(B);

    for (int i = 0; i < A; i++) {
        std::cin >> s.at(i);
    }

    for (int i = 0; i < B; i++) {
        std::cin >> t.at(i);
    }

    for (int i = 0; i < Q; i++) {
        long x;
        std::cin >> x;
        std::pair<long, long> s_s = search(A, s, x);
        std::pair<long, long> s_t = search(B, t, x);
        std::cout << std::min({std::max(s_s.first, s_t.first), std::max(s_s.second, s_t.second), std::min(s_s.second, s_t.first) * 2 + std::max(s_s.second, s_t.first), std::min(s_s.first, s_t.second) * 2 + std::max(s_s.first, s_t.second)}) << std::endl;
    }


    return 0;
}
 ✝  ~/atcoder/192224  vim d.cpp
 ✝  ~/atcoder/192224  g++ d.cpp
 ✝  ~/atcoder/192224  cat d.cpp
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>

std::pair<long, long> search(const int n, std::vector<long> v, long x)
{
    if (v.at(0) > x) {
        std::pair<long, long> res;
        res.first = 372036854775807;
        res.second = v.at(0) - x;
        return res;
    }
    if (v.at(n - 1) < x) {
        std::pair<long, long> res;
        res.second = 372036854775807;
        res.first = x - v.at(n - 1);
        return res;
    }
    int sup = n - 1;
    int inf = 0;
    int p = (sup + inf) / 2;
    while (true) {
        if (v.at(p) > x) {
            sup = p;
            p = (sup + inf) / 2;
        } else if (v.at(p + 1) < x) {
            inf = p + 1;
            p = (sup + inf) / 2;
        } else {
            inf = p;
            sup = p + 1;
            break;
        }
    }
    std::pair<long, long> res;
    res.first = x - v.at(inf);
    res.second = v.at(sup) - x;
    return res;
}

int main()
{
    int A, B, Q;
    std::cin >> A >> B >> Q;
    std::vector<long> s(A);
    std::vector<long> t(B);

    for (int i = 0; i < A; i++) {
        std::cin >> s.at(i);
    }

    for (int i = 0; i < B; i++) {
        std::cin >> t.at(i);
    }

    for (int i = 0; i < Q; i++) {
        long x;
        std::cin >> x;
        std::pair<long, long> s_s = search(A, s, x);
        std::pair<long, long> s_t = search(B, t, x);
        std::cout << std::min({std::max(s_s.first, s_t.first), std::max(s_s.second, s_t.second), std::min(s_s.second, s_t.first) * 2 + std::max(s_s.second, s_t.first), std::min(s_s.first, s_t.second) * 2 + std::max(s_s.first, s_t.second)}) << std::endl;
    }


    return 0;
}

Compiler output:
a.cc:67:2: error: extended character ✝ is not valid in an identifier
   67 |  ✝  ~/atcoder/192224  vim d.cpp
      |  ^
a.cc:67:4: error: extended character  is not valid in an identifier
   67 |  ✝  ~/atcoder/192224  vim d.cpp
      |    ^
a.cc:67:23: error: extended character  is not valid in an identifier
   67 |  ✝  ~/atcoder/192224  vim d.cpp
      |                       ^
a.cc:68:2: error: extended character ✝ is not valid in an identifier
   68 |  ✝  ~/atcoder/192224  g++ d.cpp
      |  ^
a.cc:68:4: error: extended character  is not valid in an identifier
   68 |  ✝  ~/atcoder/192224  g++ d.cpp
      |    ^
a.cc:68:23: error: extended character  is not valid in an identifier
   68 |  ✝  ~/atcoder/192224  g++ d.cpp
      |                       ^
a.cc:69:2: error: extended character ✝ is not valid in an identifier
   69 |  ✝  ~/atcoder/192224  cat d.cpp
      |  ^
a.cc:69:4: error: extended character  is not valid in an identifier
   69 |  ✝  ~/atcoder/192224  cat d.cpp
      |    ^
a.cc:69:23: error: extended character  is not valid in an identifier
   69 |  ✝  ~/atcoder/192224  cat d.cpp
      |                       ^
a.cc:67:2: error: '\U0000271d' does not name a type
   67 |  ✝  ~/atcoder/192224  vim d.cpp
      |  ^
a.cc:111:5: error: redefinition of 'int main()'
  111 | int main()
      |     ^~~~
a.cc:41:5: note: 'int main()' previously defined here
   41 | int main()
      |     ^~~~