semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int main()
{ 
	struct a
	{
		char x[6];
		double y;
	}as[40],t;
	int n,i,k,I;
	scanf("%d",&n);
	for(i=0;i<n;i++) scanf("%s%lf",as[i].x,&as[i].y);
	for(k=0;k<n;k++) 
	{ 
		for(i=1;i<n-k;i++) 
		if(as[i].y<as[i-1].y)
		{
			t=as[i];
			as[i]=as[i-1];
			as[i-1]=t;
		}
	}
	for(i=0;i<n;i++)
	{
		if(strcmp(as[i].x,"male")==0) printf("%.2lf ",as[i].y);
	}
	for(i=n-1;i>=0;i--)
	{
		if(strcmp(as[i].x,"female")==0) {printf("%.2lf",as[i].y);I=i;break;}
	}
	for(i=I-1;i>=0;i--)
	{
		if(strcmp(as[i].x,"female")==0) printf(" %.2lf",as[i].y);
	}
	return 0;
}
int main()
{
	int n;
	cin>>n;
	char sex[100][30];
	double high[100];
	for(int i = 1; i <= n; ++i)
		cin >> sex[i] >> high[i];
	for(int i = 1; i <= n; ++i)
	{
		for(int t = 1; t <= n; ++t)
		{
			double s;
			char c[30];
			if(high[t] > high[i])
			{
				s=high[t];
				high[t]=high[i];
				high[i]=s;
				strcpy(c,sex[i]);
				strcpy(sex[i],sex[t]);
				strcpy(sex[t],c);
			}
		}
	}
	//for(int i = 1; i <= n; ++i) cout<<high[i]<<sex[i]<<endl;
	int step = 0;
	for(int i = 1; i <= n; ++i)
	{
		if(strcmp(sex[i],"female") == 0)
			continue;
		if(step != (n-1))
		{
			printf("%.2f ",high[i]);
			step = step + 1;
            //cout<<step<<endl;
		}
		else
			printf("%.2f",high[i]);
        //cout<<step<<endl;
	}
	
	for(int i = n; i >= 1; --i)
	{
		if(strcmp(sex[i],"male") ==0)
			continue;
		if(step != (n-1))
		{
			printf("%.2f ",high[i]);
			step = step + 1;
            //cout<<step<<endl;
		}
		else
			printf("%.2f",high[i]);
		//if(step == n) break;
		//cout<<step<<endl;
	}
	//while(1);
	return 0;
}
int cmp(const void *x,const void *y)
{
	return *(int*)x-*(int *)y;
}
int main()
{
	int n;
	scanf("%d",&n);
	int i=0,j,k,a=0,b=0;
	char sex[10];
	float man[40],woman[40],h;
	while(i<n)
	{
		scanf("%s %f",sex,&h);
		if(sex[0]=='m')
		{
			man[a]=h;
			a++;
		}
		else
		{	
			woman[b]=h;
			b++;
		}
		i++;
	}
	qsort(man,a,sizeof(float),cmp);
	qsort(woman,b,sizeof(float),cmp);
	printf("%.2f",man[0]);
	for(k=1;k<a;k++)
		printf(" %.2f",man[k]);
	for(k=b-1;k>0;k--)
		printf(" %.2f",woman[k]);
	printf(" %.2f\n",woman[0]);
}
int main(){
char xb[40][7];
int n,i,j=0,z=0,k;
double h,hm[40],hf[40];

scanf("%d",&n);
for(i=0;i<n;i++){
  scanf("%s %lf",xb[i],&h);
  
  if(xb[i][0]=='m'){
  hm[j]=h;
  j++;
  }else{
  hf[z]=h;
  z++;
  }
}

for(k=1;k<j;k++){
	for(i=0;i<j-k;i++){
		if(hm[i]>hm[i+1]){
		h=hm[i];
		hm[i]=hm[i+1];
		hm[i+1]=h;
		}
	}
}

for(k=1;k<z;k++){
	for(i=0;i<z-k;i++){
		if(hf[i]<hf[i+1]){
		h=hf[i];
		hf[i]=hf[i+1];
		hf[i+1]=h;
		}
	}
}
for(i=0;i<j;i++){
printf("%.2lf ",hm[i]);
}
for(i=0;i<z-1;i++){
printf("%.2lf ",hf[i]);

}
printf("%.2lf",hf[z-1]);

return 0;
}
int main()
{
	int i,j,n;
	scanf("%d",&n);
	char s[41][7],t[7];
	double h[41],tmp;
	for(i=1;i<=n;i++)
		scanf("%s %lf",s[i],&h[i]);

	for(i=n;i>1;i--)
		for(j=1;j<i;j++)
		{
			if( (s[j][0]=='m'&&s[j+1][0]=='m'&&h[j]>h[j+1]) || (s[j][0]=='f'&&s[j+1][0]=='f'&&h[j]<h[j+1]) || (s[j][0]=='f'&&s[j+1][0]=='m'))
			{
				strcpy(t,s[j]);
				strcpy(s[j],s[j+1]);
				strcpy(s[j+1],t);
				tmp=h[j];
				h[j]=h[j+1];
				h[j+1]=tmp;
			}
		}
   tmp=1;
	for(i=1;i<=n;i++)
	{
		if(tmp==1)
		{
			printf("%.2lf",h[i]);
			tmp++;
		}
		else printf(" %.2lf",h[i]);
	}

	return 0;
}
void main()
{
	int i,j,n,num=0;
	struct p{
		char sex[8];
		double ag;
	}a[300],temp;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s %lf",a[i].sex,&a[i].ag);
	}
	for(i=0;i<n-1;i++){
		for(j=1;j<n-i;j++){
			if(strcmp(a[j-1].sex,"female")==0&&strcmp(a[j].sex,"female")==0){
				if(a[j-1].ag<a[j].ag){
					temp=a[j-1];
					a[j-1]=a[j];
					a[j]=temp;
				}
			}
			else if(strcmp(a[j-1].sex,"female")==0&&strcmp(a[j].sex,"male")==0){
				temp=a[j-1];
				a[j-1]=a[j];
				a[j]=temp;
			}
			else if(strcmp(a[j-1].sex,"male")==0&&strcmp(a[j].sex,"male")==0){
				if(a[j-1].ag>a[j].ag){
					temp=a[j-1];
					a[j-1]=a[j];
					a[j]=temp;
				}
			}
		}
	}
	for(i=0;i<n;i++)printf("%.2lf%c",a[i].ag,i==n-1?'\n':' ');
}
int main()
{
int number,lm=0,lw=0,i,j,m,n;
float height[50],hm[50],hw[50],k;
char sex[50][10],male[5]={'m','a','l','e'},female[7]={'f','e','m','a','l','e'};
scanf("%d",&number);
for(i=0;i<number;i++)
 {
 scanf("%s%f",sex[i],&height[i]);
 }
for(i=0;i<number;i++)
 {
 if(strcmp(sex[i],male)==0)
  {
  hm[lm]=height[i];
  lm++;
  }
 if(strcmp(sex[i],female)==0)
  {
  hw[lw]=height[i];
  lw++;
  }
 }
for(i=0;i<lm;i++)
 {
  for(j=0;j<(lm-1);j++)
  {
  if(hm[j]>hm[j+1])
   {
   k=hm[j];
   hm[j]=hm[j+1];
   hm[j+1]=k;
   }
  }
 }
for(i=0;i<lw;i++)
 {
  for(j=0;j<(lw-1);j++)
  {
  if(hw[j]<hw[j+1])
   {
   k=hw[j];
   hw[j]=hw[j+1];
   hw[j+1]=k;
   }
  }
}
printf("%.2f",hm[0]);
for(i=1;i<lm;i++)
 printf(" %.2f",hm[i]);
for(i=0;i<lw;i++)
 printf(" %.2f",hw[i]);

}
int main()
{
 int n,m,i,j,f,e,k;
 int q[10000],p[10000];
 double r[10000],o[10000],d;
 char s[10000],w[100000];
 scanf("%d",&n);
 j=0;k=0;
 for(i=0;i<n;i++){
	 scanf("%s",s);
	 if(s[0]=='m'){scanf("%lf",&r[j]);j++;}
	 if(s[0]=='f'){scanf("%lf",&o[k]);k++;}
 }
 for(i=0;i<j;i++){
	 for(e=0;e<j-1;e++){
		 if(r[e]>r[e+1]){
			 d=r[e];
			 r[e]=r[e+1];
			 r[e+1]=d;
		 }
	 }
 }
  for(i=0;i<k;i++){
	 for(e=0;e<k-1;e++){
		 if(o[e]<o[e+1]){
			 d=o[e];
			 o[e]=o[e+1];
			 o[e+1]=d;
		 }
	 }
 }
  printf("%.2lf",r[0]);
for(i=1;i<j;i++)  printf(" %.2lf",r[i]);
for(i=0;i<k;i++)  printf(" %.2lf",o[i]);


 return 0;
}
int main()
{

	int N,i,j,p,k;
	float d;
	float m[100],n[100];
	char c[100];
	scanf("%d",&N);
	p=0;
	k=0;
	for(i=0;i<=N-1;i++)
	{
		scanf("%s",&c);
		if(c[0]=='m')
		{
		scanf("%f",&m[p]);
		p++;
		}
		else
		{
		scanf("%f",&n[k]);
		k++;
		}
	}
	for(i=1;i<=p-1;i++)
	{
		for(j=0;j<=i-1;j++)
		{
			if(m[i]<m[j])
			{
				d=m[i];
				m[i]=m[j];
				m[j]=d;
			}
		}
	}
	for(i=1;i<=k-1;i++)
	{
		for(j=0;j<=i-1;j++)
		{
			if(n[i]>n[j])
			{
				d=n[i];
				n[i]=n[j];
				n[j]=d;
			}
		}
	}
	for(i=0;i<=p-1;i++)
	printf("%.2f ",m[i]);
	for(i=0;i<=k-2;i++)
	printf("%.2f ",n[i]);
	printf("%.2f",n[k-1]);
	return 0;
}
int com( const void * a , const void * b )
{
	double a1 = *(double*) a;
	double a2 = *(double*) b;

	if( a1 > a2 )
		return 1;
	else 
		return 0;
}

