stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

ll read(){

	ll a=0,b=getchar(),c=1;

	while(!isdigit(b))c=b=='-'?-1:1,b=getchar();

	while(isdigit(b))a=a*10+b-'0',b=getchar();

	return a*c;

}

const ll mod=998244353;

ll n,ri,le,s0,f[1000005];

struct node{

	int x,y;

	bool operator<(node b)const{

		return x-y>b.x-b.y;

	}

}a[1000005];

char s[1000005];

int main(){

	n=read();

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

		ll l=0,r=0;

		scanf("%s",s+1);

		for(int j=1;s[j];j++)

			if(s[j]=='(')l++;

			else{

				if(l)l--;

				else r++;

			}

		if(!l and r)ri+=r;

		else if(l and !r)le+=l;

		else a[i]=(node){l,r};	

		s0+=l-r;

	}

	if(s0!=0)return puts("No"),0;

	sort(a+1,a+1+n);

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

		if(le<a[i].y)

			return puts("No"),0;

		le-=a[i].y-a[i].x;

	}

	if(le!=ri)puts("No");

	else puts("Yes");

	return 0;

}

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

#include <algorithm>

#define maxn 1000010

using namespace std;

char s[maxn];

struct node{

	int l,r;

}a[maxn];

int tot;

int cmp(node a,node b){

	return a.l-a.r>b.l-b.r;

}

int main(){

	int n,i,j,l,r,ln,rn;

	ln=rn=0;

	scanf("%d",&n);

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

		l=r=0;

		scanf("%s",s+1);

		for(j=1;s[j];j++){

			if(s[j]=='(')l++;

			else if(s[j]==')'){

				if(l)l--;

				else r++;

			}

		}

		if(l&&!r)ln+=l;

		else if(!l&&r)rn+=r;

		else if(l&&r) a[++tot]=(node){l,r};

	}

	sort(a+1,a+1+tot,cmp);

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

		if(ln<a[i].r)return printf("No\n"),0;

		else ln-=a[i].r,ln+=a[i].l;

	if(ln!=rn)return printf("No\n"),0;

	printf("Yes\n");

	return 0;

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

using namespace std;

typedef int ll;

ll read(){

	ll a=0,b=getchar(),c=1;

	while(!isdigit(b))c=b=='-'?-1:1,b=getchar();

	while(isdigit(b))a=a*10+b-'0',b=getchar();

	return a*c;

}

const ll mod=998244353;

ll n,ri,le,s0,f[1000005];

struct node{

	int x,y;

	bool operator<(node b)const{

		return x-y>b.x-b.y;

	}

}a[1000005];

char s[1000005];

int main(){

	n=read();

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

		ll l=0,r=0;

		scanf("%s",s+1);

		for(int j=1;s[j];j++)

			if(s[j]=='(')l++;

			else{

				if(l)l--;

				else r++;

			}

		if(!l and r)ri+=r;

		else if(l and !r)le+=l;

		else a[i]=(node){l,r};	

		s0+=l-r;

	}

	if(s0!=0)return puts("No"),0;

	sort(a+1,a+1+n);

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

		if(le<a[i].y)

			return puts("No"),0;

		le-=a[i].y-a[i].x;

	}

	if(le!=ri)puts("No");

	else puts("Yes");

	return 0;

}

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

#include <algorithm>

#define maxn 1000010

using namespace std;

char s[maxn];

struct node{

	int l,r;

}a[maxn];

int tot;

int cmp(node a,node b){

	return a.l-a.r>b.l-b.r;

}

int main(){

	int n,i,j,l,r,ln,rn;

	ln=rn=0;

	scanf("%d",&n);

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

		l=r=0;

		scanf("%s",s+1);

		for(j=1;s[j];j++){

			if(s[j]=='(')l++;

			else if(s[j]==')'){

				if(l)l--;

				else r++;

			}

		}

		if(l&&!r)ln+=l;

		else if(!l&&r)rn+=r;

		else if(l&&r) a[++tot]=(node){l,r};

	}

	sort(a+1,a+1+tot,cmp);

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

		if(ln<a[i].r)return printf("No\n"),0;

		else ln-=a[i].r,ln+=a[i].l;

	if(ln!=rn)return printf("No\n"),0;

	printf("Yes\n");

	return 0;

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

using namespace std;

typedef int ll;

ll read(){

	ll a=0,b=getchar(),c=1;

	while(!isdigit(b))c=b=='-'?-1:1,b=getchar();

	while(isdigit(b))a=a*10+b-'0',b=getchar();

	return a*c;

}

