func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MX = 200005;   const int MD = 998244353;   void add(int& a, int b) {     a += b;     if (a >= MD) a -= MD;   }   void sub(int& a, int b) {     a -= b;     if (a < 0) a += MD;   }   int mod_mult(long long a, long long b) { return (a * b) % MD; }   int h[MX];   int fact[MX];   int inv_fact[MX];   int exp(int a, int b) {     int res = 1;     while (b) {       if (b % 2 == 1) res = mod_mult(res, a);       a = mod_mult(a, a);       b /= 2;     }     return res;   }   int C(int n, int k) {     int tmp = fact[n];     tmp = mod_mult(tmp, inv_fact[k]);     tmp = mod_mult(tmp, inv_fact[n - k]);     return tmp;   }   int f(int x) {     int tmp = exp(2, x);     if (x % 2 == 0) {       sub(tmp, C(x, x / 2));     }     tmp = mod_mult(tmp, inv_fact[2]);     return tmp;   }   int main() {     fact[0] = 1;     for (int i = 1; i < MX; i++) {       fact[i] = mod_mult(fact[i - 1], i);     }     inv_fact[MX - 1] = exp(fact[MX - 1], MD - 2);     for (int i = MX - 2; i >= 0; i--) {       inv_fact[i] = mod_mult(inv_fact[i + 1], i + 1);     }     int n, k;     ignore = scanf( %d %d , &n, &k);     for (int i = 0; i < n; i++) {       ignore = scanf( %d , h + i);     }     int mult_at_end = 1;     int B = 0;     for (int i = 0; i < n; i++) {       if (h[i] == h[(i + 1) % n]) {         mult_at_end = mod_mult(mult_at_end, k);       } else {         B++;       }     }     int ans = 0;     for (int c = 0; c <= B; c++) {       int tmp = exp(k - 2, c);       tmp = mod_mult(tmp, C(B, c));       tmp = mod_mult(tmp, f(B - c));       add(ans, tmp);     }     ans = mod_mult(ans, mult_at_end);     printf( %d n , ans);   }   