criyle/codenet-compile-errors huggingface dataset:
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

#define TR(container, it) \
        for (auto it = container.begin(); it != container.end(); it++)
#define IN(c, x) ((c).find(x) != (c).end())   //O(log n)
#define IN_L(c, x) (find((c).begin(),(c).end(),x) != (c).end()) //O(n)
#define PLL pair<ll,ll>
#define PII pair<int,int>
#define VI vector<int>
#define VVI vector<vector<int>>
#define FOR(i, _begin, _end) for (__typeof(_end) end = _end, begin = _begin,  i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define REP(i, end) for (__typeof(end) i = 0, _len = (end); i < (_len); i += 1)
#define ALL(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define F first
#define S second
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define MOD(x, m) ((((x) % (m)) + (m)) % (m))
#define BIT(n) (1LL<<(n))
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define READ ({int t;cin >> t;t;})
#define EB emplace_back
#define fcout cout << fixed << setprecision(12)
#define fcerr cerr << fixed << setprecision(12)

#ifdef DEBUG
#define ERR(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); _err(cerr,_it, args); }
#define DBG(x) cerr << #x << " is " << x << endl;
#else
#define DBG(x) {}
#define ERR(args...) {}
#endif
void _err(std::ostream& cerr,istream_iterator<string> it) {cerr << endl;}
template<typename T, typename... Args>
void _err(std::ostream& cerr, istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << ", ";
    _err(cerr,++it, args...);
}

const double pi = 2 * acos(.0);
const int inf = 0x3f3f3f3f;
const ll mod = (ll) (1e9) + 7;
//const ll mod = (ll) 998244353 ;
const double eps = 1e-10;

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
    std::fill((T *) array, (T *) (array + N), val);
}

template <typename T>
ostream& operator << (ostream& os, const vector<T> V) {
    for(auto v : V)os << v << " ";
    return os;
}

template <typename T>
ostream& operator << (ostream& os, const set<T> V) {
    for(auto v : V)os << v << " ";
    return os;
}

template <typename T>
ostream& operator << (ostream& os, const deque<T> V) {
    for(auto v : V)os << v << " ";
    return os;
}

template<class T>bool Chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool Chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

//#define int ll

class CKThSubstring {
public:
    string s;
    int k;


void solve(std::istream& cin, std::ostream& cout, std::ostream& cerr) {
    cin >> s >> k;
//    auto cmp = [](string s1, string s2){return lexicographical_compare(ALL(s1), ALL(s2));};
    set<string> vs;
    int N = SZ(s);
    REP(i,5)REP(j,N-i)vs.insert(s.substr(j, i+1));
    for(auto s : vs)ERR(s)
    cout << *next(vs.begin(), k-1) << endl;
}


};


