stablegradients/pie-gem5-bysrc huggingface dataset:
// Original C++ solution (slower):
#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;

}

// Optimized solution to the same problem (faster):
#include <cstdio>

#include <algorithm>

using namespace std;

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 n,ri,le;

	int i,j;

	le=ri=0;

	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].r,le+=a[i].l;

	}

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

	else puts("Yes");

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;  

} 

// Optimized solution to the same problem (faster):
#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;

}//

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}


// Optimized solution to the same problem (faster):
#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;

}//

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}

// Optimized solution to the same problem (faster):
#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;

}//

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}


// Optimized solution to the same problem (faster):
#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;

}//

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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];

}


// Optimized solution to the same problem (faster):
#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;

}//

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}


// Optimized solution to the same problem (faster):
#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;

}//

// Fastest known solution for this problem:
// Original C++ solution (slower):


#include<bits/stdc++.h>

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

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

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

#define debug(x) cout << #x << " => " << x << endl

using namespace std;



#define fi first

#define se second

#define mp make_pair

typedef pair<int,int> pii;



#define pb push_back

typedef vector<int> vi;



typedef long long ll;

typedef long double ld;



const int MAX_N = 7 + 100;

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

string str[MAX_N]; 

int main() {



	///read

	int n,l; cin>>n>>l;

	rep(i,0,n) cin>>str[i];



	///prework

	sort(str, str+n);



	///print

	rep(i,0,n) cout << str[i];



}


// Optimized solution to the same problem (faster):
#include<cstdio>

#include<cstring>

#include<algorithm>

using namespace std;

struct edge

{

	char a[120];

	int x;

};

int main(void)