int main()
{
	int i , j , k , r , ren , max , i_nan , i_nv ;
	char c;
	double nan[200];
	double nv[200];

	scanf( "%d" , &ren );
	getchar();

	i_nan = i_nv = 0;
	for( i = 0 ; i < ren ; i++ ){
		for( j = 0 ; j < 4 ; j++ ){
			c = getchar();
		}

		if( c == 'e' ){
			getchar();
			scanf( "%lf" , &nan[i_nan++] );
			getchar();
		}

		else{
			for( k = 0 ; k < 3 ; k++ )
				getchar();
			scanf( "%lf" , &nv[i_nv++] );
			getchar();
		}
	}

	qsort( (void*)nan , i_nan , sizeof( nan[0] ) , com  );
	qsort( (void*)nv , i_nv , sizeof( nv[0] ) , com  );

	for( i = 0 ; i < i_nan ; i++ ){
		printf( "%.2lf" , nan[i] );
		printf( " " );
	}
	for( j = i_nv-1 ; j >= 0 ; j-- ){
		printf( "%.2lf" , nv[j] );
		if( j != 0 )
			printf( " " );
		else
			printf( "\n" );
	}

	return 0;
}
int main()
{
	int n,i;
	scanf("%d",&n);

	char s1[100][40]={0};
	double s2[40]={0};
	double a[40]={0};
	double b[40]={0};
	int j,k;
	j=0;
	k=0;
	for(i=0;i<n;i++)
	{
		scanf("%s %lf",s1[i],&s2[i]);
		if(strcmp(s1[i],"male")==0)
		{
			a[j]=s2[i];
			j++;
		}
		if(strcmp(s1[i],"female")==0)
		{
			b[k]=s2[i];
			k++;
		}
	}

	double slot;
	int aa,bb;
	for(aa=j;aa>=0;aa--)
	{
		for(bb=0;bb<=aa;bb++)
		{
			if(a[bb]>a[bb+1])
			{
				slot=a[bb];
				a[bb]=a[bb+1];
				a[bb+1]=slot;
			}
		}
	}
	for(aa=k;aa>=0;aa--)
	{
		for(bb=0;bb<=aa;bb++)
		{
			if(b[bb]<b[bb+1])
			{
				slot=b[bb];
				b[bb]=b[bb+1];
				b[bb+1]=slot;
			}
		}
	}

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

	return 0;
}
int main(){
	int n;
	scanf("%d",&n);
	double a;
	char b[10];
	int i,j=0,q=0,s=0;
	double m[40];
	double f[40];
	for(i=0;i<n;i++){
		m[i]=0.00;
		f[i]=0.00;
		scanf("%s",b);
		scanf("%lf",&a);
		if(b[0]=='m'){
			m[j]=a;
			j++;
		}
		else{
			f[q]=a;
			q++;
		}			
	}
	int k;
	for(k = 1; k <= j; k++){
		double e;
		for(i=0;i<j-k;i++){
			if(m[i] >m[i+1]){
				e = m[i+1];
				m[i+1] = m[i];
				m[i] = e;
			}
		}
	}
	for(k=1; k <= q; k++){
		double g;
		for(i=0;i<q-k;i++){
			if(f[i]<f[i+1]){
				g = f[i+1];
				f[i+1] = f[i];
				f[i] = g;
			}
		}
	}
	for(i=0;i<j;i++){
		if(s==0){
			printf("%.2lf",m[i]);
		    s++;
		}
		else
			printf(" %.2lf",m[i]);
	}
	for(i=0;i<q;i++){
		if(s==0){
			printf("%.2lf",f[i]);
			s++;
		}
		else 
			printf(" %.2lf",f[i]);
	}
    return 0;
}
int main(){
    double male[40]={0};
    double female[40]={0};
    char sex[10];
	int i,j,n;
	int m=0,f=0;
	double h,t;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s%lf",sex,&h);
		if(sex[0]=='m'){
           male[m]=h;
           m++;
        }else{
           female[f]=h;
           f++;
        }
	}
	for(i=1;i<=m;i++){
		for(j=0;j<m-i;j++){
			if(male[j]>male[j+1]){
				t=male[j];
				male[j]=male[j+1];
				male[j+1]=t;
			}
		}
    }
	for(i=1;i<=f;i++){
		for(j=0;j<f-i;j++){
			if(female[j]>female[j+1]){
				t=female[j];
				female[j]=female[j+1];
				female[j+1]=t;
			}
		}
	}
	printf("%.2lf",male[0]);
	for(i=1;i<m;i++){
		printf(" %.2lf",male[i]);
	}for(i=f-1;i>=0;i--){
		printf(" %.2lf",female[i]);
	}
   
   return 0;
}
int main()
{
	int n;
	cin>>n;
	int i,j,s=0,t=0;
    float temp,m[10000],f[10000];
	char tempchar[10];
	for (i=0;i<n;i++)
	{
		cin>>tempchar;
		if (tempchar[0]=='m')
			cin>>m[s++];
		else cin>>f[t++];
	}

	for (i=0;i<s-1;i++)
		for (j=s-1;j>i;j--)
			if(m[j]<m[j-1])
			{
				temp=m[j];
				m[j]=m[j-1];
				m[j-1]=temp;
			}

	for (i=0;i<t-1;i++)
		for (j=t-1;j>i;j--)
			if(f[j]>f[j-1])
			{
				temp=f[j];
				f[j]=f[j-1];
				f[j-1]=temp;
			}
	for (i=0;i<s;i++)
	{
		printf("%.2f",m[i]);
		cout<<' ';
	}
	for (i=0;i<t-1;i++)
	{	printf("%.2f",f[i]);
		cout<<' ';
	}
	printf("%.2f",f[i]);
	return 0;
}
int main ()
{
    char gender[10];
    float high_male[40], high_female[40];
    int counter_male = 0, counter_female = 0, n;
    cin >> n;
    for (int i = 1; i <= n; i++){
        cin >> gender;
        switch (gender[0]){
            case 'f' : {
                cin >> high_female[counter_female];
                counter_female++;
                break;
            }
            case 'm' : {
                cin >> high_male[counter_male];
                counter_male++;
                break;
            }
        }
    }
    for (int i = 1; i <= counter_male; i++)
        for (int j = 0; j < counter_male-i; j++)
            if (high_male[j] > high_male[j+1]){
                float temp = high_male[j];
                high_male[j] = high_male[j+1];
                high_male[j+1] = temp;
            }
    for (int i = 1; i <= counter_female; i++)
        for (int j = 0; j < counter_female-i; j++)
            if (high_female[j] < high_female[j+1]){
                float temp = high_female[j];
                high_female[j] = high_female[j+1];
                high_female[j+1] = temp;
            }
    for (int i = 0; i < counter_male; i++) cout << fixed << setprecision(2) << high_male[i] << " ";
    for (int i = 0; i < counter_female-1; i++) cout << high_female[i] << " ";
    cout << high_female[counter_female-1];
    return 0;
}
int main()
{
	int n,i,k=0,j=0,t;
	struct ren{
		char sex[41];
		double high;
	}xue[41],huan,man[41],woman[41];

scanf("%d",&n);
		for(i=0;i<n;i++){
scanf("%s %lf",&xue[i].sex,&xue[i].high);
		}
		for(i=0;i<n;i++){
			if(strcmp(xue[i].sex,"male")==0){
			man[k]=xue[i];
			k++;
			}
			if(strcmp(xue[i].sex,"female")==0){
				woman[j]=xue[i];
				j++;
			}
		}
		for(i=0;i<k;i++){
			for(t=0;t<k-i-1;t++){
				if(man[t].high>man[t+1].high){
			huan=man[t];
			man[t]=man[t+1];
			man[t+1]=huan;
				}
			}
		}
		
		for(i=0;i<j;i++){
			for(t=0;t<j-i-1;t++){
				if(woman[t].high<woman[t+1].high){
			huan=woman[t];
			woman[t]=woman[t+1];
			woman[t+1]=huan;
				}
			}
		}
		for(t=0;t<k;t++){
		printf("%.2lf ",man[t].high);
		}
		for(t=0;t<j-1;t++){
		printf("%.2lf ",woman[t].high);
		}
		printf("%.2lf",woman[j-1].high);
		return 0;
}
int main()
{
	int i,r,j=0,k=0,n;
	double a[41],b[41];
	char s[10];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s",s);
		if(strlen(s)==4)
		{
			scanf("%lf",&a[j]);
			j++;
		}
		if(strlen(s)==6)
		{
			scanf("%lf",&b[k]);
			k++;
		}
	}
	for(i=j-1;i>0;i--)
	{
		for(r=0;r<i;r++)
		{
			if(a[r+1]<a[r])
			{
				double tmp;
				tmp=a[r+1];
				a[r+1]=a[r];
				a[r]=tmp;
			}
		}
	}
	for(i=0;i<k-1;i++)
	{
		for(r=k-1;r>0;r--)
		{
			if(b[r-1]<b[r])
			{
				double tmp;
				tmp=b[r-1];
				b[r-1]=b[r];
				b[r]=tmp;
			}
		}
	}
	r=0;
	for(i=j;i<=(j+k-1);i++)
	{
		a[i]=b[r];
		r++;
	}
    printf("%.2lf",a[0]);
	for(i=1;i<=(j+k-1);i++)
	{
		printf(" %.2lf",a[i]);
	}
	return 0;
}
int mao(double * a,int n)
{
    double tmp=0;
    for (int i=0;i<n;i++)
    {
        for (int j=1;j<n;j++)
        {
            if (a[j]<a[j-1]){ tmp=a[j];a[j]=a[j-1]; a[j-1]=tmp;}
        }
    }
    return 0;
}
int mao1(double * a,int n)
{
    double tmp=0;
    for (int i=0;i<n;i++)
    {
        for (int j=1;j<n;j++)
        {
            if (a[j]>a[j-1]){ tmp=a[j];a[j]=a[j-1]; a[j-1]=tmp;}
        }
    }
    return 0;
}
int main()
{
    double m[40],f[40],r;
    int n,i;
    int ml=0,fl=0;
    char type[10];
    cin>>n;
    for (i=0;i<n;i++)
    {
        scanf("%s%lf",type,&r);
        if (type[0]=='m') m[ml++]=r;
        else f[fl++]=r;
    }
    mao(m,ml);
    mao1(f,fl);
    for (i=0;i<ml;i++)
    printf("%.2lf ",m[i]);
    printf("%.2lf",f[0]);
    for (i=1;i<fl;i++)
    printf(" %.2lf",f[i]);
    cout<<endl;

    return 0;
}
int main(){
	int q,i,e,p=0,o=0;
	double w,r,M[100]={0},F[100]={0};
	char D[50][10];
	scanf("%d",&q);
	for(i=0;i<q;i++){
		scanf("%s%lf",D[i],&w);
		if(D[i][0]=='m'){
			M[p]=w;
						p++;

		}else if(D[i][0]=='f'){
			F[o]=w;
			o++;
		}
	}
	for(i=0;i<o;i++){
		for(e=o-1;e>0;e--){
			if(F[e]>F[e-1]){
				r=F[e];
				F[e]=F[e-1];
				F[e-1]=r;
			}
		}
	}
	for(i=0;i<p;i++){
		for(e=p-1;e>0;e--){
		if(M[e]<M[e-1]){
			r=M[e];
			M[e]=M[e-1];
			M[e-1]=r;
		}
		}
	}
	for(i=0;i<p;i++){
		printf("%0.2lf ",M[i]);
	}
	for(i=0;i<o;i++){
		if(i<o-1){
			printf("%0.2lf ",F[i]);
		}else if(i==o-1){
			printf("%0.2lf",F[i]);
		}
	}
	return 0;
}
main()
{
 struct student
 {
  char sex[6];
  float height;      
 }stu[40];
 int n, bnum=0, gnum=0;
 int i, j;
 float temp;
 float boy[40], girl[40];
 scanf("%d", &n);
 for (i=0; i<n; i++)
 {
  scanf("%s", stu[i].sex);
  scanf("%f", &stu[i].height);    
  if (strcmp(stu[i].sex, "female")>0)
  {
   boy[i-gnum]=stu[i].height;
   bnum++;                      
  }
  else 
  {
   girl[i-bnum]=stu[i].height;
   gnum++;    
  }
 }
 
 for (i=0; i<bnum; i++)
 {
  for (j=bnum-1; j>i; j--)
  {
   if (boy[j]<boy[j-1])
   {
    temp=boy[j-1];
    boy[j-1]=boy[j];
    boy[j]=temp;                   
   }   
  }    
 }
 
 for (i=0; i<gnum; i++)
 {
  for (j=gnum-1; j>i; j--)
  {
   if (girl[j]>girl[j-1])
   {
    temp=girl[j-1];
    girl[j-1]=girl[j];
    girl[j]=temp;                   
   }   
  }    
 }
  
 for (i=0; i<bnum; i++)
     printf("%.2f ", boy[i]);
 for (i=0; i<gnum-1; i++)
     printf("%.2f ", girl[i]);
 printf("%.2f", girl[gnum-1]);
 
 }