const ll mod=998244353;

ll n,ri,le,s0,f[1000005];

struct node{

	int x,y;

	/*bool operator<(node b)const{

		return x-y>b.x-b.y;

	}*/

}a[1000005];

int tot;

char s[1000005];

int cmp(node a,node b){

	return a.x-a.y>b.x-b.y;

}

int main(){

	n=read();

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

		ll l=0,r=0;

		scanf("%s",s+1);

		for(int j=1;s[j];j++)

			if(s[j]=='(')l++;

			else{

				if(l)l--;

				else r++;

			}

		if(!l&&r)ri+=r;

		else if(l&&!r)le+=l;

		else if(l&&r)a[++tot]=(node){l,r};	

		//s0+=l-r;

	}

	//if(s0!=0)return puts("No"),0;

	sort(a+1,a+1+tot,cmp);

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

		if(le<a[i].y)

			return puts("No"),0;

		le-=a[i].y-a[i].x;

	}

	if(le!=ri)puts("No");

	else puts("Yes");

	return 0;

}

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

#include <algorithm>

#define maxn 1000010

using namespace std;

char s[maxn];

struct node{

	int l,r;

}a[maxn];

int tot;

int cmp(node a,node b){

	return a.l-a.r>b.l-b.r;

}

int main(){

	int n,i,j,l,r,ln,rn;

	ln=rn=0;

	scanf("%d",&n);

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

		l=r=0;

		scanf("%s",s+1);

		for(j=1;s[j];j++){

			if(s[j]=='(')l++;

			else if(s[j]==')'){

				if(l)l--;

				else r++;

			}

		}

		if(l&&!r)ln+=l;

		else if(!l&&r)rn+=r;

		else if(l&&r) a[++tot]=(node){l,r};

	}

	sort(a+1,a+1+tot,cmp);

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

		if(ln<a[i].r)return printf("No\n"),0;

		else ln-=a[i].r,ln+=a[i].l;

	if(ln!=rn)return printf("No\n"),0;

	printf("Yes\n");

	return 0;

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

using namespace std;

typedef int ll;

ll read(){

	ll a=0,b=getchar(),c=1;

	while(!isdigit(b))c=b=='-'?-1:1,b=getchar();

	while(isdigit(b))a=a*10+b-'0',b=getchar();

	return a*c;

}

const ll mod=998244353;

ll n,ri,le,s0,f[1000005];

struct node{

	int x,y;

	/*bool operator<(node b)const{

		return x-y>b.x-b.y;

	}*/

}a[1000005];

int tot;

char s[1000005];

int cmp(node a,node b){

	return a.x-a.y>b.x-b.y;

}

int main(){

	//n=read();

	scanf("%d",&n);

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

		ll l=0,r=0;

		scanf("%s",s+1);

		for(int j=1;s[j];j++)

			if(s[j]=='(')l++;

			else if(s[j]==')'){

				if(l)l--;

				else r++;

			}

		if(!l&&r)ri+=r;

		else if(l&&!r)le+=l;

		else if(l&&r)a[++tot]=(node){l,r};	

		//s0+=l-r;

	}

	//if(s0!=0)return puts("No"),0;

	sort(a+1,a+1+tot,cmp);

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

		if(le<a[i].y)

			return puts("No"),0;

		le-=a[i].y-a[i].x;

	}

	if(le!=ri)puts("No");

	else puts("Yes");

	return 0;

}

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

#include <algorithm>

#define maxn 1000010

using namespace std;

char s[maxn];

struct node{

	int l,r;

}a[maxn];

int tot;

int cmp(node a,node b){

	return a.l-a.r>b.l-b.r;

}

int main(){

	int n,i,j,l,r,ln,rn;

	ln=rn=0;

	scanf("%d",&n);

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

		l=r=0;

		scanf("%s",s+1);

		for(j=1;s[j];j++){

			if(s[j]=='(')l++;

			else if(s[j]==')'){

				if(l)l--;

				else r++;

			}

		}

		if(l&&!r)ln+=l;

		else if(!l&&r)rn+=r;

		else if(l&&r) a[++tot]=(node){l,r};

	}

	sort(a+1,a+1+tot,cmp);

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

		if(ln<a[i].r)return printf("No\n"),0;

		else ln-=a[i].r,ln+=a[i].l;

	if(ln!=rn)return printf("No\n"),0;

	printf("Yes\n");

	return 0;

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

