func_code_string: #include <bits/stdc++.h>   using namespace std;   const int M = 5005;   int a[M], n, dp[M], ans, mx, s[M], t[M], cnt;   bool vis[M];   struct no {     int l, r, x;   } p[M];   bool cmp(no a, no b) { return a.r != b.r ? a.r < b.r : a.l < b.l; }   int main() {     ios::sync_with_stdio(false);     cin >> n;     for (int i = 1; i <= n; i++) {       cin >> a[i];       if (!p[a[i]].l) p[a[i]].l = i;       p[a[i]].r = i;       if (s[a[i]] == 0) s[a[i]] = i;       t[a[i]] = i;       mx = max(mx, a[i]);     }     for (int i = 1; i <= n; i++) {       int l = i, r = t[a[i]];       memset(vis, 0, sizeof(vis));       bool flag = 0;       int res = 0;       for (int j = l; j <= r; j++) {         if (vis[a[j]]) continue;         if (s[a[j]] < l) {           flag = 1;           break;         }         r = max(r, t[a[j]]);         res ^= a[j];         vis[a[j]] = 1;       }       if (flag) continue;       p[++cnt] = (no){l, r, res};     }     sort(p + 1, p + cnt + 1, cmp);     for (int i = 1; i <= cnt; i++) {       for (int j = 1; j < i; j++) {         if (p[j].r < p[i].l) {           dp[i] = max(dp[i], dp[j]);         }       }       dp[i] += p[i].x;       ans = max(ans, dp[i]);     }     cout << ans << endl;     return 0;   }   