semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int main()
{
	int n,i,j,s,mm,ff;
	double b[41],m[41],f[41],c;
	char a[41][7];
	scanf("%d",&n);
	mm=ff=0;
	for(i=0;i<n;i++)
	{
		
		scanf("%s",a[i]);
		scanf("%lf",&b[i]);
		if(a[i][0]=='m')
		{
			m[mm]=b[i];
			mm++;
		}
		if(a[i][0]=='f')
		{
			f[ff]=b[i];
			ff++;
		}
	}
	
	for(i=0;i<mm-1;i++)
	{
		for(j=0;j<mm-1-i;j++)
		{
			if(m[j]>m[j+1])
			{
				c=m[j];
				m[j]=m[j+1];
				m[j+1]=c;
			}
		}
	}
	for(i=0;i<ff-1;i++)
	{
		for(j=0;j<ff-1-i;j++)
		{
			if(f[j]<f[j+1])
			{
				c=f[j];
				f[j]=f[j+1];
				f[j+1]=c;
			}
		}
	}
	for(i=0;i<mm;i++)
	{
		printf("%.2lf ",m[i]);
	}
	for(i=0;i<ff;i++)
	{
		if(i==ff-1)
			printf("%.2lf",f[i]);
		else
			printf("%.2lf ",f[i]);
	}
	
	
	return 0;
}
int main()
{   
int i,j=0,r=0,n,f;
char a[100][100];
double b[100],c[100],d[100];
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%s %lf",a[i],&b[i]);
}
for(i=0;i<n;i++)
{
if(a[i][0]=='m')
{
c[j]=b[i];
j++;
}
if(a[i][0]=='f')
{
d[r]=b[i];
r++;
}
}
for(i=j-1;i>0;i--)
{
for(f=0;f<i;f++)
{
if(c[f]>c[f+1])
{
double tmp;
tmp=c[f+1];
                c[f+1]=c[f];
c[f]=tmp;
}
}
}
for(i=r-1;i>0;i--)
{
for(f=0;f<i;f++)
{
if(d[f]<d[f+1])
{
double p;
p=d[f];
d[f]=d[f+1];
d[f+1]=p;
}
}
}
for(i=0;i<j;i++)
{
printf("%.2lf ",c[i]);
}
for(i=0;i<r-1;i++)
{
printf("%.2lf ",d[i]);
}
printf("%.2lf",d[r-1]);
return 0;
}
int main()
{
	int i,a,b,n,k;
	char m[40][8];
	double male[40],female[40],p;
scanf("%d",&n);
a=0;b=0;
for(i=0;i<n;i++)
{
	scanf("%s %lf",m[i],&p);
	if(strcmp(m[i],"male")==0)
	{
		male[a]=p;
		a++;
	}
	else if(strcmp(m[i],"female")==0)
	{
		female[b]=p;
		b++;
	}
}
for(k=a-1;k>0;k--)
for(i=0;i<k;i++){
	if( male[i]>male[i+1])
	{
		double tmp;
		tmp=male[i+1];
		male[i+1]=male[i];
		male[i]=tmp;
	}
}
for(k=b-1;k>0;k--)
for(i=0;i<k;i++){
	if( female[i]>female[i+1])
	{
		double tmp;
		tmp=female[i+1];
		female[i+1]=female[i];
		female[i]=tmp;
	}
}
printf("%.2lf",male[0]);
for(i=1;i<a;i++)
printf(" %.2lf",male[i]);
for(i=b-1;i>=0;i--)
printf(" %.2lf",female[i]);
return 0;
}
int main()
{
	char a[8];
	float male[44] = {0}, female[44] = {0}, temple;
	int n, i = 0, j = 0;

	cin >> n;
	for ( int k = 0; k < n; k++ )
	{
		cin.get();
		a[0] = cin.get();
		for ( int l = 0; a[l] != ' '; l++ )
			a[l + 1] = cin.get();
		if ( a[0] == 'm' )
		{
			cin >> male[i];
			i++;
		}
		else
		{
			cin >> female[j];
			j++;
		}
	}
	for ( int k = 0; k < i; k++ )
	{
		for ( int l = 1; l < i - k; l++ )
		{
			if ( male[l] < male[l - 1] )
			{
				temple = male[l];
				male[l] = male[l - 1];
				male[l - 1] = temple;
			}
		}
	}
	for ( int k = 0; k < j; k++ )
	{
		for ( int l = 1; l < j - k; l++ )
		{
			if ( female[l] > female[l - 1] )
			{
				temple = female[l];
				female[l] = female[l - 1];
				female[l - 1] = temple;
			}
		}
	}
	cout << fixed << setprecision(2) << male[0];
	for ( int k = 1; k < i; k++ )
		cout << " " << setprecision(2) << male[k];
	for ( int k = 0; k < j; k++ )
		cout << " " << setprecision(2) << female[k];
	return 0;
}
main()
{
      int n,i,j;
      char s[10];
      float k;
      scanf("%d",&n);
      struct 
      {
      char sex[10];
      float hei;
      } peo[n];
      for(i=0;i<n;i++)
      scanf("%s %f",peo[i].sex,&peo[i].hei);
      for(i=1;i<=n;i++)
      for(j=n-1;j>=i;j--)
      if(peo[j].hei<peo[j-1].hei)
      {
          k=peo[j].hei;
          peo[j].hei=peo[j-1].hei;
          peo[j-1].hei=k;
          strcpy(s,peo[j].sex);
          strcpy(peo[j].sex,peo[j-1].sex);
          strcpy(peo[j-1].sex,s);
      }
      for(i=0;i<n;i++)
      if(strcmp(peo[i].sex,"male")==0)
      {printf("%.2f",peo[i].hei);break;}
      for(i=i+1;i<n;i++)
      if(strcmp(peo[i].sex,"male")==0)
      printf(" %.2f",peo[i].hei);
      
      for(i=n-1;i>=0;i--)
      if(strcmp(peo[i].sex,"female")==0)
      printf(" %.2f",peo[i].hei);
}
int main(){
	char sex[10];
	double shengao;
	int n,i,male=0,female=0;
	double m[40],f[40];
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s %lf",sex,&shengao);
		if(sex[0]=='m') {
			m[male++]=shengao;//???
		}
		if(sex[0]=='f'){
			f[female++]=shengao;//???
		}
	}

	int k;
	double e;
	for(k=1;k<=male;k++){//???????
		for(i=male-1;i>=k;i--){
			if(m[i]<m[i-1]){
				e=m[i];
				m[i]=m[i-1];
				m[i-1]=e;
			}
		}
	}


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


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

