func_code_string: #include <bits/stdc++.h>   using namespace std;   vector<int> q, s;   int n, k;   vector<int> apply(vector<int> &a, vector<int> q) {     vector<int> res(n);     for (int i = 0; i < n; i++) {       res[i] = a[q[i]];     }     return res;   }   vector<int> rev_apply(const vector<int> &a, vector<int> &q) {     vector<int> res(n);     for (int i = 0; i < n; i++) {       res[q[i]] = a[i];     }     return res;   }   int main() {     cin >> n >> k;     q = vector<int>(n);     s = vector<int>(n);     for (int i = 0; i < n; i++) {       cin >> q[i];       q[i]--;     }     for (int i = 0; i < n; i++) {       cin >> s[i];       s[i]--;     }     vector<int> a(n), b, c;     for (int i = 0; i < n; i++) {       a[i] = i;     }     if (a == s) {       cout <<  NO  << endl;       return 0;     }     b = apply(a, q);     c = rev_apply(a, q);     if (b == s && c == s) {       if (k == 1) {         cout <<  YES  << endl;       } else {         cout <<  NO  << endl;       }       return 0;     }     b = a;     c = a;     int min_b = -1, min_c = -1;     for (int i = 0; i < k; i++) {       b = apply(b, q);       c = rev_apply(c, q);       if (b == s && min_b == -1) {         min_b = i + 1;       }       if (c == s && min_c == -1) {         min_c = i + 1;       }     }     if (min_b >= 0 && min_b % 2 == k % 2) {       cout <<  YES  << endl;       return 0;     }     if (min_c >= 0 && min_c % 2 == k % 2) {       cout <<  YES  << endl;       return 0;     }     cout <<  NO  << endl;     return 0;   }   