func_code_string: #include <bits/stdc++.h>   using namespace std;   int gcd(int a, int b) {     while (b) {       int r = a % b;       a = b;       b = r;     }     return a;   }   int64_t lcm(int a, int b) { return 1LL * a * b / gcd(a, b); }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(nullptr);     int n;     cin >> n;     vector<int> next(n + 1);     for (int i = 1; i <= n; i++) cin >> next[i];     int64_t ans = 1;     vector<bool> cycle(n + 1);     for (int i = 1; i <= n; i++)       if (!cycle[i]) {         int node = i;         vector<int> vis(n + 1);         for (int j = 0; j < n + 1; j++) {           vis[node]++;           node = next[node];         }         if (vis[i] >= 2) {           int len = 0, node = i;           while (!cycle[node]) {             len++;             cycle[node] = true;             node = next[node];           }           ans = lcm(ans, len);         }       }     int mx = 0;     for (int i = 1; i <= n; i++)       if (!cycle[i]) {         int dist = 0, node = i;         while (!cycle[node]) {           dist++;           node = next[node];         }         mx = max(mx, dist);       }     int it = 1;     while (it * ans < mx) it++;     cout << it * ans <<   n ;     return 0;   }   