semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
struct play
{
       char sex[10];
       double h; 
};

main()
{
      int n,i,j;
      double t; 
      scanf("%d",&n);
      struct play ab[n];
      for(int i=0;i<n;i++)
      {
              scanf("%s %lf",ab[i].sex,&ab[i].h); 
      } 
      int ma=0;
      int fe=0;
      double nan[50];
      double nv[50];
      for(i=0;i<50;i++)
      {
                       nan[i]=1.0;
                       nv[i]=1.0; 
      } 
      for(i=0;i<n;i++)
      {
                      if(strcmp(ab[i].sex,"male")==0)
                      {nan[ma]=ab[i].h;
                      ma++;}
                      if(strcmp(ab[i].sex,"female")==0)
                      { 
                      nv[fe]=ab[i].h;
                      fe++; 
                      }           
      } 
     
      
      for(j=0;j<ma-1;j++)
      {
                for(i=0;i<ma-1-j;i++)
                if(nan[i]>nan[i+1])
                {
                                   t=nan[i];
                                   nan[i]=nan[i+1];
                                   nan[i+1]=t; 
                }      
      }
        for(j=0;j<fe-1;j++)
      {
                for(i=0;i<fe-1-j;i++)
                if(nv[i]<nv[i+1])
                {
                                   t=nv[i];
                                   nv[i]=nv[i+1];
                                   nv[i+1]=t; 
                }      
      }
      for(i=0;i<ma;i++)
      printf("%.2lf ",nan[i]);
      for(i=0;i<fe-1;i++)
      printf("%.2lf ",nv[i]);
      printf("%.2lf",nv[fe-1]); 
      
       
}
double male[40];
double female[40];
int mk,fk;
void sor1(){
	int i,j,tmp;
	double min;
	for(i=0;i<mk;i++){
		min=male[i];
		tmp=i;
		for(j=i+1;j<mk;j++){
			if(min>male[j]){
				min=male[j];
				tmp=j;
			}
		}
		male[tmp]=male[i];
		male[i]=min;
	}
	
}
void sor2(){
	int i,j,tmp;
	double min;

	for(i=0;i<fk;i++){
		min=female[i];
		tmp=i;
		for(j=i+1;j<fk;j++){
			if(min>female[j]){
				min=female[j];
				tmp=j;
			}
		}
		female[tmp]=female[i];
		female[i]=min;
	}
	
}

int main(void){
	int n,i;
	char sex[10];

	scanf("%d",&n);
	mk=0;
	fk=0;
	for(i=0;i<n;i++){
		scanf("%s",sex);
		if(sex[0]=='m')
			scanf("%lf",&male[mk++]);
		else
			scanf("%lf",&female[fk++]);
	}
	sor1();
	sor2();
	for(i=0;i<mk;i++)
		printf("%.2f ",male[i]);
	for(i=fk-1;i>0;i--)
		printf("%.2f ",female[i]);
	printf("%.2f\n",female[0]);
}
int main(){
	int num,i,j=0,k=0,m,n;
	double man[50],woman[50],r[50],e;
	char sx[50][10];
	scanf("%d",&num);
	for(i=0;i<num;i++){
     scanf("%s%lf",sx[i],&r[i]);
	}
		for(i=0;i<num;i++){
		if(sx[i][0]=='m'){
           man[j]=r[i];
		   j++;
		}else {
           woman[k]=r[i];
		   k++;
		}
	}
	for(i=1;i<=j;i++){
		for(m=0;m<j-i;m++){
			if(man[m]>man[m+1]){
               e=man[m+1];
			   man[m+1]=man[m];
			   man[m]=e;
			}
		}	
	}
	for(i=1;i<=k;i++){
		for(n=0;n<k-i;n++){
			if(woman[n]<woman[n+1]){
				e=woman[n+1];
				woman[n+1]=woman[n];
				woman[n]=e;
			}
		}
	}
    for(i=0;i<j;i++){
        printf("%.2lf ",man[i]);
	}
	for(i=0;i<k-1;i++){
        printf("%.2lf ",woman[i]);
	}
     printf("%.2lf",woman[i]);
return 0;
}
typedef struct{
	int sex;
	char h[5];
	double height;
}person;

