func_code_string: #include <bits/stdc++.h>   using namespace std;   long n, k, iters, p[10000], q[1000], rp[1000], ar[200000], ar1[20000];   long ans;   bool not_same() {     for (int i = 1; i <= n; i++)       if (ar[i] != q[i]) return true;     return false;   }   int main() {     ios_base::sync_with_stdio(0);     cin >> n >> k;     for (int i = 1; i <= n; i++) cin >> p[i];     for (int i = 1; i <= n; i++) cin >> q[i];     for (int i = 1; i <= n; i++) rp[p[i]] = i;     long tf = 0;     for (int i = 1; i <= n; i++)       if (rp[i] != p[i]) tf = 1;     ans = 0;     for (int i = 1; i <= n; i++) ar[i] = i;     iters = 0;     while (not_same()) {       ++iters;       for (int i = 1; i <= n; i++) ar1[i] = ar[p[i]];       for (int i = 1; i <= n; i++) ar[i] = ar1[i];       if (iters > k) break;     }     if (iters <= k && iters % 2 == k % 2) ans = 1;     for (int i = 1; i <= n; i++) ar[i] = i;     iters = 0;     while (not_same()) {       ++iters;       for (int i = 1; i <= n; i++) ar1[i] = ar[rp[i]];       for (int i = 1; i <= n; i++) ar[i] = ar1[i];       if (iters > k) break;     }     if (iters <= k && iters % 2 == k % 2) ans = 1;     long fl = 0;     for (int i = 1; i <= n; i++)       if (q[i] != i) fl = 1;     if (fl == 0) ans = 0;     if (tf == 0 && k > 1) ans = 0;     if (ans)       cout <<  YES  << endl;     else       cout <<  NO  << endl;     cin.get();     cin.get();     return 0;   }   