{

	int n, l, i, j;

	edge s[300];

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

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

	{

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

	}

	edge r;

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

	{

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

		{

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

			{

				r = s[i];

				s[i] = s[j];

				s[j] = r;

			}

		}

	}

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

	{

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

	}

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<algorithm>

#include <stdio.h>

#include <string.h>

#include <map>

using namespace std;

int N,L;

int main()

{

    cin>>N>>L;

    string a[N];

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

    {

        cin>>a[i];

    }

    sort(a,a+N);

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

    {

        cout<<a[i];

    }

return 0;

}


// Optimized solution to the same problem (faster):
#include<cstdio>

#include<cstring>

#include<algorithm>

using namespace std;

struct edge

{

	char a[120];

	int x;

};

int main(void)

{

	int n, l, i, j;

	edge s[300];

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

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

	{

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

	}

	edge r;

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

	{

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

		{

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

			{

				r = s[i];

				s[i] = s[j];

				s[j] = r;

			}

		}

	}

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

	{

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

	}

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<cstdio>

#include<cstring>

#include<cstdlib>

#include<algorithm>

using namespace std;

string str[110];

int main()

{

    int N,L,i,flag=0;

    scanf("%d%d",&N,&L);

    getchar();

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

        cin >> str[i];

   sort(str,str+N);

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

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

    cout << str[i];

    return 0;

}

// Optimized solution to the same problem (faster):
#include<cstdio>

#include<cstring>

#include<algorithm>

using namespace std;

struct edge

{

	char a[120];

	int x;

};

int main(void)

{

	int n, l, i, j;

	edge s[300];

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

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

	{

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

	}

	edge r;

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

	{

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

		{

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

			{

				r = s[i];

				s[i] = s[j];

				s[j] = r;

			}

		}

	}

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

	{

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

	}

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <cstdlib>

#include <cstring>

#include <stdio.h>

using namespace std;



struct Str {

	char s[105];

}str[100];



int cmp(const void *a, const void *b) {

	const struct Str *p1 = (const struct Str*)a;

	const struct Str *p2 = (const struct Str*)b;

	return strcmp(p1->s, p2->s);



}



int main() {

	int n, l;

	cin >> n >> l;

	getchar();

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

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

        getchar();

	}

	qsort(str, n, sizeof(Str), cmp);

	for (int i = 0; i < n; i++) printf("%s",str[i].s);

	return 0;

}


// Optimized solution to the same problem (faster):
#include<cstdio>

#include<cstring>

#include<algorithm>

using namespace std;

struct edge

{

	char a[120];

	int x;

};

int main(void)

{

	int n, l, i, j;

	edge s[300];

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

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

	{

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

	}

	edge r;

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

	{

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

		{

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

			{

				r = s[i];

				s[i] = s[j];

				s[j] = r;

			}

		}

	}

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

	{

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

	}

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<cstdio>

#include<cstring>

#include<string>

#include<algorithm>

using namespace std;



char str[1005];  

int n,hsh[30],cnt,len; 



bool cmp(string a,string b){

	return a < b;

}



int main()  

{  

    string str[100];

    int N,M;

    cin >> N >> M;

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

    	cin >> str[i];

	}

	sort(str,str+N,cmp);

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

		cout << str[i];

	}

	cout << endl;

    return 0;  

}  

// Optimized solution to the same problem (faster):
#include<cstdio>

#include<cstring>

#include<algorithm>

using namespace std;

struct edge

{

	char a[120];

	int x;

};

int main(void)

{

	int n, l, i, j;

	edge s[300];

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

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

	{

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

	}

	edge r;

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

	{

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

		{

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

			{

				r = s[i];

				s[i] = s[j];

				s[j] = r;

			}

		}

	}

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

	{

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

	}

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
    #include<iostream>

    #include<cstdio>

    #include<cstring>

    #include<algorithm>

    using namespace std;



    struct node

    {

        char st[101];

    }a[100];

    bool cmp(node s1,node s2)

    {

        return strcmp(s1.st,s2.st)<0;

    }



    int main()

    {

        int n,l;

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

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

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

        }

        sort(a,a+n,cmp);

        for(int i=0;i<n;i++) printf("%s",a[i].st);

        return 0;

    }


// Optimized solution to the same problem (faster):
#include<cstdio>

#include<cstring>

#include<algorithm>

using namespace std;

struct edge

{

	char a[120];

	int x;

};

int main(void)

{

	int n, l, i, j;

	edge s[300];

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

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

	{

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

	}

	edge r;

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

	{

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

		{

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

			{

				r = s[i];

				s[i] = s[j];

				s[j] = r;

			}

		}

	}

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

	{

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

	}

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<algorithm>

#include<string.h>

#include<stdio.h>

using namespace std;

struct node

{

    char a[104];

}st[200];

bool cmp(node s1,node s2)

{

    return strcmp(s1.a,s2.a)<0;

}

int main()

{

    int n,l;

    while(cin>>n>>l)

    {

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

        {

                cin>>st[i].a;

        }

        sort(st+1,st+1+n,cmp);

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

         {

                cout<<st[i].a;

        }

        cout<<endl;

    }

}


// Optimized solution to the same problem (faster):
#include<cstdio>

#include<cstring>

#include<algorithm>

using namespace std;

struct edge

{

	char a[120];

	int x;

};

int main(void)

{

	int n, l, i, j;

	edge s[300];

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

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

	{

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

	}

	edge r;

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

	{

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

		{

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

			{

				r = s[i];

				s[i] = s[j];

				s[j] = r;

			}

		}

	}

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

	{

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

	}

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):


#include <bits/stdc++.h> 

using namespace std; 



string s[10000];



bool compare( string a, string b)

{

	return a+b < b+a ;

}





int main()

{

	int n,l; cin>>n>>l;



	

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

	cin>>s[i];

	

	sort( s, s+n ,compare);

//	sort(s, s+n) ;

	

	string ans="";

	

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

	ans= ans + s[i];

	

	cout<<ans<<endl;

	

}

// Optimized solution to the same problem (faster):
#include<iostream>

#include<vector>

#include<algorithm>

using namespace std;

int main()

{

    int n,l,i;



    cin >> n >> l;



    vector<string>s(n);



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

        cin >> s[i];



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



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

        cout << s[i];



    cout << endl;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

int  main (){

  string a[105][105];

  int n,l;

  cin>>n>>l;

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

    cin>>a[0][i];

  }

  sort(a[0],a[0]+n);

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

    cout<<a[0][i];

  }

  cout<<"\n";

  return(0);

}



  


// Optimized solution to the same problem (faster):
#include<bits/stdc++.h>

using namespace std;

int  main (){

  string a[105];

  int n,l;

  cin>>n>>l;

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

    cin>>a[i];

  }

  sort(a,a+n);

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

    cout<<a[i];

  }

  cout<<"\n";

  return(0);

}



  

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<cstdio>

#include<string>

#include<algorithm>

using namespace std;

int read(){

    int f=1,x=0;

    char ch;

    do{ch=getchar();if(ch=='0')f=-1;}while(ch<'0'||ch>'9');

    do{x=x*10+ch-'0';ch=getchar();}while(ch>='0'&&ch<='9');

    return f*x;

}



string s[10001];

int n,l;

int main(){

    n=read();

    l=read();

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

    cin>>s[i];

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

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

    cout<<s[i];

    return 0;

}

// Optimized solution to the same problem (faster):
#include<bits/stdc++.h>

using namespace std;

template<typename T>inline void read(T &x){

	short f=1;x=0;char c=getchar();

	while(!isdigit(c)){ if(c=='-')f=-1;c=getchar(); }

	while(isdigit(c)) x=(x<<3)+(x<<1)+(c^48),c=getchar();

	x*=f;

}

template<typename T>inline void write(T x){

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

	if(x>9)write(x/10);

	putchar(x%10+'0');

}

