func_code_string: #include <bits/stdc++.h>   #pragma GCC optimize( Ofast ,  unroll-loops ,  omit-frame-pointer ,  inline )   #pragma GCC option( arch=native ,  tune=native ,  no-zero-upper )   #pragma GCC target( avx2 )   using namespace std;   template <typename T>   void maxtt(T& t1, T t2) {     t1 = max(t1, t2);   }   template <typename T>   void mintt(T& t1, T t2) {     t1 = min(t1, t2);   }   bool debug = 0;   int n, m, k;   int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};   string direc =  RDLU ;   const long long MOD2 = (long long)1000000007 * (long long)1000000007;   long long ln, lk, lm;   void etp(bool f = 0) {     puts(f ?  YES  :  NO );     exit(0);   }   void addmod(int& x, int y, int mod = 1000000007) {     x += y;     if (x >= mod) x -= mod;     if (x < 0) x += mod;     assert(x >= 0 && x < mod);   }   void et(int x = -1) {     printf( %d n , x);     exit(0);   }   long long fastPow(long long x, long long y, int mod = 1000000007) {     long long ans = 1;     while (y > 0) {       if (y & 1) ans = (x * ans) % mod;       x = x * x % mod;       y >>= 1;     }     return ans;   }   long long gcd1(long long x, long long y) { return y ? gcd1(y, x % y) : x; }   vector<int> sufPaliLen[(100035)];   int a[(100035)], p[(100035)], q[(100035)], pos, c[(100035)], xyx;   void add(int pos) {     sufPaliLen[pos].clear();     if (a[pos] == a[pos - 1]) sufPaliLen[pos].push_back(2);     for (int x : sufPaliLen[pos - 1]) {       if (a[pos - 1 - x] == a[pos]) sufPaliLen[pos].push_back(x + 2);     }   }   bool ckEvenPali(int l, int r) {     for (int z : sufPaliLen[r]) {       if (z == r - l + 1) return 1;     }     return 0;   }   int qy() {     int ans = xyx + c[pos];     int cur = pos;     while (p[cur] && q[pos] <= cur - p[cur] / 2) {       cur -= p[cur] / 2;       ans++;     }     return ans;   }   void fmain(int tid) {     scanf( %d , &n);     q[0] = 1;     for (int(i) = 1; (i) <= (int)(n); (i)++) {       pos++;       scanf( %d , a + pos);       bool fg = 0;       add(pos);       if (!sufPaliLen[pos].empty()) {         int len = sufPaliLen[pos][0];         if (ckEvenPali(pos - len / 2 - len + 1, pos - len / 2)) {           pos -= len;           xyx += 2;           fg = 1;         }       }       if (!fg) {         p[pos] = sufPaliLen[pos].empty() ? 0 : sufPaliLen[pos][0];         q[pos] = q[pos - 1];         c[pos] = c[pos - 1];         if (ckEvenPali(q[pos], pos)) {           q[pos] += (pos - q[pos] + 1) / 2;           c[pos]++;         }       }       printf( %d  , qy());     }   }   int main() {     int t = 1;     for (int(i) = 1; (i) <= (int)(t); (i)++) {       fmain(i);     }     return 0;   }   