return 0;
}
int main(){
int n,i,j=0,k=0,o,p;
char u[10];
double v[50],m[40],f[40],t;
scanf("%d",&n);
for(i=0;i<n;i++){
 
	scanf("%s",u);
	scanf("%lf",&v[i]);
	if(u[0]=='m'){m[j]=v[i];j++;}
	else if(u[0]=='f'){f[k]=v[i];k++;}
}
for(i=0;i<j;i++){

	for(o=0;o<i;o++){
	
		if(m[o]>m[i]){
		
			t=m[o];
			m[o]=m[i];
			m[i]=t;

		}
	}

}
for(i=0;i<k;i++){

	for(p=0;p<=i;p++){
	
		if(f[p]<f[i]){
		
			t=f[p];
			f[p]=f[i];
			f[i]=t;

		}
	}

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

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

}
printf("%.2lf",f[k-1]);
return 0;
}
int main()
{
	int n,i,j=0,k=0,q;
	char sex[42][10];
	double height[42];
	double male[42];
	double female[42];
	double x;
	double *h;
	cin>>n;
	h = height;
	for(i=0;i<n;i++)
	{
		cin>>sex[i];
		cin>>*h++;
		cin.get();
	}
	h = height;
	for(i=0;i<n;i++)
	{
		if(sex[i][0]=='m')
		{
			male[j] = height[i];
			j++;
		}
		else
		{
			female[k] = height[i];
			k++;
		}
	}
	for(i=1;i<=j-1;i++)
	{
		for(q=0;q<=j-i-1;q++)
		{
			if(male[q]>male[q+1])
			{
				x = male[q];
				male[q] = male[q+1];
				male[q+1] = x;
			}
		}
	}
	for(i=1;i<=k-1;i++)
	{
		for(q=0;q<=k-i-1;q++)
		{
			if(female[q]<female[q+1])
			{
				x = female[q];
				female[q] = female[q+1];
				female[q+1] = x;
			}
		}
	}
	cout<<fixed<<setprecision(2)<<male[0];
	for(i=1;i<=j-1;i++)
	{
		cout<<" "<<fixed<<setprecision(2)<<male[i];
	}
	for(i=0;i<=k-1;i++)
	{
		cout<<" "<<fixed<<setprecision(2)<<female[i];
	}
	cout<<endl;
	return 0;
}
int main(){
	int n,i,j,k=0,p=0;
	double e;
	double a[40],b[40];
	double h[41];
	char sex[7];
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s %lf\n",sex,&h[i]);
		if(strcmp(sex,"male")==0){
			a[k]=h[i];
			k++;
		}
		else{
			b[p]=h[i];
			p++;
		}
	}
	
	for(i=1;i<=k;i++){
		for(j=0;j<k-i;j++){
			if(a[j]>a[j+1]){
				e=a[j];
				a[j]=a[j+1];
				a[j+1]=e;
			}
		}
	}
	for(i=1;i<=p;i++){
		for(j=0;j<p-i;j++){
			if(b[j]<b[j+1]){
				e=b[j];
				b[j]=b[j+1];
				b[j+1]=e;
			}
		}
	}

	for(i=0;i<k;i++)printf("%.2lf ",a[i]);
	for(i=0;i<p;i++){
		if(i==p-1)printf("%.2lf",b[i]);
		else printf("%.2lf ",b[i]);
	}
	return 0;
}
int main()
{
int a,n,m=0,w=0;
float b[40];
float g[40];
scanf("%d\n",&n);
for(int i=0;i<n;i++)
{
	char sex[7];
	for(int j=0;j<7;j++)
	{
		scanf("%c",&sex[j]);
		if(sex[j]==' ')
		{
			if(j==4)
			{	a=1;scanf("%f\n",&b[m]);m++;break;}
			if(j==6||i!=n-1)
			{a=0;scanf("%f\n",&g[w]);w++;break;}
			else{a=0;scanf("%f",&g[w]);w++;break;}
		}		
	}
}
for(int i=0;i<m;i++)
{
	for(int j=0;j<i;j++)
	{
		if(b[j]>b[i])
		{
		float t=b[j];
		b[j]=b[i];
		b[i]=t;
		}			
	}
}
for(int i=0;i<w;i++)
{
	for(int j=0;j<i;j++)
	{
		if(g[j]<g[i])
		{
		float t=g[j];
		g[j]=g[i];
		g[i]=t;
		}
	}
}
for(int i=0;i<m;i++)
printf("%.2f ",b[i]);
printf("%.2f",g[0]);
for(int i=1;i<w;i++)
printf(" %.2f",g[i]);

}
int main()
{
	double m[50], f[50], p[100];
	char sex[50][10];
	int n, i, j=0, l = 0;
	double q;
	int k=0;

	scanf("%d", &n);
	for(i = 0; i < n; i++)
	{
		scanf("%s", sex[i]);
		scanf("%lf", &p[i]);
		if(sex[i][0]=='m')
		{
			m[j] = p[i];
			j++;
		}
		else
		{
			f[l] = p[i];
			l++;
		}
	}
	for(k = j-1; k > 0; k--)
	{
		for(i = 0; i < k; i++)
			if(m[i]>m[i+1])
			{
				q = m[i], m[i] = m[i+1], m[i+1] = q;
			}
	}

	for(k = l-1; k > 0; k--)
	{
		for(i = 0; i < k; i++)
			if(f[i] < f[i+1])
			{
				q = f[i], f[i] = f[i+1], f[i+1] = q;
			}
	}

	printf("%.2lf", m[0]);
	for(i = 1; i<=j-1; i++)
		printf(" %.2lf", m[i]);
	for(i = 0; i<=l-1; i++)
		printf(" %.2lf", f[i]);

	return 0;
}
void bubblesort1(float a[],int n)
{
	int i,j;
	float tmp;
	for(i=0;i<n-1;i++)
	for(j=i+1;j<n;j++)
	{
		if(a[i]>a[j])
		{
			tmp=a[i];
			a[i] = a[j];
			a[j]=tmp;	
		}	
	}
}
void bubblesort2(float a[],int n)
{
	int i,j;
	float tmp;
	for(i=0;i<n-1;i++)
	for(j=i+1;j<n;j++)
	{
		if(a[i]<a[j])
		{
			tmp=a[i];
			a[i] = a[j];
			a[j]=tmp;	
		}	
	}
}
int main()
{
	int n;
	char ss[10];
	float height;
	float male[40];
	float female[40];
	int c_m=0;
	int c_f=0;
	scanf("%d",&n);
	while(n--)
	{
		scanf("%s %f",ss,&height);
		if(ss[0]=='m')
		{
			male[c_m]=height;
			c_m++;
		}
		else 
		{
			female[c_f]=height;
			c_f++;	
		}
	}	
	bubblesort1(male, c_m);
	bubblesort2(female,c_f);
	for(int i=0;i<c_m;i++)
		printf("%.2f ",male[i]);
	for(int j=0;j<c_f-1;j++)
		printf("%.2f ",female[j]);
	printf("%.2f",female[c_f-1]);
	//scanf("%s",ss);
	return 0;
}
int main()
{
    struct student {
        char gender[7];
        float height;
    } students[40], ts;
    int n, i, j;
    scanf("%d", &n);
    for (i=0; i<n; i++) {
        scanf("%s %f", students[i].gender, &students[i].height);
    }
    for (i=0; i<n; i++) {
        for (j=i+1; j<n; j++) {
            int ex = 0;
            if (students[i].gender[0] == 'f' && students[j].gender[0] == 'm')
                ex = 1;
            else if (students[i].gender[0] == 'm' && students[j].gender[0] == 'm')
                ex = (students[i].height > students[j].height);
            else if (students[i].gender[0] == 'f' && students[j].gender[0] == 'f')
                ex = (students[i].height < students[j].height);
            if (ex) {
                ts = students[i];
                students[i] = students[j];
                students[j] = ts;
            }
        }
    }
    for (i=0; i<n; i++) {
        if (i == 0) {
            printf("%.2f", students[i].height);
        }
        else {
            printf(" %.2f", students[i].height);
        }
    }
    return 0;
}
main()
{
      int n,m,f;
      m=0;
      f=0;
      scanf("%d\n",&n);
      struct student
      {
             char sex[6];
             float tall; 
      };
      struct student std1[40];
      struct student std2[40];
      struct student std3[40];
      for(int i=0;i<n;i++)
      {
              scanf("%s %f",std1[i].sex,&std1[i].tall);
              if(strcmp(std1[i].sex,"male")==0)
              {
                       std2[m]=std1[i];
                       m=m+1;
              }
              else
              {
                       std3[f]=std1[i];
                       f=f+1;
              }  
      }
      for(int p=m-1;p>0;p--)
      {
              for(int q=0;q<p;q++)
              {
                      if(std2[q].tall>std2[q+1].tall)
                      {
                                 float t;
                                 t=std2[q].tall;
                                 std2[q].tall=std2[q+1].tall;
                                 std2[q+1].tall=t;
                      }
              }
                      
      }
      for(int p=f-1;p>0;p--)
      {
              for(int q=0;q<p;q++)
              {
                      if(std3[q].tall<std3[q+1].tall)
                      {
                                 float t;
                                 t=std3[q].tall;
                                 std3[q].tall=std3[q+1].tall;
                                 std3[q+1].tall=t;
                      }
              }
      }
      for(int z=0;z<m;z++)
      {
              if(z==0)
              printf("%.2f",std2[z].tall);
              else printf(" %.2f",std2[z].tall);
      }
      for(int z=0;z<f;z++)
      {
              printf(" %.2f",std3[z].tall);
      }
      
}
int n,i,m,f;
char c[41][10];
double h[41];
double hm[41],hf[41];

int main(){
	cin>>n;
	m=0;
	f=0;
	for(i=1;i<=n;i++){
		cin>>c[i]>>h[i];
		if(c[i][0]=='m'){
			hm[m]=h[i];
			m++;
		}
		else{
			hf[f]=h[i];
			f++;
		}
	}
	sort(hm,hm+m);
	sort(hf,hf+f);
	printf("%.2f",hm[0]);
	for(i=1;i<m;i++)
		printf("%c%.2f",' ',hm[i]);
	for(i=f-1;i>=0;i--)
		printf("%c%.2f",' ',hf[i]);
	cout<<endl;
	return 0;
}
int main(){
	int n,i;
	scanf("%d\n",&n);
	char a[40][7];
	int k=0;
	int l=0;
	double d[40],e[40],f[40];
	for(i=0;i<n;i++){
		scanf("%s %lf\n",a[i],&d[i]);
		if(strcmp(a[i],"male")==0){
			e[k]=d[i];
			k++;
		}else{
			f[l]=d[i];
			l++;
		}
	}
	int t;
	double p;
	for(i=1;i<=k;i++){
		for(t=0;t<k-i;t++){
			if(e[t]>e[t+1]){
				p=e[t];
				e[t]=e[t+1];
				e[t+1]=p;
			}
		}
	}
	for(i=1;i<=l;i++){
		for(t=0;t<l-i;t++){
			if(f[t]<f[t+1]){
				p=f[t];
				f[t]=f[t+1];
				f[t+1]=p;
			}
		}
	}
	printf("%.2lf",e[0]);
	for(i=1;i<k;i++){
		printf(" %.2lf",e[i]);
	}
	for(i=0;i<l;i++){
		printf(" %.2lf",f[i]);
	}
	return 0;
}
int main(){
    int n,e=0,w=0;
    char sex[50][9];
    double height[50],mh[50],fh[50],temp;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%s %lf",sex[i],&height[i]);
        if(sex[i][0]=='m'){
            mh[e++]=height[i];
        }else fh[w++]=height[i];
    }
    for(int k=1;k<=e+1;k++){
        for(int j=0;j<e-k;j++){
            if(mh[j]>mh[j+1]){
                temp=mh[j];
                mh[j]=mh[j+1];
                mh[j+1]=temp;
            }
        }
    }
    for(int i=0;i<e;i++){
    printf("%.2lf ",mh[i]);
    }
    for(int k=1;k<=w+1;k++){
        for(int j=0;j<w-k;j++){
            if(fh[j]<fh[j+1]){
                temp=fh[j];
                fh[j]=fh[j+1];
                fh[j+1]=temp;
            }
        }
    }
    for(int i=0;i<w-1;i++){
    printf("%.2lf ",fh[i]);
    }
    printf("%.2lf",fh[w-1]);
    return 0;

    
}
int main()
{
	double m[41],f[41],h;
	char s[10];
	int n,nm,nf;
	int i,j;
	
	scanf("%d",&n);
	i=j=0;
	while(n--)
	{
		scanf("%s%lf",s,&h);
		if(strcmp(s,"male")==0)m[i++]=h;
		else f[j++]=h;
	}
	nm=i;nf=j;
	for(i=0;i<nm;i++)
		for(j=i+1;j<nm;j++)
			if(m[i]>m[j]){
				h=m[i];m[i]=m[j];m[j]=h;
			}
	for(i=0;i<nf;i++)
		for(j=i+1;j<nf;j++)
			if(f[i]<f[j]){
				h=f[i];
				f[i]=f[j];
				f[j]=h;
			}
	if(nm>0)printf("%.2f",m[0]);
	for(i=1;i<nm;i++)
		printf(" %.2f",m[i]);
	for(i=0;i<nf;i++)
		printf(" %.2f",f[i]);
	printf("\n");
	return 0;
}
int main(int argc, char* argv[])
{
	int n,i,r,j=0,k=0;
	char s[7];
	double a[100],b[100],h;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s %lf",s,&h);
		if(*s=='m'){
			a[j]=h;
			j++;
		}
		if(*s=='f'){
			b[k]=h;
			k++;
		}
	}
    for(r=j-1;r>0;r--){
		for(i=0;i<r;i++){
			if(a[i]>a[i+1]){
               h=a[i+1];
			   a[i+1]=a[i];
			   a[i]=h;
			}
		}
	}
    for(r=k-1;r>0;r--){
		for(i=0;i<r;i++){
			if(b[i]>b[i+1]){
               h=b[i+1];
			   b[i+1]=b[i];
			   b[i]=h;
			}
		}
	}
	for(i=0;i<j;i++){
		printf("%.2lf ",a[i]);
	}
	for(i=k-1;i>0;i--){
		printf("%.2lf ",b[i]);
	}
	printf("%.2lf",b[0]);

	return 0;
}
int main(){
	char a[45][10];
	float b[45],f[45],m[45],e;
	int n,k,i;
	int x=0,y=0;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s %f",a[i],&b[i]);
		if(a[i][0]=='m'){
			m[y]=b[i];
			y++;
		}
		if(a[i][0]=='f'){
			f[x]=b[i];
			x++;
		}
	}
	for(k=1;k<=y;k++){
		for(i=0;i<y-k;i++){
			if(m[i]>m[i+1]){
				e=m[i+1];
				m[i+1]=m[i];
				m[i]=e;
			}
		}
	}
	for(i=0;i<y;i++){printf("%.2f ",m[i]);}
	for(k=1;k<=x;k++){
		for(i=0;i<x-k;i++){
			if(f[i]<f[i+1]){
				e=f[i+1];
				f[i+1]=f[i];
				f[i]=e;
			}
		}
	}
	for(i=0;i<x-1;i++){printf("%.2f ",f[i]);}
	printf("%.2f",f[x-1]);
	return 0;
}
int main ()
{
    int n,i,j,s,f,m;
    double male[41],female[41];
    char tip[7];
    scanf("%d\n",&n);
    f=0;
    m=0;
    for(i=0;i<n-1;i++)
    {
                    scanf("%s",tip);
                    if(tip[0]=='f') {scanf("%lf\n",&female[f]);f++;}
                    else
                    {scanf("%lf\n",&male[m]);m++;}
                    }
    scanf("%s",tip);
    if(tip[0]=='f') {scanf("%lf",&female[f]);f++;}
    else
    {scanf("%lf",&male[m]);m++;}
    s=1;
    while (s>0)
    {s=0;
    for (i=0;i<m-1;i++)
    if (male[i]>male[i+1]) {male[i]=male[i]+male[i+1];male[i+1]=male[i]-male[i+1];male[i]=male[i]-male[i+1];s++;}
    }
    s=1;
    while (s>0)
    {s=0;
    for (i=0;i<f-1;i++)
    if (female[i]<female[i+1]) {female[i]=female[i]+female[i+1];female[i+1]=female[i]-female[i+1];female[i]=female[i]-female[i+1];s++;}
    }
    for(i=0;i<m;i++) printf("%.2lf ",male[i]);
    for(i=0;i<f-1;i++) printf("%.2lf ",female[i]);
    printf("%.2lf\n",female[f-1]);
    return 0;
}
int main()
{
	char sex[40][7];
	double height[40], male[40]={0.00}, female[40]={0.00};
	int n, num_male, num_female;
	cin >> n;
	int i, j = 0, k = 0;
	double temp;
	for ( i = 0; i < n; i ++)
	{
		cin >> sex[i] >> height[i];
		if ( strcmp(sex[i],"male")==0 )
		{
			male[j] = height[i];
			j ++;
		}
		else
		{
			female[k] = height[i];
			k ++;
		}
	}
	for ( num_male = 0; num_male < n; num_male ++)
	{
		if (male[num_male] <= 0)
			break;
	}
	for ( num_female = 0; num_female < n; num_female ++)
	{
		if (female[num_female] <= 0)
			break;
	}
	for ( i = 0; i < num_male - 1; i ++)
		for ( j = 0; j < num_male - i - 1; j ++)
		{
			if (male[j] > male[j + 1])
			{
				temp = male[j];
				male[j] = male[j + 1];
				male[j + 1] = temp;
			}
		}
	for ( i = 0; i < num_female - 1; i ++)
		for ( j = 0; j < num_female - i - 1; j ++)
		{
			if (female[j] > female[j+1])
			{
				temp = female[j];
				female[j] = female[j + 1];
				female[j + 1] = temp;
			}
		}
	cout << fixed << setprecision(2) << male[0];
	for ( i = 1; i < num_male; i ++)
		cout << fixed << setprecision(2) <<" "<< male[i];
	for ( i =( num_female - 1); i >= 0; i --)
		cout << fixed << setprecision(2) <<" "<< female[i];
	return 0;
}
int main()
{
	int n,m=0,d=0,i,j,r;
	double s[40],a[40],b[40];
	char c[10];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s%lf",c,&s[i]);
		if(strlen(c)==4){
			a[m]=s[i];
			m++;
		}else{
			b[d]=s[i];
			d++;
		}
	}
	for(j=m-1;j>0;j--)
	{
		for(r=0;r<j;r++)
		{
			if(a[r]>a[r+1]){
				double tmp;
				tmp=a[r+1];
				a[r+1]=a[r];
				a[r]=tmp;
			}
		}
	}
	for(j=d-1;j>0;j--)
	{
		for(r=0;r<j;r++)
		{
			if(b[r]<b[r+1]){
				double tmp;
				tmp=b[r+1];
				b[r+1]=b[r];
				b[r]=tmp;
			}
		}
	}
	for(i=0;i<m;i++)
	{
		printf("%.2lf ",a[i]);
	}
	for(i=0;i<d;i++)
	{
		if(i==d-1){
			printf("%.2lf",b[i]);
		}else{
			printf("%.2lf ",b[i]);
		}
	}
	return 0;
}
int main()
{
	int n,i,j=0,k=0,h;
	double a[40],b[40],c[40];
	struct p{
		char sex[7];
		double height;
	}p[40];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s%lf",p[i].sex,&p[i].height);
	}
	for(i=0;i<n;i++)
	{
		if(strcmp(p[i].sex,"male")==0)
		{
			a[j]=p[i].height;
			j++;

		}
		else{
			b[k]=p[i].height;
			k++;

			
		}
	}
	double t=0;
	for(h=0;h<j;h++)
	{
	for(i=0;i<j-1;i++)
	{
		if(a[i]>a[i+1])
		{
			t=a[i];
			a[i]=a[i+1];
			a[i+1]=t;
		}
	}
	}
	for(h=0;h<k;h++)
	{
		for(i=0;i<k-1;i++)
		if(b[i]<b[i+1])
		{
			t=b[i];
			b[i]=b[i+1];
			b[i+1]=t;
		}
	}
	for(i=0;i<j;i++)
	{
		c[i]=a[i];
	}
	for(i=j;i<n;i++)
	{
		c[i]=b[i-j];
	}
	printf("%.2lf",c[0]);
	for(i=1;i<n;i++)
	{
		printf(" %.2lf",c[i]);
	}
	return 0;
}
/*
 * ????first.cpp
 * ???00948343_??
 * ?????2012/9/16
 * ?????1???100?????????
 */



int main(){
	int n, i, j;
	cin >> n;
	float male[n], female[n], height;
	int count_male=0, count_female=0;
	char gender[8];
	for (i=0;i<n;i++){
		cin >> gender >> height;
		if (strcmp(gender,"male")==0){
			male[count_male]=height;
			count_male++;
		}
		else{
			female[count_female]=height;
			count_female++;
		}
	}
	float temp;
	for (i=0;i<count_male-1;i++){
		for (j=0;j<count_male-1-i;j++){
			if (male[j]>male[j+1]){
				temp=male[j];
				male[j]=male[j+1];
				male[j+1]=temp;
			}
		}
	}
	for (i=0;i<count_female-1;i++){
		for (j=0;j<count_female-i-1;j++){
			if (female[j]<female[j+1]){
				temp=female[j];
				female[j]=female[j+1];
				female[j+1]=temp;
			}
		}
	}
	for (i=0;i<count_male;i++){
		cout << fixed << setprecision(2)<< male[i] << ' ';
	}
	for (i=0;i<count_female;i++){
		cout << fixed << setprecision(2) << female[i];
		if (i!=count_female-1)
			cout << ' ';
	}
	return 0;
}
int main(){
	int n,i,j,t=0,l=0;
	double h[40],m[40],f[40];
	char s[40][7];
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s%lf",s[i],&h[i]);
		if(s[i][0]=='m'){
			m[t]=h[i];
			t++;
		}else{
			f[l]=h[i];
			l++;
		}
	}
	for(i=0;i<t-1;i++){
		for(j=t-1;j>i;j--){
			if(m[j]<m[j-1]){
				double p=m[j];
				m[j]=m[j-1];
				m[j-1]=p;
			}
		}
	}
	for(i=0;i<t;i++){
		printf("%.2lf ",m[i]);
	}
	for(i=0;i<l-1;i++){
		for(j=l-1;j>i;j--){
			if(f[j]>f[j-1]){
				double q=f[j];
				f[j]=f[j-1];
				f[j-1]=q;
			}
		}
	}
	for(i=0;i<l-1;i++){
		printf("%.2lf ",f[i]);
	}
	for(i=l-1;i<l;i++){
		printf("%.2lf",f[i]);
	}
	return 0;
}
int main(){
    int n,i,j,k,s,q;
	double e,a,m[40],f[40];
	char gen[10];
	s=0;
	q=0;
	j=0;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s",gen);
		scanf("%lf",&a);
        if(gen[0]=='m'){
		    m[j]=a;
			j++;
		}
		else{
		   f[q]=a;
		   q++;
		}
	}
    for(k=1;k<=j;k++){
		for(i=0;i<j-k;i++){
			if(m[i]>m[i+1]){
                  e=m[i];
				  m[i]=m[i+1];
				  m[i+1]=e;
			}
		}
	}
	for(k=1;k<=q;k++){
		for(i=0;i<q-k;i++){
			if(f[i]<f[i+1]){
                  e=f[i];
				  f[i]=f[i+1];
				  f[i+1]=e;
			}
		}
	}
    for(i=0;i<j;i++){
		printf("%.2lf ",m[i]);
	}
    for(i=0;i<q-1;i++){
		printf("%.2lf ",f[i]);
	}
	printf("%.2lf",f[q-1]);