int main(){
    char a[100];
    int k,n,i,j,nimei=0,meizi=0;
    double tem,m[100],f[100],b;
 scanf("%d",&n);
 
 for(j=0;j<n;j++){
                   scanf("%s%lf",a,&b);
                   
                   if(a[0]=='m'){
                                 m[nimei]=b;
                                 nimei++;
                                 }
                    else{f[meizi]=b;
                        meizi++;
                        }
                        }
            for(i=0;i<nimei;i++){
                                 for(k=0;k<nimei-1;k++){
                                                        if(m[k]>m[k+1]){
                                                                        tem=m[k];
                                                                        m[k]=m[k+1];
                                                                        m[k+1]=tem;
                                                                        }
                                                         }
                                 }
  for(i=0;i<meizi;i++){  
                              for(k=0;k<meizi-1;k++){
                                                        if(f[k]<f[k+1]){
                                                                        tem=f[k];
                                                                        f[k]=f[k+1];
                                                                        f[k+1]=tem;
                                                                        }
                                                      }
                              }
 for(j=0;j<nimei;j++){  printf("%.2lf ",m[j]);}
 for(j=0;j<meizi-1;j++){printf("%.2lf ",f[j]);}
 printf("%.2lf",f[meizi-1]);
                                     
                                     
                                                                                                      

return 0;}
int main() 
{
    int n,i,j,nan=0,nv=0;
    char s[10];
    double h,male[40],female[40];
    scanf("%d",&n);
    for(i=1;i<=n;i++)
    {
         scanf("%s%lf",s,&h);
         if(strlen(s)==4)
         {
             nan++;
             male[nan-1]=h;
         }else if(strlen(s)==6){
             nv++;
             female[nv-1]=h;
         }
    }
    for(i=1;i<=nan;i++)
    {
         for(j=0;j<nan-i;j++)
         {
             if(male[j]>male[j+1])
             {
                 double e;
                 e=male[j];
                 male[j]=male[j+1];
                 male[j+1]=e;
             }
         }
    }
    for(i=1;i<=nv;i++)
    {
         for(j=0;j<=nv-i;j++)
         {
             if(female[j]<female[j+1])
             {
                 double e;
                 e=female[j];
                 female[j]=female[j+1];
                 female[j+1]=e;
             }
         }
    }
    printf("%.2lf",male[0]);
    for(i=1;i<nan;i++)
    {
                      printf(" %.2lf",male[i]);
    }
    for(i=0;i<nv;i++)
    {
                      printf(" %.2lf",female[i]);
    }
    return 0;
}
int cmp(const void* a,const void * b)
{   float x=*(float*)a;
    float y=*(float*)b;
	if(x>y)
	 return 1;
	 else return -1;
	}
	