using namespace std;

int n,ri,le;

struct node{

	int x,y;

}a[1000005];

int tot;

char s[1000005];

int cmp(node a,node b){

	return a.x-a.y>b.x-b.y;

}

int main(){

	//n=read();

	int i,j;

	scanf("%d",&n);

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

		int l=0,r=0;

		scanf("%s",s+1);

		for(j=1;s[j];j++)

			if(s[j]=='(')l++;

			else if(s[j]==')'){

				if(l)l--;

				else r++;

			}

		if(!l&&r)ri+=r;

		else if(l&&!r)le+=l;

		else if(l&&r)a[++tot]=(node){l,r};	

	}

	sort(a+1,a+1+tot,cmp);

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

		if(le<a[i].y)

			return puts("No"),0;

		le-=a[i].y-a[i].x;

	}

	if(le!=ri)puts("No");

	else puts("Yes");

	return 0;

}

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

#include <algorithm>

#define maxn 1000010

using namespace std;

char s[maxn];

struct node{

	int l,r;

}a[maxn];

int tot;

int cmp(node a,node b){

	return a.l-a.r>b.l-b.r;

}

int main(){

	int n,i,j,l,r,ln,rn;

	ln=rn=0;

	scanf("%d",&n);

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

		l=r=0;

		scanf("%s",s+1);

		for(j=1;s[j];j++){

			if(s[j]=='(')l++;

			else if(s[j]==')'){

				if(l)l--;

				else r++;

			}

		}

		if(l&&!r)ln+=l;

		else if(!l&&r)rn+=r;

		else if(l&&r) a[++tot]=(node){l,r};

	}

	sort(a+1,a+1+tot,cmp);

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

		if(ln<a[i].r)return printf("No\n"),0;

		else ln-=a[i].r,ln+=a[i].l;

	if(ln!=rn)return printf("No\n"),0;

	printf("Yes\n");

	return 0;

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

using namespace std;

int n,ri,le;

struct node{

	int l,r;

}a[1000005];

int tot;

char s[1000005];

int cmp(node a,node b){

	return a.l-a.r>b.l-b.r;

}

int main(){

	int i,j;

	scanf("%d",&n);

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

		int l=0,r=0;

		scanf("%s",s+1);

		for(j=1;s[j];j++)

			if(s[j]=='(')l++;

			else if(s[j]==')'){

				if(l)l--;

				else r++;

			}

		if(!l&&r)ri+=r;

		else if(l&&!r)le+=l;

		else if(l&&r)a[++tot]=(node){l,r};	

	}

	sort(a+1,a+1+tot,cmp);

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

		if(le<a[i].r)

			return puts("No"),0;

		//le-=a[i].y-a[i].x;

		le-=a[i].r,le+=a[i].l;

	}

	if(le!=ri)puts("No");

	else puts("Yes");

	return 0;

}

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

#include <algorithm>

#define maxn 1000010

using namespace std;

char s[maxn];

struct node{

	int l,r;

}a[maxn];

int tot;

int cmp(node a,node b){

	return a.l-a.r>b.l-b.r;

}

int main(){

	int n,i,j,l,r,ln,rn;

	ln=rn=0;

	scanf("%d",&n);

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

		l=r=0;

		scanf("%s",s+1);

		for(j=1;s[j];j++){

			if(s[j]=='(')l++;

			else if(s[j]==')'){

				if(l)l--;

				else r++;

			}

		}

		if(l&&!r)ln+=l;

		else if(!l&&r)rn+=r;

		else if(l&&r) a[++tot]=(node){l,r};

	}

	sort(a+1,a+1+tot,cmp);

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

		if(ln<a[i].r)return printf("No\n"),0;

		else ln-=a[i].r,ln+=a[i].l;

	if(ln!=rn)return printf("No\n"),0;

	printf("Yes\n");

	return 0;

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

#include <algorithm>  

#include <cstring>   

  

using namespace std;  

  

bool cmp(string a,string b)  

{  

    return a<b;  

}  

  

int main()  

{  

    string s[100];

    int n,l;

	cin>>n>>l;  

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

        cin>>s[i];  

    sort(s,s+n,cmp);  

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

        cout<<s[i];

        cout<<endl;

    return 0;  

} 

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

#include<string.h>

int n,m,t;

	char a[105][105];

	char b[105]={"0"};

	char c[10005];

