semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
main()
{
    int i,n,j,p=0,q=0; 
    float d;
    struct photo
    {
        char gender[10];
        float height;
    }a[40],m[40],f[40];
    
    scanf("%d",&n);
    for(i=0;i<n;i++)
    scanf("%s %f",&a[i].gender,&a[i].height);
    
    for(i=0;i<n;i++)
    {
        if (a[i].gender[0]=='m')
        {
            m[p]=a[i];
            p++;
        }
        else
        {
            f[q]=a[i];
            q++;
        }    
    }
    
    for(i=0;i<p-1;i++)
    {
        for(j=i;j<p;j++)
        {
            if(m[i].height>m[j].height)
            {
                d=m[i].height;
                m[i].height=m[j].height;
                m[j].height=d;
            }
        }
    }    
    for(i=0;i<q-1;i++)
    {
        for(j=i;j<q;j++)
        {
            if(f[i].height<f[j].height)
            {
                d=f[i].height;
                f[i].height=f[j].height;
                f[j].height=d;
            }
        }
    }
    
    for(i=0;i<p;i++)
    printf("%4.2f ",m[i].height);
    for(i=0;i<q-1;i++)
    printf("%4.2f ",f[i].height);
    printf("%4.2f",f[q-1].height);
    

}
int main(){
	int n,i,j=0,k=0;
	double b[50],a[50],m;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		char s[10];
		scanf("%s%lf",&s,&m);
		if(strcmp(s,"male")==0){
			a[j]=m;
			j++;
		}
		else{
			b[k]=m;
			k++;
		}
	}
	int c;
	for(c=1;c<=j;c++){
		for(i=0;i<j-c;i++){
			if(a[i]>a[i+1]){
				m=a[i];
				a[i]=a[i+1];
				a[i+1]=m;
			}
		}
	}
	for(c=1;c<=k;c++){
		for(i=0;i<k-c;i++){
			if(b[i]<b[i+1]){
				m=b[i];
				b[i]=b[i+1];
				b[i+1]=m;
			}
		}
	}
	for(i=0;i<j;i++){
		printf("%.2lf ",a[i]);
	}
	for(i=0;i<k-1;i++){
		printf("%.2lf ",b[i]);
	}
	printf("%.2lf",b[k-1]);
	return 0;
}
struct stu
{
char gen[7];
float hei;              
};  