int main()
{
	int n;
	scanf("%d",&n);
  float s1[50];
  float s2[50];
	    int m=0,f=0;
	for(int i=0;i<n;i++)
	{   	char sex[10];
	    float h;
		cin>>sex>>h;
		if(strcmp(sex,"male")==0)
		{s1[m]=h;
		 m++;}
		if(strcmp(sex,"female")==0)
		{s2[f]=h;f++;}
		
		
		
		}
	qsort(s1,m,sizeof(s1[0]),&cmp);
	qsort(s2,f,sizeof(s2[0]),&cmp);
	for(int i=0;i<m;i++)
	printf("%.2f ",s1[i]);
	for(int i=f-1;i>0;i--)
		printf("%.2f ",s2[i]);
	printf("%.2f",s2[0]);
	}
int main()
{
	int n,i,k;
	char zfc[100][20],ex[20];
	double h[100],mi;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s%lf",zfc[i],&h[i]);
	}
	for(k=1;k<n;k++)
	{
		for(i=0;i<n-k;i++)
		{
			if((strcmp(zfc[i],"female")==0&&strcmp(zfc[i+1],"male")==0)||(strcmp(zfc[i],"male")==0&&strcmp(zfc[i+1],"male")==0&&h[i]>h[i+1])||(strcmp(zfc[i],"female")==0&&strcmp(zfc[i+1],"female")==0&&h[i]<h[i+1]))
			{
				strcpy(ex,zfc[i]);
				strcpy(zfc[i],zfc[i+1]);
				strcpy(zfc[i+1],ex);
				mi=h[i];
				h[i]=h[i+1];
				h[i+1]=mi;
			}
		}
	}
	printf("%.2lf",h[0]);
	for(i=1;i<=n-1;i++)
	{
		printf(" %.2lf",h[i]);
	}
	return 0;
}
//*************************
//*  ??????? 
//*  ????? 
//*  ???1200012941 
//*  ???2012?9?24? 
//*************************
int main()
{
    int i, j, n, s = 0, r = 0;
    char sex[10];
    double height;
    double male[40] = {0};
    double female[40] = {0};
    cin >> n;
    for (i = 0; i < n; i++)
    {
        cin >> sex >> height;
        if (strcmp(sex, "male") == 0)
        {
            male[s++] = height;
        }
        else
        {
            female[r++] = height;
        }
    }
    double temp;
    for (i = 0; i < s - 1; i++)
     for (j = 0; j < s - 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 < s; i++)
    {
        cout << fixed << setprecision(2) << male[i] << " ";
    }
    for (i = 0; i < r - 1; i++)
     for (j = 0; j < r - 1 - i; j++)
     {
         if (female[j] < female[j+1])
         {
             temp = female[j];
             female[j] = female[j+1];
             female[j+1] = temp;
         }
     }
    for (i = 0; i < r - 1; i++)
    {
         cout << fixed << setprecision(2) << female[i] << " "; 
    }
    cout << fixed << setprecision(2) << female[r-1] << endl;
    return 0;
}
main()
{
    int n,i,j,k;
    double w;
    scanf("%d",&n);
    char sex[100][100];
    double height1[100];
    double height3[100];
    double height2[100];
    for(i=0;i<n;i++)
    {
        char b[100];
        scanf("%s",sex[i]);
        scanf("%lf",&height1[i]);
    }
    char *p={"female"};
    int count1=0;
    int count2=0;
    j=0;
    k=0;
    for(i=0;i<n;i++)
    {
        if(strcmp(sex[i],p)==0)
        {
            count1++;
            w=height1[i];//???2
            height2[j]=w;
            j++;
        }
        else
        {
            count2++;
            w=height1[i];//???3
            height3[k]=w;
            k++;
        }
    }
    /*qsort(height2,count1,sizeof(double),cmp);
    qsort(height3,count2,sizeof(double),cmp);
    for(i=0;i<count1;i++)
    printf("%.2f ",height2[i]);
    for(j=0;j<count2;j++)
    printf("~%.2lf~",height3[j]);
    printf("%d %d",count1,count2);*/
    for(i=0;i<count1;i++)
    {
        for(j=i;j<count1;j++)
        {
            if(height2[i]<height2[j])
            {
                double m;
                m=height2[j];
                height2[j]=height2[i];
                height2[i]=m;
            }
        }
    }
    for(i=0;i<count2;i++)
    {
        for(j=i;j<count2;j++)
        {
            if(height3[i]>height3[j])
            {
                double m;
                m=height3[j];
                height3[j]=height3[i];
                height3[i]=m;
            }
        }
    }
    for(i=0;i<count2;i++)
    printf("%.2lf ",height3[i]);
    for(i=0;i<count1-1;i++)
    printf("%.2lf ",height2[i]);
    printf("%.2lf",height2[count1-1]);
}
main()
{
    int n,c=0,d=0,e,f,g,h,i,a[40],a1[40],b[40],b1[40];
    char gender[7];
    scanf("%d",&n);
    for( ;d+c<=n-1; )
   {
    scanf("%s ",gender);
    if (gender[0]=='m')
    {scanf("%d.%d",&a1[c],&a[c]);
     c++;
     }
   else
    {scanf("%d.%d",&b1[d],&b[d]);
     d++;
     }
   }
    for(e=0;e<=c-2;e++)
    {
       for(f=e+1;f<=c-1;f++)
       {
        if(a1[e]>a1[f])
        {g=a[e];a[e]=a[f];a[f]=g;g=a1[e];a1[e]=a1[f];a1[f]=g;}
        else 
        {
         if(a1[e]==a1[f] && a[e]>a[f])
          {g=a[e];a[e]=a[f];a[f]=g;g=a1[e];a1[e]=a1[f];a1[f]=g;}
         else ;
        }
       }
    }
    for(e=0;e<=d-2;e++)
    {
       for(f=e+1;f<=d-1;f++)
       {
        if(b1[e]<b1[f])
        {g=b[e];b[e]=b[f];b[f]=g;g=b1[e];b1[e]=b1[f];b1[f]=g;}
        else 
        {
         if(b1[e]==b1[f] && b[e]<b[f])
         {g=b[e];b[e]=b[f];b[f]=g;g=b1[e];b1[e]=b1[f];b1[f]=g;}
         else ;
        }
       }
    }
  // printf("%d %d %d\n",c,d,n);
   
    for(e=0;e<=c-1;e++)
{
    if(a[e]>=10)
    printf("%d.%d ",a1[e],a[e]);
    else
    printf("%d.0%d ",a1[e],a[e]);
}
    for(e=0;e<=d-2;e++)
{
    if(b[e]>=10)
    printf("%d.%d ",b1[e],b[e]);
    else
    printf("%d.0%d ",b1[e],b[e]);
    
}
    
if(b[e]>=10)
    printf("%d.%d\n",b1[e],b[e]);
    else
    printf("%d.0%d\n",b1[e],b[e]);

}
int main()
 
