func_code_string: #include <bits/stdc++.h>   using namespace std;   const int INF = 1000000007;   const long long MOD = 1000000007;   void solve_test() {     int n;     cin >> n;     vector<int> arr(n);     vector<int> ct(101);     for (int i = 0; i < n; i++) {       cin >> arr[i];       ct[arr[i]]++;     }     int max_val = -1;     int max_freq = -1;     for (int i = 1; i <= 100; i++) {       if (ct[i] > max_freq) {         max_freq = ct[i];         max_val = i;       }     }     unordered_map<int, int> um;     int ans = 0;     for (int i = 1; i <= 100; i++) {       if (max_val == i) continue;       um.clear();       int st = 0;       um[0] = -1;       for (int j = 0; j < n; j++) {         if (arr[j] == i) {           st++;         } else if (arr[j] == max_val) {           st--;         }         if (um.find(st) == um.end()) {           um[st] = j;         } else {           ans = max(ans, j - um[st]);         }       }     }     cout << ans;   }   signed main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     int tests;     tests = 1;     while (tests--) {       solve_test();     }     return 0;   }   