func_code_string: #include <bits/stdc++.h>   using namespace std;   int n, m;   long long a[200000], b[200000];   bool ok(long long x) {     int p(1);     long long q(0);     for (int i = 1; i <= (m); ++i)       if (b[i] > q) {         while (p <= n && a[p] + x < b[i]) ++p;         if (a[p] - x > b[i] || p > n) return false;         if (a[p] <= b[i])           q = a[p] + x;         else           q = max(b[i] + x - (a[p] - b[i]), a[p] + (x - (a[p] - b[i])) / 2);         ++p;       }     return true;   }   int main() {     scanf( %d%d , &n, &m);     for (int i = 1; i <= (n); ++i) scanf( %I64d , &a[i]);     for (int i = 1; i <= (m); ++i) scanf( %I64d , &b[i]);     long long L = -1, R = 1LL << 40;     while (L + 1 < R) (ok(L + R >> 1) ? R : L) = L + R >> 1;     printf( %I64d n , R);     return 0;   }   