func_code_string: #include <bits/stdc++.h>   using namespace std;   template <typename T, typename U>   inline void smin(T &a, U b) {     if (a > b) a = b;   }   template <typename T, typename U>   inline void smax(T &a, U b) {     if (a < b) a = b;   }   template <class T>   inline void gn(T &first) {     char c, sg = 0;     while (c = getchar(), (c >  9  || c <  0 ) && c !=  - )       ;     for ((c ==  -  ? sg = 1, c = getchar() : 0), first = 0; c >=  0  && c <=  9 ;          c = getchar())       first = (first << 1) + (first << 3) + c -  0 ;     if (sg) first = -first;   }   template <class T, class T1>   inline void gn(T &first, T1 &second) {     gn(first);     gn(second);   }   template <class T, class T1, class T2>   inline void gn(T &first, T1 &second, T2 &z) {     gn(first);     gn(second);     gn(z);   }   template <class T>   inline void print(T first) {     if (first < 0) {       putchar( - );       return print(-first);     }     if (first < 10) {       putchar( 0  + first);       return;     }     print(first / 10);     putchar(first % 10 +  0 );   }   template <class T>   inline void printsp(T first) {     print(first);     putchar(   );   }   template <class T>   inline void println(T first) {     print(first);     putchar(  n );   }   int power(int a, int b, int m, int ans = 1) {     for (; b; b >>= 1, a = 1LL * a * a % m)       if (b & 1) ans = 1LL * ans * a % m;     return ans;   }   struct Node {     int sz, val;     Node *ls, *rs, *fa;   } buf[1111111];   int used;   struct Splay_Tree {     Node *root, *NIL, *minf, *pinf;     Node *create_node(int first = 0) {       Node *node = &buf[used++];       node->sz = 1;       node->val = first;       node->ls = node->rs = node->fa = NIL;       return node;     }     void init() {       used = 0;       NIL = create_node(0);       NIL->sz = 0;       Node *first = create_node(-0x3f3f3f3f);       Node *second = create_node(0x3f3f3f3f);       first->rs = second;       second->fa = first;       root = first;       minf = first;       pinf = second;       update(first);     }     void update(Node *first) { first->sz = first->ls->sz + first->rs->sz + 1; }     void zig(Node *first) {       Node *second = first->rs, *p = first->fa;       first->rs = second->ls;       second->ls->fa = first;       second->ls = first;       first->fa = second;       second->fa = p;       if (p == NIL)         root = second;       else if (p->ls == first)         p->ls = second;       else         p->rs = second;       update(first);     }     void zag(Node *first) {       Node *second = first->ls, *p = first->fa;       first->ls = second->rs;       second->rs->fa = first;       second->rs = first;       first->fa = second;       second->fa = p;       if (p == NIL)         root = second;       else if (p->rs == first)         p->rs = second;       else         p->ls = second;       update(first);     }     void splay(Node *first, Node *g) {       Node *second, *z;       while (first->fa != g) {         second = first->fa;         z = second->fa;         if (z == g) {           if (first == second->rs)             zig(second);           else             zag(second);         } else if (second == z->rs) {           if (first == second->rs)             zig(z), zig(second);           else             zag(second), zig(z);         } else {           if (first == second->rs)             zig(second), zag(z);           else             zag(z), zag(second);         }       }       update(first);     }     Node *find(Node *first, int k) {       if (k <= first->ls->sz) return find(first->ls, k);       if (k == first->ls->sz + 1) return first;       return find(first->rs, k - first->ls->sz - 1);     }     Node *next(Node *first, int val) {       if (first == NIL) return first;       if (first->val > val) {         Node *ans = next(first->ls, val);         if (ans == NIL) ans = first;         return ans;       } else         return next(first->rs, val);     }     Node *prev(Node *first, int val) {       if (first == NIL) return first;       if (first->val < val) {         Node *ans = prev(first->rs, val);         if (ans == NIL) ans = first;         return ans;       } else         return prev(first->ls, val);     }     Node *insert(int val) {       Node *first = create_node(val);       Node *z = prev(root, val);       Node *second = next(root, val);       splay(z, NIL);       splay(second, z);       first->fa = second;       second->ls = first;       update(second);       update(z);       return first;     }     void removeFront(int val) {       Node *first = minf;       Node *second = next(root, val);       splay(first, NIL);       splay(second, first);       second->ls = NIL;       update(second);       update(first);     }     void removeBack(int val) {       Node *first = pinf;       Node *second = prev(root, val);       splay(first, NIL);       splay(second, first);       second->rs = NIL;       update(second);       update(first);     }     void remove(int k) {       Node *z = find(root, k), *second = find(root, k + 2);       splay(z, NIL);       splay(second, z);       second->ls = NIL;       update(second);       update(z);     }     void remove(Node *first) {       splay(first, NIL);       remove(first->ls->sz);     }     void dup(Node *first) {       if (first == NIL) return;       dup(first->ls);       printf( %d  , first->val);       dup(first->rs);     }   } tree;   int N, s1, s2;   int first[111111];   bool possible(int d) {     tree.init();     tree.insert(s1);     int cur = s2;     for (int i = 0; i < N; i++) {       if (abs(cur - first[i]) <= d) tree.insert(cur);       tree.removeFront(max(first[i] - d - 1, -0x3f3f3f3f + 1));       tree.removeBack(min(first[i] + d + 1, 0x3f3f3f3f - 1));       if (tree.root->sz == 2) {         return false;       }       cur = first[i];     }     return true;   }   int main() {     gn(N, s1, s2);     for (int i = 0; i < N; i++) gn(first[i]);     int high = 1000000000, low = abs(s1 - s2);     while (high > low + 1) {       int mid = (high + low) / 2;       if (possible(mid))         high = mid;       else         low = mid;     }     if (possible(low))       printf( %d n , low);     else       printf( %d n , high);     return 0;   }   