stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#include<iostream>

#include<cstdio>

#include<cstring>

#include<cstdlib>

#include<algorithm>

#include<cmath>

using namespace std;

int n,m;

int a[100010],b[100010],cnt[100010];

int main(){

	scanf("%d%d",&n,&m);

	int i,j;

	for(i=1;i<=m;++i){

		scanf("%d%d",&a[i],&b[i]);cnt[a[i]]++;cnt[b[i]]++;

	}

	for(i=1;i<=n;++i){

		if(cnt[i]%2!=0){

			printf("NO\n");return 0;

		}

	}

	printf("YES\n");return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.243268098111499x):
#include<cstdio>

#include<algorithm>

using namespace std;



const int MAXN=1e5+5;



int n,m;

int cnt[MAXN];



int main(){

    scanf("%d%d",&n,&m);

    for(int i=1;i<=m;i++){

        int u,v;

        scanf("%d%d",&u,&v);

        cnt[u]++,cnt[v]++;

    }

    for(int i=1;i<=n;i++)

        if(cnt[i]&1) return puts("NO"),0;

    puts("YES");

}
// Slower C++ solution:
#include <algorithm>

#include <iostream>

#include <string>

#include <vector>

using namespace std;

 

const int MAXN = 1e5 + 10;

 

int N, M;

int C[MAXN];

 

int main()

{

	cin >> N >> M;

	for(int i = 1; i <= M; i++)

	{

		int u, v;

		cin >> u >> v;

		C[u]++, C[v]++;

	}

 

	for(int i = 1; i <= N; i++)

		if(C[i] & 1)

		{

			cout << "NO" << endl;

			return 0;

		}

 

	cout << "YES" << endl ;

 

	return 0;

}

 

// Faster C++ solution for the same problem (measured speedup: 5.3127009242907075x):
#include<cstdio>

#include<algorithm>

using namespace std;



const int MAXN=1e5+5;



int n,m;

int cnt[MAXN];



int main(){

    scanf("%d%d",&n,&m);

    for(int i=1;i<=m;i++){

        int u,v;

        scanf("%d%d",&u,&v);

        cnt[u]++,cnt[v]++;

    }

    for(int i=1;i<=n;i++)

        if(cnt[i]&1) return puts("NO"),0;

    puts("YES");

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

typedef signed long long ll;



#undef _P

#define _P(...) (void)printf(__VA_ARGS__)

#define FOR(x,to) for(x=0;x<(to);x++)

#define FORR(x,arr) for(auto& x:arr)

#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)

#define ALL(a) (a.begin()),(a.end())

#define ZERO(a) memset(a,0,sizeof(a))

#define MINUS(a) memset(a,0xff,sizeof(a))

//-------------------------------------------------------



int N,M;

int A[101010],B[101010];

vector<pair<int,int>> E[101010];

int did[101010];



int dfs(int cur,int tar) {

	if(cur==tar) return 1;

	

	FORR(r,E[cur]) if(did[r.second]==0) {

		did[r.second]=1;

		return dfs(r.first,tar);

	}

	return 0;

}



void solve() {

	int i,j,k,l,r,x,y; string s;

	

	cin>>N>>M;

	FOR(i,M) {

		cin>>A[i]>>B[i];

		A[i]--;

		B[i]--;

		

		E[A[i]].push_back({B[i],i});

		E[B[i]].push_back({A[i],i});

	}

	

	FOR(i,M) if(did[i]==0) {

		did[i]=1;

		if(dfs(A[i],B[i])==0) return _P("NO\n");

	}

	_P("YES\n");

}





int main(int argc,char** argv){

	string s;int i;

	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);

	FOR(i,argc-1) s+=argv[i+1],s+='\n';

	FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);

	solve(); return 0;

}


// Faster C++ solution for the same problem (measured speedup: 3.527050165506064x):
#include <bits/stdc++.h>

using namespace std;

typedef signed long long ll;



