func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long mod = 998244353;   const long long maxn = 2001;   long long h[maxn], dp[maxn][2 * maxn];   signed main() {     long long n, k;     scanf( %lld%lld , &n, &k);     for (long long i = 1; i <= n; i++) scanf( %lld , &h[i]);     dp[0][2001] = 1;     for (long long i = 1; i <= n; i++) {       for (long long j = 1; j < 2 * maxn; j++)         if (h[i] == h[i % n + 1])           dp[i][j] = k * dp[i - 1][j] % mod;         else           dp[i][j] = (dp[i - 1][j + 1] + dp[i - 1][j - 1] +                       (k - 2) * dp[i - 1][j] % mod) %                      mod;     }     long long ans = 0;     for (long long i = 1; i < maxn; i++) ans = (ans + dp[n][maxn + i]) % mod;     printf( %lld n , ans);   }   