func_code_string: #include <bits/stdc++.h>   using namespace std;   const int mod = 1e9 + 7;   const int N = 1e6 + 7;   const int mxn = 3e5 + 9;   inline long long in() {     long long _;     scanf( %lld , &_);     return _;   }   int n, m, k;   struct node {     int len;     int link;     int firstpos;     map<char, int> nxt;     void clr() {       len = link = firstpos = 0;       nxt.clear();     }     void print() {       cerr << __FUNCTION__ <<     << 50 <<  ..  ,           cerr <<  len                 <<   =   << len,           cerr <<   ,  ,           cerr <<  link                 <<   =   << link,           cerr <<   ,  ,           cerr <<  firstpos                 <<   =   << firstpos,           cerr << endl;       for (auto z : nxt) {         cerr << z.first <<     << z.second << endl;       }     }   };   node t[mxn];   int sz, last;   void init() {     sz = last = 0;     t[0].len = 0;     t[0].firstpos = 0;     t[0].link = -1;     sz++;   }   long long cnt[mxn];   set<pair<int, int> > nodes;   void add_letter(char ch) {     int cur = sz++;     t[cur].len = t[last].len + 1;     t[cur].firstpos = t[cur].len;     cnt[cur] = 1;     nodes.insert(make_pair(t[cur].len, cur));     int p;     for (p = last; p != -1 && !t[p].nxt.count(ch); p = t[p].link)       t[p].nxt[ch] = cur;     if (p == -1)       t[cur].link = 0;     else {       int q = t[p].nxt[ch];       if (t[p].len + 1 == t[q].len)         t[cur].link = q;       else {         int clone = sz++;         t[clone].len = t[p].len + 1;         t[clone].nxt = t[q].nxt;         t[clone].link = t[q].link;         t[clone].firstpos = t[q].firstpos;         cnt[clone] = 0;         nodes.insert(make_pair(t[clone].len, clone));         for (; p != -1 && t[p].nxt[ch] == q; p = t[p].link) t[p].nxt[ch] = clone;         t[q].link = t[cur].link = clone;       }     }     last = cur;   }   string ans =   ;   void kth(int cur) {     if (k <= 0) return;     for (auto x : t[cur].nxt) {       k -= cnt[x.second];       kth(x.second);       if (k <= 0) {         ans += x.first;         return;       }     }   }   void CLR() {     for (int i = 0; i < sz; i++) {       t[i].clr();       cnt[i] = 0;     }     sz = last = 0;     nodes.clear();   }   char s[mxn];   int main() {     int tc = 1;     while (tc--) {       scanf( %s , s);       k = in();       init();       n = strlen(s);       if (1LL * n * (n + 1) < k * 2) {         printf( No such line. n );         continue;       }       for (int i = 0; i < n; i++) add_letter(s[i]);       for (set<pair<int, int> >::reverse_iterator it = nodes.rbegin();            it != nodes.rend(); it++) {         int x = (*it).second;         cnt[t[x].link] += cnt[x];       }       ans =   ;       kth(0);       reverse(ans.begin(), ans.end());       printf( %s n , ans.c_str());       if (tc) CLR();     }     return 0;   }   