int main()
{

struct stu stu[40],t; //shifouyaogaichengdongtai?
int n,i,j,s=0;

scanf("%d",&n);
for(i=0;i<n;i++)
                {
                        scanf("%s %f",stu[i].gen,&stu[i].hei);
               }

for(j=0;j<n;j++)
for(i=0;i<n-1-j;i++)                
{
   if(stu[i].hei>stu[i+1].hei)
    {t=stu[i];
     stu[i]=stu[i+1];
     stu[i+1]=t;}
}

for(i=0;i<n;i++)
{
               if(strlen(stu[i].gen)==4) 
              //  if(*(stu[i]).gen=='male')
              {
                  if(s==0)
              {printf("%.2f",stu[i].hei);s++;}
              else{printf(" %.2f",stu[i].hei);}
              }
}

for(i=n-1;i>=0;i--)
{
    if(strlen(stu[i].gen)!=4)                 
  //if(*(stu[i]).gen!='male') 
  printf(" %.2f",stu[i].hei);             
}

return 0;    
}
//zifuchuanbijiaoyaoyonghanshu
int main(){
	int n,i,j;
	struct student{
	   char s[10];
	   double h;
	
	} a[41],t;
	scanf("%d",&n);
	for(i=0;i<n;i++){
	  scanf("%s %lf",a[i].s,&a[i].h);
	
	}
	for(i=1;i<n;i++){
		for(j=0;j<n-i;j++){
			if(strcmp(a[j].s,"male")==0){
				if(strcmp(a[j].s,a[j+1].s)==0){
				    if(a[j].h>a[j+1].h){
				        t=a[j];
						a[j]=a[j+1];
						a[j+1]=t;
				 
				     }
				}
			
			}else if( strcmp(a[j].s,"female")==0){
				if(strcmp(a[j].s,a[j+1].s)==0){
				        if(a[j].h<a[j+1].h){
				        t=a[j];
						a[j]=a[j+1];
						a[j+1]=t;
				 
				        }
				
				}else{
				        t=a[j];
						a[j]=a[j+1];
						a[j+1]=t;
				 
				
				
				}
			         
			
			
			}
		
		}
	
	
	}
	printf("%.2lf",a[0].h);
	for(i=1;i<n;i++){
	   printf(" %.2lf",a[i].h);
	
	}
	

	
	return 0;
}
int main(){
	int i,n,j,k=0,l=0;
	char c[40][10];
	double a[40],ag[40],ab[40],x;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s%lf",c[i],&a[i]);
	}
	for(i=0;i<n;i++){
		if(strcmp(c[i],"female")==0){
			ag[k]=a[i];
			k++;
		}
		if(strcmp(c[i],"male")==0){
			ab[l]=a[i];
			l++;
		}
	}
	for(i=1;i<=k;i++){
		for(j=0;j<k-i;j++){
			if(ag[j]>ag[j+1]){
				x=ag[j+1];
				ag[j+1]=ag[j];
				ag[j]=x;
			}
		}
	}
	for(i=1;i<=l;i++){
		for(j=0;j<l-i;j++){
			if(ab[j]>ab[j+1]){
				x=ab[j+1];
				ab[j+1]=ab[j];
				ab[j]=x;
			}
		}
	}
	for(i=0;i<l;i++){
		printf("%.2lf ",ab[i]);
	}
	for(i=k-1;i>0;i--){
		printf("%.2lf ",ag[i]);
	}
	printf("%.2lf",ag[0]);
	return 0;
}
int main()
{
	int n, n_m, n_f, i, j;
	float male[40], female[40];
	char s[10];
	float t;
	scanf("%d", &n);
	n_m = 0;
	n_f = 0;
	for(i = 1; i <= n; i++)
	{
		scanf("%s", s);
		if(s[0] == 'm')
		{
			scanf("%f", &male[n_m]);
			n_m++;
		}
		else
		{
			scanf("%f", &female[n_f]);
			n_f++;
		}
	}
	for(i = 0; i < n_m - 1; i++)
		for(j = i + 1; j <= n_m - 1; j++)
		{
			if(male[i] > male[j])
			{
				t = male[i];
				male[i] = male[j];
				male[j] = t;
			}
		}
	for(i = 0; i < n_f - 1; i++)
		for(j = i + 1; j <= n_f - 1; j++)
		{
			if(female[i] < female[j])
			{
				t = female[i];
				female[i] = female[j];
				female[j] = t;
			}
		}
	for(i = 0; i <= n_m - 1; i++)
		printf("%.2f ", male[i]);
	for(i = 0; i < n_f - 1; i++)
		printf("%.2f ", female[i]);
	printf("%.2f\n", female[n_f - 1]);
	return 0;
}
int main(){
	int num;
	scanf("%d",&num);
	int i;
	int f=0,m=0;
	char c[7];
	double high;
	double mh[40],nh[40];
	for(i=0;i<num;i++){
	scanf("%s %lf",c,&high);
	if(strcmp(c,"male")==0){
	m=m+1;
	mh[m-1]=high;
	}else{
	f=f+1;
	nh[f-1]=high;
	}
	}
	int j;
	double max;
	for(i=1;i<=m;i++){
		for(j=0;j<m-i;j++){
			if(mh[j]>mh[j+1]){
			max=mh[j];
			mh[j]=mh[j+1];
			mh[j+1]=max;
			}
		}}
	for(i=1;i<=f;i++){
		for(j=0;j<f-i;j++){
			if(nh[j]<nh[j+1]){
			max=nh[j];
			nh[j]=nh[j+1];
			nh[j+1]=max;
			}
		}}
	for(i=0;i<m;i++){
	printf("%.2lf ",mh[i]);
	}
	printf("%.2lf",nh[0]);
	for(i=1;i<f;i++){
	printf(" %.2lf",nh[i]);
	}

return 0;
}
/*Macro*/
float male[N];
float female[N];