int main(){
	int N;
	int i = 0;
	int count = 0;
	person* line;
	scanf("%d\n", &N);
	line = (person*)malloc(sizeof(person)*N);
	while(i < N){
		char sex;
		char tmp;
		char h[5];
		int k = 0;
		int point = 0;
		int num = 0;
		int j = 0;
		double number;
		int length = 0;
		scanf("%c", &sex);
		while((tmp = fgetc(stdin)) != ' '){
		}


		scanf("%s", &h);
		fgetc(stdin);

		while(h[j] != '\0'){
			line[i].h[j] = h[j];
			j++;
		}
		line[i].h[j] = '\0';

		while(h[k] != '\0'){
			int one = 0;
			if(h[k] == '.'){
				point = k;
			}
			else{
				one = h[k] - 48;
				num = num*10 + one;
			}
			k++;
			length++;
		}
		point = length - point - 1;
		number = (double)num/(pow(10.0,point));

		line[i].height = number;
		if(sex == 'm')
			line[i].sex = 1;
		if(sex == 'f')
			line[i].sex = 0;
		i++;
	}

	i = N-1;
	while(i > 0){
		int k = 0;
		while(k < i){
			if(line[k].height > line[k+1].height){
				person tmp = line[k];
				line[k] = line[k+1];
				line[k+1] = tmp;
			}
			k++;
		}
		i--;
	}

	i = 0;
	while(i < N){
		if(line[i].sex == 1){
			printf("%s", line[i].h);
			count++;
			if(count != N)
			printf(" ");
		else 
			printf("\n");
		}
		
		i++;
	}
	i = N-1;
	while(i >= 0){
		if(line[i].sex == 0){
			printf("%s", line[i].h);
			count++;
			if(count != N)
			printf(" ");
		else 
			printf("\n");
		}
		
		i--;
	}
	return 0;
}
int main()
{
	int n,i,a=0,b=0,k,j;
	scanf("%d\n",&n);
	char s1[10]="male";
	char s2[10]="female";
	struct stu{
		char sex[10];
		double hei;
	}stu[40];
	double sz1[40];
	double sz2[40];
	for(i=0;i<n;i++)
	{
		scanf("%s%lf",stu[i].sex,&stu[i].hei);
		if(strcmp(stu[i].sex,s1)==0)
		{
			sz1[a]=stu[i].hei;
			a=a+1;
		}
		if(strcmp(stu[i].sex,s2)==0)
		{
			sz2[b]=stu[i].hei;
			b=b+1;
		}
	}
	double e;
	
	for(k=1;k<a+1;k++)
	{
		for(j=0;j<a+1-k;j++)
		{
			if(sz1[j]>sz1[j+1])
			{
				e=sz1[j+1];
				sz1[j+1]=sz1[j];
				sz1[j]=e;
			}
		}
	}
		for(k=1;k<b+1;k++)
	{
		for(j=0;j<b+1-k;j++)
		{
			if(sz2[j]<sz2[j+1])
			{
				e=sz2[j+1];
				sz2[j+1]=sz2[j];
				sz2[j]=e;
			}
		}
	}
    for(j=1;j<a+1;j++)
	{
		printf("%.2lf ",sz1[j]);
	}
	for(j=0;j<b-1;j++)
	{
		printf("%.2lf ",sz2[j]);
	}
printf("%.2lf",sz2[b-1]);
	return 0;
}
int main()
{
	int n;
	scanf("%d",&n);
	char sex[100][10],empty[10];
	double len[100],male[100],female[100];
	int i,m=0,f=0,numm,numf,j;
	for(i=0;i<n;i++)
	{
		gets(empty);
		scanf("%s %lf",sex[i],&len[i]);
		if(sex[i][0]=='m')
		{
			male[m]=len[i];
			m=m+1;
		}
		if(sex[i][0]=='f')
		{
			female[f]=len[i];
			f=f+1;

		}
	}
	double e;
	for(i=0;i<m;i++)
	{
		for(j=1;j<m-i;j++)
		{
			if(male[j]<male[j-1])
			{
				e=male[j-1];
				male[j-1]=male[j];
				male[j]=e;

			}
		}
	}
	for(i=0;i<f;i++)
	{
		for(j=1;j<f-i;j++)
		{
			if(female[j]>female[j-1])
			{
				e=female[j-1];
				female[j-1]=female[j];
				female[j]=e;

			}
		}
	}
	for(i=0;i<m;i++)
		printf("%.2lf ",male[i]);
	for(i=0;i<f;i++)
	{
		if(i==f-1)
			printf("%.2lf",female[i]);
		else
			printf("%.2lf ",female[i]);
	}
	return 0;




}
int main(){
	int a,b,c,e=0,g=0;
	double h,i[40],f[40],m[40];
	char l[40][7],o[1][5],p[1][7];
	strcpy(o[0],"male");
	strcpy(p[0],"female");
	scanf("%d",&a);
	for(b=0;b<a;b++){
		scanf("%s%lf",l[b],&i[b]);
		if(strcmp(o[0],l[b])){
			f[e]=i[b];
			e++;
		}
		else{
			m[g]=i[b];
			g++;
		}
	}
	for(b=0;b<e;b++){
		for(c=b+1;c<e;c++){
			if(f[b]<f[c]){
				h=f[b];
				f[b]=f[c];
				f[c]=h;
			}
		}
	}
	for(b=0;b<g;b++){
		for(c=b+1;c<g;c++){
			if(m[b]>m[c]){
				h=m[b];
				m[b]=m[c];
				m[c]=h;
			}
		}
	}
	for(b=0;b<g;b++){
		printf("%.2lf ",m[b]);
	}
	for(b=0;b<(e-1);b++){
		printf("%.2lf ",f[b]);
	}
	printf("%.2lf",f[e-1]);
	return 0;
}
int main()
{
	int n;
	struct photo
	{
		char sex[6];
		float h;
	}p[40];
	struct photo t;
	int i,j;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s %f",p[i].sex,&p[i].h);
	}
	for(i=0;i<n-1;i++)
	{
		for(j=0;j<n-1-i;j++)
		{
			if(p[j].sex[0]=='m' && p[j+1].sex[0]=='m' && p[j].h>p[j+1].h)
			{
				t=p[j];
				p[j]=p[j+1];
				p[j+1]=t;
			}
			if(p[j].sex[0]=='f' && p[j+1].sex[0]=='f' && p[j].h<p[j+1].h)
			{
				t=p[j];
				p[j]=p[j+1];
				p[j+1]=t;
			}
			if(p[j].sex[0]=='f' && p[j+1].sex[0]=='m')
			{
				t=p[j];
				p[j]=p[j+1];
				p[j+1]=t;
			}
		}
	}
	for(i=0;i<n-1;i++)
	printf("%.2f ",p[i].h);
	printf("%.2f\n",p[n-1].h);
	
	return 0;
}
typedef struct area
{
	char sex[8];
	float hight;
}area;

