func_code_string: #include <bits/stdc++.h>   using namespace std;   vector<string> vec_splitter(string s) {     for (char& c : s) c = c ==  ,  ?     : c;     stringstream ss;     ss << s;     vector<string> res;     for (string z; ss >> z; res.push_back(z))       ;     return res;   }   void debug_out(vector<string> args, int idx) { cerr << endl; }   template <typename Head, typename... Tail>   void debug_out(vector<string> args, int idx, Head H, Tail... T) {     if (idx > 0) cerr <<  ,  ;     stringstream ss;     ss << H;     cerr << args[idx] <<   =   << ss.str();     debug_out(args, idx + 1, T...);   }   void localTest() {}   const long long N = 2e5 + 5, MOD = 998244353;   long long A[N], fac[N], ifac[N];   long long power(long long a, long long b, long long c) {     long long ret = 1;     while (b) {       if (b & 1) {         ret = (ret * a) % c;       }       b >>= 1;       a = (a * a) % c;     }     return ret;   }   long long C(long long n, long long r) {     if (n < r) {       return 0;     }     long long ret = fac[n];     ret = (ret * ifac[r]) % MOD;     ret = (ret * ifac[n - r]) % MOD;     return ret;   }   int main() {     localTest();     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     fac[0] = ifac[0] = 1;     for (long long i = 1; i < N; ++i) {       fac[i] = (i * fac[i - 1]) % MOD;       ifac[i] = power(fac[i], MOD - 2, MOD);     }     long long n, k;     cin >> n >> k;     for (long long i = 1; i <= n; ++i) {       cin >> A[i];     }     if (k == 1) {       cout <<  0 n ;       return 0;     }     long long ans = power(k, n, MOD), val = 0, fixed = 0, move = n, sum = 0;     for (long long i = 1; i <= n; ++i) {       if (A[i] == A[i % n + 1]) {         fixed++;         move--;       }     }     val = power(k, fixed, MOD);     for (long long i = 0; i <= move / 2; ++i) {       long long mul = C(move, i) * C(move - i, i) % MOD;       mul = (mul * power(k - 2, move - 2 * i, MOD)) % MOD;       sum += mul;       sum %= MOD;     }     val = (val * sum) % MOD;     ans = (ans - val + MOD) % MOD;     ans = (ans * power(2, MOD - 2, MOD)) % MOD;     cout << ans <<   n ;     return 0;   }   