semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int main ()
{
	int n, i, m, w, j;
	double height, temp;
	double man[50];
	double woman[50];
	char xb[10];
	cin >> n;
	m = 0;
	w = 0;
	for (i = 1; i <= n; i++)
	{
		cin >> xb;
		cin >> height;
		if (xb[0] == 'm') 
		{
			m++;
			man[m] = height;
		}
		else 
		{
			w++;
			woman[w] = height;
		}
	}
	for (i = 1; i <= m - 1; i++)
	{
		for (j = 1; j <= m - i; j++)
		{
			if (man[j] > man[j + 1]) 
			{
				temp = man[j];
				man[j] = man[j + 1];
				man[j + 1] = temp;
			}
		}
	}
	for (i = 1; i <= w - 1; i++)
	{
		for (j = 1; j <= w - i; j++)
		{
			if (woman[j] < woman[j + 1])
			{
				temp = woman[j];
				woman[j] = woman[j + 1];
				woman[j + 1] = temp;
			}
		}
	}
	cout << fixed << setprecision(2) <<man[1];
	for (i = 2; i <= m; i++)
	{
		cout << fixed << setprecision(2) << " " << man[i];
	}
	for (i = 1; i <= w; i++)
	{
		cout << fixed << setprecision(2) << " " << woman[i];
	}
	cout << endl;
	return 0;
}
int compInc(const void *a, const void *b)
{
    return *(int *)a - *(int *)b;
}
struct student
{
    float height;
    char sex[7];
};
main()
{
    int n,q=0,j=0;
    struct student stu[40];
    float girl[40],boy[40];
    scanf("%d",&n);
    for(int i = 0;i < n;i ++)
        scanf("%s%f",stu[i].sex,&stu[i].height);
    for(int i = 0;i < n;i ++)
    {
        if(stu[i].sex[0]=='f')
            girl[q++]=stu[i].height;
        else
            boy[j++]=stu[i].height;
    }
    qsort(boy,j,sizeof(boy[0]),compInc);
    qsort(girl,q,sizeof(girl[0]),compInc);
    printf("%.2f",boy[0]);
    for (int i = 1;i < j;i++)
        printf(" %.2f",boy[i]);
    for (int i = q-1;i >=0 ;i--)
        printf(" %.2f",girl[i]);
    
}
int main()
{
    int i, j, n, t;
    float m[41]={0}, f[41]={0}, h[41]={0};
    char str[41][7];
    cin>>n;
    for(i=1; i<=n; i++)
    {
        cin>>str[i]>>h[i];
        if(strcmp(str[i],"male")==0)
        {
            m[i]=h[i];            
            //cout<<" "<<fixed<<setprecision(2)<<m[i];            
        }
        else
        {
            f[i]=h[i];
        }
             
    }
    sort(m+1,m+n+1);
    sort(f+1,f+n+1);
    for(i=1; i<=n; i++)
    {
        if(m[i]!=0)
        {
            t=i;
            cout<<fixed<<setprecision(2)<<m[i];
            for(j=t+1;j<=n;j++)
            {
                
                cout<<" "<<fixed<<setprecision(2)<<m[j]; 
                              
            }
            break;
        }
        
    }
    for(i=n; i>=1; i--)
    {
        if(f[i]==0)
            break;
        else
        {
            cout<<" "<<fixed<<setprecision(2)<<f[i];                 
        }
        
    }
    int x;cin>>x;
    return 0;
    }