area a[100];

int cmp(const void *a, const void *b)
{
	area *aa = (area *)a;
	area *bb = (area *)b;
	if (aa->sex[0] == 'm' && bb->sex[0] == 'f')
		return -1;
	else if (aa->sex[0] == 'f' && bb->sex[0] == 'm')
		return 1;
	else if (aa->sex[0] == 'm')
	{
		return aa->hight < bb->hight ? -1 : 1;
	}
	else
		return aa->hight < bb->hight ? 1 : -1;
}

int main()
{
	int n, i;
	//freopen("in.txt", "r", stdin);
	scanf("%d", &n);
	for (i = 0; i < n; i ++)
	{
		scanf("%s%f", &a[i].sex, &a[i].hight);
	}
	qsort(a, n, sizeof (area), cmp);
	for (i = 0; i < n; i ++)
	{
		printf("%.2f", a[i].hight);
if (i < n -1)
printf(" ");
	}
	return 0;
}
main()
{
	int n,i,j,p,q;
	char a[40][7];
	float b[40],b1[40],b2[40],t;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	scanf("%s %f\n",a[i],&b[i]);
	p=0;
	q=0;
	for(i=0;i<n;i++)
	{
		if(a[i][0]=='m')
		{
			b1[p]=b[i];
			p++;
		}
		else
		{
			b2[q]=b[i];
			q++;
		}
	}
	for(j=0;j<p-1;j++)
	{
		for(i=0;i<p-j-1;i++)
		{
			if(b1[i]>b1[i+1])
			{
				t=b1[i];
				b1[i]=b1[i+1];
				b1[i+1]=t;
			}
		}
	}
	for(j=0;j<q-1;j++)
	{
		for(i=0;i<q-j-1;i++)
		{
			if(b2[i]<b2[i+1])
			{
				t=b2[i];
				b2[i]=b2[i+1];
				b2[i+1]=t;
			}
		}
	}
	for(i=0;i<p;i++)
	printf("%.2f ",b1[i]);
	for(i=0;i<q-1;i++)
	printf("%.2f ",b2[i]);
	printf("%.2f",b2[q-1]);
}
int main()
{
    char gender[40][10]; 
    float maleheight[40], femaleheight[40], temp; 
    int num, i, j = 0, k = 0, male = 0, female = 0;
    cin >> num;
    for (i = 0; i < num; i++)
    {
        cin >> gender[i];
        if (gender[i][0] == 'm')
        {
            cin >> maleheight[j];
            j++;
            male++;
        }
        else
        {
            cin >> femaleheight[k];
            k++;
            female++;
        }         
    }
    for (i = 0; i < male; i++)
    {
        for (j = 0; j < male - 1 - i; j++)
        {
            if (maleheight[j] - maleheight[j + 1] > 0)
            {
                temp = maleheight[j];
                maleheight[j] = maleheight[j + 1];
                maleheight[j + 1] = temp;
            }
        }
    }
    for (i = 0; i < female; i++)
    {
        for (j = 0; j < female - 1 - i; j++)
        {
            if (femaleheight[j] - femaleheight[j + 1] > 0)
            {
                temp = femaleheight[j];
                femaleheight[j] = femaleheight[j + 1];
                femaleheight[j + 1] = temp;
            }
        }
    }
    cout << fixed << setprecision(2);
    for (i = 0; i < male; i++)
    {
        cout << maleheight[i] << " ";
    }
    for (i = female - 1; i > 0; i--)
    {
        cout << femaleheight[i] << " ";
    }
    cout << femaleheight[0];
    
    return 0;
}
int main(){
   int n,i,j,p=0,q=0;
   double  m[50],w[50],e;
   char s[50],b[10]="male";
   scanf("%d",&n);
   for(i=0;i<n;i++){
	   scanf("%s",s);
	   if(strcmp(s,b)!=0){
		   scanf("%lf",&w[p]);
		   p++;
	   }else{
		   scanf("%lf",&m[q]);
		   q++;
	   }
   }
   for(i=1;i<=q;i++){
	   for(j=0;j<q-i;j++){
		   if(m[j]>m[j+1]){
			   e=m[j];
			   m[j]=m[j+1];
			   m[j+1]=e;
		   }
	   }
   }
   for(i=0;i<q;i++){
	   if(i==0){
	   printf("%.2lf",m[i]);
	   }else{
		     printf(" %.2lf",m[i]);
	   }

   }

   for(i=1;i<=p;i++){
	   for(j=0;j<p-i;j++){
		   if(w[j]>w[j+1]){
			   e=w[j];
			   w[j]=w[j+1];
			   w[j+1]=e;
		   }
	   }
   }
   for(i=p-1;i>=0;i--){
	   printf(" %.2lf",w[i]);
   }
   return 0;
}
int main(){
	struct point{
		char a[100];
		double b;
	}points[100];
	int n,i=0,k=1;
	char p[100];
	double d;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s%lf",points[i].a,&points[i].b);
	}
	for(k=1;k<=n;k++){
		for(i=0;i<n-k;i++){
			if(points[i].b>points[i+1].b){
				d=points[i+1].b;
				points[i+1].b=points[i].b;
				points[i].b=d;
				strcpy(p,points[i+1].a);
				strcpy(points[i+1].a,points[i].a);
				strcpy(points[i].a,p);
			}
		}
	}
	for(i=0;i<n;i++){
		if(strcmp(points[i].a,"male")==0){
			printf("%.2lf",points[i].b);
			break;
		}
	}

	for(i=i+1;i<n;i++){
		if(strcmp(points[i].a,"male")==0){
             printf(" %.2lf",points[i].b);
		}
	}
	for(i=n-1;i>=0;i--){
		if(strcmp(points[i].a,"female")==0){
			printf(" %.2lf",points[i].b);
		}
	}




	


	
	 return 0;
}
int main()
{
   int n,ans=0;
   cin>>n;
   int aa=0;
   int bb=0;
   double a[10000];
   double b[10000];
   for (int i=1;i<=n;i++)
   {
       char s[100];double t;
       cin>>s>>t;
      // cout<<s<<" "<<t;
       if (s[0]=='m') {aa++;a[aa]=t;}else {bb++;b[bb]=t;}
   }    
   sort(a+1,a+aa+1);
   sort(b+1,b+bb+1);
   for (int i=1;i<=aa;i++) printf("%.2f ",a[i]);
   for (int i=bb;i>=1;i--) if (i!=1)printf("%.2f ",b[i]);else printf("%.2f\n",b[i]);
   //for (;;);
}
int main()
{
	int i,j,k=0,n;
	double a[50]={0},e;
	char b[50][10]={'\0'},c[20]={'\0'};
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s %lf",b[i],&a[i]);
	}
	for(i=1;i<=n;i++){
		for(j=0;j<n-i;j++){
			if(a[j]<a[j+1]){
				e=a[j];
				a[j]=a[j+1];
				a[j+1]=e;
				strcpy(c,b[j]);
				strcpy(b[j],b[j+1]);
				strcpy(b[j+1],c);
	}}}
	for(i=n-1;i>=0;i--){
		if(strcmp(b[i],"male")==0){
			if(k==0){
				printf("%.2lf",a[i]);
				k++;
			}
			else printf(" %.2lf",a[i]);
		}
	}
	for(i=0;i<n;i++){
		if(strcmp(b[i],"female")==0){
			printf(" %.2lf",a[i]);			
	}}
	return 0;
}
int cmp(const void *p1,const void *p2)
{
	float f1=*((float *)p1);
	float f2=*((float *)p2);
	if(f1>f2)
		return 1;
	else
		return -1;
}

