func_code_string: #include <bits/stdc++.h>   #pragma warning(disable : 4996)   #pragma comment(linker,  /STACK:336777216 )   using namespace std;   int IT_MAX = 1 << 17;   const long long MOD = 1000000009;   const int INF = 0x3f3f3f3f;   const long long LL_INF = 0x3f3f3f3f3f3f3f3f;   const double PI = acos(-1);   const double ERR = 1e-8;   vector<pair<long long, long long> > Vu;   int main() {     int N, K, M, i, j;     scanf( %d %d %d , &N, &K, &M);     for (i = 1; i <= N; i++) {       int t;       scanf( %d , &t);       if (!Vu.empty() && Vu.back().first == t) {         Vu.back().second++;         if (Vu.back().second == K) Vu.pop_back();       } else         Vu.emplace_back(t, 1);     }     long long s = 0;     for (auto it : Vu) s += it.second;     if (M == 1 || s == 0) return !printf( %lld n , s);     s *= M;     int st = 0, en = (int)Vu.size() - 1;     while (st < en) {       if (Vu[st].first != Vu[en].first) return !printf( %lld n , s);       if (Vu[st].second + Vu[en].second == K) {         s -= (long long)(M - 1) * K;         st++, en--;         continue;       }       if (Vu[st].second + Vu[en].second > K) s -= (long long)(M - 1) * K;       return !printf( %lld n , s);     }     long long x = Vu[st].second * M;     if (x % K == 0) {       return !printf( 0 n );     } else {       return !printf( %lld n , s - (x / K) * K);     }     return 0;   }   