func_code_string: #include <bits/stdc++.h>   using namespace std;   template <typename Tp>   inline void outarr(Tp _begin, Tp _end, const char* _delim =    ) {     for (Tp current = _begin; current != _end; ++current) {       std::cout << *current << _delim;     }     std::cout <<   n ;   }   using ll = long long;   using pii = std::pair<int, int>;   constexpr int INF = 0x3f3f3f3f;   constexpr int MOD = static_cast<const int>(1e9 + 7);   constexpr int g_mod = 998244353;   int arr[200000];   int fact[200001];   int ifact[200001];   int Add(int x, int y) {     x += y;     return x < g_mod ? x : x - g_mod;   }   int Sub(int x, int y) {     x -= y;     return x >= 0 ? x : x + g_mod;   }   int Mul(int x, int y) { return int(1LL * x * y % g_mod); }   int FastPow(int x, int p) {     int res = 1;     while (p > 0) {       if (p & 1) {         res = Mul(res, x);       }       p >>= 1;       x = Mul(x, x);     }     return res;   }   int Inv(int x) { return FastPow(x, g_mod - 2); }   void Init(int n) {     fact[0] = 1;     for (int i = 1; i <= n; ++i) {       fact[i] = Mul(i, fact[i - 1]);     }     ifact[n] = Inv(fact[n]);     for (int i = n - 1; i >= 0; --i) {       ifact[i] = Mul(i + 1, ifact[i + 1]);     }   }   int C(int k, int n) { return Mul(fact[n], Mul(ifact[k], ifact[n - k])); }   int Func(int len) {     if (len & 1) {       return 0;     }     return C(len >> 1, len);   }   int main() {     std::ios_base::sync_with_stdio(false);     std::cin.tie(nullptr);     int n, k;     cin >> n >> k;     Init(n);     for (int i = 0; i < (n); ++i) {       cin >> arr[i];     }     int len = distance(arr, unique(arr, arr + n));     if (arr[0] == arr[len - 1]) {       --len;     }     if (len == 0) {       return cout << (0) <<   n , 0;       ;     }     const int inv2 = Inv(2);     int k2 = (k - 2) % g_mod;     int ans = 0;     for (int i = 0; i < (len); ++i) {       int cur =           Mul(Sub(FastPow(2, len - i - 1), Mul(Func(len - i), inv2)), C(i, len));       ans = Add(ans, Mul(FastPow(k2, i), cur));     }     ans = Mul(ans, FastPow(k % g_mod, n - len));     cout << ans <<   n ;     return 0;   }   