template<typename T>inline void writeln(T x){

	write(x);putchar('\n');

}

int main(){

	int n,l;

	string s[110];

	read(n),read(l);

	for(int i=1;i<=n;i++)cin>>s[i];

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

	for(int i=1;i<=n;i++)cout<<s[i];

	putchar('\n');

	return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<iomanip>

#include<cstring>

#include<cstdio>

#include<cmath>

#include<algorithm>

using namespace std;

int main()

{  int n,l;

   string a[10005];

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

   for(int i=1;i<=n;i++)cin>>a[i];

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

   for(int i=1;i<=n;i++)cout<<a[i];

   return 0;

}

// Optimized solution to the same problem (faster):
#include<bits/stdc++.h>

using namespace std;

template<typename T>inline void read(T &x){

	short f=1;x=0;char c=getchar();

	while(!isdigit(c)){ if(c=='-')f=-1;c=getchar(); }

	while(isdigit(c)) x=(x<<3)+(x<<1)+(c^48),c=getchar();

	x*=f;

}

template<typename T>inline void write(T x){

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

	if(x>9)write(x/10);

	putchar(x%10+'0');

}

template<typename T>inline void writeln(T x){

	write(x);putchar('\n');

}

int main(){

	int n,l;

	string s[110];

	read(n),read(l);

	for(int i=1;i<=n;i++)cin>>s[i];

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

	for(int i=1;i<=n;i++)cout<<s[i];

	putchar('\n');

	return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<algorithm>

#include<cstring>

#include<cmath>

#include<queue>

using namespace std;

int main()

{    

	int n,m;

	cin>>n>>m;

	string a[10001];

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

		cin>>a[i];

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

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

	{

		cout<<a[i];

	}

    cout<<endl;

	return 0;

}




// Optimized solution to the same problem (faster):
#include<iostream>

#include<string>

#include<algorithm>

using namespace std;

int main()

{

	string s[109];

	int n,l;

	cin>>n>>l;

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

		cin>>s[i];

	sort(s,s+n);

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

		cout<<s[i];

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>



using namespace std;



int main()

{

    int n, l;

    vector<string> string_vector;

    string s;

    cin >> n >> l;

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

       cin >> s;

       string_vector.push_back(s);



    }

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

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

        cout << string_vector[i];

    }

    return 0;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<string.h>

char str[101][101];

char k[101];

int main()

{

	int i,j,m,n;

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

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

	{

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

	}

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

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

		{

			if (strcmp(str[i],str[i+1])>0)

			{

				strcpy(k,str[i]);

				strcpy(str[i],str[i+1]);

				strcpy(str[i+1],k);

			}

		}

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

		{

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

		}

		return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;



#define getn int n; cin >> n

#define fori(n) for (int i = 0; i < (n); i++)

#define forj(n) for (int j = 0; j < (n); j++)

#define forifill(n,x) for (int i = 0; i < (n); i++) cin >> x[i]

#define foriprint(n,x,sep) for (int i = 0; i < (n); i++) cout << x[i] << sep;

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

#define allr(x) (x).rbegin(), (x).rend()

#define unsync cin.sync_with_stdio(false), cin.tie(0)

#define inoutfile freopen("d:\\testcase.txt", "r", stdin);freopen("d:\\output.txt", "w", stdout)



typedef unsigned long long lng;





int main()

{

	unsync;



	int n, l;

	cin >> n >> l;

	string x[105];

	forifill(n, x);

	sort(x, x + n);

	foriprint(n, x, "");

	cout << "\n";

}


// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<string.h>

char str[101][101];

char k[101];

int main()

{

	int i,j,m,n;

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

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

	{

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

	}

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

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

		{

			if (strcmp(str[i],str[i+1])>0)

			{

				strcpy(k,str[i]);

				strcpy(str[i],str[i+1]);

				strcpy(str[i+1],k);

			}

		}

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

		{

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

		}

		return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <cstdio>

#include <string.h>

#include <iostream>

using namespace std;

int main()

{

	char st[1001][101],te[101];

	int n,l,i,ii;

	cin>>n>>l;

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

	cin>>st[i];

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

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

		if(strcmp(st[ii],st[ii+1])>0)

		{

			strcpy(te,st[ii]);

			strcpy(st[ii],st[ii+1]);

			strcpy(st[ii+1],te);

		}

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

		cout<<st[i];

		return 0;

}

		

// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<string.h>

char str[101][101];

char k[101];

int main()

{

	int i,j,m,n;

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

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

	{

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

	}

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

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

		{

			if (strcmp(str[i],str[i+1])>0)

			{

				strcpy(k,str[i]);

				strcpy(str[i],str[i+1]);

				strcpy(str[i+1],k);

			}

		}

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

		{

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

		}

		return 0;

}

// Fastest known solution for this problem: