func_code_string: #include <bits/stdc++.h>   using namespace std;   int a[100005], lg[100005];   int rmq[100005][20];   struct trie {     struct node {       node *edge[2];       vector<int> ps[2];       node() {         for (int i = 0; i < 2; i++) edge[i] = 0;         ps[0].clear();         ps[1].clear();       }     } * root;     trie() { root = new node(); }     void insert(int v, int p) {       node *t = root;       for (int po = 29; po >= 0; po--) {         int x = (bool)(v & (1 << po));         if (!t->edge[x]) t->edge[x] = new node();         t->ps[x].push_back(p);         t = t->edge[x];       }     }     void remove(int v) {       node *t = root;       for (int po = 29; po >= 0; po--) {         int x = (bool)(v & (1 << po));         t->ps[x].pop_back();         t = t->edge[x];       }     }     long long query(int v, int last) {       node *t = root;       int res = 0;       for (int po = 29; po >= 0; po--) {         int x = (bool)(v & (1 << po));         x = !x;         if (!t->ps[x].empty() && t->ps[x].back() > last) {           res += (1 << po);           t = t->edge[x];         } else           t = t->edge[!x];       }       return res;     }   };   int q(int l, int r) {     if (l > r) swap(l, r);     int po = lg[r - l + 1];     return max(rmq[l][po], rmq[r - (1 << po) + 1][po]);   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     lg[0] = -1;     for (int i = 1; i < 100005; i++) lg[i] = lg[i - 1] + !(i & (i - 1));     int n;     cin >> n;     for (int i = 0; i < n; i++) cin >> a[i];     for (int i = 0; i < n; i++) rmq[i][0] = a[i];     for (int i = 1; i <= lg[n]; i++)       for (int j = 0; j + (1 << i) <= n; j++)         rmq[j][i] = max(rmq[j][i - 1], rmq[j + (1 << (i - 1))][i - 1]);     long long res = 0;     trie t;     t.insert(a[0], 0);     stack<pair<long long, long long> > ms;     ms.push(pair<long long, long long>(a[0], 0));     for (int i = 1; i < n; i++) {       int p1 = -1;       for (int po = (1 << 17); po; po >>= 1)         if (p1 + po < i && q(p1 + po, i) > a[i]) p1 += po;       int p2 = -1;       if (p1 > 0)         for (int po = (1 << 17); po; po >>= 1)           if (p2 + po <= p1 - 1 && q(p2 + po, p1 - 1) > a[i]) p2 += po;       res = max(res, t.query(a[i], p2));       while (!ms.empty() && ms.top().second > p1) {         t.remove(ms.top().first);         ms.pop();       }       t.insert(a[i], i);       ms.push(pair<long long, long long>(a[i], i));     }     cout << (res) <<   n ;     return 0;   }   