func_code_string: #include <bits/stdc++.h>   using namespace std;   inline long long add(long long a, long long b) {     return ((a % 1000000007LL) + (b % 1000000007LL)) % 1000000007LL;   }   inline long long mul(long long a, long long b) {     return ((a % 1000000007LL) * (b % 1000000007LL)) % 1000000007LL;   }   inline long long sub(long long a, long long b) {     return ((a % 1000000007LL) - (b % 1000000007LL) + 1000000007LL) %            1000000007LL;   }   long long dp[1001][2001];   long long findAns(long long i, long long j, long long n, long long k,                     long long a[], long long key[], long long p) {     if (i == n) {       return 0;     }     if (j >= k) {       return -1000000000000000000LL;     }     if (dp[i][j] != -1) {       return dp[i][j];     }     long long ret;     long long ret1 = findAns(i, j + 1, n, k, a, key, p);     long long ret2 = findAns(i + 1, j + 1, n, k, a, key, p);     if (ret1 == -1000000000000000000LL && ret2 == -1000000000000000000LL) {       ret = -1000000000000000000LL;     } else if (ret1 == -1000000000000000000LL) {       ret = max(abs(a[i] - key[j]) + abs(key[j] - p), ret2);     } else if (ret2 == -1000000000000000000LL) {       ret = ret1;     } else {       ret = min(ret1, max(abs(a[i] - key[j]) + abs(key[j] - p), ret2));     }     return dp[i][j] = ret;   }   void Flash() {     long long n, k, p;     cin >> n >> k >> p;     long long a[n];     for (long long i = 0; i < n; i++) {       cin >> a[i];     }     long long key[k];     for (long long i = 0; i < k; i++) {       cin >> key[i];     }     sort(a, a + n), sort(key, key + k);     memset(dp, -1, sizeof(dp));     long long ans = findAns(0, 0, n, k, a, key, p);     cout << ans <<   n ;   }   int main(int argc, char const *argv[]) {     ios::sync_with_stdio(0), cin.tie(NULL), cout.tie(NULL);     ;     long long t = 1;     for (long long i = 1; i <= t; i++) {       Flash();     }     return 0;   }   