semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int main()
{
 	char zfc[41][10];
 	double sz[41],male[41],female[41],final[41];
 	double e;
	int n,i,k,num1=0,num2=0;
 	scanf("%d",&n);
 	for(i=0;i<n;i++){
		scanf("%s %lf",zfc[i],&sz[i]);
		if(strcmp(zfc[i],"male")==0){
			male[num1]=sz[i];
			num1++;
			}
		else{
			female[num2]=sz[i];
			num2++;
			}
		}
	for(k=1;k<=num1;k++){
		for(i=0;i<num1-k;i++){
			if(male[i]>male[i+1]){
				e=male[i+1];
				male[i+1]=male[i];
				male[i]=e;
				}
			}
		}
	for(k=1;k<=num2;k++){
		for(i=0;i<num2-k;i++){
			if(female[i]>female[i+1]){
				e=female[i+1];
				female[i+1]=female[i];
				female[i]=e;
				}
			}
		}
	for(i=0;i<num1;i++){
		final[i]=male[i];
		}
	for(i=0;i<num2;i++){
		final[n-1-i]=female[i];
		}
	for(i=0;i<n;i++){
		if(i<n-1) printf("%.2lf ",final[i]);
		else printf("%.2lf",final[i]);
		}
 	
    return 0;
}
int main(){
int n,i,j,x=0,y=0,z;
char a[40][10];
double b[40],c[40],d[40],m;
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%s %lf",&a[i],&b[i]);
for(i=0;i<n;i++){
z=strcmp(a[i],"female\0");
if(z==0){
c[x]=b[i];
x++;
}else{
d[y]=b[i];
y++;
}
}
for(i=y-1;i>0;i--){
for(j=0;j<i;j++){
if(d[j]>d[j+1]){
m=d[j+1];
d[j+1]=d[j];
d[j]=m;
}
}
}
for(i=x-1;i>0;i--){
for(j=0;j<i;j++){
if(c[j]>c[j+1]){
m=c[j+1];
c[j+1]=c[j];
c[j]=m;
}
}
}
for(i=0;i<y;i++)
printf("%.2lf ",d[i]);
for(i=x-1;i>0;i--)
printf("%.2lf ",c[i]);
printf("%.2lf",c[0]);
return 0;
}
/*************************
 ***??:??? 1200012776
 ***????:????
 ***??:2012?11?1?
 *************************/
int main()
{
	int i, j, n, num_male = 0, num_female = 0;
	char sex[41][8], man[8] = "male", woman[8] = "female";
	float h[41], t;
	cin >> n;
	for (i = 1; i <= n; i++)
	{
		cin >> sex[i];	//??????sex[i]
		if (!(strcmp(sex[i],man)))	//??sex[i]?man???
		{
			num_male++;	//???,??num_male??
			cin >> h[num_male];	//????????????
		}
		else	//??????
		{
			num_female++;	//???????
			cin >> h[n + 1 - num_female];	//????????????
		}
	}
	for (i = 1; i <= num_male - 1; i++)	//???????????
	{
		for (j = i; j <= num_male; j++)
		{
			if (h[i] > h[j])
			{
				t = h[i];
				h[i] = h[j];
				h[j] = t;
			}
		}
	}
	for (i = n; i >= num_male + 2; i--)	//???????????
	{
		for (j = i - 1; j >= num_male + 1; j--)
		{
			if (h[i] > h[j])
			{
				t = h[i];
				h[i] = h[j];
				h[j] = t;
			}
		}
	}
	cout << fixed << setprecision(2) << h[1];
	for (i = 2; i <= n; i++)
	{
		cout << " "<< h[i];	//??????
	}
	return 0;
}
/*
 * practice.cpp
 *
 *  Created on: 2014-1-4
 *      Author: 111
 */

int main()
{
	int n;
	cin >> n;
	float male[100],female[100];
	int m=0,f=0;
	for(int i=1;i<=n;i++)
	{
		char sex[10]; float height;
		cin >> sex >> height;
		if(sex[0]=='m')
		{
			male[m] = height;
			m++;
		}
		else
		{
			female[f] = height;
			f++;
		}
	} //cout << m << endl << f << endl;
	for(int i=0;i<m;i++)
		for(int j=i+1;j<m;j++)
			if(male[i]>male[j])
			{
				float temp = male[i];
				male[i] = male[j];
				male[j] = temp;
			}

	for(int i=0;i<f;i++)
		for(int j=i+1;j<f;j++)
			if(female[i]<female[j])
			{
				float temp = female[i];
				female[i] = female[j];
				female[j] = temp;
			}
	cout << fixed << setprecision(2);
	cout << male[0];
	for(int i=1;i<m;i++)
		cout << ' ' << male[i];
	for(int i=0;i<f;i++)
		cout << ' ' << female[i];
	return 0;
}
int main()
{
	int n,i,j,k,m,min;
	char flag[42];
	float male[42],female[42];
	float h;
	char str[10];
	j=0;k=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s %f",str,&h);
		if(str[0]=='m')
		{
			male[j]=h;
			j++;
		}
		else
		{
			female[k]=h;
			k++;
		}
	}
	male[41]=100;
	for(i=0;i<j;i++)
		flag[i]=1;
	for(m=0;m<j;m++)
	{
		min=41;
		for(i=0;i<j;i++)
		{
			if(male[i]<male[min]&&flag[i]==1)
				min=i;
		}
		flag[min]=0;
		printf("%.2f ",male[min]);
	}
	female[41]=0;
	for(i=0;i<k;i++)
		flag[i]=1;
	for(m=0;m<k;m++)
	{
		min=41;
		for(i=0;i<k;i++)
		{
			if(female[i]>female[min]&&flag[i]==1)
				min=i;
		}
		flag[min]=0;
		if(m!=k-1)
			printf("%.2f ",female[min]);
		else
			printf("%.2f",female[min]);
	}
	printf("\n");
	return 0;
}
int main(){
	int n,i,a=0,b=0,j;
	double h=0,m=0;
	double a1[40]={0},b1[40]={0};
	char p[40]="male";
	char q[40]="female";
	scanf("%d",&n);
	
	for(i=1;i<=n;i++){
		char s[40];
		scanf("%s",s);
		scanf("%lf",&h);
		if(strcmp(s,p)==0){
			a1[a]=h;
			a++;
			
		}
		else if(strcmp(s,q)==0){
			b1[b]=h;
			b++;
		}
	}

	for(i=1;i<=a;i++){
		for(j=0;j<a-i;j++){
			if(a1[j]>a1[j+1]){
				m=a1[j];
				a1[j]=a1[j+1];
				a1[j+1]=m;
			}
		}
	}
	for(i=1;i<=b;i++){
		for(j=0;j<b-i;j++){
			if(b1[j]>b1[j+1]){
				m=b1[j];
				b1[j]=b1[j+1];
				b1[j+1]=m;
			}
		}
	}

	printf("%.2lf",a1[0]);
	for(i=1;i<a;i++){
		printf(" %.2lf",a1[i]);
	}

	for(i=b-1;i>=0;i--){
		printf(" %.2lf",b1[i]);
	}
	
	return 0;
}
int main()
{ 
    int n,i;
    scanf("%d",&n);
    struct student 
    {
           char a[7];
           float b;
    };
    struct student c[n];  
    for(i=0;i<n;i++)
    {
                    scanf("%s %f",c[i].a,&c[i].b);
    }
    for(i=0;i<n;i++)
    {
                    for(int t=1;t<n-i;t++)
                    {
                            if(strlen(c[i].a)>strlen(c[i+t].a))
                            {
                            struct student k;
                            k=c[i];c[i]=c[i+t];c[i+t]=k;
                            }
                            else if(strlen(c[i].a)==strlen(c[i+t].a))
                            {
                                 if(strlen(c[i].a)==4)
                                 {
                                 if(c[i].b>c[i+t].b)
                                 { 
                                 struct student k;
                                 k=c[i];c[i]=c[i+t];c[i+t]=k;
                                 } 
                                 }
                                 else
                                 {
                                 if(c[i].b<c[i+t].b)
                                 { 
                                 struct student k;
                                 k=c[i];c[i]=c[i+t];c[i+t]=k;
                                 }
                                 }
                            }
                    }
    }
                     for(i=0;i<n-1;i++)
                     {   
                     printf("%.2f ",c[i].b);
                     } 
                      printf("%.2f",c[n-1].b);             
   }
int geshu(int c);
int main()
{
	char a[number], ch1,ch2, max1,max2, tmp[100003];
    int k, m, n, sz[number], sz1[number], i, j, b;
	double high[100], high2[100], mc;
	scanf("%d", &n);
	k=0;
	m=0;
	for(i=0;i<n;i++)
	{
		scanf("%s %lf", a, &high[m]);
		if(a[0]=='f')
		{
			high2[k]=high[m];
			k++;
			m--;
		}
		m++;
	}

	for(j=0;j<m-1;j++)
	{
		for(b=0;b<m-j-1;b++)
		{
			if(high[b]>high[b+1])
			{
				mc=high[b];
				high[b]=high[b+1];
				high[b+1]=mc;
			}
		}
	}

	for(j=0;j<k-1;j++)
	{
		for(b=0;b<k-j-1;b++)
		{
			if(high2[b]<high2[b+1])
			{
				mc=high2[b];
				high2[b]=high2[b+1];
				high2[b+1]=mc;
			}
		}
	}


	for(i=0;i<m;i++)
		printf("%.2lf ", high[i]);
	for(i=0;i<k;i++)
	{
		if(i==k-1)
			printf("%.2lf", high2[i]);
		else
			printf("%.2lf ", high2[i]);
	}
	return 0;
}
int main()
{
int n;
int m=0,f=0;
double a[41],b[41];
char s[8];
double k;
int i,j;
cin>>n;
while(n--)
{
	cin>>s;
	cin>>k;
	if(s[0]=='m')
	{  
		a[m]=k;
		m++;
	}
		if(s[0]=='f')
	{  
		b[f]=k;
		f++;
	}
}
sort(a,a+m);
sort(b,b+f);
for(i=0;i<m;i++)
{
printf("%.2f ",a[i]);

//cout<<setprecision(2)<<a[i]<<" ";
}
for(i=f-1;i>=0;i--)
{   
	if(i>0)
	{
printf("%.2f ",b[i]);
	}
		if(i==0)
	{
printf("%.2f",b[i]);
	}

}
cout<<endl;

return 0;
}
int main(){
	int n,i,j,a=0,b=0;
	double z[39],t[39],c,d;
	char zff[7];
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s",zff);
		if(zff[0]=='f'){
			scanf("%lf",&z[a]);
			a++;
		}else{
			scanf("%lf",&t[b]);
			b++;
		}
	}
	for(i=1;i<=b;i++){
		for(j=0;j<b-i;j++){
			if(t[j]>=t[j+1]){
				c=t[j];
				t[j]=t[j+1];
				t[j+1]=c;
			}
		}
	}
    for(i=1;i<=a;i++){
		for(j=0;j<a-i;j++){
			if(z[j]>=z[j+1]){
				d=z[j];
				z[j]=z[j+1];
				z[j+1]=d;
			}
		}
	}
	for(i=0;i<b;i++){
		if(i==0){
			printf("%.2lf",t[i]);
		}else{
		    printf(" %.2lf",t[i]);
		}
	}
	for(i=a-1;i>=0;i--){
		printf(" %.2lf",z[i]);
	}
	return 0;
}
main()
{
      struct photo
      {
             double high;
             char sex[10];
      }p[43];
      int n,i,i2,j=0,k=0;
      double man[43],woman[43],hehe;
      scanf("%d",&n);
      for(i=0;i<n;i++)
      scanf("%s%lf",p[i].sex,&(p[i].high));
      for(i=0;i<n;i++)
          if(strcmp(p[i].sex,"male")==0) {man[j]=p[i].high;j++;}
          else  {woman[k]=p[i].high;k++;}
      for(i=j-2;i>=0;i--)
          for(i2=0;i2<=i;i2++)
              if(man[i2]>man[i2+1]) {hehe=man[i2+1];man[i2+1]=man[i2];man[i2]=hehe;}
      for(i=k-2;i>=0;i--)
          for(i2=0;i2<=i;i2++)
              if(woman[i2]<woman[i2+1]) {hehe=woman[i2+1];woman[i2+1]=woman[i2];woman[i2]=hehe;}
      for(i=0;i<j;i++)
      printf("%.2f ",man[i]);
      for(i=0;i<k-1;i++)
      printf("%.2f ",woman[i]);
      printf("%.2f",woman[i]);
}
int main()
{
    int i,n,k=0,l=0,p;
    char a[100][10];
    double f[100],m[100],e;
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
                    scanf("%s",a[i]);
                    if(a[i][0]=='m')
                    {
                                    scanf("%lf",&m[k]);
                                    k++;
                    }
                    else if(a[i][0]=='f')
                    {
                         scanf("%lf",&f[l]);
                         l++;
                    }
    }
    for(i=1;i<=k;i++)
    {
                     for(p=0;p<k-i;p++)
                     {
                                       if(m[p]>m[p+1])
                                       {
                                                    e=m[p+1];
                                                    m[p+1]=m[p];
                                                    m[p]=e;
                                       }
                     }
    }
    for(i=1;i<=l;i++)
    {
                     for(p=0;p<l-i;p++)
                     {
                                       if(f[p]<f[p+1])
                                       {
                                                    e=f[p+1];
                                                    f[p+1]=f[p];
                                                    f[p]=e;
                                       }
                     }
    }      
    for(i=0;i<k;i++)
    {
                    if(i==0)
                    printf("%.2lf",m[i]);
                    else
                    printf(" %.2lf",m[i]);
    }
    for(i=0;i<l;i++)
    {
                    printf(" %.2lf",f[i]);
    }
    return 0;
}
int main(){
	int n,i,j,p,q;
	double t,a[100],b[100];
	struct student{
		char x[10];
		double h;
	}s[100];
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s %lf",(s[i].x),&(s[i].h));
	}
	p=0;
	q=0;
	for(i=0;i<n;i++){
		    if(s[i].x[0]=='m'){
			    a[p]=s[i].h;
				p++;
			}else{
				b[q]=s[i].h;
				q++;
			}

	}
    for(j=1;j<=p;j++){
		for(i=0;i<p-j;i++){
			if(a[i]>a[i+1]){
				t=a[i+1];
				a[i+1]=a[i];
                a[i]=t;
			}
		}
	}
    for(j=1;j<=q;j++){
		for(i=0;i<q-j;i++){
			if(b[i]<b[i+1]){
				t=b[i+1];
				b[i+1]=b[i];
                b[i]=t;
			}
		}
	}
	for(i=0;i<p;i++){
		printf("%.2lf ",a[i]);
	}
	for(i=0;i<q;i++){
		if(i!=q-1){
			printf("%.2lf ",b[i]);
		}
		if(i==q-1){
			printf("%.2lf",b[i]);
		}
	}
    return 0;
}
int main()
{
    int n;
    char sex[7];
    float high[40];
    float male[40];
    float female[40];
    float temp;
    int m=0,f=0;
    int i,j;
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
                    scanf("%s%f",sex,&high[i]);
                    if(sex[0]=='m')
                    male[m++]=high[i];
                    else
                    female[f++]=high[i];
    }
    
    for(i=1;i<m;i++)
    for(j=1;j<m-i+1;j++)
    if(male[j-1]>male[j])
    {
                         temp=male[j-1];
                         male[j-1]=male[j];
                         male[j]=temp;
    }
    for(i=1;i<f;i++)
    for(j=1;j<f-i+1;j++)
    if(female[j-1]>female[j])
    {
                         temp=female[j-1];
                         female[j-1]=female[j];
                         female[j]=temp;
    }

    for(i=0;i<m;i++)
    printf("%.2f ",male[i]);

    for(i=f-1;i>=0;i--)
    {printf("%.2f",female[i]);
    if((i)!=0)
    printf(" ");}
    getchar();
    getchar();
    getchar();
    return 0;
    
    }
int Compare(const void *elem1, const void *elem2)
{
    return *((int *)(elem1)) - *((int *)(elem2));
}
struct Student
{
	char sex[10];
	float height;
}stu[40];
int main()
{
	int n,z,k1=0,k2=0;
	float male[40],female[40];
	char a[10]="male",b[10]="female";
	int i,i1,i2,i3;
    scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s %f",stu[i].sex,&stu[i].height);
		z=strcmp(stu[i].sex,a);
		if(z==0)
			{male[k1]=stu[i].height;
		    k1++;}
		else
			{female[k2]=stu[i].height;
		    k2++;}
	}
	qsort(male,k1,sizeof(float),Compare);
	qsort(female,k2,sizeof(float),Compare);
	for(i1=0;i1<k1;i1++)
	{
		printf("%.2f ",male[i1]);
	}
	for(i2=k2-1;i2>=1;i2--)
	{
		printf("%.2f ",female[i2]);
	}
	printf("%.2f",female[0]);
}
int main(){
	int n,i,m=0,f=0,len[40],x=0,y=0;
	char sum[40][7],me[40][7],fl[40][7];
	double sg[40],s[40],g[40];
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s",sum[i]);
		scanf("%lf",&(sg[i]));
		len[i]=strlen(sum[i]);
		if(len[i]==4){
			strcpy(me[x],sum[i]);
            s[x]=sg[i];
            m++;
			x++;
		}
		else{
			strcpy(fl[y],sum[i]);
			g[y]=sg[i];
			f++;
			y++;
		}
	}
	int k;
	double e;
	for(k=1;k<=x;k++){
		for(i=0;i<x-k;i++){
			if(s[i]>s[i+1]){
				e=s[i];
				s[i]=s[i+1];
				s[i+1]=e;
			}
		}
	}
    for(k=1;k<=y;k++){
		for(i=0;i<y-k;i++){
			if(g[i]<g[i+1]){
				e=g[i];
				g[i]=g[i+1];
				g[i+1]=e;
			}
		}
	}
	printf("%.2lf",s[0]);
	for(i=1;i<x;i++){
		printf(" %.2lf",s[i]);
	}
	for(i=0;i<y;i++){
		printf(" %.2lf",g[i]);
	}
	return 0;
}
struct ren
{
     char a[10];
     float b;
};
void l(float *a,int n)
{
     float k;
     for(int i=0;i<n;i++)
     for(int j=i;j<n;j++)
     {
          if(a[j]<a[i])
          {
               k=a[i];
               a[i]=a[j];
               a[j]=k;
          }
     }
}
main()
{
     void l(float *a,int n);
     int n,p=0,q=0;
     struct ren m[40];
     float f[40],g[40];
     scanf("%d",&n);
     for(int i=0;i<n;i++)
     {
          scanf("%s",m[i].a);
          scanf("%f",&m[i].b);
          if(strcmp(m[i].a,"male")==0)
          {
               f[p]=m[i].b;
               p++;
          }
          else
          {
               g[q]=m[i].b;
               q++;
          }
     }
     l(g,q);
     l(f,p);
     for(int i=0;i<p;i++) 
     {
             printf("%.2f",f[i]);
             printf(" ");
     }
     for(int i=q-1;i>=0;i--) 
     {
          printf("%.2f",g[i]);
          if(i!=0) printf(" ");
     }
}
struct Student
{char sex[10];
 double h;
};