int main(int argc, char *argv[])
{
/*Definition*/

	int i = 0;
	int j = 0;
	int n = 0;
	char p[10] = "H";
	float h = 0;
	int ii = 0;
	int jj = 0;
/*Definition*/
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
	scanf("%d", &n);
	while(n--)
	{
		scanf("%s%f", p, &h);
		if(0 == strcmp(p, "male"))
		{
			male[i++] = h;
		}
		else
		{
			female[j++] = h;
		}
	}

	for(ii= 0; ii < i; ii++)
	{
		for(jj=ii+1; jj < i; jj++)
		{
			if(male[ii] > male[jj])
			{
				h = male[ii];
				male[ii] = male[jj];
				male[jj] = h;
			}
		}
	}

	for(ii= 0; ii < j; ii++)
	{
		for(jj=ii+1; jj < j; jj++)
		{
			if(female[ii] < female[jj])
			{
				h = female[ii];
				female[ii] = female[jj];
				female[jj] = h;
			}
		}
	}


	for(ii=0; ii < i; ii++)
	{
		printf("%.2lf ", male[ii]);
	}
	for(jj=0; jj <j-1; jj++)
	{
		printf("%.2lf ", female[jj]);
	}
	printf("%.2lf\n", female[jj]);

	return 0;
}
int main(){
	int n,i,j,h;
	j=1;
	h=1;
	scanf("%d",&n);
	double hei[50],man[50],woman[50];
	char xb[50][10];
	int chang[50];
	for(i=1;i<=n;i++){
		scanf("%s %lf\n",xb[i],&hei[i]);
		chang[i]=strlen(xb[i]);
		if(chang[i]==4){
			man[j]=hei[i];
			j++;
		}
		if(chang[i]==6){
			woman[h]=hei[i];
			h++;
		}
	}
	j--;
	h--;
	int k;
	double e;
	for(k=1;k<j;k++){
		for(i=1;i<=j-k;i++){
			if(man[i]>man[i+1]){
				e=man[i+1];
				man[i+1]=man[i];
				man[i]=e;
			}
		}
	}
	for(k=1;k<h;k++){
		for(i=1;i<=h-k;i++){
			if(woman[i]<woman[i+1]){
				e=woman[i+1];
				woman[i+1]=woman[i];
				woman[i]=e;
			}
		}
	}
	for(i=1;i<=j;i++)
		printf("%.2lf ",man[i]);
	printf("%.2lf",woman[1]);
	for(i=2;i<=h;i++)
		printf(" %.2lf",woman[i]);
	return 0;
}
main()
{
      int n,i,j,k,t;
      char s[7];
      double a[40],b[40],p;
      scanf("%d",&n);
      j=0;
      k=0;
      for (i=0;i<n;i++)
      {
          scanf("%s",s);
          if(strcmp(s,"male")==0)
          {
              scanf("%lf",&a[j]);
              j++;
          }
          if(strcmp(s,"female")==0)
          {
              scanf("%lf",&b[k]);
              k++;
          }
      }
      for (i=j-1;i>0;i--)
      {
          for (t=0;t<i;t++)
          {
              if (a[t]>a[t+1])
              {
                  p=a[t];
                  a[t]=a[t+1];
                  a[t+1]=p;
              }
          }
      }
      for (i=k-1;i>0;i--)
      {
          for (t=0;t<i;t++)
          {
              if (b[t]<b[t+1])
              {
                  p=b[t];
                  b[t]=b[t+1];
                  b[t+1]=p;
              }
          }
      }
      for (i=0;i<j;i++)
      printf("%.2f ",a[i]);
      for (i=0;i<k;i++)
      {
          if (i==k-1) printf ("%.2f",b[k-1]);
          else printf ("%.2f ",b[i]);
      }
}
int main(){
	char str[100][7],sts[100][7];
	double u[100],fe[100],ma[100];
	double n,k;
	int f=0,m=0,i,j;
	scanf("%lf",&n);
	for(i=0;i<n;i++){
		fe[i]=0;
		ma[i]=0;
	}
	for(i=0;i<n;i++){
		scanf("%s %lf",sts[i],&u[i]);
		if(sts[i][0]=='f'){
			fe[i]=u[i];
			f++;
		}
		else if(sts[i][0]=='m'){
			ma[i]=u[i];
			m++;
		}
	}
	for(i=0;i<n-1;i++){
		for(j=0;j<n-i-1;j++){
			if(ma[j+1]>ma[j]){
				k=ma[j+1];
				ma[j+1]=ma[j];
				ma[j]=k;
			}
		}
	}
	for(i=0;i<n-1;i++){
		for(j=0;j<n-i-1;j++){
			if(fe[j+1]>fe[j]){
				k=fe[j+1];
				fe[j+1]=fe[j];
				fe[j]=k;
			}
		}
	}
	for(i=m-1;i>=0;i--){
		if(i==m-1){
			printf("%.2lf",ma[i]);
		}
		else if(i<m-1){
		    printf(" %.2lf",ma[i]);
		}
	}
	for(i=0;i<f;i++){
		printf(" %.2lf",fe[i]);
	}
	return 0;
}
int main()
{
	int n,i,j=0,w=0,k;
	float b[40],c[40],d[40],e;
	char a[40][7];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s%f",a[i],&b[i]);
		if(strcmp(a[i],"male")==0)
		{
			c[j]=b[i];
			j++;
		}
		if(strcmp(a[i],"female")==0)
		{
			d[w]=b[i];
			w++;
		}
	}