int main()
{
    double male[50],female[50];
    double hit,t;
    char str[10];
    int n,i,j=0,k=0,l;
    scanf("%d",&n);
    for (i=0;i<n;i++){
        scanf("%s%lf",str,&hit);
        if (str[0]=='m') {
                         male[j]=hit;
                         j++;
                         }
                         else {
                              female[k]=hit;
                              k++;
                              }
        }
    for (i=0;i<j;i++){
        for (l=i;l<j;l++) {
            if (male[i]>male[l]){
               t=male[i];
               male[i]=male[l];
               male[l]=t;
               }
        }
    }
    for (i=0;i<k;i++){
        for (l=i;l<k;l++) {
            if (female[i]<female[l]){
               t=female[i];
               female[i]=female[l];
               female[l]=t;
               }
        }
    }
    for (i=0;i<j-1;i++){
        printf("%.2lf ",male[i]);
        }
    printf("%.2lf",male[j-1]);
    for (i=0;i<k;i++){
        printf(" %.2lf",female[i]);
        }
    return 0;
}
int main(){
	struct person{ 
		char sex[6];
		double height;
	}person[40];
	int n,i,j,mk=0,fk=0;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s%lf",person[i].sex,&(person[i].height));
	}
	double male[40],female[40];
	for(i=0;i<n;i++){
		if(strcmp(person[i].sex,"male")==0){
			male[mk]=person[i].height;
			mk++;
		}
	}
	for(i=0;i<n;i++){
		if(strcmp(person[i].sex,"female")==0){
			female[fk]=person[i].height;
			fk++;
		}
	}
	for(i=0;i<mk;i++){
		for(j=mk-1;j>0;j--){
			if(male[j-1]>male[j]){
				double p;
				p=male[j];
				male[j]=male[j-1];
				male[j-1]=p;
			}
		}
	}
	for(i=0;i<fk;i++){
		for(j=fk-1;j>0;j--){
			if(female[j-1]<female[j]){
				double p;
				p=female[j];
				female[j]=female[j-1];
				female[j-1]=p;
			}
		}
	}
	for(i=0;i<mk;i++){
		if(i==0){
			printf("%.2lf",male[i]);
		}else{
			printf(" %.2lf",male[i]);
		}
	}
	for(i=0;i<fk;i++){
		printf(" %.2lf",female[i]);
	}
	return 0;
}
int main(){
int n,i,a=0,b=0,j,k;
scanf("%d",&n);
char A[n][10];
double F[n],M[n],h,g;
for(i=0;i<n;i++)
{
    scanf("%s",A[i]);
    if(A[i][0]=='f')
    {
       scanf("%lf",&F[a]);
       a++;
    }
    if(A[i][0]=='m')
    {
       scanf("%lf",&M[b]);
       b++;
    }
}
for(j=0;j<a;j++)
{
    for(k=0;k<a-j-1;k++)
    {
        if(F[k]<F[k+1])
        {
            h=F[k];
            F[k]=F[k+1];
            F[k+1]=h;
        }
    }
}
for(j=0;j<b;j++)
{
    for(k=0;k<b-j-1;k++)
    {
        if(M[k]>M[k+1])
        {
            g=M[k];
            M[k]=M[k+1];
            M[k+1]=g;
        }
    }
}
for(i=0;i<b;i++)
{
    printf("%.2lf ",M[i]);
}
for(i=0;i<a-1;i++)
{
    printf("%.2lf ",F[i]);
}
printf("%.2lf",F[a-1]);
return 0;
}
int main()
{
	int n,i,m;
	double a[41]={0},b[41]={0};
	char s1[41][10];
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		char c[10];
		scanf("%s %lf",s1[i],&a[i]);
		gets(c);
	}
	int j=0,k=0;
	for(i=1;i<=n;i++)
	{
	    if(s1[i][0]=='m')
	    {
	    	a[j]=a[i];
	    	j++;
	    }
	    if(s1[i][0]=='f')
	    {
	    	b[k]=a[i];
	    	k++;
	    }
	}
	for(i=0;i<j;i++)
	{
		for(m=i+1;m<j;m++)
		{
			if(a[i]>a[m])
			{
				double p;
				p=a[i];
				a[i]=a[m];
				a[m]=p;
			}
		}
	}
	for(i=0;i<k;i++)
	{
		for(m=i+1;m<k;m++)
		{
			if(b[i]<b[m])
			{
				double p;
				p=b[i];
				b[i]=b[m];
				b[m]=p;
			}
		}
	}
	printf("%.2f",a[0]);
	for(i=1;i<j;i++)
	{
		printf(" %.2f",a[i]);
	}
	for(i=0;i<k;i++)
	{
		printf(" %.2f",b[i]);
	}
}
int htr(int h);
int main()
{
    int n,i,j,m=0,f=0;
    double mh[41],fh[41],h,e;
    char fm[7];
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%s%lf",&fm,&h);
        if(fm[0]=='f'){
           fh[f]=h;
           f++;
           }
        else {
           mh[m]=h;
           m++;
           }
        }
     for(i=(m-1);i>0;i--){
        for(j=0;j<i;j++){
            if(mh[j]>mh[j+1]){
               e=mh[j];
               mh[j]=mh[j+1];
               mh[j+1]=e;
               }
            }
        }
     for(i=(f-1);i>0;i--){
        for(j=0;j<i;j++){
            if(fh[j]<fh[j+1]){
               e=fh[j];
               fh[j]=fh[j+1];
               fh[j+1]=e;
               }
            }
        }
     for(i=0;i<m;i++)printf("%.2lf ",mh[i]);
     for(i=0;i<(f-1);i++)printf("%.2lf ",fh[i]);
     printf("%.2lf",fh[f-1]);
     return 0;
}
int main()
{
	int n,i,j,m=0,f=0;
	double sz[40],male[40],female[40];
	char sex[40][10];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s%lf",&sex[i],&sz[i]);
		if(strcmp(sex[i],"male")==0)
		{
			male[m]=sz[i];
			m++;
		}
		else
		{
			female[f]=sz[i];
			f++;
		}
	}
	for(i=1;i<m;i++)
	{
		for(j=0;j<m-i;j++)
		{
			if(male[j]>male[j+1])
			{
				double c;
				c=male[j];
				male[j]=male[j+1];
				male[j+1]=c;
			}
		}
	}
	for(i=0;i<m;i++)
	{
		printf("%.2lf ",male[i]);
	}


	for(i=1;i<f;i++)
	{
		for(j=0;j<f-i;j++)
		{
			if(female[j]<female[j+1])
			{
				double d;
				d=female[j];
				female[j]=female[j+1];
				female[j+1]=d;
			}
		}
	}
	for(i=0;i<f;i++)
	{
		if(i==f-1)
		{
			printf("%.2lf",female[i]);
		}
		else
		{
		    printf("%.2lf ",female[i]);
		}
	}
	return 0;
}
double m[40],f[40];
int main()
{
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    int n;
    char str[20];
    double h;
    int b,g;
    while(scanf("%d",&n)!=EOF)
    {
        b=0;
        g=0;
        for(int i=0;i<n;i++)
        {
            scanf("%s%lf",str,&h);
            if(strcmp(str,"male")==0)
            {
                m[b++]=h;
            }
            else
                f[g++]=h;
        }
        sort(m,m+b);
        sort(f,f+g);
        for(int i=0;i<b;i++)
            printf("%.2lf ",m[i]);
            //cout<<<<" ";
        //cout<<g<<endl;      
        for(int i=(g-1);i>0;i--)
            printf("%.2lf ",f[i]);
        printf("%.2lf\n",f[0]);
        //cout<<f[0]<<endl;
        //cout<<endl;
        
    }
    return 0;
}
int main(){
	int n,a=0,b=0,k,j;
	double m[40],f[40];
	struct ren
	{
		char s[10];
		double h;
	}r[40];
	scanf("%d",&n);
	for(int i=0;i<n;i++)
	{
		scanf("%s%lf",r[i].s,&r[i].h);
		if(strcmp(r[i].s,"male")==0)
		{
			m[a]=r[i].h;
			a++;
		}
		if(strcmp(r[i].s,"female")==0)
		{
			f[b]=r[i].h;
			b++;
		}
	}
	for( k = 1; k <= a; k++){
		double e;
		for(int i = 0; i < a - k; i++){
			if(m[i] > m[i+1]){
				e = m[i+1];
				m[i+1] = m[i];
				m[i] = e;
			}
		}

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

	}
	printf("%.2lf",m[0]);
	for( j=1;j<a;j++)
	{
		printf(" %.2lf",m[j]);
	}
	for( j=b-1;j>=0;j--)
	{
		printf(" %.2lf",f[j]);
	}
	return 0;
}
int main(){
	int n,i,k=0,r=0,t;
	double fm[40],m[40],e,h;
	char x[7];
	struct pd{
		double h;
		char x[7];
	}pds[40];
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s%lf",x,&h);
		strcpy(pds[i].x,x);
		pds[i].h=h;
	}
	for(i=0;i<n;i++){
		if(strcmp(pds[i].x,"male")==0){
			m[k]=pds[i].h;
			k++;
		}else{
			fm[r]=pds[i].h;
			r++;
		}
	}for(t=1;t<=k;t++){
		for(i=0;i<k-t;i++){
			if(m[i]>m[i+1]){
				e=m[i];
				m[i]=m[i+1];
				m[i+1]=e;
			}
		}
	}
	for(t=1;t<=r;t++){
		for(i=0;i<r-t;i++){
			if(fm[i]<fm[i+1]){
				e=fm[i];
				fm[i]=fm[i+1];
				fm[i+1]=e;
			}
		}
	}
	for(i=0;i<k;i++){
		printf("%.2lf ",m[i]);
	}
	for(i=0;i<r-1;i++){
		printf("%.2lf ",fm[i]);
	}
	printf("%.2lf",fm[r-1]);
	return 0;
}
int main()
{
	int n,sum1=0,sum2=0,i;
	double data1[50],data2[50],temp;
	char mark[10];
	cin>>n;
	for(i=0;i<n;i++)
	{
		cin>>mark;
		if(strcmp(mark,"male")==0)
		{
			cin>>data1[sum1++];
		}
		else{cin>>data2[sum2++];}
	}
	sort(data1,data1+sum1);
	sort(data2,data2+sum2);
	for(i=0;i<sum2/2;i++)
	{
		temp=data2[i];
		data2[i]=data2[sum2-1-i];
		data2[sum2-1-i]=temp;
	}
	printf("%.2f",data1[0]);
	for(i=1;i<sum1;i++)
	{
		printf(" %.2f",data1[i]);
	}
	for(i=0;i<sum2;i++)
	{
		printf(" %.2f",data2[i]);
	}
	cout<<endl;
	return 0;
}
int main()
{
	int n=0;
	char gender[8];
	char gen[40];
	float height[40];
	float male[40];
	float female[40];
	int malenum=0,femalenum=0;
	int i=0,j=0,k=0,l=0,m=0;
	float temp;

	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s %f",&gender,&height[i]);
		gen[i]=gender[0];
		male[i]=0.0;
		female[i]=0.0;
	
	}
	for(i=0;i<n;i++)
	{
		if(gen[i]=='m')
		{
			male[j]=height[i];
			j++;
		}
			else if(gen[i]=='f')
			{
				female[k]=height[i];

				k++;
			}
	}

	malenum=j;
	femalenum=k;

	while(j--)
	{
		for(l=0;l<j;l++)
		{
			if(male[l]>male[l+1])
			{
				temp=male[l+1];
				male[l+1]=male[l];
				male[l]=temp;
			}
		}
	}

	while(k--)
	{
		for(l=0;l<k;l++)
		{
			if(female[l]<female[l+1])
			{
				temp=female[l+1];
				female[l+1]=female[l];
				female[l]=temp;
			}
		}
	}

	for(i=0;i<malenum;i++)
		printf("%.2f ",male[i]);
	for(i=0;i<(femalenum-1);i++)
		printf("%.2f ",female[i]);

	printf("%.2f",female[i]);

	return 0;
}
int main()
{
	float h,e,mh[40],fh[40];
	int n,i,j,am,af;
	char xb[7];
	am=0;
	af=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s %f",xb,&h);
		if(xb[0]=='m')
		{
			mh[am]=h;
			am=am+1;
		}
		if(xb[0]=='f')
		{
			fh[af]=h;
			af=af+1;
		}
	}
	for(i=1;i<=am;i++)
	{
		for(j=0;j<am-i;j++)
		{
			if(mh[j]>mh[j+1])
			{
				e=mh[j];
				mh[j]=mh[j+1];
				mh[j+1]=e;
			}
		}
	}
	for(i=1;i<=af;i++)
	{
		for(j=af-1;j>0;j--)
		{
			if(fh[j]>fh[j-1])
			{
				e=fh[j];
				fh[j]=fh[j-1];
				fh[j-1]=e;
			}
		}
	}
	for(i=0;i<am;i++)
	{
		if(i==0)
		{
			printf("%.2f",mh[i]);
		}else{
			printf(" %.2f",mh[i]);
		}
	}
	for(i=0;i<af;i++)
	{
		printf(" %.2f",fh[i]);
	}
	return 0;
}
int main(){
	int n,i,j=0,k=0,a,b,p=0,q=0;
	double sz[50],f[50],m[50],e;
	char s[10];
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s%lf",s,&(sz[i]));
		if(s[0]=='f'){
			f[j]=sz[i];
			j++;
			p++;

		}
		else if(s[0]=='m'){
			m[k]=sz[i];
			k++;
			q++;
		}
	}
		for(a=1;a<=q;a++){
			for(k=0;k<q-a;k++){
				if(m[k]>m[k+1]){
				e=m[k];
				m[k]=m[k+1];
				m[k+1]=e;
			}
			}
		}
		for(b=1;b<=p;b++){
			for(j=0;j<p-b;j++){
				if(f[j]<f[j+1]){
					e=f[j];
					f[j]=f[j+1];
					f[j+1]=e;
				}
			}
		}
		for(k=0;k<q;k++){
			printf("%.2lf ",m[k]);
		}
		for(j=0;j<p;j++){
			if(j<p-1)
			printf("%.2lf ",f[j]);
			else printf("%.2lf",f[j]);
		}
		return 0;
	}
