func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MAXN = 1007;   long long lcp[MAXN][MAXN];   string s;   bool cmp(pair<long long, long long> a, pair<long long, long long> b) {     long long l = lcp[a.second][b.second];     long long al = a.second - a.first + 1;     long long bl = b.second - b.first + 1;     l = min(l, al);     l = min(l, bl);     if (al == l && bl == l)       return 0;     else if (al == l)       return 1;     else if (bl == l)       return 0;     else       return s[a.second - l] < s[b.second - l];   }   vector<pair<long long, long long>> subs;   long long n, m, k;   long long dp[2][MAXN];   long long add(long long a, long long b) {     return min(a + b, (long long)2e18 + 100);   }   long long f(long long num) {     long long l = subs[num].first;     long long r = subs[num].second;     long long len = r - l + 1;     auto lim = subs[num];     fill(dp[0], dp[0] + n + 1, 0);     dp[0][0] = 1;     for (long long c = 1; c <= m; ++c) {       long long* pdp = dp[c & 1 ^ 1];       long long* cdp = dp[c & 1];       fill(cdp, cdp + n + 1, 0);       for (long long i = 1; i <= n; ++i) pdp[i] = add(pdp[i], pdp[i - 1]);       for (long long i = 1; i <= n; ++i) {         long long first = min(lcp[i][r], len);         if (first == i)           cdp[i] = (c == 1 && first == len);         else if (first == len)           cdp[i] = pdp[i - max(1ll, first)];         else if (s[r - first] < s[i - first])           cdp[i] = pdp[i - first - 1];       }     }     return dp[m & 1][n];   }   void solve() {     cin >> n >> m >> k;     cin >> s;     s +=  # ;     reverse(s.begin(), s.end());     for (long long i = 0; i <= n; ++i)       for (long long j = 0; j <= n; ++j)         if (i && j) lcp[i][j] = (s[i] == s[j] ? lcp[i - 1][j - 1] + 1 : 0);     for (long long i = 1; i <= n; ++i)       for (long long j = i; j <= n; ++j) subs.push_back({i, j});     sort(subs.begin(), subs.end(), cmp);     reverse(subs.begin(), subs.end());     long long l = -1, r = subs.size();     while (r - l > 1) {       long long m = (l + r) / 2;       if (f(m) >= k)         r = m;       else         l = m;     }     auto p = subs[r];     for (long long i = p.second; i >= p.first; --i) cout << s[i];     cout <<   n ;     return;   }   signed main() {     ios_base::sync_with_stdio(false);     solve();     return 0;   }   