return 0;
}
int main(){
	double hi[40],ghi[40],bhi[40];
	double h;
	char sex[40][7];
	int n,i,g,b,k;
	g=0;
	b=0;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s %lf",sex[i],&hi[i]);
		if(sex[i][0]=='f'){
			ghi[g]=hi[i];
			g++;
		}else{
			bhi[b]=hi[i];
			b++;
		}
	}
	for(k=1;k<g;k++){
		for(i=0;i<g-k;i++){
			if(ghi[i]<ghi[i+1]){
				h=ghi[i];
				ghi[i]=ghi[i+1];
				ghi[i+1]=h;
			}
		}
	}
	for(k=1;k<b;k++){
		for(i=0;i<b-k;i++){
			if(bhi[i]>bhi[i+1]){
				h=bhi[i];
				bhi[i]=bhi[i+1];
				bhi[i+1]=h;
			}
		}
	}
	for(i=0;i<b;i++){
		printf("%.2lf ",bhi[i]);
	}
	for(i=0;i<g;i++){
		printf("%.2lf",ghi[i]);
		if(i<g-1){
			printf(" ");
		}
	}
	return 0;
}
int main(){
    int i,nanshu=0,nvshu=0,k,zongrenshu;
    double shengao;
    scanf("%d",&zongrenshu);
    double nanshengao[zongrenshu],nvshengao[zongrenshu],zhongjianliang;
    char xingbie[7],nv[7]="female",nan[5]="male";
    for(i=0;i<zongrenshu;i++){
        scanf("%s %lf",xingbie,&shengao);
        if(strcmp(xingbie,nv)==0){
            nvshengao[nvshu]=shengao;
            nvshu++;
        }else{
            nanshengao[nanshu]=shengao;
            nanshu++;
        }
    }
    for(i=1;i<=nanshu;i++){
        for(k=0;k<(nanshu-i);k++){
            if(nanshengao[k]>nanshengao[k+1]){
                zhongjianliang=nanshengao[k+1];
                nanshengao[k+1]=nanshengao[k];
                nanshengao[k]=zhongjianliang;
            }
        }
    }
    for(i=1;i<=nvshu;i++){
        for(k=0;k<(nvshu-i);k++){
            if(nvshengao[k]<nvshengao[k+1]){
                zhongjianliang=nvshengao[k+1];
                nvshengao[k+1]=nvshengao[k];
                nvshengao[k]=zhongjianliang;
            }
        }
    }
    for(i=0;i<nanshu;i++){
        printf("%.2lf ",nanshengao[i]);
    }
    for(i=0;i<(nvshu-1);i++){
        printf("%.2lf ",nvshengao[i]);
    }
    printf("%.2lf",nvshengao[nvshu-1]);
    return 0;
}
int main(){
	int n,i,j,gn=0,bn=0;
	double h[42],g[42],b[42],t;
	char sex[42][10];
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		scanf("%s",sex[i]);
		scanf("%lf",&h[i]);
		if(strcmp(sex[i],"female")==0)
		{
			g[gn]=h[i];
			gn++;
		}
		else
		{
			b[bn]=h[i];
			bn++;
		}
	}
	for(i=0;i<bn-1;i++)
	{
		for(j=0;j<bn-i-1;j++)
		{
			if(b[j]>b[j+1])
			{
				t=b[j];
				b[j]=b[j+1];
				b[j+1]=t;
			}
		}
	}
    for(i=0;i<gn-1;i++)
	{
		for(j=0;j<gn-i-1;j++)
		{
			if(g[j]<g[j+1])
			{
				t=g[j];
				g[j]=g[j+1];
				g[j+1]=t;
			}
		}
	}
	for(i=0;i<bn;i++)
	{
		printf("%.2lf ",b[i]);
	}
	for(i=0;i<gn-1;i++)
	{
		printf("%.2lf ",g[i]);
	}
	printf("%.2lf",g[gn-1]);
	return 0;
}