int main()
{
	int n, i ,j, f = 0, m=0;
	float height[41] = {0}, female[41], male[41];
	char gender[41][7] = {'\0'};
	cin >> n;
	for(i = 0; i < n; i++)
		cin >> gender[i] >> height[i];
	for(i = 0; i < n ;i++)
	{
		if(gender[i][0] == 'm')		
			male[m++] = height[i];	 
		else
			female[f++] = height[i];
	}
	for(i = 0; i < m; i++)
	{
		for(j = 0; j < m - 1 - i; j++)
		{
			if(male[j] > male[j + 1])
			{
				double temp = male[j];
				male[j] = male[j + 1];
				male[j + 1] = temp;
			}
		}
	}
	for(i = 0; i < f; i++)
	{
		for(j = 0; j < f - 1 - i; j++)
		{
			if(female[j] < female[j + 1])
			{
				double temp = female[j];
				female[j] = female[j + 1];
				female[j + 1] = temp;
			}
		}
	}
	for(i = 0; i < m; i++)
		cout << fixed << setprecision(2) << male[i] << " ";
	for(i = 0; i < f - 1; i++)
		cout << fixed << setprecision(2) << female[i] << " ";
	cout << fixed << setprecision(2) << female[f - 1] << endl;
	return 0;
}
int main()
{
	char s[50][20], man[5] = { "male" }, wman[7] = { "female" };
	double l[50];
	double temp;
	int n, i, j, tip;
	cin >> n;
	for (i = 0; i < n; i++)
		cin >> s[i] >> l[i];
	for (i = 0; i < n - 1; i++)
	for (j = i + 1; j < n; j++)
	{
		if (strcmp(s[i], man) == 0 && strcmp(s[j], man) == 0 && l[i] > l[j])
		{
			temp = l[i];
			l[i] = l[j];
			l[j] = temp;
		}

	}
	for (i = 0; i < n - 1; i++)
	for (j = i + 1; j < n; j++)
	{
		if (strcmp(s[i], wman) == 0 && strcmp(s[j], wman) == 0 && l[i] < l[j])
		{
			temp = l[i];
			l[i] = l[j];
			l[j] = temp;
		}

	}
	for (i = n - 1; i >= 0; i--)
	{
		if (strcmp(s[i], wman) == 0)
		{
			tip = i;
			break;
		}
	}
	cout <<fixed;
	for (i = 0; i < n; i++)
	{
		if (strcmp(s[i], man) == 0)
			cout << setprecision(2) << l[i] << " ";
	}
	for (i = 0; i < tip; i++)
	{
		if (strcmp(s[i], wman) == 0)
			cout << setprecision(2) << l[i] << " ";
	}
	cout << setprecision(2) << l[tip] << endl;
	return 0;
}
int main()
{
	double male[50], female[50], height, tep;
    int n, i, j, m = 0, f = 0;
	char ch[7];

	cin >> n;
	for (i = 0; i < n ; i++)
	{
		 cin.get();
	     cin.getline(ch, 7, ' ');//?????????????cin?getline??????height??????????cin??
		 cin >> height;
		 if (ch[0] == 'm')
			 male[m++] = height;
		 else
			 female[f++] = height;
	}
	for (i = 0; i < m - 1; i++)
		for (j = 0; j < m - 1 - i; j++)
		{
          	if(male[j] > male[j + 1])
			{
			     tep = male[j];
				 male[j] = male[j + 1];
				 male[j + 1] = tep;
			}
		}
	for (i = 0; i < f - 1; i++)
	    for (j = i + 1; j < f; j++)
		{
		    if (female[i] < female[j])
			{
			    tep = female[i];
				female[i] = female[j];
				female[j] = tep;
			}
		}
	cout << fixed << setprecision(2);
	cout << male[0];
	for (i = 1; i < m; i++)
		cout << " " << male[i];
	for (i = 0; i < f; i++)
        cout << " " << female[i];
	
	    return 0;
}
int main()
{
	int n,i,m=0,f=0,k;
	char sex[10];
	char s[10]={"male"};
	double h;
	struct
	{
		char sex[10];
		double h;
	}
	qq[40],male[40],female[40],e;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s",sex);
		scanf("%lf",&h);
		strcpy(qq[i].sex,sex);
		qq[i].h=h;
	}
	for(i=0;i<n;i++)
	{
		if(strcmp(qq[i].sex,s))
		{
			female[f]=qq[i];
			f++;
		}
		else
		{
			male[m]=qq[i];
			m++;
			
		}
	}
	for(i=1;i<m;i++)
	{
		for(k=0;k<m-i;k++)
		{
			if(male[k].h>male[k+1].h)
			{
				e=male[k];
				male[k]=male[k+1];
				male[k+1]=e;
			}
		}
	}
    for(i=1;i<f;i++)
	{
		for(k=0;k<f-i;k++)
		{
			if(female[k].h>female[k+1].h)
			{
				e=female[k];
				female[k]=female[k+1];
				female[k+1]=e;
			}
		}
	}
	printf("%.2lf",male[0].h);
	for(i=1;i<m;i++)
	{
		printf(" %.2lf",male[i].h);
	}
	for(i=f-1;i>=0;i--)
	{
		printf(" %.2lf",female[i].h);
	}
	return 0;
}
float m[50];
float f[50];
int main()
{
	int total,count;
	float meter;
	char str[10];
	int mt,ft;
	int i,j;
	scanf("%d",&total);
	mt=ft=0;
	for(count=0;count<total;count++)
	{
		scanf("%s %f",&str,&meter);

		if(!strcmp(str,"male"))
		{
			m[mt++]=meter;
		}
		else
		{
			f[ft++]=meter;
		}
	}
	for(i=0;i<mt;i++)
		for(j=i+1;j<mt;j++)
			if(m[i]>m[j])
			{
				meter=m[i];
				m[i]=m[j];
				m[j]=meter;
			}
	for(i=0;i<ft;i++)
		for(j=i+1;j<ft;j++)
			if(f[i]<f[j])
			{
				meter=f[i];
				f[i]=f[j];
				f[j]=meter;
			}
	for(i=0;i<mt;i++)
		printf("%.2f ",m[i]);
	for(i=0;i<ft-1;i++)
		printf("%.2f ",f[i]);
	printf("%.2f\n",f[i]);
	return 0;
}
int male[45];
int female[45];
char ch[20];
int cmp1(const void *a, const void *b)
{
	int *temp1 = (int *)a;
	int *temp2 = (int *)b;
	
	return (int )(*temp1 - *temp2);
}
int cmp2(const void *a, const void *b)
{
	int *temp1 = (int *)a;
	int *temp2 = (int *)b;
	
	return (int )(*temp2 - *temp1);
}