Compiler output:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
char s[5050];
map<char,int> trie[505050];
int n,cnt;
stack<char> st;
bool f(int cur){
    if(!n--) return true;
    for(int i=0;i<=256;i++){
        if(trie[cur].count(i)){
            if(f(trie[cur][i])){
                st.push(i);
                return true;
            }
        }
    }
    return false;
}
int main(){
    scanf("%s %d",s,&n);
    for(int i=0;s[i];i++){
        int cur = 0;
        for(int j=i;j<i+k && s[j];j++){
            if(!trie[cur][s[j]]) trie[cur][s[j]] = ++cnt;
            cur = trie[cur][s[j]];
        }
    }
    f(0);
    while(!st.empty()){
        printf("%c",st.top());
        st.pop();
    }
    puts("");
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:25: error: 'k' was not declared in this scope
   24 |         for(int j=i;j<i+k && s[j];j++){
      |                         ^
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <utility>
#include <tuple>
#include <string>
#include <cctype>
#include <cstdio>
#include <math.h>
using f32 = float;
using f64 = double;
using f80 = __float80;
using namespace std;
using LL = long long;
using ULL = unsigned long long;
using vi = vector<int>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvi = vector<vi>;
using vs = vector<string>;
using vl = vector<LL>;
using vvl = vector<vl>;
using P = pair<int, int>;
using T = tuple<int, int, int>;
using vp = vector<P>;
#define REP(i, n) for (LL i = 0; i < (int)(n); i++)
#define FOR(i, m, n) for (LL i = m; i < n; i++)
#define SORT(x) sort(x.begin(), x.end())
#define REVE(x) reverse(x.begin(), x.end())
#define all(x) (x).begin(), (x).end()
#define fst first
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define pob pop_back
#define sw swap
#define UP(x) transform(x.begin(), x.end(), x.begin(), ::toupper);
#define LOW(x) transform(x.begin(), x.end(), x.begin(), ::tolower);
struct initon
{
    initon()
    {
        cin.tie(0);
        ios::sync_with_stdio(false);
    };
};
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return 1;
    }
    return 0;
}
int main()
{
    int K;
    string S,SAVE;
    vector<string> a;
  
    cin >> S >> K;
    J=S.size();
   if(1<J){
  for(int i=0;i<J;i++)
    {
       SAVE=S[i];
      a.pb(SAVE);
        for(int j = i+1;j<min(i+6,J);j++)
        {
            SAVE += S[j];
            a.pb(SAVE);
        }
    }
    SORT(a);
a.erase(std::unique(a.begin(), a.end()), a.end());
cout << a[K-1];
   }else{
   cout <<S;
   }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:76:5: error: 'J' was not declared in this scope
   76 |     J=S.size();
      |     ^
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <utility>
#include <tuple>
#include <string>
#include <cctype>
#include <cstdio>
#include <math.h>
using f32 = float;
using f64 = double;
using f80 = __float80;
using namespace std;
using LL = long long;
using ULL = unsigned long long;
using vi = vector<int>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvi = vector<vi>;
using vs = vector<string>;
using vl = vector<LL>;
using vvl = vector<vl>;
using P = pair<int, int>;
using T = tuple<int, int, int>;
using vp = vector<P>;
#define REP(i, n) for (LL i = 0; i < (int)(n); i++)
#define FOR(i, m, n) for (LL i = m; i < n; i++)
#define SORT(x) sort(x.begin(), x.end())
#define REVE(x) reverse(x.begin(), x.end())
#define all(x) (x).begin(), (x).end()
#define fst first
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define pob pop_back
#define sw swap
#define UP(x) transform(x.begin(), x.end(), x.begin(), ::toupper);
#define LOW(x) transform(x.begin(), x.end(), x.begin(), ::tolower);
struct initon
{
    initon()
    {
        cin.tie(0);
        ios::sync_with_stdio(false);
    };
};
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return 1;
    }
    return 0;
}
int main()
{
    int K;
    string S,SAVE;
    vector<string> a;
  
    cin >> S >> K;
    J=S.size();
   if(1<J){
  for(int i=0;i<J;i++)
    {
       SAVE=S[i];
      a.pb(SAVE);
        for(int j = i+1;j<min(i+1,J);j++)
        {
            SAVE += S[j];
            a.pb(SAVE);
        }
    }
    SORT(a);
a.erase(std::unique(a.begin(), a.end()), a.end());
cout << a[K-1];
   }else{
   cout <<S;
   }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:76:5: error: 'J' was not declared in this scope
   76 |     J=S.size();
      |     ^
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <utility>
#include <tuple>
#include <string>
#include <cctype>
#include <cstdio>
#include <math.h>
using f32 = float;
using f64 = double;
using f80 = __float80;
using namespace std;
using LL = long long;
using ULL = unsigned long long;
using vi = vector<int>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvi = vector<vi>;
using vs = vector<string>;
using vl = vector<LL>;
using vvl = vector<vl>;
using P = pair<int, int>;
using T = tuple<int, int, int>;
using vp = vector<P>;
#define REP(i, n) for (LL i = 0; i < (int)(n); i++)
#define FOR(i, m, n) for (LL i = m; i < n; i++)
#define SORT(x) sort(x.begin(), x.end())
#define REVE(x) reverse(x.begin(), x.end())
#define all(x) (x).begin(), (x).end()
#define fst first
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define pob pop_back
#define sw swap
#define UP(x) transform(x.begin(), x.end(), x.begin(), ::toupper);
#define LOW(x) transform(x.begin(), x.end(), x.begin(), ::tolower);
struct initon
{
    initon()
    {
        cin.tie(0);
        ios::sync_with_stdio(false);
    };
};
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return 1;
    }
    return 0;
}
int main()
{
    int K;
    string S,SAVE;
    vector<string> a;
    cin >> S >> K;
    for(int i;i<S.size();i++)
    {
        SAVE = S[i];
        for(int j = i+1;j<S.size();j++)
        {
            SAVE += S[j];
            a.PB(SAVE);
        }
    }
    SORT(a);
    cout << a[K];
}

Compiler output:
a.cc: In function 'int main()':
a.cc:81:15: error: 'class std::vector<std::__cxx11::basic_string<char> >' has no member named 'PB'
   81 |             a.PB(SAVE);
      |               ^~
Language: C++

#include <iostream>
#include <vector>
#include <cstring>
#include <algorithm> // sort

#define REP(i, n) for (long long i = 0; i < (n); i++) 
typedef long long ll;
const ll INF = 1000000000000007;

using namespace std;