int Compare1(const void* e1,const void *e2)
{
    return(*((int*)e1)-*((int*)e2));
}


main()
{
      int n,i,j,k,l,q;
      double a;
      struct Student num[50];
      double m[50]={0};
      double f[50]={0};
      scanf("%d",&n);
      for(i=0;i<n;i++)
      {
          scanf("%s",num[i].sex);
          scanf("%lf",&num[i].h);
      }
      j=0;
      k=0;
      for(i=0;i<n;i++)
      {
          
          if(num[i].sex[0]=='m')
          {  
              m[j]=num[i].h;
              j++;
              
          }
          else
          {
              f[k]=num[i].h;
              k++;
            
          }
      }
     for(l=0;l<j-1;l++)
     {
         for(q=0;q<j-1-l;q++)
         {
             if(m[q]-m[q+1]>0)
             {a=m[q];
             m[q]=m[q+1];
             m[q+1]=a;
             }
         }
     }     
      for(l=0;l<k-1;l++)
     {
         for(q=0;q<k-1-l;q++)
         {
             if(f[q]*100-f[q+1]*100<0)
             {a=f[q];
             f[q]=f[q+1];
             f[q+1]=a;
             }
         }
     }     
     
     
     for(j=0;m[j]!=0;j++)
         printf("%.2lf ",m[j]);
     for(k=0;f[k+1]!=0;k++)
         printf("%.2lf ",f[k]);      
      printf("%.2lf",f[k]);
      
    }