int main()
{
	int i,j,k;
	int n;
    float h,h1[50],h2[50];
	while(scanf("%d",&n)!=EOF)
	{
		char temp[20];
		int cnt0=0,cnt1=0;
		for(i=0;i<n;i++)
		{
			scanf("%s%f",temp,&h);
			if(temp[0]=='m')
				h1[cnt0++]=h;
			else
				h2[cnt1++]=h;
		}
		qsort(h1,cnt0,sizeof(h1[0]),cmp);
		qsort(h2,cnt1,sizeof(h2[0]),cmp);
		for(i=0;i<cnt0;i++)
			printf("%.2f ",h1[i]);
		for(i=cnt1-1;i>0;i--)
			printf("%.2f ",h2[i]);
		printf("%.2f\n",h2[0]);
	}
	return 0;
}
int main(){
	int n,i,j,k,p;
	double sg,ns[50],nv[50],e;
	char xb[10];
	scanf("%d",&n);
	j=0;
	k=0;
	for(i=0;i<n;i++){
		scanf("%s%lf",xb,&sg);
		if(xb[0]=='m'){
			ns[j]=sg;
			j++;
		}
		else{
			nv[k]=sg;
			k++;
		}
	}
	for(i=0;i<j;i++){
		for(p=0;p<j-1;p++){
			if(ns[p]>ns[p+1]){
				e=ns[p];
				ns[p]=ns[p+1];
				ns[p+1]=e;
			}
		}
	}
	for(i=0;i<k;i++){
		for(p=0;p<k-1;p++){
			if(nv[p]<nv[p+1]){
				e=nv[p];
				nv[p]=nv[p+1];
				nv[p+1]=e;
			}
		}
	}
	printf("%.2lf",ns[0]);
	for(i=1;i<j;i++){
		printf(" %.2lf",ns[i]);
	}
	for(i=0;i<k;i++){
		printf(" %.2lf",nv[i]);
	}
	return 0;
}
int main(){
	int n;
	int i,j;
	float g[40],m[40],f[40],r[40];
	float temp;
	int summ=0;
	int sumf=0;
	char sex[40][10];
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s%f",sex[i],&g[i]);
	}
	for(i=0;i<n;i++){
		if(sex[i][0]=='m'){
			m[summ]=g[i];
			summ=summ+1;
		}
		else{
			f[sumf]=g[i];
			sumf=sumf+1;
		}
	}

	for(i=0;i<summ;i++){
		for(j=0;j<summ;j++){
			if(m[i]<m[j]){
				temp=m[i];
				m[i]=m[j];
				m[j]=temp;
			}
		}
	}
    for(i=0;i<sumf;i++){
		for(j=0;j<sumf;j++){
			if(f[i]>f[j]){
				temp=f[i];
				f[i]=f[j];
				f[j]=temp;
			}
		}
	}
	for(i=0;i<summ;i++)		
	printf("%.2f ",m[i]);
	for(i=0;i<sumf;i++)	{
		if(i!=sumf-1)
	printf("%.2f ",f[i]);
		else
printf("%.2f",f[i]);
	}

	return 0;
}
int main(){
int i,n,a,b,j,c,d;
a=0;
b=0;
double z,f[40],m[40];
char sex[7];
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%s",sex);
c=strcmp(sex,"male");
d=strcmp(sex,"female");
if(c==0){
scanf("%lf",&m[a]);
a++;
}else if(d==0){
scanf("%lf",&f[b]);
b++;
}
}

