func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long LINF = 1e18;   const long long MOD = 1e9 + 7;   const int INF = 0x3f3f3f3f;   const int MAXN = 200050;   int a[MAXN], cnt[105];   unordered_map<int, int> mp;   void solve(int T) {     int n;     scanf( %d , &n);     for (int i = 1; i <= n; i++) {       scanf( %d , &a[i]);       cnt[a[i]]++;     }     int maxx = 0, idx;     for (int i = 1; i <= 100; i++) {       if (cnt[i] > maxx) {         maxx = cnt[i];         idx = i;       }     }     int tmp = 0;     for (int i = 1; i <= 100; i++) {       if (cnt[i] == maxx) tmp++;     }     if (tmp >= 2) {       printf( %d n , n);       return;     }     int ans = 0;     for (int i = 1; i <= 100; i++) {       if (i == idx) continue;       mp.clear();       mp[idx] = 0;       int sum = 0;       for (int j = 1; j <= n; j++) {         if (a[j] == idx)           sum++;         else if (a[j] == i)           sum--;         if (sum == 0)           ans = max(ans, j);         else if (mp[sum]) {           ans = max(ans, j - mp[sum]);         } else           mp[sum] = j;       }     }     printf( %d , ans);   }   signed main() {     int t = 1;     for (int i = 1; i <= t; i++) {       solve(i);     }   }   