{
 
int n,m,o,i,j;
 
double a[81]={0};
double male[50],female[50];
 
char b[41][7];
 
cin>>n;
 
m=0; 
o=0;
for(i=1;i<=n;i++)
{
cin>>b[i];
if(b[i][0]=='m')
{
	m++;
	cin>>male[m];
}
 if(b[i][0]=='f') 
{
o++;
cin>>female[o];
}
} 
 
/*double x;
for(i=1;i<=m-1;i++) 
{
for(j=m;j>i;j--)
{ 
if(male[j]<male[j-1])
{
x=male[j];
male[j]=male[j-1];
male[j-1]=x;
}
}
}
 
for(i=1;i<=o-1;i++) 
{
for(j=o;j>i;j--)
{
if(female[j]>female[j-1])
{
x=female[j];
female[j]=female[j-1];
female[j-1]=x;
}
}
 
}
*/
sort(male+1,male+m+1);
sort(female+1,female+o+1);
for(i=1;i<=m;i++)
 
{
 
cout<<fixed;
cout<<setprecision(2)<<male[i]<<" ";
 
}
for(i=o;i>=2;i--)
 
{
 
cout<<fixed;
cout<<setprecision(2)<<female[i]<<" ";
 
}
if(o>0) 
{cout<<fixed;
 
cout<<setprecision(2)<<female[1]<<endl;
}
return 0;
}