int main(){
    string S,res = "";
    cin >> S;
    ll K;
    cin >> K;
    ll kazu;

    ll S_Size = S.Size();
    if(S_Size % 2 == 1)
    {
      kazu = S_Size * (S_Size/2 + 1);
    }
    else
    {
      kazu = (S_Size+1) * S_Size/2;
    }

    vector <string> v(kazu);

    ll cnt = 0;

    for(ll i = 1; i <= S_Size; i++)
    {
      for(ll j = 0; j + i <= S_Size; j++)
      {
        v[cnt] = S.substr(j, i);
        cnt++;
      }
    }

    sort(v.begin(),v.end());

    cnt = 0;
    string b4t = "";
    // find K
    for(auto t:v)
    {
      if(b4t == t)continue;
      cnt++;
      b4t = t;
      if(cnt == K)
      {
        res = t;
        break;
      }
    }
    cout << res << endl;

    return 0;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:19: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'Size'; did you mean 'size'?
   19 |     ll S_Size = S.Size();
      |                   ^~~~
      |                   size
Language: C++

#include<bits/stdc++.h>
using namespace std;

int main(){
  string s;
  cin>>s;
 int K,u,c;
  N=s.size();
  cin>>K;
  vector<string>S(20000)
    for(int i=0;i<N-4;i++){
      S[i]=s[i]+s[i+1]+s[i+2]+s[i+3]+s[i+4];
      u=i;
    }
      for(int i=u;i<u+N-3;i++){
      S[i]=s[i-u]+s[i-u+1]+s[i-u+2]+s[i-u+3];
      c=i;
    }
        for(int i=c;i<c+N-2;i++){
      S[i]=s[i-c]+s[i-c+1]+s[i-c+2];
      u=i;
    }
        for(int i=u;i<u+N-1;i++){
      S[i]=s[i-u]+s[i-u+1];
      c=i;
    }
          for(int i=c;i<c+N-2;i++){
      S[i]=s[i-c];
      u=i;
    }
  c=0;
  sort(s.begin(),s.end());
  cout<<s[0]
  for(int i=0;i<20000;i++){
    
  
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:3: error: 'N' was not declared in this scope
    8 |   N=s.size();
      |   ^
a.cc:11:5: error: expected ',' or ';' before 'for'
   11 |     for(int i=0;i<N-4;i++){
      |     ^~~
a.cc:11:17: error: 'i' was not declared in this scope
   11 |     for(int i=0;i<N-4;i++){
      |                 ^
a.cc:33:13: error: expected ';' before 'for'
   33 |   cout<<s[0]
      |             ^
      |             ;
   34 |   for(int i=0;i<20000;i++){
      |   ~~~
Language: C++

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "Header.h"

void check(int *q, int *x, int *y, int m, int index);


int main(){
	int n, m;		// 要素数
	scanf_s("%d %d", &n, &m);
	int* p = new int[n];
	int* x = new int[m];
	int* y = new int[m];
	for (int i = 0; i < n; i++)
	{
		scanf_s("%d", &p[i]);
	}
	for (int j = 0; j < m; j++)
	{
		scanf_s("%d %d", &x[j], &y[j]);
	}

	int count = 0;
	for (int i = 0; i < n; i++)
	{
		int* q = new int[n] {0};		// チェック用
		check(q, x, y, m, i + 1);

		for (int ii = 0; ii < n; ii++)
		{
			if (q[ii] == 1 && i + 1 == p[ii])
			{
				count++;
				break;
			}
		}
		delete[] q;
	}

	printf("%d", count);
	delete[] p;
	delete[] x;
	delete[] y;
	return 0;
}

// indexとnの時nで再度check
void check(int *q, int *x, int *y, int m, int index)
{
	q[index - 1] = 1;
	for (int j = 0; j < m; j++)
	{
		bool flag = q[x[j] - 1] == 0 || q[y[j] - 1] == 0;
		if (flag && (x[j] == index || y[j] == index))
		{
			int n = (x[j] == index) ? y[j] : x[j];
			q[x[j] - 1] = 1;
			q[y[j] - 1] = 1;
			check(q, x, y, m, n);
		}
	}
}

Compiler output:
a.cc:5:10: fatal error: Header.h: No such file or directory
    5 | #include "Header.h"
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
const double PI = acos(-1);
const double EPS = 1e-15;
long long INF=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;
bool prime(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd(b,a%b);
  }
}
 
long long lcm(long long x, long long y){
  return (x/gcd(x,y))*y;
}
 
class UnionFind {
    public:
    //各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。
    vector<int> Parent;
    
    //クラスを作るときは、Parentの値を全て-1にする。
    //以下のようにすると全てバラバラの頂点として解釈できる。
    UnionFind(int N) {
        Parent = vector<int>(N, -1);
    }
    
    //Aがどのグループに属しているか調べる
    int root(int A) {
        if (Parent[A] < 0) return A;
        return Parent[A] = root(Parent[A]);
    }
    
    //自分のいるグループの頂点数を調べる
    int size(int A) {
        return -Parent[root(A)];//先祖をrootで取っておきたい。
    }
    
    //AとBをくっ付ける
    bool connect(int A, int B) {
        //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
        A = root(A);
        B = root(B);
        if (A == B) {
            //すでにくっついてるからくっ付けない
            return false;
        }
        
        //大きい方(A)に小さいほう(B)をくっ付けたい
        //大小が逆だったらAとBをひっくり返す。
        if (size(A) < size(B)) swap(A, B);
        
        //Aのサイズを更新する
        Parent[A] += Parent[B];
        //Bの親をAに変更する
        Parent[B] = A;
        
        return true;
    }
};

int main(){
  string s;
  cin>>s;
  int k;
  cin>>k;
  vector<string> ss;
  map<string,bool> exist;
  string cs="";
  int len=s.size();
  REP(i,len){
    for(int j=0;j<min(k,len-i);j++){
      REP(k,j){
        cs += s[i+k];
      }
      if(exist[cs]){
        cs = "";
        continue;
      }else{
        exist[cs]=true;
        ss.push_back(cs);
        cs = "";
    }
  }
  sort(ss.begin(),ss.end());
  cout<<ss[k-1]<<endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:115:2: error: expected '}' at end of input
  115 | }
      |  ^
a.cc:89:11: note: to match this '{'
   89 | int main(){
      |           ^
Language: C++

#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
const double PI = acos(-1);
const double EPS = 1e-15;
long long INF=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;
bool prime(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd(b,a%b);
  }
}
 
long long lcm(long long x, long long y){
  return (x/gcd(x,y))*y;
}
 
class UnionFind {
    public:
    //各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。
    vector<int> Parent;
    
    //クラスを作るときは、Parentの値を全て-1にする。
    //以下のようにすると全てバラバラの頂点として解釈できる。
    UnionFind(int N) {
        Parent = vector<int>(N, -1);
    }
    
    //Aがどのグループに属しているか調べる
    int root(int A) {
        if (Parent[A] < 0) return A;
        return Parent[A] = root(Parent[A]);
    }
    
    //自分のいるグループの頂点数を調べる
    int size(int A) {
        return -Parent[root(A)];//先祖をrootで取っておきたい。
    }
    
    //AとBをくっ付ける
    bool connect(int A, int B) {
        //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
        A = root(A);
        B = root(B);
        if (A == B) {
            //すでにくっついてるからくっ付けない
            return false;
        }
        
        //大きい方(A)に小さいほう(B)をくっ付けたい
        //大小が逆だったらAとBをひっくり返す。
        if (size(A) < size(B)) swap(A, B);
        
        //Aのサイズを更新する
        Parent[A] += Parent[B];
        //Bの親をAに変更する
        Parent[B] = A;
        
        return true;
    }
};

int main(){
  string s;
  cin>>s;
  int k;
  cin>>k;
  vector<string> ss;
  map<string,bool> exist;
  string cs="";
  REP(i,s.size()){
    for(int j=0;j<min(k,n-i);j++){
      REP(k,j){
        cs += s[i+k];
      }
      if(exist){
        cs = "";
        continue;
      }else{
        exist[cs]=true;
        ss.push_back(cs);
        cs = "";
    }
  }
  sort(ss.begin(),ss.end());
  cout<<ss[k-1]<<endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:98:25: error: 'n' was not declared in this scope
   98 |     for(int j=0;j<min(k,n-i);j++){
      |                         ^
a.cc:102:10: error: could not convert 'exist' from 'std::map<std::__cxx11::basic_string<char>, bool>' to 'bool'
  102 |       if(exist){
      |          ^~~~~
      |          |
      |          std::map<std::__cxx11::basic_string<char>, bool>
a.cc:114:2: error: expected '}' at end of input
  114 | }
      |  ^
a.cc:89:11: note: to match this '{'
   89 | int main(){
      |           ^
Language: C++

#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <set>
#include <sstream>
#include <bitset>
#include <string>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define all(x) (x).begin(),(x).end()
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)


ll modpow(ll x, ll n) {
    if (n == 0) {
        return 1;
    } else if (n % 2 == 0) {
        ll h = modpow(x, n / 2);
        return h * h % MOD;
    } else {
        return x * modpow(x, n - 1) % MOD;
    }
}

int gcd(int a,int b)  {
	if (a%b==0)  return(b);
	else return(gcd(b,a%b));
}

int vector_finder(vector<int> vec, int number) {
  auto itr = find(vec.begin(), vec.end(), number);
  size_t index = distance(vec.begin(), itr);
  if (index != vec.size()) { // 発見できたとき
    return 1;
  }
  else { // 発見できなかったとき
    return 0;
  }
}

int main() {
    string S; cin >> S;
    int K, N;  cin >> K;
    N = S.length();

    vector<string> s;
    rep(i, N){
      reps(j, 5){
        s.push_back(S.substr(i, j));
      }
    }
    sort(all(s));
    s.erase(unique(all(s)), s.end())
    cout << s[K-1] << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:68:37: error: expected ';' before 'cout'
   68 |     s.erase(unique(all(s)), s.end())
      |                                     ^
      |                                     ;
   69 |     cout << s[K-1] << endl;
      |     ~~~~
Language: C++

#include <iostream>
#include <algorithm>
#include <set>
#include <string>
using namespace std;

int main() {
    string S;
    cin >> S;
    int K;
    cin >> K;

    vector<string> v;
    for (int i = 0; i < S.size(); i++) {
        for (int j = 1; j <= S.size() - i; j++) {
            v.push_back(S.substr(i, j));
        }
    }
    sort(v.begin(), v.end());
    v.erase(unique(v.begin(), v.end()), v.end());
    cout << v[K - 1] << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:5: error: 'vector' was not declared in this scope
   13 |     vector<string> v;
      |     ^~~~~~
a.cc:4:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    3 | #include <set>
  +++ |+#include <vector>
    4 | #include <string>
a.cc:13:18: error: expected primary-expression before '>' token
   13 |     vector<string> v;
      |                  ^
a.cc:13:20: error: 'v' was not declared in this scope
   13 |     vector<string> v;
      |                    ^
Language: C++

#include "bits/stdc++.h"
using namespace std;
#define Would
#define you
const long long INF = 1e18;
const long long MOD = 1e9 + 7;
const double pi = acos(-1);
const int SIZE = 1 << 17;
int dx[] = { 1,0,-1,0 }, dy[] = { 0,1,0,-1 }, alp[30];
long long fac[200005], finv[200005], inv[200005];
vector<long long>dij;
struct edge { long long to, cost; };
vector<vector<edge> >G;

int main() {
	string h;
	int n;
	cin >> h >> n;
	set<string>s;
	for (int i = 0; i < h.length(); ++i) {
		for (int j = 1; j <= n; ++j) { s.insert(s.substr(i, j)); }
	}
	set<string>::iterator t = s.begin();
	for (int i = 1; i < n; ++i) { ++t; }

	cout << *t << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:59: error: 'class std::set<std::__cxx11::basic_string<char> >' has no member named 'substr'
   21 |                 for (int j = 1; j <= n; ++j) { s.insert(s.substr(i, j)); }
      |                                                           ^~~~~~
Language: C++

#include "bits/stdc++.h"
using namespace std;
#define Would
#define you
const long long INF = 1e18;
const long long MOD = 1e9 + 7;
const double pi = acos(-1);
const int SIZE = 1 << 17;
int dx[] = { 1,0,-1,0 }, dy[] = { 0,1,0,-1 }, alp[30];
long long fac[200005], finv[200005], inv[200005];
vector<long long>dij;
struct edge { long long to, cost; };
vector<vector<edge> >G;

int main() {
	string h;
	int n;
	cin >> h >> n;
	set<string>s;
	for (int i = 0; i < h.length(); ++i) {
		for (int j = 1; k <= n; ++j) { s.insert(s.substr(i, j)); }
	}
	set<string>::iterator t = s.begin();
	for (int i = 1; i < n; ++i) { ++t; }

	cout << *t << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:33: error: 'k' was not declared in this scope
   21 |                 for (int j = 1; k <= n; ++j) { s.insert(s.substr(i, j)); }
      |                                 ^
a.cc:21:59: error: 'class std::set<std::__cxx11::basic_string<char> >' has no member named 'substr'
   21 |                 for (int j = 1; k <= n; ++j) { s.insert(s.substr(i, j)); }
      |                                                           ^~~~~~
Language: C++

#include <iostream>
#include <vector>
#include <string>

using namespace std;

int main(){
    string s;
    getline(cin,s);
    
    int k;
    cin >> k;
    
    vector<string> strs;
    
    for (int i=0;i<s.size();i++)
        for (int j=1;j<=k&&i+j-1<s.size();j++)
            strs.push_back(s.substr(i,j));
    
    sort(strs.begin(),strs.end());
    unique(strs.begin(),strs.end());
    
    cout << strs[k-1] << '\n';
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   20 |     sort(strs.begin(),strs.end());
      |     ^~~~
      |     short
a.cc:21:5: error: 'unique' was not declared in this scope
   21 |     unique(strs.begin(),strs.end());
      |     ^~~~~~
Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <complex>
#include <math.h>

using namespace std;

int main(){
    string s;
    getline(cin,s);
    
    int k;
    cin >> k;
    
    vector<string> strs;
    
    for (int i=1;i<=k;i++)
        for (int j=0;j<s.size()-k+1;j++) strs.push_back(s.substr(j,k));
    
    sort(strs.begin(),strs.end());
    unique(strs.begin(),strs.end());
    
    cout << strs[k-1] << '\n';
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:5: error: 'sort' was not declared in this scope; did you mean 'sqrt'?
   21 |     sort(strs.begin(),strs.end());
      |     ^~~~
      |     sqrt
a.cc:22:5: error: 'unique' was not declared in this scope
   22 |     unique(strs.begin(),strs.end());
      |     ^~~~~~
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
using namespace std;

string s;
int k;
int main() {
  cin >> s >> k;
  set<string> st;
  for (int i = 0; i < s.size(); ++i) {
    for (int k = 1; k <= 5; ++k) {
      st.insert(s.substr(i, k));
    }
  }
  
  auto it = st.begin();
  for (int i = 0; i < k - 1; ++i) ++st;
  cout << *st << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:35: error: no match for 'operator++' (operand type is 'std::set<std::__cxx11::basic_string<char> >')
   20 |   for (int i = 0; i < k - 1; ++i) ++st;
      |                                   ^~~~
a.cc:21:11: error: no match for 'operator*' (operand type is 'std::set<std::__cxx11::basic_string<char> >')
   21 |   cout << *st << endl;
      |           ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define forx(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) for (int i = 0; i < (n); i++)
typedef long long ll;


int main(){
    string s,t;
    cin>>s;
    int n=s.size();
    vector<string>v;
    rep(i,n){
        t=s[i];
        v.push_back(t);
    }
    if(n>=2)rep(i,n-1){
        t=s[i]+s[i+1];
        v.push_back(t);
    }
    if(n>=3)rep(i,n-2){
        t=s[i]+s[i+1]+s[i+2];
        v.push_back(t);
    }
    if(n>=4)rep(i,n-3){
        t=s[i]+s[i+1]+s[i+2]+s[i+3];
        v.push_back(t);
    }
    if(n>=5)rep(i,n-4){
        t=s[i]+s[i+1]+s[i+2]+s[i+3];
        v.push_back(t);
    }
    sort(begin(v),end(v));
    unique(begin(v),end(v));
    cout<<v[k-1]<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:34:11: warning: ignoring return value of '_FIter std::unique(_FIter, _FIter) [with _FIter = __gnu_cxx::__normal_iterator<__cxx11::basic_string<char>*, vector<__cxx11::basic_string<char> > >]', declared with attribute 'nodiscard' [-Wunused-result]
   34 |     unique(begin(v),end(v));
      |     ~~~~~~^~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h:891:5: note: declared here
  891 |     unique(_ForwardIterator __first, _ForwardIterator __last)
      |     ^~~~~~
a.cc:35:13: error: 'k' was not declared in this scope
   35 |     cout<<v[k-1]<<endl;
      |             ^
Language: C++

#include <iostream>
#include <string>
#include <vector>
using namespace std;

string S;
int K;

int main() {
  cin >> S >> K;
  vector<string> vec;
  for (int i = 0; i < S.size(); ++i) {
	for (int j = 1; j <= K; ++j) {
	  string tmp = S.substr(i, j);
	  vec.push_back(tmp);
	}
  }
  sort(vec.begin(), vec.end());
  vec.erase(unique(vec.begin(), vec.end()), vec.end());
  cout << vec[K-1] << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   18 |   sort(vec.begin(), vec.end());
      |   ^~~~
      |   short
a.cc:19:13: error: 'unique' was not declared in this scope
   19 |   vec.erase(unique(vec.begin(), vec.end()), vec.end());
      |             ^~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)


int main(void) {
	string s; cin >> s;
	int k; cin >> k;
	vector<string> v;
	rep(i, s.size()) {
		reps(j, 1, min(s.size() - i + 1, 6)) {
			v.push_back(s.substr(i, j));
			// cout << s.substr(i, j) << endl;
		}
	}
	sort(v.begin(), v.end());
	v.erase(unique(v.begin(), v.end()), v.end());
	cout << v[k - 1] << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:31: error: no matching function for call to 'min(std::__cxx11::basic_string<char>::size_type, int)'
   14 |                 reps(j, 1, min(s.size() - i + 1, 6)) {
      |                            ~~~^~~~~~~~~~~~~~~~~~~~~
a.cc:6:38: note: in definition of macro 'reps'
    6 | #define reps(i,f,n) for(int i=(f);i<(n);i++)
      |                                      ^
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:14:31: note:   deduced conflicting types for parameter 'const _Tp' ('long unsigned int' and 'int')
   14 |                 reps(j, 1, min(s.size() - i + 1, 6)) {
      |                            ~~~^~~~~~~~~~~~~~~~~~~~~
a.cc:6:38: note: in definition of macro 'reps'
    6 | #define reps(i,f,n) for(int i=(f);i<(n);i++)
      |                                      ^
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:14:31: note:   mismatched types 'std::initializer_list<_Tp>' and 'long unsigned int'
   14 |                 reps(j, 1, min(s.size() - i + 1, 6)) {
      |                            ~~~^~~~~~~~~~~~~~~~~~~~~
a.cc:6:38: note: in definition of macro 'reps'
    6 | #define reps(i,f,n) for(int i=(f);i<(n);i++)
      |                                      ^
Language: C++

#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <set>
#include <numeric>
#include <cmath>

using namespace std;

typedef long long int ll;

const ll mod = 1e9+7;
const ll INF = 1e9;
const ll MAXN = 1e9;

int main()
{
  string s;
  cin >> s;
  int k;
  cin >> k;

  set<string> sub;
  for(int i = 0; i < s.size(); i++){
    string t = "";
    for(int j = i; j < min((int)s.length(),i+6); j++){
      t += s[j];
      sub.insert(t);
    }
  }

  vector<string> sol;
  for(string s : v){
    sol.push_back(s);
  }

  sort(sol.begin(),sol.end());
  cout << sol[k-1] << endl;

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:36:18: error: 'v' was not declared in this scope
   36 |   for(string s : v){
      |                  ^
Language: C++

#include<iostream>
#include<vector>
#include<string>
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;
int main(){
    string s;
    cin >> s;
    int k;
    cin >> k;
    vector<string> v;
    rep(i,s.size()){
        for(int j = 1; i+j <= s.size( )&& j <= 5; j++)v.push_back(s.substr(i,j));
    }
    sort(v.begin(),v.end());
    unique(v.begin(),v.end());
    cout << v[k-1] << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   15 |     sort(v.begin(),v.end());
      |     ^~~~
      |     short
a.cc:16:5: error: 'unique' was not declared in this scope
   16 |     unique(v.begin(),v.end());
      |     ^~~~~~
Language: Java

import java.util.*;

public class Test {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine();
        int n = sc.nextInt();
        Set<String> substr = new HashSet<>();
        for (int i = 1; i <= n; i++) {
            for (int j = 0; j < str.length() - i + 1; j++) {
                substr.add(str.substring(j, j + i));
            }
        }
        String result = "";
        for (int i = 0; i < n; i++) {
            String min = substr.iterator().next();
            for (String cur : substr) {
                if (min.compareTo(cur) > 0) {
                    min = cur;
                }
            }
            substr.remove(min);
            result = min;
        }
        System.out.println(result);
    }
}

Compiler output:
Main.java:3: error: class Test is public, should be declared in a file named Test.java
public class Test {
       ^
1 error
Language: Java

mport java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine();
        int n = sc.nextInt();
        Set<String> substr = new HashSet<>();
        for (int i = 1; i <= n; i++) {
            for (int j = 0; j < str.length() - i + 1; j++) {
                substr.add(str.substring(j, j + i));
            }
        }
        String result = "";
        for (int i = 0; i < n; i++) {
            String min = substr.iterator().next();
            for (String cur : substr) {
                if (min.compareTo(cur) > 0) {
                    min = cur;
                }
            }
            substr.remove(min);
            result = min;
        }
        System.out.println(result);
    }
}

Compiler output:
Main.java:1: error: class, interface, enum, or record expected
mport java.util.*;
^
1 error
Language: C++

#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
 
string s;
int k;
set<string> se;
 
int main() {    
    cin >> s >> k;
    for (int i = 0; i < s.size(); i++) {
        for (int j = 1; j <= k; j++) {
            if (i + j > s.size()) break;
            se.insert(s.substr(i, j));
        }
    }
    for (int i = 1; i < k; i++) se.erase(se.begin());
    cout << *se.begin() << endl;
    retu

Compiler output:
a.cc: In function 'int main()':
a.cc:19:5: error: 'retu' was not declared in this scope
   19 |     retu
      |     ^~~~
a.cc:19:9: error: expected '}' at end of input
   19 |     retu
      |         ^
a.cc:9:12: note: to match this '{'
    9 | int main() {
      |            ^
Language: Java

public class Main {
    public static void main(String args[]) {
        InputParser parser = new InputParser(System.in);

        final String s = parser.scanLineNTimes(1).get(0);
        final Integer K = Integer.parseInt(parser.scanLineNTimes(1).get(0));

        List<String> subs = getSubstrings(s).stream()
                .distinct()
                .sorted()
                .collect(Collectors.toList());

        System.out.println(subs.get(K - 1));


    }

    public static List<String> getSubstrings(String s) {
        List<String> substrings = new ArrayList<>();
        for(int i = 0; i < s.length(); i++) {
            for(int j = i; j < s.length(); j++) {
                String sub = s.substring(i, j + 1);
                substrings.add(sub);
            }
        }

        return substrings;
    }

    static class InputParser {
        private static Scanner scanner;

        public InputParser(InputStream in) {
            scanner = new Scanner(in);
        }

        public List<String> scanLineNTimes(int n) {
            List<String> lines = new ArrayList<String>();
            for (int i = 0; i < n; i++) {
                lines.add(scanner.nextLine());
            }
            return lines;
        }
    }
}

Compiler output:
Main.java:18: error: cannot find symbol
    public static List<String> getSubstrings(String s) {
                  ^
  symbol:   class List
  location: class Main
Main.java:31: error: cannot find symbol
        private static Scanner scanner;
                       ^
  symbol:   class Scanner
  location: class InputParser
Main.java:33: error: cannot find symbol
        public InputParser(InputStream in) {
                           ^
  symbol:   class InputStream
  location: class InputParser
Main.java:37: error: cannot find symbol
        public List<String> scanLineNTimes(int n) {
               ^
  symbol:   class List
  location: class InputParser
Main.java:8: error: cannot find symbol
        List<String> subs = getSubstrings(s).stream()
        ^
  symbol:   class List
  location: class Main
Main.java:11: error: cannot find symbol
                .collect(Collectors.toList());
                         ^
  symbol:   variable Collectors
  location: class Main
Main.java:19: error: cannot find symbol
        List<String> substrings = new ArrayList<>();
        ^
  symbol:   class List
  location: class Main
Main.java:19: error: cannot find symbol
        List<String> substrings = new ArrayList<>();
                                      ^
  symbol:   class ArrayList
  location: class Main
Main.java:34: error: cannot find symbol
            scanner = new Scanner(in);
                          ^
  symbol:   class Scanner
  location: class InputParser
Main.java:38: error: cannot find symbol
            List<String> lines = new ArrayList<String>();
            ^
  symbol:   class List
  location: class InputParser
Main.java:38: error: cannot find symbol
            List<String> lines = new ArrayList<String>();
                                     ^
  symbol:   class ArrayList
  location: class InputParser
11 errors
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#define rep(i, n) for(int i = 0; i<n; i++)

using namespace std;

int main(void) {
    string s;
    int k;
    cin >> s >> k;

    vector<string> subs;
    rep(i, 5) subs.push_back({'z'+1});

    rep(start, s.size()) {
        rep(li, k) {
            string si = s.substr(start, li+1);
            if(si > subs[k-1]) break;
            auto it = lower_bound(subs.begin(), subs.end(), si);
            if (*it == si) continue;

            subs.insert(it, si);
            subs.resize(k+1);
            memo[si] = true;
        }
    }
    cout << subs[k-1] << endl; 
}


Compiler output:
a.cc: In function 'int main()':
a.cc:25:13: error: 'memo' was not declared in this scope
   25 |             memo[si] = true;
      |             ^~~~
Language: C++

#include <cmath>
#include <algorithm>
#include <cstdio>
#include <string>
#include <iostream>
#include <set>

using namespace std;

int main() {
    string s;
    int K;
    cin >> s >> K;

    set<string> data;
    for (int i = 0; i < s.size(); i++) {
      for (int j = 1; j <= K; j++) {
        data.insert(s.substr(i, j));
      }
    }
    cout << data[K-1] << endl;

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:17: error: no match for 'operator[]' (operand types are 'std::set<std::__cxx11::basic_string<char> >' and 'int')
   21 |     cout << data[K-1] << endl;
      |                 ^
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <map>

using namespace std;

int main(){
  string s;
  int N;
  cin >> s;
  cin >> N;
  set<string> arr;
  int len = s.size();
  for(int i=0;i<len;i++){
    for(int j=1; j<=N; j++){
      string sub = s.substr(i,j);
      arr.insert(sub);
    }
  }
  // cout << arr[N-1] << endl;
  for(int i=0;i<N;i++){
    cout<<arr[i]<<endl;
  }
  // bool x=s.substr(0,2)<s.substr(1,2);
  // cout << arr[0] << endl;
  // cout << len << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:14: error: no match for 'operator[]' (operand types are 'std::set<std::__cxx11::basic_string<char> >' and 'int')
   25 |     cout<<arr[i]<<endl;
      |              ^
Language: C++

#include "iostream"
#include "map"
#include "vector"

using namespace std;

int main() {
    string s;
    int K;

    cin >> s >> K;

    vector<string> sub;

    for (int i = 0; i < s.length(); i++) {
        for (int j = 1; j <= s.length() - i; j++) {
            sub.push_back(s.substr(i,j));
        }
    }

    sort(sub.begin(), sub.end());
    unique(sub.begin(), sub.end());

    cout << sub[K - 1] << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   21 |     sort(sub.begin(), sub.end());
      |     ^~~~
      |     short
a.cc:22:5: error: 'unique' was not declared in this scope
   22 |     unique(sub.begin(), sub.end());
      |     ^~~~~~
Language: C++

    #include<iostream>
    #include<string>
     
    void main(){
      const int MAX_s=5000;
      const int MAX_K=5;
      
      std::string index="abcdefghijklmnopqrstuvwxyz";
      
      std::string s;
      int K;
      std::cin>>s;
      std::cin>>K;
        
      int s_num[MAX_s+MAX_K];
      for(int i=0;i<MAX_s+MAX_K;i++){
        if(i<s.length()){
          for(int j=0;j<index.length();j++){
            if(s[i]==index[j]){
              s_num[i]=j;
              break;
            }
          }
        }
        else{
          s_num[i]=-1;
        }
      }
      
      int ans[MAX_K][MAX_K];
      for(int i=0;i<MAX_K;i++){
        for(int j=0;j<MAX_K;j++){
          ans[i][j]=index.length();
        }
      }
      
      for(int i=0;i<s.length();i++){
        for(int j=0;j<MAX_K;j++){
          int sn[MAX_K];
          for(int k=0;k<MAX_K;k++){
            if(k<=j){
              sn[k]=s_num[i+k];
            }
            else{
              sn[k]=-1;
            }
          }
          
          bool change=false;
          for(int k=0;k<MAX_K;k++){
            for(int l=0;l<MAX_K;k++){
              if(ans[k][l]<sn[l]){
                break;
              }
              else if(ans[k][l]>sn[l]){
                change=true;
                break;
              }
            }
            if(change=true){
              for(int l=k;l<MAX_K-1;l++){
                for(int m=0;m<MAX_K;m++){
                  ans[l+1][m]=ans[l][m];
                }
              }
              for(int l=0;l<MAX_K;l++){
                ans[k][l]=sn[l];
              }
              break;
            }
          }
        }
      }
      
      std::string output;
      for(int i=0;i<MAX_K;i++){
        output=index[ans[K-1][i]];
      }
      
      std::cout<<output<<std::endl;
    }

Compiler output:
a.cc:4:5: error: '::main' must return 'int'
    4 |     void main(){
      |     ^~~~
Language: C++

#include<iostream>
#include<string>

void main(){
  const int MAX_s=5000;
  const int MAX_K=5;
  
  std::string index="abcdefghijklmnopqrstuvwxyz";
  
  std::string s;
  int K;
  std::cin>>s;
  std::cin>>K;
    
  int s_num[MAX_s+MAX_K];
  for(int i=0;i<MAX_s+MAX_K;i++){
    if(i<s.length()){
      for(int j=0;j<index.length();j++){
        if(s[i]==index[j]){
          s_num[i]=j;
          break;
        }
      }
    }
    else{
      s_num[i]=-1;
    }
  }
  
  int ans[MAX_K][MAX_K];
  for(int =0;i<MAX_K;i++){
    for(int j=0;j<MAX_K;j++){
      ans[i][j]=index.length();
    }
  }
  
  for(int i=0;i<s.length();i++){
    for(int j=0;j<MAX_K;j++){
      int sn[MAX_K];
      for(int k=0;k<MAX_K;k++){
        if(k<=j){
          sn[k]=s_num[i+k];
        }
        else{
          sn[k]=-1;
        }
      }
      
      bool change=false;
      for(int k=0;k<MAX_K;k++){
        for(int l=0;l<MAX_K;k++){
          if(ans[k][l]<sn[l]){
            break;
          }
          else if(ans[k][l]>sn[l]){
            change=true;
            break;
          }
        }
        if(change=true){
          for(int l=k;l<MAX_K-1;l++){
            for(int m=0;m<MAX_K;m++){
              ans[l+1][m]=ans[l][m];
            }
          }
          for(int l=0;l<MAX_K;l++){
            ans[k][l]=sn[l]
          }
          break;
        }
      }
    }
  }
  
  std::string output;
  for(int i=0;i<MAX_K;i++){
    output=index[ans[K-1][i]];
  }
  
  std::cout<<output<<std::endl;
}

Compiler output:
a.cc:4:1: error: '::main' must return 'int'
    4 | void main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:31:11: error: expected unqualified-id before '=' token
   31 |   for(int =0;i<MAX_K;i++){
      |           ^
a.cc:31:10: error: expected ';' before '=' token
   31 |   for(int =0;i<MAX_K;i++){
      |          ^~
      |          ;
a.cc:31:11: error: expected primary-expression before '=' token
   31 |   for(int =0;i<MAX_K;i++){
      |           ^
a.cc:31:14: error: 'i' was not declared in this scope
   31 |   for(int =0;i<MAX_K;i++){
      |              ^
a.cc:31:21: error: expected ')' before ';' token
   31 |   for(int =0;i<MAX_K;i++){
      |      ~              ^
      |                     )
a.cc:31:22: error: 'i' was not declared in this scope
   31 |   for(int =0;i<MAX_K;i++){
      |                      ^
a.cc:67:28: error: expected ';' before '}' token
   67 |             ans[k][l]=sn[l]
      |                            ^
      |                            ;
   68 |           }
      |           ~
Language: C++

#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>

using namespace std;

typedef pair<int, int> Pair;
typedef pair<Pair, int> Triple;

#define mp(x, y) make_pair(x, y)
#define left(x) x.first.first
#define right(x) x.first.second

const int N = 1000010;
char s[N];
int n;
int sa[N], rnk[N], tp[N], c[N];
Triple tmp[N];

bool cmp_sa(int x, int y) {
    return s[x] < s[y];
} 

bool cmp_rnk(Triple x, Triple y) {
    if (left(x) != left(y)) return left(x) < left(y);
    return right(x) < right(y);
}

int m = 128;

void calc_SA() {
    for (int i = 0; i < n; i++) sa[i] = i;
    sort(sa, sa+n, cmp_sa);	
    int p = 0;
    rnk[sa[0]] = 0;
    for (int i = 1; i < n; i++) 
        rnk[sa[i]] = s[sa[i]] == s[sa[i-1]] ? p : ++p;

    for (int k = 1; k <= n; k <<= 1) {
        for (int i = 0; i < n; i++)
            tmp[i] = mp(mp(rnk[i], i+k < n ? rnk[i+k] : -1), i);
        sort(tmp, tmp+n, cmp_rnk);
        int p = 0;
        rnk[tmp[0].second] = 0;
        for (int i = 1; i < n; i++)
            rnk[tmp[i].second] = tmp[i].first == tmp[i-1].first ? p : ++p;
    }

    for (int i = 0; i < n; i++) sa[rnk[i]] = i;
}

int lcp[N];

void build_LCP() {
    int k = 0;
    for (int i = 0; i < n; i++) {
        if (k) k--;
        int j = sa[rnk[i]-1];
        while (s[i+k] == s[j+k]) k++;
        lcp[rnk[i]] = k;
    }
}

int main() {  
    int k;
    scanf("%s %d", s, &k);
    n = strlen(s);
    calc_SA();
    // for (int i = 0; i < n; i++) cout << sa[i] << ' ';
    //     puts("");
    for (int i = 0; i < n; i++) {
        int lp = sa[i];
        if (i) {
            int rp = sa[i-1];
            while (s[lp] == s[rp] && lp < n && rp < n) lp++, rp++;
        }
        // cout << lp << endl;
        if (lp < n && n - lp >= k) {
            for (int i = lp, j = 1; j <= k; i++, j++)
                printf("%c", s[i]);
            puts("");
            break;
        } else {
            k -= (n - lp);
        }
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:68:9: error: 'strlen' was not declared in this scope
   68 |     n = strlen(s);
      |         ^~~~~~
a.cc:5:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    4 | #include <algorithm>
  +++ |+#include <cstring>
    5 |