for(i=0;i<a;i++){
	for(j=a-1;j>0;j--){
		if(m[j]<m[j-1]){
			z=m[j];
			m[j]=m[j-1];
			m[j-1]=z;
		}
	}
	printf("%.2lf ",m[i]);
}

for(i=0;i<b;i++){
	for(j=b-1;j>0;j--){
		if(f[j]>f[j-1]){
			z=f[j];
			f[j]=f[j-1];
			f[j-1]=z;
		}
	}
	if(i==b-1){
	printf("%.2lf",f[i]);
	}else{
	printf("%.2lf ",f[i]);
	}
}


return 0;
}
int main()
{
	int n,i,j,k,boys,girls;
	char tmp[10];
	float boy[45],girl[45];
	float shengao,temp;
	scanf("%d",&n);
	getchar();
	for(i=1,j=1,k=1;i<=n;i++)
	{
		scanf("%s",tmp);
		scanf("%f",&shengao);
		if(tmp[0]=='f')
		{
			girl[j]=shengao;
			j++;
		}
		else if(tmp[0]=='m')
		{
			boy[k]=shengao;
			k++;
		}
	}
	boys=k-1;
	girls=j-1;
	for(j=1;j<=boys-1;j++)
	{
		for(i=1;i<=boys-j;i++)
		{
			if(boy[i]>boy[i+1])
			{
				temp=boy[i];
				boy[i]=boy[i+1];
				boy[i+1]=temp;
			}
		}
	}
	for(j=1;j<=girls-1;j++)
	{
		for(i=1;i<=girls-j;i++)
		{
			if(girl[i]<girl[i+1])
			{
				temp=girl[i];
				girl[i]=girl[i+1];
				girl[i+1]=temp;
			}
		}
	}
	for(i=1;i<=boys;i++)
	{
		printf("%.2f ",boy[i]);
	}
	for(i=1;i<=girls;i++)
	{
		if(i==girls)
		{
			printf("%.2f\n",girl[i]);
		}
		else
		{
			printf("%.2f ",girl[i]);
		}
	}
	return 0;
}
int main(){
    int n,i,j;
    float sg[45],e;
    char xb[45][8],f[8];
    scanf("%d",&n);
    for(i=0;i<n;i++){
          scanf("%s",xb[i]);
          scanf("%f",&sg[i]);
    }
    for(j=1;j<=n;j++){
        for(i=0;i<n-j;i++){
                if(xb[i][0]<xb[i+1][0]||
                   (xb[i][0]==xb[i+1][0]&&xb[i][0]=='f'&&sg[i]<sg[i+1])||
                   (xb[i][0]==xb[i+1][0]&&xb[i][0]=='m'&&sg[i]>sg[i+1])){
                          e=sg[i];
                          sg[i]=sg[i+1];
                          sg[i+1]=e;
                          strcpy(f,xb[i]);
                          strcpy(xb[i],xb[i+1]);
                          strcpy(xb[i+1],f);
                }
        }
    }
    printf("%.2f",sg[0]);
    for(i=1;i<n;i++){
                     printf(" %.2f",sg[i]);
    }
    scanf("%d",&n);
    return 0;
}
int main(){
    int m,i,j,x=0,y=0,k=0,n=0;
    scanf("%d",&m);
    char a[m][10];
    double b[m],g,h;
    for(i=0;i<m;i++){
        scanf("%s%lf",a[i],&b[i]);
        }
    for(i=0;i<m;i++){
       if(a[i][0]=='m')k++;
       if(a[i][0]=='f')n++;
       }
    double c[k],d[n];
    for(j=0;j<k;j++){
       for(i=x;i<m;i++){
          if(a[i][0]=='m'){
            c[j]=b[i];
            x=i+1;
            break;
            }
          }
       }
    for(j=0;j<n;j++){
       for(i=y;i<m;i++){
          if(a[i][0]=='f'){
            d[j]=b[i];
            y=i+1;
            break;
            }
          }
       }
    for(i=1;i<k;i++){
       for(j=0;j<k-i;j++){
          if(c[j]>c[j+1]){
            g=c[j];
            c[j]=c[j+1];
            c[j+1]=g;
            }
          }
       }
    for(i=1;i<n;i++){
       for(j=0;j<n-i;j++){
          if(d[j]<d[j+1]){
            h=d[j];
            d[j]=d[j+1];
            d[j+1]=h;
            }
          }
       }
    printf("%.2lf",c[0]);
    for(i=1;i<k;i++)printf(" %.2lf",c[i]);
    for(i=0;i<n;i++)printf(" %.2lf",d[i]);      
    scanf("%d",&m);
    return 0;
}
int main()
{
int n; 
scanf("%d",&n);
double m[40],f[40];
int nm=0,nf=0;
int i;
for (i=0; i<n; i++)
{
char sex[7]; 
double h;
scanf("%s%lf",sex,&h);
if (sex[0]=='m') 
{
nm++;
m[nm-1]=h;
}
else 
{
nf++;
f[nf-1]=h;
}
}

int j;
for (i=0; i<nm-1; i++)
for (j=i+1; j<nm; j++)
if (m[i]>m[j])
{
double t=m[i];
m[i]=m[j];
m[j]=t;
}

for (i=0; i<nf-1; i++)
for (j=i+1; j<nf; j++)
if (f[i]<f[j])
{
double t=f[i];
f[i]=f[j];
f[j]=t;
}

for (i=0; i<nm; i++) printf("%.2lf ",m[i]);
for (i=0; i<nf; i++) 
{
printf("%.2lf",f[i]);
if (i<nf-1) printf(" "); else printf("\n");
}

return 0;
}
int main()
{
	int n, i, j = 0, k = 0, r, s, u, v;  // n????
	double height, girl_height[40], boy_height[40], temp;
	char gender[6];
	cin >> n;
	for (i = 0; i < n; i++)  // ??????j??????k?????
	{
		cin >> gender >> height;
		if (gender[0] == 'm')   
		{
			boy_height[j] = height;   
			j++;
		}
		else
		{
			girl_height[k] = height;
			k++;
		}
	}
	for (r = 0; r < j - 1; r++)
	{
		for (u = r + 1; u < j; u++)
		{
			if (boy_height[r] > boy_height[u])
			{
				temp = boy_height[r];
				boy_height[r] = boy_height[u];
				boy_height[u] = temp;
			}
		}
	}
	for (s = 0; s < k - 1; s++)
	{
		for (v = s + 1; v < k; v++)
		{
			if (girl_height[s] < girl_height[v])
			{
				temp = girl_height[s];
				girl_height[s] = girl_height[v];
				girl_height[v] = temp;
			}
		}
	}
	for (r = 0; r < j; r++)
	{
		cout << fixed << setprecision(2)<< boy_height[r] << " ";
	}
	for (r = 0; r < k - 1; r++)
	{
		cout << fixed << setprecision(2) << girl_height[r] << " ";
	}
	cout << girl_height[k - 1];
	return 0;
}
int main(){
   int i,j,s,a,b,e,h;
     a=0;b=0;
     e=0;h=0;
   double m,c,n;
   double x[100],y[100];
   char z[100][10];
   scanf("%d",&s);
   for(i=0;i<s;i++)
    {  scanf("%s %lf",z[i],&m);
       if(strcmp(z[i],"male")==0)
        {  x[e]=m;
            a++;e++;}
        else{y[h]=m;
             b++;h++;}
     }
       for(i=a;i>0;i--)
        for(j=0;j<i-1;j++)
       {   if(x[j]>x[j+1])
              { c=x[j];
                x[j]=x[j+1];
                x[j+1]=c;
                }
       } 
        for(i=b;i>0;i--)
        for(j=0;j<i-1;j++)
       {   if(y[j]<y[j+1])
              { c=y[j];
                y[j]=y[j+1];
                y[j+1]=c;
                }
       }
          for(i=0;i<a;i++)
            printf("%.2lf ",x[i]);
          for(i=0;i<b;i++)
           {if(i!=b-1) printf("%.2lf ",y[i]);
             else{printf("%.2f",y[i]);}
       } return 0;
}
int main(){
    int n,count1=0,count2=0;
	char zf[40][7],q;
    double sg[40];
	scanf("%d%c",&n,&q);
	count2=n-1;
	for(int i=0;i<n;i++){
		scanf("%s",zf[i]);
		int a=strlen(zf[i]);
		if(a==4){
			scanf("%lf",&sg[count1]);
			count1++;
		}else{
			scanf("%lf",&sg[count2]);
			count2--;
		}
	}
	int k,m,d,f;
	double e=0.0,c=0.0;
	for(k=0;k<count1-1;k++){
		for(m=k+1;m<count1;m++){
			if(sg[m]<sg[k]){
				e=sg[k];
				sg[k]=sg[m];
				sg[m]=e;
			}
		}
	}
    for(d=count2+1;d<n;d++){
		for(f=k+1;f<n;f++){
			if(sg[f]<sg[d]){
				c=sg[d];
				sg[d]=sg[f];
				sg[f]=c;
			}
		}
	}
	printf("%.2lf",sg[0]);
	for(int s=1;s<n;s++){
		printf(" %.2lf",sg[s]);
	}
    return 0;
}
int main()  {
int i,n,t=0,m=0,k;
double c[40],d[40];
double l;

struct{
     char z[10];
     double b;
}  a[40];

  scanf("%d",&n);
  for(i=0;i<n;i++){
	  scanf("%s %lf",a[i].z,&a[i].b);
  }

  for(i=0;i<n;i++){
	  if(a[i].z[0]=='m')  {c[t]=a[i].b;t++;}
      else if(a[i].z[0]=='f')    {d[m]=a[i].b;m++;}
  }
  
  for(i=0;i<t;i++){
	  for(k=0;k<t-1;k++){
          if(c[k]>c[k+1])   {l=c[k+1];c[k+1]=c[k];c[k]=l;}
	  }
  }
printf("%.2lf",c[0]);
for(i=1;i<t;i++){
    printf(" %.2lf",c[i]);
}

for(i=0;i<m;i++){
	for(k=0;k<m-1;k++){
		if(d[k]<d[k+1])  {l=d[k];d[k]=d[k+1];d[k+1]=l;}
	}
}
for(k=0;k<m;k++){
	printf(" %.2lf",d[k]);
}
return 0;
}
double mHeight[40];
double fHeight[40];

