func_code_string: #include <bits/stdc++.h>   using namespace std;   int n;   int A[200005];   vector<int> L[105];   int dp[400005];   int main() {     scanf( %d , &n);     for (int i = 1; i <= n; i++) {       scanf( %d , &A[i]);       L[A[i]].push_back(i);     }     int opt = 0;     int D = 0;     int N = min(n, 100);     for (int i = 1; i <= N; i++) {       if (L[i].size() > L[D].size()) D = i;     }     memset(dp, -1, sizeof(dp));     for (int V = 1; V <= N; V++) {       if (V == D) continue;       if (L[V].empty()) continue;       int bal = 0;       vector<int> T;       T.push_back(bal);       dp[bal + n] = 0;       for (int i = 1; i <= n; i++) {         if (A[i] == D)           bal++;         else if (A[i] == V)           bal--;         if (dp[bal + n] != -1) {           if (i - dp[bal + n] > opt) opt = i - dp[bal + n];         }         if (dp[bal + n] == -1) {           dp[bal + n] = i;           T.push_back(bal);         }       }       for (int v : T) {         dp[v + n] = -1;       }     }     printf( %d n , opt);     return 0;   }   