for(k=1;k<=j;k++)
{
	for(i=0;i<j-k;i++)
	{
		if(c[i]>c[i+1])
		{
			e=c[i+1];
			c[i+1]=c[i];
			c[i]=e;
		}
	}
}

for(k=1;k<=w;k++)
{
	for(i=0;i<w-k;i++)
	{
		if(d[i]<d[i+1])
		{
			e=d[i+1];
			d[i+1]=d[i];
			d[i]=e;
		}
	}
}
printf("%.2f",c[0]);
for(i=1;i<j;i++)
{printf(" %.2f",c[i]);}
for(i=0;i<w;i++)
{printf(" %.2f",d[i]);}
return 0;
}
int main(){
	int n;
	scanf("%d",&n);
	struct point{
		char x[10];
		double y;
	}b[40];
	int i;
	for (i=0;i<n;i++){
		scanf("%s%lf",b[i].x,&b[i].y);
	}
	int p=0;
	for(i=0;i<n;i++){
		if(strcmp(b[i].x,"male")==0){
			p+=1;
		}
	}
	double d[40];
	int k=0;
	for(i=0;i<n;i++){
		if(strcmp(b[i].x,"male")==0){
			d[k]=b[i].y;
			k+=1;
		}
	}
	double m;
	for(k=1;k<p;k++){
		for(i=0;i<p-k;i++){
			if(d[i]>d[i+1]){
				m=d[i];
				d[i]=d[i+1];
				d[i+1]=m;
			}
		}
	}
	for(i=0;i<p;i++){
		printf("%.2lf ",d[i]);
	}
	double e[40];
	int r=0;
	for(i=0;i<n;i++){
		if(strcmp(b[i].x,"female")==0){
			e[r]=b[i].y;
			r++;
		}
	}
	for(k=1;k<n-p;k++){
		for(i=0;i<n-p-k;i++){
			if(e[i]<e[i+1]){
				m=e[i];
				e[i]=e[i+1];
				e[i+1]=m;
			}
		}
	}
	for(i=0;i<n-p-1;i++){
		printf("%.2lf ",e[i]);
	}
	printf("%.2lf",e[n-p-1]);
	return 0;
}
main()
{
      int i,n,j=0,k=0,p,m,c;
      float h,a[40],b[40],t;
      char s[10];
      scanf("%d",&n);
      for(i=0;i<n;i++)
      {
             scanf("%s %f",s,&h);
             if(s[0]=='m')
             {a[j]=h; j++;}
             if(s[0]=='f')
             {b[k]=h; k++;}
      }
      for(p=0;p<j;p++)
      {
            for(m=0;m<j-p-1;m++)
            {
                   if(a[m]>a[m+1])
                   {
                          t=a[m+1];
                          a[m+1]=a[m];
                          a[m]=t;
                   }
            }
      }
      for(c=0;c<j;c++)
      printf("%.2f ",a[c]);
      for(p=0;p<k;p++)
      {
            for(m=0;m<k-p-1;m++)
            {
                   if(b[m]<b[m+1])
                   {
                          t=b[m+1];
                          b[m+1]=b[m];
                          b[m]=t;
                   }
            }
      }
      for(c=0;c<k-1;c++)
      printf("%.2f ",b[c]);
      printf("%.2f\n",b[k-1]);
      getchar();getchar();getchar();getchar();getchar();getchar();getchar();getchar();
}
int main()
{   	
    int n,i,p;
	double y;
	double c[40],d[40];
	int j=0,k=0;
	char t[10]={"male"};
	struct student 
	{ 
	   char a[10];
	   double b;
	};
	struct student x[100];
	scanf("%d",&n);
	for(i=0;i<n;i++) scanf("%s%lf",x[i].a,&x[i].b);
	for(i=0;i<n;i++)                            
           {if (strcmp(x[i].a,t)==0)
              {
                c[j]=x[i].b;
                j++;
              }
            else
              {
              	d[k]=x[i].b;
              	k++;
              }
           }
	for(i=0;i<=j-1;i++)                             
           {for(p=i;p<=j-1;p++)
             {if(c[i]<c[p])
                {y=c[i];
                c[i]=c[p];
                c[p]=y;}
             }
           }
    for(i=0;i<=k-1;i++)                             
           {for(p=i;p<=k-1;p++)
             {if(d[i]<d[p])
                {y=d[i];
                d[i]=d[p];
                d[p]=y;}
             }
           }
     for(i=j-1;i>=0;i--)
     printf("%.2f ",c[i]);
     for(i=0;i<k-1;i++)
     printf("%.2f ",d[i]);
     printf("%.2f",d[k-1]);
     return 0;
}
int main()
{
	int i,n,j,a,b,sum1,sum2;
	char xb[40][7];
	double sg[40],k;
	double nan[40],nv[40];
	k=0;
	b=0;
	a=0;
	sum1=0;
	sum2=0;
	for(i=0;i<40;i++){
		nan[i]=0.0;
		nv[i]=0.0;
	}
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s%lf",xb[i],&sg[i]);
		j=strcmp(xb[i],"male");
		if(j==0){
			nan[b]=sg[i];
			b++;
			sum1++;
		}else{
			nv[a]=sg[i];
			a++;
			sum2++;
		}
	}
	for(i=0;i<sum1;i++){
		for(j=0;j<sum1-1;j++){
			if(nan[j]>nan[j+1]){
				k=nan[j+1];
				nan[j+1]=nan[j];
				nan[j]=k;
			}
		}
	}
	for(i=0;i<sum2;i++){
		for(j=0;j<sum2-1;j++){
			if(nv[j]<nv[j+1]){
				k=nv[j+1];
				nv[j+1]=nv[j];
				nv[j]=k;
			}
		}
	}
	for(i=0;i<n;i++){
		j=strcmp(xb[i],"male");
		if(j==0){
			printf("%.2lf",nan[0]);
			break;
		}
	}
	b=1;
	for(i=i+1;i<n;i++){
		j=strcmp(xb[i],"male");
		if(j==0){
			printf(" %.2lf",nan[b]);
			b++;
		}
	}
	a=0;
	for(i=0;i<n;i++){
		j=strcmp(xb[i],"female");
		if(j==0){
			printf(" %.2lf",nv[a]);
			a++;
		}
	}
	return 0;
}
int main()
{
    char s[100][10],tmp[10];
    double h[100],tmp2;
    int n,i,j,first=1;
    scanf("%d",&n);
    for (i=0;i<n;i++)
        scanf("%s %lf",s[i],&h[i]);
    for (i=0;i<n-1;i++)
        for (j=0;j+i<n-1;j++)
            if (h[j]>h[j+1])
            {
               tmp2=h[j];
               h[j]=h[j+1];
               h[j+1]=tmp2;
               strcpy(tmp,s[j]);
               strcpy(s[j],s[j+1]);
               strcpy(s[j+1],tmp);
            }
    for (i=0;i<n;i++)
        if (s[i][0]=='m')
        {
           if (first==0)
              printf(" ");
           first=0;
           printf("%.2lf",h[i]);
        }
    for (i=n-1;i>=0;i--)
        if (s[i][0]=='f')
           printf(" %.2lf",h[i]);
    return 0;
}
int main()
{
	int n,i,p=0,q=0,j,k,m;
	double c[40]={0},d[40]={0};
	char a[6]={0};
	double b,e;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("\n%s",a);
		scanf("%lf",&b);
		m=strlen(a);
		if(a[0]=='m'){
			c[p]=b;
			p=p+1;
		}else{
			d[q]=b;
			q=q+1;
		}
	}
	for(k=1;k<p;k++){
		for(j=0;j<p-k;j++){
			if(c[j]>c[j+1]){
				e=c[j+1];
				c[j+1]=c[j];
				c[j]=e;
			}
		}
	}
	for(k=1;k<q;k++){
		for(j=0;j<q-k;j++){
			if(d[j]<d[j+1]){
				e=d[j+1];
				d[j+1]=d[j];
				d[j]=e;
			}
		}
	}
	for(j=0;j<p;j++){
		printf("%.2lf ",c[j]);
	}
	for(j=0;j<q-1;j++)
		printf("%.2lf ",d[j]);
	printf("%.2lf",d[q-1]);
	return 0;
}
int main()
{
	int n , k , i , j ;
	char sex[10] ;
	double h ;
	double maleH[40] , femaleH[40] ;
	cin >> n ;
	int numM = 0 ;
	int numF = 0 ;
	for ( k = 0 ; k < n ; k++ )
	{
		cin >> sex ;
		cin >> h ;
		if ( sex[0] == 'm' )
		{
			maleH[numM] = h ;
			numM++ ;
		}
		else if ( sex[0] == 'f' )
		{
			femaleH[numF] = h ;
			numF++ ;
		}
	}
	double t = 0 ;
	for ( i = 0 ; i < numF - 1 ; i++ )
	{
		for ( j = 0 ; j < numF - i - 1 ; j++ )
		{
			if ( femaleH[j] < femaleH[j+1] )
			{
				t = femaleH[j] ;
				femaleH[j] = femaleH[j+1] ;
				femaleH[j+1] = t ;
			}
		}
	}
	for ( i = 0 ; i < numM - 1 ; i++ )
	{
		for ( j = 0 ; j < numM - i - 1 ; j++ )
		{
			if ( maleH[j] > maleH[j+1] )
			{
				t = maleH[j] ;
				maleH[j] = maleH[j+1] ;
				maleH[j+1] = t ;
			}
		}
	}

	for ( i = 0 ; i < numM ; i++ )
	{
		cout << fixed << setprecision(2) << maleH[i] << " " ;
	}
	for ( i = 0 ; i < numF ; i++ )
	{
		if ( i == numF - 1 )
		{
			cout << fixed << setprecision(2) << femaleH[i] ;
		}
		else
		{
			cout << fixed << setprecision(2) << femaleH[i] << " " ;
		}
	}
	return 0 ;
}
//??
struct data
{
    char ch[10];
    double h;
}p[40], f[40], m[40];
int main()
{
    int n, i, j = 0, k = 0, len;
    cin >> n;
    for (i = 0; i < n; i++)
    {
        cin >> p[i].ch >> p[i].h;
        len = strlen(p[i].ch);
        if (len == 4)
            m[j++].h = p[i].h;
        else
            f[k++].h = p[i].h;
    }
    for (i = j - 1; i > 0; i--)
        for (int x = 0; x < i; x++)
            if (m[x].h > m[x + 1].h)
            {
                double temp = m[x].h;
                m[x].h = m[x + 1].h;
                m[x + 1].h = temp;
            }
    for (i = k - 1; i > 0; i--)
        for (int x = 0; x < i; x++)
            if (f[x].h < f[x + 1].h)
            {
                double temp = f[x].h;
                f[x].h = f[x + 1].h;
                f[x + 1].h = temp;
            }
    cout << fixed << setprecision(2);
    for (i = 0; i < j;i++)
        cout << m[i].h << " ";
    cout << f[0].h;
    for (i = 1; i < k; i++)
        cout << " " << f[i].h;
    return 0;
}
main()
{


int n,i,j,x,y;
scanf("%d\n",&n);
double a[n],male[n],female[n],k;
char b[n][10];

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

x=0;
y=0;
for(i=0;i<n;i++)
{
                if(b[i][0]=='m')
                {
                                male[x]=a[i];

                //printf("male[%d]=",x);
                //printf("%.2lf ",male[x]);
                //printf("a[%d]=",i);
                //printf("%.2lf ",a[i]);
                                x=x+1;
                }
                if(b[i][0]=='f')
                {
                                female[y]=a[i];
                                y=y+1;
                }
}

for(i=0;i<x;i++)
{
                for(j=i;j<x;j++)
                {
                                if(male[i]>male[j])
                                {
                                             k=male[i];
                                             male[i]=male[j];
                                             male[j]=k;
                                }
                }
}

for(i=0;i<x;i++)
{
                //printf("male[%d]=",i);
                printf("%.2lf ",male[i]);
}
for(i=0;i<y;i++)
{
                for(j=i;j<y;j++)
                {
                                if(female[i]<female[j])
                                {
                                             k=female[i];
                                             female[i]=female[j];
                                             female[j]=k;
                                }
                }
}


for(i=0;i<y-1;i++)
{
                 //printf("female[%d]=",i);
                 printf("%.2lf ",female[i]);
}

printf("%.2lf",female[y-1]);

}
int main(){
	int n,i,j,k=0,m=0,t;
	double a[41],b[41],h[41],x,y;
	char s[41];
	scanf("%d",&n);
	for(i=1;i<=n;i++){
		scanf("\n%s %lf",s,&h[i]);
//printf("%lf",a[i]);
		if(strcmp(s,"male")==0){
			a[k+1]=h[i];
			k=k+1;
		}
	if(strcmp(s,"female")==0){
			b[m+1]=h[i];
			m=m+1;
		}
	}
	for(j=1;j<=k;j++) {
		for(t=1;t<=k-j;t++){
			if(a[t]>a[t+1]){
				x=a[t+1];
				a[t+1]=a[t];
				a[t]=x;
			}
		}
	}
for(j=1;j<=m;j++){
		for(t=1;t<=m-j;t++){
			if(b[t]<b[t+1]){
				y=b[t+1];
				b[t+1]=b[t];
				b[t]=y;
			}
		}
	}
for(i=1;i<=k;i++){
printf("%.2lf ",a[i]);

}
for(i=1;i<m;i++)
printf("%.2lf ",b[i]);
printf("%.2lf",b[m]);

return 0;
}
void mysort1(float array[],int length)
{
	int i=0,j=0;
	int tmpindex=0;
	double tmpvalue;
	for(i=0;i<length;i++)
	{
		tmpindex=i;
		for(j=i;j<length;j++)
		{
			if(array[j]<array[tmpindex])
			tmpindex=j;
		}
		
		tmpvalue=array[tmpindex];
		array[tmpindex]=array[i];
		array[i]=tmpvalue;
	}
}