int comp(const void *a, const void *b)
{
	//return (int)(*(double *)a -*(double *)b);
	if (*(double *)a > *(double *)b)
		return 1;
	else if (*(double *)a < *(double *)b)
		return -1;
	else 
		return 0;
}

int main()
{
	int n;
	int mCount= 0, fCount = 0;
	int i;
	char temp[10];
	double height;
	cin >> n;
	for (i=0; i<n; i++)
	{
		cin >> temp;
		cin >> height;
		if (strcmp(temp, "male") == 0)
		{
			mHeight[mCount++] = height;
		}
		else
			fHeight[fCount++] = height;
	}
	qsort(mHeight, mCount, sizeof(double), comp);
	qsort(fHeight, fCount, sizeof(double), comp);
	
	for (i=0; i<mCount; i++)
		//cout << setprecision(2) << mHeight[i] << " ";
		printf("%0.2f ", mHeight[i] );
	for (i=0; i<fCount-1; i++)
		//cout << setprecision(2) << fHeight[fCount-1-i] << " ";
		printf("%0.2f ", fHeight[fCount-1-i] );
	//cout << setprecision(2) << fHeight[0] << endl;
	printf("%0.2f\n", fHeight[0]);
	
	return 0;
}
int main (){
	int count1,count2,all,i,p;
	double height1[40],height2[40],exchange,preheight;
	char input[7];
	scanf("%d",&all);
	count1=0;
	count2=0;
	for(i=0;i<all;i++){
		scanf("%s",input);
		scanf("%lf",&preheight);
		if(strlen(input)==4){height1[count1]=preheight;count1++;}
		if(strlen(input)==6){height2[count2]=preheight;count2++;}
	}
	for(i=0;i<count1;i++){	for(p=0;p<count1-1;p++){if(height1[p]>height1[p+1]){exchange=height1[p];height1[p]=height1[p+1];height1[p+1]=exchange;}}}
	for(i=0;i<count2;i++){	for(p=0;p<count2-1;p++){if(height2[p]<height2[p+1]){exchange=height2[p];height2[p]=height2[p+1];height2[p+1]=exchange;}}}
	printf("%.2lf",height1[0]);
	for(i=1;i<count1;i++){printf(" %.2lf",height1[i]);}
	for(i=0;i<count2;i++){printf(" %.2lf",height2[i]);}





	

return 0;
}
int cmp(const void *a,const void *b)
{	
	int r;
	if((*(float *)a)-(*(float *)b)<0)
		r=-1;
	else if((*(float *)a)-(*(float *)b)==0)
			r=0;
	else r=1;
	return r;
}
int cmp2(const void *a,const void *b)
{	
	int r;
	if(*(float *)a-*(float *)b>0)
		r=-1;
	else if(*(float *)a-*(float *)b==0)
			r=0;
		else r=1;
	return r;
}
int main()
{
	int n,i,x=0,y=0;
	float h;
	char temp[10];
	char sex[2][10]={"male","female"};
	float height[2][40];
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s %f",temp,&h);
		if(strcmp(temp,sex[0])==0){
			height[0][x]=h;
			x++;
		}
		else {
			height[1][y]=h;
			y++;
		}		
	}
	qsort(height[0],x,sizeof(float),cmp);
	qsort(height[1],y,sizeof(float),cmp2);
	for(i=0;i<x;i++)
		printf("%.2f ",height[0][i]);
	for(i=0;i<y;i++){
		if(i!=y-1)
			printf("%.2f ",height[1][i]);
		else  printf("%.2f",height[1][i]);
	}
	return 0;
}