func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 105;   int Q[N], S[N], ok[N + N], Sav[N], mat[N + N][N];   int dp[N + N][N];   int solve(int p, int k) {     if (ok[p]) return k == 0;     if (!k) return 0;     if (dp[p][k] != -1) return dp[p][k];     return dp[p][k] = solve(p - 1, k - 1) | solve(p + 1, k - 1);   }   int main() {     int n, k;     cin >> n >> k;     for (int i = 1; i <= n; i++) cin >> Q[i], Sav[Q[i]] = i, mat[100][i] = i;     for (int i = 1; i <= n; i++) cin >> S[i];     for (int i = 99; i >= 0; i--)       for (int j = 1; j <= n; j++) mat[i][j] = mat[i + 1][Sav[j]];     for (int i = 101; i <= 200; i++)       for (int j = 1; j <= n; j++) mat[i][j] = mat[i - 1][Q[j]];     for (int i = 0; i <= 200; i++) {       ok[i] = 1;       for (int j = 1; j <= n; j++) ok[i] &= mat[i][j] == S[j];     }     memset(dp, -1, sizeof(dp));     puts(solve(100, k) ?  YES  :  NO );     return 0;   }   