#undef _P

#define _P(...) (void)printf(__VA_ARGS__)

#define FOR(x,to) for(x=0;x<(to);x++)

#define FORR(x,arr) for(auto& x:arr)

#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)

#define ALL(a) (a.begin()),(a.end())

#define ZERO(a) memset(a,0,sizeof(a))

#define MINUS(a) memset(a,0xff,sizeof(a))

//-------------------------------------------------------



int N,M;



int num[101010];



void solve() {

	int i,j,k,l,r,x,y; string s;

	

	cin>>N>>M;

	FOR(i,M) {

		cin>>x>>y;

		num[x-1]^=1;

		num[y-1]^=1;

	}

	FOR(i,N) if(num[i]) return _P("NO\n");

	_P("YES\n");

}





int main(int argc,char** argv){

	string s;int i;

	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);

	FOR(i,argc-1) s+=argv[i+1],s+='\n';

	FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);

	solve(); return 0;

}
// Slower C++ solution:
#include <iostream>

#include <cstring>

using namespace std;

int pd[100010],arr[100010];

int main()

{

    int n,m,i,ans=0,T=1;

    memset(pd,0,sizeof(pd));

    cin>>n>>m;

    

    for(int i=1;i<=m;i++)

    {

        int x,y;

        cin>>x>>y;

        pd[x]++;

        pd[y]++;

    }

    for(i=1;i<=n;i++)

    {

        if(pd[i]%2==1){

            T=0;

            break;

        }

    }

    //if(m%2==0) T=1;

    if(T==1) cout<<"YES"<<endl;

    else cout<<"NO"<<endl;

}

// Faster C++ solution for the same problem (measured speedup: 1.4287974022242058x):
#include<bits/stdc++.h> //Ithea Myse Valgulious

namespace chtholly{

typedef long long ll;

#define re0 register int

#define rec register char

#define rel register ll

#define gc getchar

#define pc putchar

#define p32 pc(' ')

#define pl puts("")

/*By Citrus*/

inline int read(){

  int x=0,f=1;char c=gc();

  for (;!isdigit(c);c=gc()) f^=c=='-';

  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');

  return f?x:-x;

  }

template <typename mitsuha>

inline bool read(mitsuha &x){

  x=0;int f=1;char c=gc();

  for (;!isdigit(c)&&~c;c=gc()) f^=c=='-';

  if (!~c) return 0;

  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');

  return x=f?x:-x,1;

  }

template <typename mitsuha>

inline int write(mitsuha x){

  if (!x) return 0&pc(48);

  if (x<0) x=-x,pc('-');

  int bit[20],i,p=0;

  for (;x;x/=10) bit[++p]=x%10;

  for (i=p;i;--i) pc(bit[i]+48);

  return 0;

  }

inline char fuhao(){

  char c=gc();

  for (;isspace(c);c=gc());

  return c;

  }

}using namespace chtholly;

using namespace std;

const int yuzu=1e5;

typedef int fuko[yuzu|10];

fuko cnt;