void mysort2(float array[],int length)
{
	int i=0,j=0;
	int tmpindex=0;
	double tmpvalue;
	for(i=0;i<length;i++)
	{
		tmpindex=i;
		for(j=i;j<length;j++)
		{
			if(array[j]>array[tmpindex])
			tmpindex=j;
		}
		
		tmpvalue=array[tmpindex];
		array[tmpindex]=array[i];
		array[i]=tmpvalue;
	}
}
		
		
	
	

int main()
{
	int n,i=0,j=0,k,m;
	float marr[40];
	float farr[40];
	char str[8];
	float height;
	scanf("%d",&n);
	
	for(k=0;k<n;k++)
	{
		scanf("%s%f",str,&height);
		if(strcmp(str,"male")==0)
	   {
		  marr[i]=height;
		  
		  i++;
		 
	   }
		else
		{
		farr[j]=height;
		
		j++;
		}
		
	}
	

	mysort1(marr,i);
	mysort2(farr,j);
	
	for(m=0;m<i;m++)
	printf("%.2f ",marr[m]);
	
	for(m=0;m<j-1;m++)
	printf("%.2f ",farr[m]);
	
	printf("%.2f",farr[j-1]);
	
	
	
	
	
	
	
		return 0;
}
int main()
{
	int n,i,j=0,k=0,r;
	double nan[40],nv[40],gao[40],e;
	char nannv[40][10];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s%lf",nannv[i],&gao[i]);
		if(nannv[i][0]=='m')
		{
			nan[j]=gao[i];
			j++;
		}
		else
		{
			nv[k]=gao[i];
			k++;
		}
	}
	for(r=j-1;r>0;r--)
	{
		for(i=0;i<r;i++)
		{
			if(nan[i]>nan[i+1])
			{
				e=nan[i];
				nan[i]=nan[i+1];
				nan[i+1]=e;
			}
		}
	}
	printf("%.2lf",nan[0]);
	for(i=1;i<j;i++)
	{
		printf(" %.2lf",nan[i]);
	}
    for(r=k-1;r>0;r--)
	{
		for(i=0;i<r;i++)
		{
			if(nv[i]>nv[i+1])
			{
				e=nv[i];
				nv[i]=nv[i+1];
				nv[i+1]=e;
			}
		}
	}
	for(i=k-1;i>=0;i--)
	{
		printf(" %.2lf",nv[i]);
	}
	printf("\n");
	return 0;
}
int main(){
int n,i,j,k,l;
j=k=0;
char zfc[7];
double h,e,b[39],g[39];
scanf("%d",&n);
for(i=0;i<n;i++){
	scanf("%s%lf",zfc,&h);
	if(zfc[0]=='m'){
          b[j]=h;
		  j++;
	}else{
		g[k]=h;
		k++;
	}
}
for(i=1;i<=j;i++){
	for(l=0;l<j-i;l++){
		if(b[l]>b[l+1]){
			e=b[l];
			b[l]=b[l+1];
			b[l+1]=e;
		}
	}
}
for(i=1;i<=k;i++){
	for(l=0;l<k-i;l++){
		if(g[l]<g[l+1]){
			e=g[l];
			g[l]=g[l+1];
			g[l+1]=e;
		}
	}
}
for(i=0;i<j;i++){
	printf("%.2lf ",b[i]);
}
for(i=0;i<k-1;i++){
	printf("%.2lf ",g[i]);
}
printf("%.2lf",g[k-1]);
	return 0;
}
int main()
{
	int n,i,j=0,k=0,d,b;
	double a[100],m[100],f[100],c;
	char s[100][100];
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s %lf",s[i],&a[i]);}
	for(i=0;i<n;i++){
		if(s[i][0]=='f'){
	f[j]=a[i];j++;}
		if(s[i][0]=='m'){
	m[k]=a[i];k++;}}
	for(d=1;d<=k;d++){
		for(b=0;b<k-d;b++){
			if(m[b]>m[b+1]){
				c=m[b+1];m[b+1]=m[b];m[b]=c;}}}
	for(i=0;i<k;i++){
	printf("%.2lf ",m[i]);}
	for(d=1;d<=j;d++){
		for(b=0;b<j-d;b++){
			if(f[b]<f[b+1]){
				c=f[b+1];f[b+1]=f[b];f[b]=c;}}}
	for(i=0;i<j-1;i++){
	printf("%.2lf ",f[i]);}
	printf("%.2lf",f[j-1]);
return 0;
}
int cmpf(void const *a,void const *b)
{
	double m;
	m=*(double *)b-*(double *)a;
	if (m>0) return 1;
	else return -1;
}
int cmpm(void const *a,void const *b)
{
	double m;
	m=*(double *)a-*(double *)b;
	if (m>0) return 1;
	else return -1;
}
int main()
{
	int n,i;
	double	f[40],m[40];
	int fp=0,mp=0;
	scanf("%d",&n);
	for (i=1;i<=n;i++)
	{
		char s[7];
		scanf("%s",s);
		if (s[0]=='f')
			scanf("%lf",&f[fp++]);
		else
			scanf("%lf",&m[mp++]);
	}
	qsort(f,fp,sizeof(double),cmpf);
	qsort(m,mp,sizeof(double),cmpm);

	for (i=0;i<mp;i++)
		printf("%.2lf ",m[i]);
	
	for (i=0;i<fp;i++)
	{
		printf("%.2lf",f[i]);
		if (i!=fp-1)
            printf(" ");
	}
}
void main()
{
	int num,i,j=0,k=0,m,n;
	float hight[N],hi,woman[N],man[N];
	char string1[5]="male";
	char string[N][7];
	scanf("%d",&num);
	for(i=0;i<num;i++)
	{
		scanf("%s %f",string[i],&hight[i]);
		if(strcmp(string[i],string1)==0)
		{
			man[j]=hight[i];
		    j=j+1;
		}
		else
		{
			woman[k]=hight[i];
			k=k+1;
		}
	}
	for(i=0;i<j;i++)
		for(m=i;m<j;m++)
		{
			if(man[i]>man[m])
			{
				hi=man[i];
				man[i]=man[m];
				man[m]=hi;
			}
		}
	for(i=0;i<k;i++)
		for(n=i;n<k;n++)
		{
			if(woman[i]<woman[n])
			{
				hi=woman[n];
				woman[n]=woman[i];
				woman[i]=hi;
			}
		}
		for(i=0;i<j;i++)
			printf("%4.2f ",man[i]);
		for(i=0;i<k-1;i++)
			printf("%4.2f ",woman[i]);
		printf("%4.2f",woman[k-1]);
		printf("\n");
}