int main()
{
	int n;
	cin >> n;
	int m = 0, f = 0;
	double h;
	for(int i = 0; i < n ; i++)
	{
		cin>>ch;
		if(strcmp(ch, "male") == 0)
		{
			cin>>h;
			male[m] =(int)( h * 10000);
			m++;
		}
		else
		{
			cin>>h;
			female[f] =(int)( h * 10000);
			f++;
		}

	}
	qsort(male, m  , sizeof(int), cmp1);
	qsort(female, f  , sizeof(int), cmp2);
	
	for(int i = 0; i < m; i ++)
		printf("%3.2lf ",male[i] / 10000.0);
	for(int i = 0; i < f - 1; i++)
		printf("%3.2lf ",female[i] / 10000.0);
	printf("%3.2lf",female[f - 1] / 10000.0);
	return 0;
}
int main()
{
	int N, k,i, j;
	char sex[10];
	double a[45], b[45], temp;
	int boy = 0, girl = 0;
	cin >> N;
	for (k = 0; k < N; k++)
	{
		cin >> sex >> temp;
		if (sex[0] == 'f' )
		{
			b[girl] = temp;
			girl++;
		}
		else
		{
			a[boy] = temp;
			boy++;
		}
	}
	for(i = 1; i < boy;i++)
		for(j = 0; j < boy - 1;j++)
		{
			if (a[j] > a[j + 1])
			{
				temp = a[j + 1];
				a[j + 1] = a[j];
				a[j] = temp;
			}
		}
    for(i = 1; i < girl;i++)
		for(j = 0; j < girl - 1;j++)
		{
			if (b[j] < b[j + 1])
			{
				temp = b[j + 1];
				b[j + 1] = b[j];
				b[j] = temp;
			}
		}
	for(i = 0; i < boy;i++)
		cout <<fixed << setprecision(2) <<  a[i] << " ";
    for(j = 0; j < girl - 1;j++)
	    cout <<fixed << setprecision(2) << b[j] << " ";
	cout <<fixed << setprecision(2)<< b[j] << endl;
	return 0;
}
int main()
{
    char xb[10];
    int i,n,a=0,b=0,k;
    scanf("%d",&n);
    float m,shuzunan[40],shuzunv[40];
    for(i=0;i<n;i++)
    {
       
       scanf("%s",&xb);    
       if(*xb=='m')
       {
          scanf("%f",&shuzunan[a]);
          a++;
       }
       if(*xb=='f')
       {
          scanf("%f",&shuzunv[b]);
          b++;
       }
    }
    for(k=1;k<a;k++)
    {
       for(i=0;i<a-k;i++)
       {
          if(shuzunan[i]>shuzunan[i+1])
          {
              m=shuzunan[i+1];
              shuzunan[i+1]=shuzunan[i];
              shuzunan[i]=m;
          }
       }
    }
    for(k=1;k<b;k++)
    {
           for(i=0;i<b-k;i++)
           {
               if(shuzunv[i]<shuzunv[i+1])
               {
                 m=shuzunv[i+1];
                 shuzunv[i+1]=shuzunv[i];
                 shuzunv[i]=m;
               }
           }
    }
    printf("%.2f",shuzunan[0]);
    for(k=1;k<a;k++)
    {
        printf(" %.2f",shuzunan[k]);
    }
    for(k=0;k<b;k++)
    {
        printf(" %.2f",shuzunv[k]);
    }                     
	

   return 0;
}
int main()
{
	struct strudent
	{
		char sex[7];
		float h;
		int c;
	}s[45],m[40],f[40],t;
	int n,i,j=0,k=0,female=0,male=0,l;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("\n%s %f",&s[i].sex,&s[i].h);
	}
	for(i=0;i<n;i++)
	{
		l=strlen(s[i].sex);
		if(l==4)
		{
			s[i].c=1;
		}
		else if(l==6)
		{
			s[i].c=0;
		}
	}
	for(i=0;i<n;i++)
	{
		if(s[i].c==1)
		{
			m[male]=s[i];
			male++;
		}
		else if(s[i].c==0)
		{
			f[female]=s[i];
			female++;
		}
	}
	for(i=1;i<male;i++)
	{
		for(j=male-1;j>0;j--)
		{
			if(m[j].h<m[j-1].h)
			{
				t=m[j];
				m[j]=m[j-1];
				m[j-1]=t;
			}
		}
	}
	for(i=1;i<female;i++)
	{
		for(j=female-1;j>0;j--)
		{
			if(f[j].h>f[j-1].h)
			{
				t=f[j];
				f[j]=f[j-1];
				f[j-1]=t;
			}
		}
	}
	for(i=0;i<male;i++)
	{
		printf("%.2f ",m[i].h);
	}
	for(i=0;i<female;i++)
	{
		if(i!=female-1)
		{
			printf("%.2f ",f[i].h);
		}
		else
			printf("%.2f",f[i].h);
	}
	return 0;
}
int main()
{
	int n=0,i;
	float nan[40];
	int m,f;
	float nv[40];
	char xingbie[7];
	float shengao;
	scanf("%d",&n);
	m=0;f=0;
	for (i=0;i<=n-1;i++)
	{
		scanf("%s %f",xingbie,&shengao);
		
		if(xingbie[0]=='m')
		{nan[m]=shengao;
		 m++;
		}
		else
		{nv[f]=shengao;
		 f++;
		}
	}
float T;
int j,k;

for(j=0;j<=m-2;j++)
{ for(k=0;k<=m-2-j;k++)
 {
  if(nan[k]>nan[k+1])
   {
	  T=nan[k+1];	  
	  nan[k+1]=nan[k];
	  nan[k]=T;
   }
 }
}
   for(j=0;j<=f-2;j++)
 { for(k=0;k<=f-2-j;k++)
  {
   if(nv[k]<nv[k+1])
   {
	  T=nv[k+1];	  
	  nv[k+1]=nv[k];
	  nv[k]=T;
   }
  }
 }
   for(i=0;i<m;i++)
      printf("%.2f ",nan[i]);
 for(i=0;i<f-1;i++)
    printf("%.2f ",nv[i]);
printf("%.2f",nv[f-1]);
	return 0;
}
int main()
{
	int n,i,r=0,t=0,k;
	char s[41][8];
	double d[41],b[41],g[41],e;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s" "%lf",s[i],&d[i]);
	}
	for(i=0;i<n;i++){
		if(s[i][0]=='m'){
			b[r]=d[i];
			r++;
		}else if(s[i][0]=='f'){
			g[t]=d[i];
			t++;
		}
	}
	for(k=1;k<=r;k++){
		for(i=0;i<r-k;i++){
			if(b[i]>b[i+1]){
				e=b[i];
				b[i]=b[i+1];
				b[i+1]=e;
			}
		}
	}
	for(k=1;k<=t;k++){
		for(i=0;i<t-k;i++){
			if(g[i]<g[i+1]){
				e=g[i];
				g[i]=g[i+1];
				g[i+1]=e;
			}
		}
	}
	printf("%.2lf",b[0]);
	for(i=1;i<r;i++){
		printf(" %.2lf",b[i]);
	}
	for(i=0;i<t;i++){
		printf(" %.2lf",g[i]);
	}
	return 0;
}
int main(){
    int n,l,i,j=1,k=1;
    int o;
    double e;
    scanf("%d",&n);
    char a[45];
    double p[45],q[45],r[45];

        char sex[45];
        double h[45];

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

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

    }
    for(l=1;l<=j-1;l++){
        for(i=1;i<j-l;i++){
            if(p[i]>p[i+1]){
                e=p[i+1];
                p[i+1]=p[i];
                p[i]=e;
                }
        }
    }
    for(l=1;l<=k-1;l++){
        for(i=1;i<k-l;i++){
            if(q[i]<q[i+1]){
                e=q[i+1];
                q[i+1]=q[i];
                q[i]=e;
                }
        }
    }
    for(i=1;i<=j-1;i++){
        r[i]=p[i];
        }
    o=1;
    for(i=j;i<=n;i++){
        r[i]=q[o];
        o++;
        }
    for(i=1;i<n;i++){
        printf("%.2lf ",r[i]);
    }
    if(i==n){
        printf("%.2lf",r[i]);
        }
    return 0;
}
struct stu
{
  char sex[7];
  float height;        
};
main()
{
    int n,i,j=0,k=0,m;
	scanf("%d",&n);
    float b[n],c[n],t;
    struct stu a[n];
    for(i=0;i<n;i++)
       scanf("%s %f",a[i].sex,&a[i].height);
    
    for(i=0;i<n;i++)
      {
        if(strcmp(a[i].sex,"male")==0)
          {
            b[j]=a[i].height;
            j++;
          }
        else if(strcmp(a[i].sex,"female")==0) 
          {
            c[k]=a[i].height;
            k++;
          }
      }
     
    for(i=0;i<j-1;i++)
      for(m=0;m<j-i-1;m++)
          if(b[m]>b[m+1])
            {  
              t=b[m];  
              b[m]=b[m+1];  
              b[m+1]=t; 
            }
    for(i=0;i<k-1;i++)
      for(m=0;m<k-i-1;m++)
          if(c[m]<c[m+1])
            {  
              t=c[m];  
              c[m]=c[m+1];  
              c[m+1]=t; 
            }
    
    printf("%.2f",b[0]);
    for(i=1;i<j;i++)
	  printf(" %.2f",b[i]);
    for(i=0;i<k;i++)
	  printf(" %.2f",c[i]);  
}