int main(){

int n=read(),m=read(),i;

for (;m--;) cnt[read()]++,cnt[read()]++;

for (i=1;i<=n;++i) if (cnt[i]&1) return puts("NO"),0;

puts("YES");

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;



const int N = 1e5 + 10;



int cnt[N];



int main(){

	int n, m, u, v;

	scanf("%d %d",&n,&m);

	memset(cnt, 0, sizeof(cnt));

	for (int i = 1; i <= m; i++){

		scanf("%d %d",&u,&v);

		cnt[u]++; cnt[v]++;

	}

	for (int i = 1; i <= n; i++){

		if (cnt[i] & 1){

			printf("NO\n");

			return 0;

		}

	}

	printf("YES\n");

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.3587672890391633x):
#include<bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp>

using namespace __gnu_pbds;

using namespace std;



typedef long long ll;

typedef pair<int,int> ii;

typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;



int main() {

	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);

	int N,M,a,b; cin>>N>>M;

	map<int,int> ct;

	for (int i=0; i<M; i++) {

		cin>>a>>b;

		ct[a]++; ct[b]++;

	}



	for (auto it : ct)

		if(it.second%2) {

			cout<<"NO\n";

			return 0;

		}

	cout<<"YES\n";

	return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;



const int N = 1e5 + 10;



int cnt[N];



int main(){

	int n, m, u, v;

	scanf("%d %d",&n,&m);

	memset(cnt, 0, sizeof(cnt));

	for (int i = 1; i <= m; i++){

		scanf("%d %d",&u,&v);

		cnt[u]++; cnt[v]++;

	}

	for (int i = 1; i <= n; i++){

		if (cnt[i] & 1){

			printf("NO\n");

			return 0;

		}

	}

	printf("YES\n");

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.3718702633304911x):
#include <iostream>

#include <fstream>

#include <sstream>

#include <iomanip>

#include <algorithm>

#include <numeric>

#include <vector>

#include <string>

#include <set>

#include <map>

#include <queue>

#include <stack>

#include <climits>

#include <cmath>

#include <cstring>

#include <unordered_set>

#include <unordered_map>

using namespace std;



#define pb push_back

#define fst first

#define snd second



typedef long long ll;

typedef pair<int,int> pii;

template<typename T> using min_queue=priority_queue<T,vector<T>,greater<T>>;



const ll MOD=1e9+7;



int N,M;

int d[100100];



int main(){

  ios::sync_with_stdio(0);cin.tie(0);



  cin>>N>>M;



  int a,b;

  while (M --> 0) cin>>a>>b, d[a]++,d[b]++;



  bool good=1;

  for (int i=1;i<=N;i++) if (d[i]&1) {

      good=0;break;

    }



  cout << (good ? "YES\n" : "NO\n");



  return 0;

}
// Slower C++ solution:
#include<iostream>

#include<cstring>

using namespace std;

int main() {

	int n, m, x, y;

	bool flag = true;

	int sw[100000];

	memset(sw, 0, sizeof(sw));

	cin >> n >> m;

	for (int i = 0; i < m; i++) {

		cin >> x >> y;

		sw[x] += 1;

		sw[y] += 1;

	}

	for (int i = 0; i < 100000; i++) {

		if (sw[i] % 2 == 1) {

			flag = false;

			break;

		}

	}

	if (flag == true) {

		cout << "YES" << endl;

	}

	else {

		cout << "NO" << endl;

	}

}

// Faster C++ solution for the same problem (measured speedup: 1.4923084173694812x):
#include<bits/stdc++.h>

using namespace std;

#define HANI (1000001)

int n,m;

int x[HANI];

int main(){

    cin>>n>>m;

    for(int i=0;i<m;i++){

        int a,b;

        cin>>a>>b;

        x[a]++;

        x[b]++;

    }

    for(int i=1;i<=n;i++){

        if(x[i]%2!=0){

            cout<<"NO"<<endl;

            return 0;

        }

    }

    cout<<"YES"<<endl;

}
// Slower C++ solution:
#include <iostream>

#include <algorithm>

using namespace std;



int main() {

	string s;

	int K;

	cin >> s >> K;

	string line[25005];

	int k = 0;

	for (int i = 0; i < s.length(); i++) {

		for (int j = 1; j <= 5; j++) {

			if (i + j <= s.length()) {

				line[k] = s.substr(i, j);

				k++;

			} else {

				break;

			}

		}

	}



	sort(line, line + k);

	s = line[0];

	int num = 1;

	if (K != 1) {

		for (int i = 1; i < k; i++) {

		if (line[i] != s) {

			s = line[i];

			num++;

			if (num == K)

				break;	

		}

	}

	}

	

	cout << s << endl;

}

// Faster C++ solution for the same problem (measured speedup: 9.48249677654158x):
#include<stdio.h>

#include<string.h>

#include<algorithm>

const int MAXL = 1e4 + 10;

using namespace std;

char str[MAXL];

char substr[5 * MAXL][10];

int id[5 * MAXL];

int m;

bool cmp(int a, int b) {

	return strcmp(substr[a], substr[b]) < 0;

}

int main() {

	while (scanf("%s", str) != EOF) {

		int L = strlen(str);

		scanf("%d", &m);

		int cnt = 0;

		for (int j = 0; j < m; j++) {

			for (int i = 0; i < L - j; i++) {

				for (int k = 0; k <= j; k++) {

					substr[cnt][k] = str[i + k];

				}

				substr[cnt++][j + 1] = 0;

			}

		}



		for (int i = 0; i < cnt; i++) {

			id[i] = i;

		}



		sort(id, id + cnt, cmp);



		int t = 0;

		while (m  > 1 && t < cnt) {

			while (t + 1 < cnt && strcmp(substr[id[t]], substr[id[t + 1]]) == 0)

				t++;

			m--;

			t++;

		}

		printf("%s\n", substr[id[t]]);

	}

	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

typedef pair<int, int> pii;

typedef pair<double,int> pdi;

const int N = 50005;

string str[N];

int main()

{

    string a;

    cin >> a;

    int k, cnt = 0;

    scanf("%d",&k);

    int siz = a.size();

    int mini;

    for(int i= 0; i < siz;i++)

    {

        str[++cnt] = a[i];

        mini =min(k,siz-i);

        for(int j = 1 + i; j < mini + i; j ++,cnt++)

            str[cnt + 1] = str[cnt] + a[j];

    }

    sort(str + 1, str + cnt + 1);

    unique(str + 1, str + cnt + 1);

    cout<< str[k] <<endl;

    return 0;

}
















// Faster C++ solution for the same problem (measured speedup: 1.2372605276463435x):
#include<cstdio>

#include<cstring>

#include<cmath>

#include<algorithm>

#include<queue>

#include<stack>

#include<vector>

#include<set>

#include<map>

#include<iostream>

using namespace std;

int k,tol=0,cnt=0;

char ch;

string s,p[30000],ans,note[5001];

int main(){

	while(1){

		scanf("%c",&ch);

		if(ch=='\n') break;

		tol++;

		for(int i=1;i<=tol;i++){

			if(tol-i+1<=5){

			    note[i]+=ch;

			    p[++cnt]=note[i];

			}

		}

	}scanf("%d",&k);

	sort(p+1,p+1+cnt);unique(p+1,p+1+cnt);

	cout<<p[k];

	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

typedef pair<int, int> pii;

typedef pair<double,int> pdi;

const int N = 50005;

string str[N];

int main()

{

    string a;

    cin >> a;

    int k, cnt = 0;

    scanf("%d",&k);

    int siz = a.size();

    int mini;

    for(int i= 0; i < siz;i++)

    {

        str[++cnt] = a[i];

        mini =min(k,siz-i);

        for(int j = 1 + i; j < mini + i; j ++,cnt++)

            str[cnt + 1] = str[cnt] + a[j];

    }

    sort(str + 1, str + cnt + 1);

    unique(str + 1, str + cnt + 1);

    cout<< str[k] <<endl;

    return 0;

}
















// Faster C++ solution for the same problem (measured speedup: 1.3338077544758151x):
#include<bits/stdc++.h>

#define ll long long

using namespace std;

const int maxn=5005;

string ch[maxn*6];

char s[maxn];

int n,k,cnt;

int main(){

    scanf("%s%d",s,&k),n=strlen(s);

    for(int i=0,T;i<n;i++){

        ch[++cnt]=s[i];

        T=min(k,n-i);

        for(int j=1;j<T;j++,cnt++) ch[cnt+1]=ch[cnt]+s[i+j];

    }

     

    sort(ch+1,ch+cnt+1);

    unique(ch+1,ch+cnt+1);

    cout<<ch[k]<<endl;

    return 0;

}
// Slower C++ solution:
#include <iostream>

#include <algorithm>

using namespace std;



int main() {

	string s;

	int K;

	cin >> s >> K;

	string line[25005];

	int k = 0;

	for (int i = 0; i < s.length(); i++) {

		for (int j = 1; j <= 5; j++) {

			if (i + j <= s.length()) {

				line[k] = s.substr(i, j);

				k++;

			} else {

				break;

			}

		}

	}



	sort(line, line + k);

	s = line[0];

	int num = 1;

	if (K != 1) {

		for (int i = 1; i < k; i++) {

		if (line[i] != s) {

			s = line[i];

			num++;

			if (num == K)

				break;	

		}

	}

	}

	

	cout << s << endl;

}

// Faster C++ solution for the same problem (measured speedup: 1.7952075798034977x):
#include<bits/stdc++.h>

using namespace std;

string s;

int k;

vector<string>v;

set<string>ss;

int main()

{

	cin>>s>>k;

	for(int i=0;i<s.size();i++)

	{

		for(int j=1;j<=5;j++)

		{

			if(i+j>s.size())

			{

				break;

			}

			ss.insert(s.substr( i,j ));

		}

	}

	for(set<string>::iterator it=ss.begin();it!=ss.end();it++)

	{

		v.push_back(*it);

	}

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

	cout<<v[k-1]<<endl;

	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

typedef pair<int, int> pii;

typedef pair<double,int> pdi;

const int N = 50005;

string str[N];

int main()

{

    string a;

    cin >> a;

    int k, cnt = 0;

    scanf("%d",&k);

    int siz = a.size();

    int mini;

    for(int i= 0; i < siz;i++)

    {

        str[++cnt] = a[i];

        mini =min(k,siz-i);

        for(int j = 1 + i; j < mini + i; j ++,cnt++)

            str[cnt + 1] = str[cnt] + a[j];

    }

    sort(str + 1, str + cnt + 1);

    unique(str + 1, str + cnt + 1);

    cout<< str[k] <<endl;

    return 0;

}
















// Faster C++ solution for the same problem (measured speedup: 2.6073727803866986x):
#include<bits/stdc++.h>

using namespace std;

string s;

int k;

vector<string>v;

set<string>ss;

int main()

{

	cin>>s>>k;

	for(int i=0;i<s.size();i++)

	{

		for(int j=1;j<=5;j++)

		{

			if(i+j>s.size())

			{

				break;

			}

			ss.insert(s.substr( i,j ));

		}

	}

	for(set<string>::iterator it=ss.begin();it!=ss.end();it++)

	{

		v.push_back(*it);

	}

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

	cout<<v[k-1]<<endl;

	return 0;

}
// Slower C++ solution:
#include<cstdio>

#include<cstring>

#include<cmath>

#include<algorithm>

#include<queue>

#include<stack>

#include<vector>

#include<set>

#include<map>

#include<iostream>

using namespace std;

int k,tol=0,cnt=0;

char ch;

string s,p[30000],ans,note[5001];

int main(){

	while(1){

		scanf("%c",&ch);

		if(ch=='\n') break;

		tol++;

		for(int i=1;i<=tol;i++){

			if(tol-i+1<=5){

			    note[i]+=ch;

			    p[++cnt]=note[i];

			}

		}

	}scanf("%d",&k);

	sort(p+1,p+1+cnt);unique(p+1,p+1+cnt);

	cout<<p[k];

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 2.107375707965675x):
#include<bits/stdc++.h>

using namespace std;

string s;

int k;

vector<string>v;

set<string>ss;

int main()

{

	cin>>s>>k;

	for(int i=0;i<s.size();i++)

	{

		for(int j=1;j<=5;j++)

		{

			if(i+j>s.size())

			{

				break;

			}

			ss.insert(s.substr( i,j ));

		}

	}

	for(set<string>::iterator it=ss.begin();it!=ss.end();it++)

	{

		v.push_back(*it);

	}

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

	cout<<v[k-1]<<endl;

	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

#define ll long long

using namespace std;

const int maxn=5005;

string ch[maxn*6];

char s[maxn];

int n,k,cnt;

int main(){

    scanf("%s%d",s,&k),n=strlen(s);

    for(int i=0,T;i<n;i++){

        ch[++cnt]=s[i];

        T=min(k,n-i);

        for(int j=1;j<T;j++,cnt++) ch[cnt+1]=ch[cnt]+s[i+j];

    }

     

    sort(ch+1,ch+cnt+1);

    unique(ch+1,ch+cnt+1);

    cout<<ch[k]<<endl;

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.9548340243466293x):
#include<bits/stdc++.h>

using namespace std;

string s;

int k;

vector<string>v;

set<string>ss;

int main()

{

	cin>>s>>k;

	for(int i=0;i<s.size();i++)

	{

		for(int j=1;j<=5;j++)

		{

			if(i+j>s.size())

			{

				break;

			}

			ss.insert(s.substr( i,j ));

		}

	}

	for(set<string>::iterator it=ss.begin();it!=ss.end();it++)

	{

		v.push_back(*it);

	}

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

	cout<<v[k-1]<<endl;

	return 0;

}
// Slower C++ solution:
#include <iostream>

#include <algorithm>

using namespace std;



int main() {

	string s;

	int K;

	cin >> s >> K;

	string line[25005];

	int k = 0;

	for (int i = 0; i < s.length(); i++) {

		for (int j = 1; j <= 5; j++) {

			if (i + j <= s.length()) {

				line[k] = s.substr(i, j);

				k++;

			} else {

				break;

			}

		}

	}



	sort(line, line + k);

	s = line[0];

	int num = 1;

	if (K != 1) {

		for (int i = 1; i < k; i++) {

		if (line[i] != s) {

			s = line[i];

			num++;

			if (num == K)

				break;	

		}

	}

	}

	

	cout << s << endl;

}

// Faster C++ solution for the same problem (measured speedup: 1.809213447666085x):
#include <iostream>

#include <fstream>

#include <cmath>

#include <algorithm>

#include <vector>

#include <set>

#include <map>

#include <stack>

#include <queue>

#include <cstdlib>

#include <cstdio>

#include <string>

#include <cstring>

#include <cassert>

#include <utility>

#include <iomanip>

#include <chrono>

#include <random>

#include <bitset>



using namespace std;



#define sz(x) (int) x.size()

#define unique(x) x.erase(unique(x.begin(), x.end()), x.end())

#define all(a) a.begin(), a.end()

#define sqr(x) ((x) * (x)) 

#define y1 aksjdaskdjksjfksdjf

#define left kdnvldvoiwejifejg

#define right lkdsjflksdjfdjfk

#define prev asdasfsadjkjsdfjs

#define tm aklsjdasjdasjdkdjjf

#define lcm hddalkwjeidjjhasda

#define random_shuffle asdasdd



string s;

int k;

set <string> st;



int main() { 



  getline(cin, s);

  cin >> k;



  for (int i = 0; i < sz(s); i++) {

    for (int j = i; j < min(i + 5, sz(s)); j++) {

      string cur = s.substr(i, j - i + 1);

      st.insert(cur);

      if (sz(st) > k) {

        st.erase(*st.rbegin());

      }

    }

  }



  cout << *st.rbegin() << endl;



  return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

typedef pair<int, int> pii;

typedef pair<double,int> pdi;

const int N = 50005;

string str[N];

int main()

{

    string a;

    cin >> a;

    int k, cnt = 0;

    scanf("%d",&k);

    int siz = a.size();

    int mini;

    for(int i= 0; i < siz;i++)

    {

        str[++cnt] = a[i];

        mini =min(k,siz-i);

        for(int j = 1 + i; j < mini + i; j ++,cnt++)

            str[cnt + 1] = str[cnt] + a[j];

    }

    sort(str + 1, str + cnt + 1);

    unique(str + 1, str + cnt + 1);

    cout<< str[k] <<endl;

    return 0;

}
















// Faster C++ solution for the same problem (measured speedup: 2.6277150065679185x):
#include <iostream>

#include <fstream>

#include <cmath>

#include <algorithm>

#include <vector>

#include <set>

#include <map>

#include <stack>

#include <queue>

#include <cstdlib>

#include <cstdio>

#include <string>

#include <cstring>

#include <cassert>

#include <utility>

#include <iomanip>

#include <chrono>

#include <random>

#include <bitset>



using namespace std;



#define sz(x) (int) x.size()

#define unique(x) x.erase(unique(x.begin(), x.end()), x.end())

#define all(a) a.begin(), a.end()

#define sqr(x) ((x) * (x)) 

#define y1 aksjdaskdjksjfksdjf

#define left kdnvldvoiwejifejg

#define right lkdsjflksdjfdjfk

#define prev asdasfsadjkjsdfjs

#define tm aklsjdasjdasjdkdjjf

#define lcm hddalkwjeidjjhasda

#define random_shuffle asdasdd



string s;

int k;

set <string> st;



int main() { 



  getline(cin, s);

  cin >> k;



  for (int i = 0; i < sz(s); i++) {

    for (int j = i; j < min(i + 5, sz(s)); j++) {

      string cur = s.substr(i, j - i + 1);

      st.insert(cur);

      if (sz(st) > k) {

        st.erase(*st.rbegin());

      }

    }

  }



  cout << *st.rbegin() << endl;



  return 0;

}
// Slower C++ solution:
#include<cstdio>

#include<cstring>

#include<cmath>

#include<algorithm>

#include<queue>

#include<stack>

#include<vector>

#include<set>

#include<map>

#include<iostream>

using namespace std;

int k,tol=0,cnt=0;

char ch;

string s,p[30000],ans,note[5001];

int main(){

	while(1){

		scanf("%c",&ch);

		if(ch=='\n') break;

		tol++;

		for(int i=1;i<=tol;i++){

			if(tol-i+1<=5){

			    note[i]+=ch;

			    p[++cnt]=note[i];

			}

		}

	}scanf("%d",&k);

	sort(p+1,p+1+cnt);unique(p+1,p+1+cnt);

	cout<<p[k];

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 2.12381705215041x):
#include <iostream>

#include <fstream>

#include <cmath>

#include <algorithm>

#include <vector>

#include <set>

#include <map>

#include <stack>

#include <queue>

#include <cstdlib>

#include <cstdio>

#include <string>

#include <cstring>

#include <cassert>

#include <utility>

#include <iomanip>

#include <chrono>

#include <random>

#include <bitset>



using namespace std;



#define sz(x) (int) x.size()

#define unique(x) x.erase(unique(x.begin(), x.end()), x.end())

#define all(a) a.begin(), a.end()

#define sqr(x) ((x) * (x)) 

#define y1 aksjdaskdjksjfksdjf

#define left kdnvldvoiwejifejg

#define right lkdsjflksdjfdjfk

#define prev asdasfsadjkjsdfjs

#define tm aklsjdasjdasjdkdjjf

#define lcm hddalkwjeidjjhasda

#define random_shuffle asdasdd



string s;

int k;

set <string> st;



int main() { 



  getline(cin, s);

  cin >> k;



  for (int i = 0; i < sz(s); i++) {

    for (int j = i; j < min(i + 5, sz(s)); j++) {

      string cur = s.substr(i, j - i + 1);

      st.insert(cur);

      if (sz(st) > k) {

        st.erase(*st.rbegin());

      }

    }

  }



  cout << *st.rbegin() << endl;



  return 0;

}