int main(){

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

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

	scanf("%s",a[i]);

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

	for(int j=0;j<n-1-i;j++)

	{

		t=strcmp(a[j],a[j+1]);

		if(t>0)

		{

		strcpy(b,a[j]);

		strcpy(a[j],a[j+1]);

		strcpy(a[j+1],b);

	     }

	}

	strcpy(c,a[0]);

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

	strcat(c,a[i]);

	printf("%s",c);

	return 0;

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

#include <iostream>

#include <algorithm>

#include <cstring>

#include <cmath>



using namespace std;



string ch[105];



bool cmp(string a,string b){

	return a<b;

}



int main(){

	int N,L;

	cin>>N>>L;

	for(int i=0 ; i<N ; i++)cin>>ch[i];

	sort(ch,ch+N,cmp);

	for(int i=0 ; i<N ; i++)cout<<ch[i];

	putchar('\n');

	return 0;

}


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

#include<string.h>

int n,m,t;

	char a[105][105];

	char b[105]={"0"};

	char c[10005];

int main(){

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

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

	scanf("%s",a[i]);

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

	for(int j=0;j<n-1-i;j++)

	{

		t=strcmp(a[j],a[j+1]);

		if(t>0)

		{

		strcpy(b,a[j]);

		strcpy(a[j],a[j+1]);

		strcpy(a[j+1],b);

	     }

	}

	strcpy(c,a[0]);

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

	strcat(c,a[i]);

	printf("%s",c);

	return 0;

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

using namespace std;



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

#define rall(cont) cont.end(), cont.begin()

#define mp make_pair

#define pb push_back

#define fs first

#define sc second

#define fr(i, a, b) for(int i = a ; i < b ; i++)

#define frr(i, a, b) for(int i = a ; i >= b ; i--)

#define tr(it, var) for(__typeof(var.begin()) it = var.begin(); it != var.end(); it++)

#define trr(rit, var) for(__typeof(var.rbegin()) rit = var.rbegin(); rit != var.rend(); rit++)

#define its(x) static_cast< ostringstream & >( ( ostringstream() << dec << x ) ).str() // int to string

#define fill1(a, c, x) fr(_I, 0, (c)) (a)[_I] = (x)

#define fill2(a, r, c, x) fr(_I, 0, (r)) fr(_J, 0, (c)) (a)[_I][_J] = (x)

#define boost ios_base::sync_with_stdio(false)

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

#define deb(x) cout << #x" = " << x << '\n';

#define dist(x1, y1, x2, y2) sqrt((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1))



typedef long long ll;

typedef unsigned long long ull;

typedef pair<int, int> pii;

typedef vector<int> vi;





int main() {

//    freopen("input.in", "r", stdin);

	int n, l;

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

	vector<string> res;

	res.reserve(1234);

	fr(i, 0, n) {

		string vie;

		cin >> vie;

		res.pb(vie);

	}

	sort(all(res));

	tr(it, res) cout << *it;

	cout << '\n';

	return 0;

}

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

#include<string.h>

int n,m,t;

	char a[105][105];

	char b[105]={"0"};

	char c[10005];

int main(){

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

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

	scanf("%s",a[i]);

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

	for(int j=0;j<n-1-i;j++)

	{

		t=strcmp(a[j],a[j+1]);

		if(t>0)

		{

		strcpy(b,a[j]);

		strcpy(a[j],a[j+1]);

		strcpy(a[j+1],b);

	     }

	}

	strcpy(c,a[0]);

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

	strcat(c,a[i]);

	printf("%s",c);

	return 0;

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

#include <algorithm>

#include <stdio.h>

#include <string.h>

using namespace std;

int main()

{

    int n,l,i,j;

    char a[105][105];

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

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

        scanf("%s",&a[i]);

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

    {

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

        {

            if(strcmp(a[i],a[j])>0)

            {

                char t[105];

                strcpy(t,a[i]);

                strcpy(a[i],a[j]);

                strcpy(a[j],t);

            }

        }

    }

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

    {

        printf("%s",a[i]);

    }

    printf("\n");

    return 0;

}


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

#include<string.h>

int n,m,t;

	char a[105][105];

	char b[105]={"0"};

	char c[10005];

int main(){

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

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

	scanf("%s",a[i]);

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

	for(int j=0;j<n-1-i;j++)

	{

		t=strcmp(a[j],a[j+1]);

		if(t>0)

		{

		strcpy(b,a[j]);

		strcpy(a[j],a[j+1]);

		strcpy(a[j+1],b);

	     }

	}

	strcpy(c,a[0]);

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

	strcat(c,a[i]);

	printf("%s",c);

	return 0;

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

using namespace std;

int main()

{

 string s[103];

 int n,m;

 cin>>n>>m;

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

    cin>>s[i];

  sort(s+1,s+1+n);

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

    cout<<s[i];

}


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

#include<string.h>

int n,m,t;

	char a[105][105];

	char b[105]={"0"};

	char c[10005];

int main(){

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

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

	scanf("%s",a[i]);

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

	for(int j=0;j<n-1-i;j++)

	{

		t=strcmp(a[j],a[j+1]);

		if(t>0)

		{

		strcpy(b,a[j]);

		strcpy(a[j],a[j+1]);

		strcpy(a[j+1],b);

	     }

	}

	strcpy(c,a[0]);

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

	strcat(c,a[i]);

	printf("%s",c);

	return 0;

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

#include <cstdio>

#include <cstring>



using namespace std;



int n,m;

char s[102][101];

char c[101];



int main()

{

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

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

        scanf("%s",s[i]);

    for(int i=n-1;i>=1;i--)

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

        {

            if(strcmp(s[j+1],s[j])<0)

            {

                strcpy(c,s[j+1]);

                strcpy(s[j+1],s[j]);

                strcpy(s[j],c);

            }

        }

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

        printf("%s",s[i]);

    printf("\n");

    return 0;

}


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

#include<string.h>

int n,m,t;

	char a[105][105];

	char b[105]={"0"};

	char c[10005];

int main(){

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

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

	scanf("%s",a[i]);

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

	for(int j=0;j<n-1-i;j++)

	{

		t=strcmp(a[j],a[j+1]);

		if(t>0)

		{

		strcpy(b,a[j]);

		strcpy(a[j],a[j+1]);

		strcpy(a[j+1],b);

	     }

	}

	strcpy(c,a[0]);

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

	strcat(c,a[i]);

	printf("%s",c);

	return 0;

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

#include <algorithm>  

#include <cstring>   

  

using namespace std;  

  

bool cmp(string a,string b)  

{  

    return a<b;  

}  

  

int main()  

{  

    string s[100];

    int n,l;

	cin>>n>>l;  

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

        cin>>s[i];  

    sort(s,s+n,cmp);  

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

        cout<<s[i];

        cout<<endl;

    return 0;  

} 

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

#include<string.h>

int main()

{

    char s[200][200];

    int n,l,i,j;

    char a[300];

    while(~scanf("%d%d",&n,&l))

    {

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

            scanf("%s",s[i]);

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

            for(j=0;j<n-1-i;j++)

                if(strcmp(s[j],s[j+1])>0)

                {

                    strcpy(a,s[j]);

                    strcpy(s[j],s[j+1]);

                    strcpy(s[j+1],a);

                }

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

            printf("%s",s[i]);

        printf("\n");

    }

    return 0;

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

#include <iostream>

#include <algorithm>

#include <cstring>

#include <cmath>



using namespace std;



string ch[105];



bool cmp(string a,string b){

	return a<b;

}



int main(){

	int N,L;

	cin>>N>>L;

	for(int i=0 ; i<N ; i++)cin>>ch[i];

	sort(ch,ch+N,cmp);

	for(int i=0 ; i<N ; i++)cout<<ch[i];

	putchar('\n');

	return 0;

}


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

#include<string.h>

int main()

{

    char s[200][200];

    int n,l,i,j;

    char a[300];

    while(~scanf("%d%d",&n,&l))

    {

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

            scanf("%s",s[i]);

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

            for(j=0;j<n-1-i;j++)

                if(strcmp(s[j],s[j+1])>0)

                {

                    strcpy(a,s[j]);

                    strcpy(s[j],s[j+1]);

                    strcpy(s[j+1],a);

                }

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

            printf("%s",s[i]);

        printf("\n");

    }

    return 0;

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

using namespace std;



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

#define rall(cont) cont.end(), cont.begin()

#define mp make_pair

#define pb push_back

#define fs first

#define sc second

#define fr(i, a, b) for(int i = a ; i < b ; i++)

#define frr(i, a, b) for(int i = a ; i >= b ; i--)

#define tr(it, var) for(__typeof(var.begin()) it = var.begin(); it != var.end(); it++)

#define trr(rit, var) for(__typeof(var.rbegin()) rit = var.rbegin(); rit != var.rend(); rit++)

#define its(x) static_cast< ostringstream & >( ( ostringstream() << dec << x ) ).str() // int to string

#define fill1(a, c, x) fr(_I, 0, (c)) (a)[_I] = (x)

#define fill2(a, r, c, x) fr(_I, 0, (r)) fr(_J, 0, (c)) (a)[_I][_J] = (x)

#define boost ios_base::sync_with_stdio(false)

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

#define deb(x) cout << #x" = " << x << '\n';

#define dist(x1, y1, x2, y2) sqrt((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1))



typedef long long ll;

typedef unsigned long long ull;

typedef pair<int, int> pii;

typedef vector<int> vi;





int main() {

//    freopen("input.in", "r", stdin);

	int n, l;

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

	vector<string> res;

	res.reserve(1234);

	fr(i, 0, n) {

		string vie;

		cin >> vie;

		res.pb(vie);

	}

	sort(all(res));

	tr(it, res) cout << *it;

	cout << '\n';

	return 0;

}

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

#include<string.h>

int main()

{

    char s[200][200];

    int n,l,i,j;

    char a[300];

    while(~scanf("%d%d",&n,&l))

    {

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

            scanf("%s",s[i]);

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

            for(j=0;j<n-1-i;j++)

                if(strcmp(s[j],s[j+1])>0)

                {

                    strcpy(a,s[j]);

                    strcpy(s[j],s[j+1]);

                    strcpy(s[j+1],a);

                }

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

            printf("%s",s[i]);

        printf("\n");

    }

    return 0;

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

#include <algorithm>

#include <stdio.h>

#include <string.h>

using namespace std;

int main()

{

    int n,l,i,j;

    char a[105][105];

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

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

        scanf("%s",&a[i]);

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

    {

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

        {

            if(strcmp(a[i],a[j])>0)

            {

                char t[105];

                strcpy(t,a[i]);

                strcpy(a[i],a[j]);

                strcpy(a[j],t);

            }

        }

    }

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

    {

        printf("%s",a[i]);

    }

    printf("\n");

    return 0;

}


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

#include<string.h>

int main()

{

    char s[200][200];

    int n,l,i,j;

    char a[300];

    while(~scanf("%d%d",&n,&l))

    {

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

            scanf("%s",s[i]);

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

            for(j=0;j<n-1-i;j++)

                if(strcmp(s[j],s[j+1])>0)

                {

                    strcpy(a,s[j]);

                    strcpy(s[j],s[j+1]);

                    strcpy(s[j+1],a);

                }

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

            printf("%s",s[i]);

        printf("\n");

    }

    return 0;

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

using namespace std;

int main()

{

 string s[103];

 int n,m;

 cin>>n>>m;

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

    cin>>s[i];

  sort(s+1,s+1+n);

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

    cout<<s[i];

}


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

#include<string.h>

int main()

{

    char s[200][200];

    int n,l,i,j;

    char a[300];

    while(~scanf("%d%d",&n,&l))

    {

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

            scanf("%s",s[i]);

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

            for(j=0;j<n-1-i;j++)

                if(strcmp(s[j],s[j+1])>0)

                {

                    strcpy(a,s[j]);

                    strcpy(s[j],s[j+1]);

                    strcpy(s[j+1],a);

                }

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

            printf("%s",s[i]);

        printf("\n");

    }

    return 0;

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

#include <cstdio>

#include <cstring>



using namespace std;



int n,m;

char s[102][101];

char c[101];



int main()

{

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

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

        scanf("%s",s[i]);

    for(int i=n-1;i>=1;i--)

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

        {

            if(strcmp(s[j+1],s[j])<0)

            {

                strcpy(c,s[j+1]);

                strcpy(s[j+1],s[j]);

                strcpy(s[j],c);

            }

        }

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

        printf("%s",s[i]);

    printf("\n");

    return 0;

}


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

#include<string.h>

int main()

{

    char s[200][200];

    int n,l,i,j;

    char a[300];

    while(~scanf("%d%d",&n,&l))

    {

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

            scanf("%s",s[i]);

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

            for(j=0;j<n-1-i;j++)

                if(strcmp(s[j],s[j+1])>0)

                {

                    strcpy(a,s[j]);

                    strcpy(s[j],s[j+1]);

                    strcpy(s[j+1],a);

                }

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

            printf("%s",s[i]);

        printf("\n");

    }

    return 0;

}