// test11.cpp : Defines the entry point for the console application.
//

char a[10];
float man[100],woman[100];
int l1=1,l2=1;

int main()
{
	int M;
	float b;
	scanf("%d",&M);
	for(int i=1;i<=M;i++)
	{
		scanf("%s %f",&a,&b);
			if(a[0]=='m')
			{
				man[l1++]=b;
			}
			else
			{
				woman[l2++]=b;
			}
	}
	sort(man+1,man+l1);
	sort(woman+1,woman+l2);

	printf("%.2f",man[1]);
	for(int i=2;i<l1;i++)
		printf(" %.2f",man[i]);
	for(int i=l2-1;i>=1;i--)
		printf(" %.2f",woman[i]);
	puts("");
	//getchar();
	//getchar();
	//getchar();
	return 0;
}
int main(){
  int n,i,k,man=0,woman=0;
  char sex[7];
  double h,x,male[40],female[40];
  char a[5]={'m','a','l','e','\0'};
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%s %lf",sex,&h);
    if((strcmp(sex,a))==0){
      male[man]=h;
      man++;
    }else{
      female[woman]=h;
      woman++;
    }
  }
  for(k=1;k<=man;k++){
    for(i=0;i<man-k;i++){
      if(male[i]>male[i+1]){
        x=male[i+1];
        male[i+1]=male[i];
        male[i]=x;
      }
    }
  }
  for(k=1;k<=woman;k++){
    for(i=0;i<woman-k;i++){
      if(female[i]>female[i+1]){
        x=female[i+1];
        female[i+1]=female[i];
        female[i]=x;
      }
    }
  }
  for(i=0;i<man;i++){
    printf("%.2lf ",male[i]);
  }
  for(i=woman-1;i>0;i--){
    printf("%.2lf ",female[i]);
  }
  printf("%.2lf",female[0]);
  return 0;
}
int main()
{
	int N;
	scanf("%d",&N);
	int count1=0,count2=0;
	float male[40]={0.0};
	float female[40]={0.0};
	char judge [10]={'\0'};
	for(int i=0;i<N;i++)
	    {
		scanf("%s",judge);
		if(judge[0]=='m')
		   {
		    scanf("%f",&male[count1]);
			count1++;		
		   }
		else
		    {
			scanf("%f",&female[count2]);
			count2++;	
			}	
		}
	for(int i=0;i<count1;i++)
	    {
		for(int j=i+1;j<count1;j++)
		    {
			float temp=0.0;
			if(male[i]>male[j])	
			   {
			   temp=male[i];
			   male[i]=male[j];
			   male[j]=temp;	
			   }   
			}	
		}
	for(int i=0;i<count2;i++)
	    {
		for(int j=i+1;j<count2;j++)
		    {
			float temp=0.0;
			if(female[i]<female[j])	
			   {
			   temp=female[i];
			   female[i]=female[j];
			   female[j]=temp;	
			   }   
			}	
		}
	printf("%.2f",male[0]);
	for(int i=1;i<count1;i++)
	    printf(" %.2f",male[i]);
	for(int i=0;i<count2;i++)
	    printf(" %.2f",female[i]); 
}
int main()
{
    int n;
    int i,j,k,p,q;
    scanf("%d",&n);
    char sex[50][7];
    float height[50],heightofboy[50],heightofgirl[50],temp;
    for(i=0;i<=n-1;i++)
    {
        scanf("%s %f",&sex[i],&height[i]);
    }
    for(i=0,j=0,k=0;i<=n-1;i++)
    {
        if(strcmp(sex[i],"male")==0)
        {
            heightofboy[j]=height[i];
            j++;
        }
        else
        {
            heightofgirl[k]=height[i];
            k++;
        }
    }
    //???????+??
    for(i=0;i<j;i++)
    {
        for(p=0;p<j-i-1;p++)
        {
            if(heightofboy[p]>heightofboy[p+1])
            {
                temp=heightofboy[p];
                heightofboy[p]=heightofboy[p+1];
                heightofboy[p+1]=temp;
            }
        }
    }
    for(i=0;i<j;i++)
    {
        printf("%.2f ",heightofboy[i]);
    }
   //???????+??
   for(i=0;i<k;i++)
   {
       for(q=0;q<k-i-1;q++)
       {
           if(heightofgirl[q]<heightofgirl[q+1])
           {
               temp=heightofgirl[q];
               heightofgirl[q]=heightofgirl[q+1];
               heightofgirl[q+1]=temp;
           }
       }
   }
   for(i=0;i<k-1;i++)
    {
        printf("%.2f ",heightofgirl[i]);
    }
    printf("%.2f",heightofgirl[k-1]);
}
int main()
{
	int n,i,j=0,k=0,nan=0,nv=0;
	double h1[40],h2[40],h;
	char sex[7];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s %lf",sex,&h);
		if(sex[0]=='m')
		{
			h1[j]=h;
			nan++;
			j++;
		}
		if(sex[0]=='f')
		{
			h2[k]=h;
			nv++;
			k++;
		}
	}
	for(i=0;i<nan-1;i++)
	{
		for(j=0;j<nan-1-i;j++)
		{
			if(h1[j]>h1[j+1])
			{
				h=h1[j+1];
				h1[j+1]=h1[j];
				h1[j]=h;
			}
		}
	}
	for(i=0;i<nv-1;i++)
	{
		for(j=0;j<nv-1-i;j++)
		{
			if(h2[j]<h2[j+1])
			{
				h=h2[j+1];
				h2[j+1]=h2[j];
				h2[j]=h;
			}
		}
	}
	printf("%.2lf",h1[0]);
	for(i=1;i<nan;i++)
	{
		printf(" %.2lf",h1[i]);
	}
	for(i=0;i<nv;i++)
	{
		printf(" %.2lf",h2[i]);
	}
	return 0;
}
int main(){
    int n,i,j,k=0,l=0;
    double height,m[42],f[42],temp;
    char sex[7];
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%s%lf",sex,&height);
        if(sex[0]=='m'){
            m[k]=height;
            k++;
        }else if(sex[0]=='f'){
            f[l]=height;
            l++;
        }
    }
    
    for(i=0;i<k-1;i++){
        for(j=i+1;j<k;j++){
            if(m[j]<m[i]){
                temp=m[i];
                m[i]=m[j];
                m[j]=temp;
            }
        }
    }
    
    for(i=0;i<l-1;i++){
        for(j=i+1;j<l;j++){
            if(f[j]>f[i]){
                temp=f[i];
                f[i]=f[j];
                f[j]=temp;
            }
        }
    }
    
    for(i=0;i<k;i++){
        if(i==0)
            printf("%.2lf",m[i]);
        else
            printf(" %.2lf",m[i]);
    }
    for(i=0;i<l;i++)
        printf(" %.2lf",f[i]);
    
    return 0;
}
int main(){
	int n,i,j,k=0,p=0,ab,ba;
	double h[100],h1[100],h2[100],temp;
	char s[100];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s",s);
		scanf("%lf",&h[i]);
		ab=strcmp(s,"female");
		ba=strcmp(s,"male");
		if(ba==0)
		{
			h1[k]=h[i];
			k++;
		}
		if(ab==0)
		{
			h2[p]=h[i];
			p++;
		}
	}


	for(i=k-1;i>0;i--)       
		for(j=0;j<i;j++) 
			if(h1[j]>h1[j+1])
			{
				temp=h1[j];
				h1[j]=h1[j+1];
				h1[j+1]=temp;
			}
	for(i=0;i<k;i++)
		printf("%.2lf ",h1[i]);
	for(i=p;i>0;i--)       
		for(j=0;j<i;j++) 
			if(h2[j]<h2[j+1])
			{
				temp=h2[j];
				h2[j]=h2[j+1];
				h2[j+1]=temp;
			}
	for(i=0;i<p-1;i++)
		printf("%.2lf ",h2[i]);
	printf("%.2lf",h2[p-1]);


	return 0;
}
char a[40][10];
float b[40];
char temp;
float t,s1,s2;
int count = 0;
int main()
{
	int n;
	scanf("%d",&n);
	int i,j,k;
	for(i = 0; i < n;i++)
	{
		cin>>a[i]>>b[i];
		//scanf("%s",a[i]);
		//scanf("%f",b[i]);
	}
	for(i =0; i < n;i++)
	{
		if(a[i][0] == 'm') count++;
	}
	for(i = 0;i< n-1;i++)
		for(j = i + 1; j < n;j++)
		{
			if(a[i][0] < a[j][0])
			{
				for(k=0;k < 10;k++){
					temp = a[i][k];
					a[i][k] = a[j][k];
					a[j][k] = temp;}
				t = b[i];
				b[i] = b[j];
				b[j] = t;
			}
		}
		
		for(i = 0; i < count-1; i++)
			for(j = i + 1; j < count; j++)
			{
				if(b[i] > b[j])
				{
					s1=b[i];
					b[i] = b[j];
					b[j] = s1;
				}
			}
			for(i = count; i < n-1; i++)
				for(j = i + 1; j < n; j++)
				{
					if(b[i] < b[j])
					{
						s2=b[i];
						b[i] = b[j];
						b[j] = s2;
					}
				}
				for(i = 0;i<n - 1;i++)
					printf("%.2f ",b[i]);
					printf("%.2f\n",b[n-1]);
				return 0;
}
int main(){
int x,i,p=0,q=0,a=0,b=0,k;
double sg[41],n[41],v[41],e;
char nv[41][10];
scanf("%d" ,&x);
for(i=0;i<x;i++){
scanf("%s" ,nv[i]);
scanf("%lf" ,&sg[i]);
if(nv[i][0]=='m'){
n[p]=sg[i];
p++;
a++;
}else{
v[q]=sg[i];
q++;
b++;
}

}

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

for(k=1;k<b;k++){
	for(i=0;i<b-k;i++){
		if(v[i]>v[i+1]){
		e=v[i+1];
		v[i+1]=v[i];
		v[i]=e;
		}
	}
}

for(i=b-1;i>0;i--){
printf("%.2lf " ,v[i]);
}
printf("%.2lf" ,v[0]);
return 0;
}
int main(){
	int n,n1,n2,i;
	char s[20];
	double h1[50],h2[50],t;
	cin>>n;
	n1=n2=0;
	for (i=0;i<n;i++){
		cin>>s>>t;
		if (strcmp(s,"male")==0){
			h1[n1++]=t;
		}else 
			h2[n2++]=t;
	}
	sort(h1,h1+n1);
	sort(h2,h2+n2);
	for (i=0;i<n1;i++){
		printf("%.2lf ",h1[i]);
	}
	for (i=n2-1;i;i--){
		printf("%.2lf ",h2[i]);
	}
	printf("%.2lf",h2[0]);
	puts("");
}