func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long INF = (long long)2e18;   const int N = 1005;   char s[N];   int lcp[N][N];   vector<pair<int, int>> segs;   bool cmp(pair<int, int> a, pair<int, int> b) {     int alen = a.second - a.first;     int blen = b.second - b.first;     int clen = min(alen, blen);     int com = lcp[a.first][b.first];     if (com < clen) return s[a.first + com] < s[b.first + com];     return alen < blen;   }   int n, m;   int mn[N];   long long dp[N][N];   void sadd(long long &a, long long b) {     a += b;     if (a >= INF) a = INF;   }   long long getCntGEQ(int id) {     for (int i = 0; i < n; i++) mn[i] = n + 1;     for (int i = id; i < (int)segs.size(); i++)       mn[segs[i].first] = min(mn[segs[i].first], segs[i].second);     memset(dp, 0, sizeof dp);     dp[0][0] = 1;     for (int i = 0; i < n; i++)       for (int j = 0; j <= m; j++) {         long long cur = dp[i][j];         if (i != 0) sadd(dp[i + 1][j], cur);         sadd(dp[mn[i]][j + 1], cur);       }     return dp[n][m];   }   void printStr(pair<int, int> p) {     int l = p.first, r = p.second;     for (int i = l; i < r; i++) printf( %c , s[i]);     printf(  n );   }   int main(int, char **) {     long long k;     scanf( %d%d%lld , &n, &m, &k);     scanf( %s , s);     for (int i = n - 1; i >= 0; i--)       for (int j = n - 1; j >= 0; j--)         if (s[i] == s[j]) lcp[i][j] = 1 + lcp[i + 1][j + 1];     for (int i = 0; i < n; i++)       for (int j = i + 1; j <= n; j++) segs.emplace_back(i, j);     sort(segs.begin(), segs.end(), cmp);     int lb = -1, rb = (int)segs.size();     while (rb - lb > 1) {       int mb = (lb + rb) / 2;       long long cur = getCntGEQ(mb);       if (cur >= k)         lb = mb;       else         rb = mb;     }     printStr(segs[lb]);     return 0;   }   