func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MaxN = 5010;   int N, l, r;   long long ans;   int main() {     scanf( %d%d , &N, &l);     r = l;     for (int i = 1, __end = N; i <= __end; ++i) {       int u, v;       scanf( %d%d , &u, &v);       if (max(l, u) <= min(r, v)) {         l = max(l, u);         r = min(r, v);       } else if (v < l) {         ans += l - v;         r = l;         l = v;       } else if (r < u) {         ans += u - r;         l = r;         r = u;       }     }     cout << ans << endl;     return 0;   }   