semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int main(){
   int n,i,j=0,k,p;
   double b[40],e;
   scanf("%d",&n);
   struct a{
	   char s[8];
	   double t;
   }a[40];
   for(i=0;i<n;i++){
	   scanf("%s %lf",a[i].s,&a[i].t);
   }
   for(i=0;i<n;i++){
	   if(strcmp(a[i].s,"male")==0){
		   b[j]=a[i].t;
		   j++;
	   }
   }
   for(k=1;k<j;k++){
		 for(p=0;p<j-k;p++){
			   if(b[p]>b[p+1]){
				   e=b[p];
				   b[p]=b[p+1];
				   b[p+1]=e;
			   }
		 }
   }
	printf("%.2lf",b[0]);
	for(i=1;i<j;i++){
	printf(" %.2lf",b[i]);
	}
	j=0;
    for(i=0;i<n;i++){
	   if(strcmp(a[i].s,"female")==0){
		   b[j]=a[i].t;
		   j++;
	   }
    }
    for(k=1;k<j;k++){
		 for(p=0;p<j-k;p++){
			   if(b[p]<b[p+1]){
				   e=b[p];
				   b[p]=b[p+1];
				   b[p+1]=e;
			   }
		 }
	}
	for(i=0;i<j;i++){
		printf(" %.2lf",b[i]);
	}
	return 0;
}
int main(){
int n,c,m=0,i,a=0,b=0,j;
char s[41][10];
double h[41],hm[41],hf[40],dqm,dqf;
scanf("%d",&n);
for(i=0;i<n;i++)
{scanf("%s %lf",s[i],&h[i]);}
for(i=0;i<n;i++){if(strcmp(s[i],"male")==0){hm[a]=h[i];a++;}
                 else {hf[b]=h[i];b++;}
}
for(i=0;i<a-1;i++)
{for(j=0;j<a-1;j++){if(hm[j]>hm[j+1]){dqm=hm[j];
                                     hm[j]=hm[j+1]; 
                                      hm[j+1]=dqm;}}}
for(i=0;i<b-1;i++)
{for(j=0;j<b-1;j++){if(hf[j]<hf[j+1]){dqf=hf[j];
                                     hf[j]=hf[j+1]; 
                                      hf[j+1]=dqf;}}}
for(i=0;i<a;i++){printf("%.2lf ",hm[i]);}
for(i=0;i<b;i++){if(i<b-1)printf("%.2lf ",hf[i]);
                 else printf("%.2lf",hf[i]);}

return 0;
}
int cmp(const void* a,const void* b)
{
    return (*(float*)a) > (*(float*)b) ? 1:-1;
}
int main()
{
    int n,i,f,m;
    char sex[10];
    float male[40]={0},female[40]={0};
    scanf("%d",&n);
    for(i=0,f=0,m=0;i<n;i++)
    {
                    scanf("%s",sex); 
                    if(sex[0]=='m')
                    {
                                   scanf("%f",&male[m]);
                                   m++;
                    }
                    else
                    {
                        scanf("%f",&female[f]);
                        f++;
                    }
    }
    qsort(male,m,sizeof(float),cmp);
    qsort(female,f,sizeof(float),cmp);
    for(i=0;i<m;i++)
                    printf("%.2f ",male[i]);
    for(i=f-1;i>0;i--)
                      printf("%.2f ",female[i]);
    printf("%.2f\n",female[i]); 
    return 0;
}
int main(){
    int n,i,j,k,m,f;
    char t;
    double e,d;
    char a[40][7];
    double b[40];
    double male[40];
    double female[40];
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
    scanf("%c%s %lf",&t,&a[i],&b[i]);
    }
    j=0;k=0;
    for(i=0;i<n;i++)
    {
    if(a[i][0]=='m') {male[j]=b[i];j++;}
    if(a[i][0]=='f') {female[k]=b[i];k++;}
    }
    for(i=0;i<j;i++){
                     for(m=i;m<j;m++){
                                      if(male[m]<male[i]){
                                                          e=male[m];
                                                          male[m]=male[i];
                                                          male[i]=e;
                                                          }
                                      }
                     }
    for(i=0;i<k;i++){
                     for(f=i;f<k;f++){
                                      if(female[f]>female[i]){
                                                          d=female[f];
                                                          female[f]=female[i];
                                                          female[i]=d;
                                                          }
                                      }
                     }
                     if(male[0]){printf("%.2lf",male[0]);}
    for(i=1;i<j;i++){
                     printf(" %.2lf",male[i]);
                     }
    for(i=0;i<k;i++){
                     printf(" %.2lf",female[i]);
                     }
    
    return 0;
}
int main(){ 
	float a[41],b[41],f;
	int n,i,l,t,j=0,k=0;
	char s[8];
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s%f",s,&f);
		if(s[0]=='m'){
			a[j]=f;
			j++;
		}
		else{
			b[k]=f;
			k++;
		}
	}
	for(i=0;i<j;i++){
		t=i;
		for(l=i;l<j;l++){
			if(a[t]>a[l])
				t=l;
		}
		f=a[t];
		a[t]=a[i];
		a[i]=f;
	}
	for(i=0;i<k;i++){
		t=i;
		for(l=i;l<k;l++){
			if(b[t]<b[l])
				t=l;
		}
		f=b[t];
		b[t]=b[i];
		b[i]=f;
	}
	for(i=0;i<j;i++)
		printf("%.2f ",a[i]);
	for(i=0;i<k-1;i++)
		printf("%.2f ",b[i]);
	printf("%.2f\n",b[i]);
	return 0; 
}
int main(){
    int n, i, a=0, b=0, m;
    float height[50], male[50], female[50], t;
    char gender[50][10];
    scanf("%d", &n);
    for(i=0;i<n;i++){
        scanf("%s%f", gender[i], &height[i]);
        if (strcmp(gender[i], "male")==0) {
            male[a]=height[i];
            a++;
        }else{
            female[b]=height[i];
            b++;
        }
    }
    m=10000;
    while (m>0&&a>1) {
        for (i=1; i<a; i++) {
            if (male[i]<male[i-1]) {
                t=male[i];
                male[i]=male[i-1];
                male[i-1]=t;
            }
            m--;
        }
    }
    m=10000;
    while (m>0&&b>1) {
        for (i=1; i<b; i++) {
            if (female[i]>female[i-1]) {
                t=female[i];
                female[i]=female[i-1];
                female[i-1]=t;
            }
            m--;
        }
    }
    for (i=0; i<a; i++) {
        printf("%.2f ", male[i]);
    }
    for (i=0; i<b-1; i++) {
        printf("%.2f ", female[i]);
    }
    printf("%.2f", female[b-1]);
    return 0;
}
int main(){
	int n,i,k;
	char s[50][50],e_s[10];
	double h[50],e_h;
	scanf("%d",&n);
	for(i=0;i<n;i++){
                     scanf("%s %lf",s[i],&h[i]);
                     }
    for(k=1;k<=n;k++){
                      for(i=0;i<n-k;i++){
                                         if((s[i][0]=='f'&&s[i+1][0]=='m')||(s[i][0]=='m'&&s[i+1][0]=='m'&&h[i]>h[i+1])||(s[i][0]=='f'&&s[i+1][0]=='f'&&h[i]<h[i+1])){
                                                      strcpy(e_s,s[i]);
                                                      strcpy(s[i],s[i+1]);
                                                      strcpy(s[i+1],e_s);
                                                      e_h=h[i];
                                                      h[i]=h[i+1];
                                                      h[i+1]=e_h;
                                                         }
                                         }
                      }
   
    printf("%.2lf",h[0]);
    for(i=1;i<n;i++){printf(" %.2lf",h[i]);}
       return 0;
	}
int main()
{
  int n;
  int i; 
  int j=0, k=0;
  char v[10];
  float h[45];
  float h1[45];
  float h2[45];
  int count1, count2;
 float temp;
  

  
  scanf("%d", &n);
  
    for(i=0; i<n; i++)
  {
    h[i]=0;
    h1[i] = 0;
    h2[i] = 0;
  }
  
  for(i=0; i<n; i++)
  {
    scanf("%s%f", v, &h[i]);
    if(!strcmp(v, "male"))
    {
      h1[j] = h[i];
      j++;
    }
    
    else
    {
      h2[k] = h[i];
      k++;
    }
  }

  
  count1 =j;
  count2= k;
  
  for(i=0; i<count1-1; i++)
    for(j=count1-1; j>i; j--)
    {
      if(h1[j]<h1[j-1])
      {
        temp = h1[j];
        h1[j] = h1[j-1];
        h1[j-1] = temp;
      }
    }
    
   
      
  for(i=0; i<count2-1; i++)
    for(j=count2-1; j>i; j--)
    {
      if(h2[j]> h2[j-1])
      {
        temp = h2[j];
        h2[j] = h2[j-1];
        h2[j-1] = temp;
      }
    }
    
  for(i=0; i<count1; i++)
      printf("%.2f ", h1[i]);
    
  for(i=0; i<count2-1; i++)
      printf("%.2f ", h2[i]);
  printf("%.2f", h2[i]);
      
        
    return 0;
  }
int n = 0;
int malecnt = 0;
int femalecnt = 0;
double male[50];
double female[50];

int main()
{
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	int i = 0;
	char s[10];
	double temp = 0;

	scanf("%d", &n);

	while(n--)
	{
		scanf("%s %lf", s, &temp);
		if(strcmp(s, "male") == 0)
		{
			male[malecnt++] = temp;
		}
		else
		{
			female[femalecnt++] = temp;
		}
	}

	sort(male, male+malecnt);
	sort(female, female+femalecnt);

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

	for(i=femalecnt-1; i>=1; i--)
	{
		printf("%.2lf ", female[i]);
	}
	printf("%.2lf\n", female[0]);
	return 0;
}
int main(){
	int n=0,i=0,j=0,k=0,m=0;
	double e=0,f=0;
	double g[50];
	double a[50];
	struct ren{
		char s[10];
		double h;
	}
	rens[50];
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s %lf",rens[i].s,&rens[i].h);
	}
	j=0;
	k=0;
	for(i=0;i<n;i++){
		if(rens[i].s[0]=='m'){
			g[j]=rens[i].h;                                                                    
			j++;
		}
		else{
			a[k]=rens[i].h;
			k++;
		}
	}
	for(m=1;m<=j;m++){
		for(i=0;i<j-m;i++){
			if(g[i]>g[i+1]){
				e=g[i+1];
				g[i+1]=g[i];
				g[i]=e;
			}
		}
	}
	for(m=1;m<=k;m++){
		for(i=0;i<k-m;i++){
			if(a[i]>a[i+1]){
				f=a[i];
				a[i]=a[i+1];
				a[i+1]=f;
			}
		}
	}
	printf("%.2lf",g[0]);
	for(i=1;i<j;i++){
		printf(" %.2lf",g[i]);
	}
	for(i=k-1;i>=0;i--){
		printf(" %.2lf",a[i]);
	}
	return 0;

}
int main(){
    int n,mk=0,fk=0;
	scanf("%d",&n);
	int i,j;
	struct point{
		char sex[10];
		double height;
    }p[40],m[40],f[40],e;
	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){
			m[mk]=p[i];
			mk++;
		}
        if(strcmp(p[i].sex,"female")==0){
			f[fk]=p[i];
			fk++;
		}
	}
	for(i=1;i<mk;i++){
		for(j=0;j<mk-i;j++){
			if(m[j].height>m[j+1].height){
				e=m[j];
				m[j]=m[j+1];
				m[j+1]=e;
			}
		}
	}
    for(i=1;i<fk;i++){
		for(j=0;j<fk-i;j++){
			if(f[j].height<f[j+1].height){
				e=f[j];
				f[j]=f[j+1];
				f[j+1]=e;
			}
		}
	}
	for(i=0;i<mk;i++){
		if(i==0){
			printf("%.2lf",m[i].height);
		}else{
            printf(" %.2lf",m[i].height);
		}
	}
	for(i=0;i<fk;i++){
            printf(" %.2lf",f[i].height);
	}
    return 0;
}
void sort(float*p,int n)
{
   float temp;
   for (int i=0;i<n;i++)
      for (int j=n-1;j>i;j--)
        {
           if (*(p+j)<*(p+j-1))
              {
                 temp=*(p+j);
                 *(p+j)=*(p+j-1);
                 *(p+j-1)=temp;          
              }    
        }  
}
main()
{
  void sort(float*p,int n);
  float height[40];
  char gender[40][6];
  int n,lens[40];
  scanf ("%d",&n);
  for (int i=0;i<n;i++)
      {
        scanf ("%s%f",&gender[i],&height[i]);   
        lens[i]=strlen(gender[i]);
      }
  int p=-1,q=-1;
  float m[40],f[40];
  for (int j=0;j<n;j++)
     {
       if (lens[j]==4)
           {
             p++;
             m[p]=height[j];
           }
       else
           {
              q++;
              f[q]=height[j];
           }    
     }
  float *p1=m,*p2=f;
  sort(p1,p+1);
  sort(p2,q+1);
  for (int k=0;k<=p;k++)
      printf ("%3.2f ",m[k]);
  for (int k=q;k>=0;k--)
     {
           printf ("%3.2f",f[k]);
           if (k>0)
              printf (" ");
     }          
}
int com1(const void *e1,const void*e2)
{
    float *p1,*p2;
    int x=0;
    p1=(float *)e1;
    p2=(float *)e2;
    if ((*p1)>(*p2)) x=1;
    if ((*p1)<(*p2)) x=-1; 
    return x;
}
int com2(const void *e1,const void*e2)
{
    float *p1,*p2;
    int x=0;
    p1=(float *)e1;
    p2=(float *)e2;
    if ((*p1)>(*p2)) x=-1;
    if ((*p1)<(*p2))x=1; 
    return x;
}
int main()
{
    int i,j=0,k=0,n;
    float *a,*b;
    char c[10];
    float d;
    scanf("%d",&n);
    a=(float *)malloc(n*sizeof(int));
    b=(float *)malloc(n*sizeof(int));
    for (i=0;i<n;i++)
    {
         scanf("%s %f",c,&d);
         if (strlen(c)==4)  {a[j]=d;j++;}
         else {b[k]=d;k++;}         
    }
    for(i=j;i<n;i++)    a[i]=6;
    for (i=k;i<n;i++)   b[i]=0;
    qsort(a,n,sizeof(float),com1);
    qsort(b,n,sizeof(float),com2);
    printf("%.2f",a[0]);
    for (i=1;i<j;i++)  printf(" %.2f",a[i]);
    for (i=0;i<k;i++)  printf(" %.2f",b[i]);
    getchar();
    getchar();
    getchar();
    return 0;
}
int main()
{
	int n,m=0,i,j,k;
	char sex[40][10]={'\0'}; 
	float h[40]={0};
	float temp;
	char tsex[40];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s %f",sex[i],&h[i]);
		if(sex[i][0]=='m')
		{
			m=m+1;
		}
	}
	for(i=0;i<n;i++)
	{
		for(j=i;j<n-i;j++)
		{
			if(sex[j][0]=='m')
			{
				if(sex[j+1][0]=='m'&&h[j]>h[j+1])
				{
					temp=h[j];
					h[j]=h[j+1];
					h[j+1]=temp;
				}
			}
			else if(sex[j][0]=='f')
			{
				if(sex[j+1][0]=='m')
				{
					temp=h[j];
					h[j]=h[j+1];
					h[j+1]=temp;
					strcpy(tsex, sex[j+1]);
					strcpy(sex[j+1],sex[j]);
					strcpy(sex[j],tsex);
				}
				else if(sex[j+1][0]=='f'&&h[j]<h[j+1])
				{
					temp=h[j];
					h[j]=h[j+1];
					h[j+1]=temp;
				}

			}
		}
	}
	for(i=0;i<n;i++)
	{
		for(j=0;j<n-i;j++)
		{
			if(sex[j][0]=='m')
			{
				if(sex[j+1][0]=='m'&&h[j]>h[j+1])
				{
					temp=h[j];
					h[j]=h[j+1];
					h[j+1]=temp;
				}
			}
			else if(sex[j][0]=='f')
			{
				if(sex[j+1][0]=='m')
				{
					temp=h[j];
					h[j]=h[j+1];
					h[j+1]=temp;
					strcpy(tsex, sex[j+1]);
					strcpy(sex[j+1],sex[j]);
					strcpy(sex[j],tsex);
				}
				else if(sex[j+1][0]=='f'&&h[j]<h[j+1])
				{
					temp=h[j];
					h[j]=h[j+1];
					h[j+1]=temp;
				}

			}
		}
	}
	for(k=0,i=0;i<40;i++)
	{
		if(h[i]!=0&&k!=0)
		{
		printf(" %.2f", h[i]);
		k++;
		}
		else if (h[i]!=0&&k==0)
		{
			printf("%.2f",h[i]);
			k++;
		}

	}
	return 0;
}
int main()
{
	int k, i, j = 0,h =0, m,flag = 0;
	char n[40][7];
	float s[40], a[40], b[40], temp;
	cin >> k;
	for (i = 0; i < k; i++)
	{
		cin >> n[i] >> s[i];
	}
	for (i = 0 ; i < k; i++)
	{
		if(n[i][0] == 'm')
		{
			a[j] = s[i]; j++; 
		}
		else
		{b[h] = s[i];h++;}
	}
	for (i = 0; i < j - 1; i++)
		for (m = 0; m < j - i - 1; m++)
		{
			if (a[m] > a[m + 1])
			{
				temp = a[m + 1]; a[m + 1] = a[m]; a[m] = temp; 
			}
		}
	for (i = 0; i < h - 1; i++)
		for (m = 0; m < h - i - 1; m++)
		{
			if (b[m] < b[m + 1])
			{
				temp = b[m + 1]; b[m + 1] = b[m]; b[m] = temp;
			}
		}
    cout << fixed;
	for (i = 0; i < j; i++)
	{   if (flag)
		cout <<" "<< setprecision(2) << a[i];
	    else
		{cout << setprecision(2) << a[i]; flag = 1;}
	}
	for (i = 0; i < h; i++)
		cout <<" "<<setprecision(2) << b[i];
	return 0;
}
int compare(const void *elem1,const void *elem2)
{
	float a;
	a=*(float *)elem1-*(float *)elem2;
	if(a>0)
		return 1;
	else if(a==0)
		return 0;
	else
		return -1;

}

int main()
{
	float a[100],b[100];
	int c=0,d=0;
	int n;
	char ch[30];
	scanf("%d",&n);
	int i;
	for(i=0;i<n;i++)
	{
		scanf("%s",ch);
		if(strcmp(ch,"male")==0)
		{
			scanf("%f",&a[c++]);
		}

		else
		{
			scanf("%f",&b[d++]);
		}
	}

	qsort(a,c,sizeof(float),compare);
	qsort(b,d,sizeof(float),compare);

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

	for(i=d-1;i>=0;i--)
	{
		if(i!=0)
			printf("%.2f ",b[i]);
		else
			printf("%.2f",b[i]);

	}

	printf("\n");

	return 1;

}
int main()
{
	int i,j,k,m,f,n;
	float male[40],female[40],temp;
	char sex[40][6];
	scanf("%d",&n);
	k=0;
	j=0;
	m=0;
	f=0;
	temp=0.00;
    for (i=0;i<n;i++)
	{
		scanf("%s",sex[i]);
		if (sex[i][0]=='m') 
		{
			scanf("%f",&male[k]);
			k=k+1;
			m=k;
		}
	    else 
		{
			scanf("%f",&female[j]);
			j=j+1;
			f=j;
		}
	}
	for (i=0;i<m;i++)
	{
		for (k=1;k<m;k++)
		{
			if (male[k-1]>male[k])
			{
				temp=male[k-1];
				male[k-1]=male[k];
				male[k]=temp;
			}
		}
	}
	for (i=0;i<f;i++)
	{
		for (k=1;k<f;k++)
		{
			if (female[k-1]<female[k])
			{
				temp=female[k-1];
				female[k-1]=female[k];
				female[k]=temp;
			}
		}
	}
	for(i=0;i<m;i++)
	{
		printf("%.2f ",male[i]);
	}
	for (i=0;i<f-1;i++)
	{
		printf("%.2f ",female[i]);
	}
	printf("%.2f",female[f-1]);
	return 0;
}
int main(){
	char k[7];
	int n,i;
	double height;
	int h[40];
	int l[40];
	scanf("%d",&n);
	int a=0;
	int b=0;
	int e;
	for(i=0;i<n;i++){
		scanf("%s",k);
		scanf("%lf",&height);
		if(k[0]=='m'){
		
			height=1000*height;
			h[a]=(int)height;
		
			a++;
		}
		else{
	
			height=1000*height;
			l[b]=(int)height;
		
			b++;
		}
	}
	int j;
	for(i=1;i<=a;i++){
		for(j=0;j<a-i;j++){
			if(h[j]>h[j+1]){
				e=h[j];
				h[j]=h[j+1];
				h[j+1]=e;
			}
		}
	}
		for(i=1;i<=b;i++){
		for(j=0;j<b-i;j++){
			if(l[j]>l[j+1]){
				e=l[j];
				l[j]=l[j+1];
				l[j+1]=e;
			}
		}
	}
		for(i=0;i<=a-1;i++){
			e=h[i];
			height=1.0*e*0.001;
			if(i==0){
				printf("%.2lf",height);
			}
			else{
				printf(" %.2lf",height);
			}
		}
		for(i=b-1;i>=0;i--){
			e=l[i];
			height=1.0*e*0.001;
			printf(" %.2lf",height);
		}
		return 0;
}
int max(double n[],int m)
{
	double max_num=n[0];
	int maxn=0;
	for(int i=1;i<m;i++)
	{
		if(n[i]>max_num)
		{
			max_num=n[i];
			maxn=i;
		}
	}
	return maxn;
}
int min(double n[],int m)
{
	double max_num=n[0];
	int maxn=0;
	for(int i=1;i<m;i++)
	{
		if(n[i]<max_num)
		{
			max_num=n[i];
			maxn=i;
		}
	}
	return maxn;
}
int main()
{
	int n,i,j=0,k=0,maxn;
	char s[10];
    double mt[40],ft[40],t;
	cin>>n;
	for(i=0;i<n;i++)
	{
		cin>>s>>t;
		if(strcmp(s,"male")==0)
		{
			mt[j]=t;
			j++;
		}
		else if(strcmp(s,"female")==0)
		{
			ft[k]=t;
			k++;
		}
	}
	for(i=0;i<j;i++)
	{
		maxn=max(mt,j-i);
		double temp=mt[j-i-1];
		mt[j-i-1]=mt[maxn];
		mt[maxn]=temp;	
	}
	for(i=0;i<k;i++)
	{
		maxn=min(ft,k-i);
		double temp=ft[k-i-1];
		ft[k-i-1]=ft[maxn];
		ft[maxn]=temp;	
	}

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

		printf("%0.2f ",mt[i]);
	}
	for(i=0;i<k-1;i++)
	{
		printf("%0.2f ",ft[i]);
	}
	printf("%0.2f",ft[k-1]);
	return 0;

}
int main(){
    int i,n,x=0,y=0,m;
	struct a{
		double b;
		char c[7];
	}a[40],male[40],female[40],temp;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s%lf",a[i].c,&a[i].b);
		if(a[i].c[0]=='m'){
			male[x]=a[i];
			x++;
		}
		else {
			female[y]=a[i];
			y++;
		}
	}
	for(i=0;i<x-1;i++){
		for(m=0;m<x-1-i;m++){
			if(male[m].b>male[m+1].b){
				temp=male[m];
				male[m]=male[m+1];
				male[m+1]=temp;
			}
		}
	}
    for(i=0;i<y-1;i++){
		for(m=0;m<y-1-i;m++){
			if(female[m].b<female[m+1].b){
				temp=female[m];
				female[m]=female[m+1];
				female[m+1]=temp;
			}
		}
	}
	for(i=0;i<x;i++){
		if(i==0) printf("%.2lf",male[i].b);
		else printf(" %.2lf",male[i].b);
	}
    for(i=0;i<y;i++){
		printf(" %.2lf",female[i].b);
	}
	return 0;
}
int main()
{
	int n,i,start=0,end,p1=0,p2=0,x1,x2;
	float a,b;
	scanf("%d",&n);
	end=n-1;
	struct student
	 {char sex[6];
	  float height;
	 }s[40],t;
	for(i=0;i<n;i++)
	 scanf("%s %f",s[i].sex,&s[i].height);
	while(start<=end)
	 {a=b=3;
	  for(i=start;i<=end;i++)
	   {if(s[i].sex[0]=='m')
	     {p1=1;
		  if(s[i].height<a)
	       {x1=i;a=s[i].height;} 
	     }
	    else
	     {p2=1;
		  if(s[i].height<b)
	       {x2=i;b=s[i].height;}
	     }
	   }
	  if(p1)
	   {t=s[x1];s[x1]=s[start];s[start]=t;
	    if(x2==start)
	     x2=x1;
	    start++;p1=0;
	   }
	  if(p2)
	   {t=s[x2];s[x2]=s[end];s[end]=t;end--;p2=0;}
	 }
	for(i=0;i<n;i++)
	 {if(i>0)
	   printf(" ");
	  printf("%.2f",s[i].height);
	 }
}
int main(){
	int n,i,j,nanrenshu=0,nvrenshu=0;
	char zfc[7],male[7]={'m','a','l','e','\0'},female[7]={'f','e','m','a','l','e','\0'};
	float nan[41],nv[41],jh;
	scanf("%d",&n);
	for(i=0;i<=40;i++){
		nan[i]=0;
		nv[i]=0;
	}
	for(i=1;i<=n;i++){
		scanf("%s",zfc);
		if(strcmp(zfc,male)==0){
			scanf("%f",&nan[i]);
			nanrenshu++;
		}
		if(strcmp(zfc,male)!=0){
			scanf("%f",&nv[i]);
			nvrenshu++;
		}
	}
	for(i=1;i<n;i++){
		for(j=1;j<n-i+1;j++){
			if(nan[j]<nan[j+1]){
				jh=nan[j];
				nan[j]=nan[j+1];
				nan[j+1]=jh;
			}
			if(nv[j]<nv[j+1]){
				jh=nv[j];
				nv[j]=nv[j+1];
				nv[j+1]=jh;
			}
		}
	}
	printf("%.2f",nan[nanrenshu]);
	for(i=nanrenshu-1;i>0;i--){
		printf(" %.2f",nan[i]);
	}
	for(i=1;i<=nvrenshu;i++){
		printf(" %.2f",nv[i]);
	}
	scanf("%d",&n);
	return 0;
}
main()
{
    int n,i,j;
    scanf("%d",&n);
    float girl[40]={0},boy[40]={0};
    int g=0,b=0;//??????
    char tender[8];//??
    for(i=0;i<n;i++)
    {

        scanf("%s",tender);

        if(tender[0]=='m')//???????????????
        {
            scanf("%f",&boy[b]);
            b++;
        }

        else//??????????
        {
            scanf("%f",&girl[g]);
            g++;
        }
    }
    for(i=g-1;i>0;i--)//??????????????
    {
        for(j=0;j<i;j++){

             if(girl[j]<girl[j+1])
            {
            float temp;
            temp=girl[j];
            girl[j]=girl[j+1];
            girl[j+1]=temp;

            }
        }
    }
    for(i=b-1;i>0;i--)//??????????????
    {
        for(j=0;j<i;j++){

             if(boy[j]>boy[j+1])
            {
            float temp;
            temp=boy[j];
            boy[j]=boy[j+1];
            boy[j+1]=temp;

            }
        }
    }


    for(i=0;i<b;i++)//?????????
    {
        printf("%.2f ",boy[i]);
    }

    for(i=0;i<g;i++)//?????????
    {
        printf("%.2f",girl[i]);
        if(i<g-1) printf(" ");
    }

}
int main()
{char s[1000][8];
double h[1000],zh[1000];
int n,i,j=0,m,r;
scanf("%d",&n);
m=n-1;
for(i=0;i<n;i++){
	scanf("%s",s[i]);
	if(s[i][0]=='m'){
		scanf("%lf",&h[i]);
		zh[j]=h[i];
		j++;
	}else{
		scanf("%lf",&h[i]);
		zh[m]=h[i];
		m--;
	}
}
for(i=1;i<j;i++){
	double tmp=zh[i];
	for(r=i-1;r>=0;r--){
		if(tmp<zh[r]){
             zh[r+1]=zh[r];
			 zh[r]=tmp;
		}else{
			zh[r+1]=tmp;
			break;
		}
	}
}
for(i=0;i<n-j;i++){
for(r=j;r<n-i;r++){
	if(zh[r]<zh[r+1]){
		double tm=zh[r+1];
		zh[r+1]=zh[r];
		zh[r]=tm;
	}
}
}

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

return 0;
}
int main()
{
	int n,i,j=0,k=0,J,K,p;
	scanf("%d",&n);
	char xb[40][7];
	double h[40];
	double hm[40],hf[40];
	for(i=0;i<n;i++){
		scanf("%s %lf",&xb[i],&h[i]);
		if(strlen(xb[i])==4){
			hm[j]=h[i];
			j++;
			J=j;
		}
		else{
			hf[k]=h[i];
			k++;
			K=k;
		}
	}
	//printf("%lf",hm[1]);
	//printf("%d %d",j,k);
	double e;
	for(p=1;p<=J;p++){
		for(j=0;j<J-1;j++){
		if(hm[j]>hm[j+1]){
			e=hm[j+1];
			hm[j+1]=hm[j];
			hm[j]=e;
		}
		//printf("%.2lf\n",hm[j]);
	}
}
	//printf("%lf",hm[2]);
	for(p=1;p<=K;p++){
		for(k=0;k<K-1;k++){
	  if(hf[k]<hf[k+1]){
			e=hf[k+1];
			hf[k+1]=hf[k];
			hf[k]=e;
		}
	}
}
	for(j=0;j<J;j++){
		printf("%.2lf ",hm[j]);
		//printf("hehe");
	}
	for(k=0;k<K-1;k++){
		printf("%.2lf ",hf[k]);
	}
	printf("%.2lf",hf[K-1]);
	//scanf("%d",&n);
	return 0;
}
int main(){
	int n,i,m=0,w=0,j;
	double h[50],manh[50],womanh[50],g,b;
	char sex[50][10];
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s%lf",sex[i],&h[i]);
		if(sex[i][0]=='m'){
			manh[m]=h[i];
			m++;
		}else if(sex[i][0]=='f'){
			womanh[w]=h[i];
			w++;
		}
	}
	for(i=0;i<m-1;i++){
		for(j=0;j<m-1;j++){
			if(manh[j]>manh[j+1]){
				b=manh[j];
				manh[j]=manh[j+1];
				manh[j+1]=b;
			}
		}
	}
	for(i=0;i<w-1;i++){
		for(j=w-2;j>=0;j--){
			if(womanh[j]<womanh[j+1]){
				g=womanh[j];
				womanh[j]=womanh[j+1];
				womanh[j+1]=g;
			}
		}
	}
	for(i=0;i<m;i++){
		printf("%.2lf ",manh[i]);
	}
	for(i=0;i<w-1;i++){
		printf("%.2lf ",womanh[i]);
	}
	printf("%.2lf",womanh[w-1]);
	return 0;
}
int main()
{
	int n,i,j;
	double h,t,f[40],m[40];
	char sex[6];
	cin>>n;
	int count1=0,count2=0;
	for(i=0;i<n;i++){
		cin>>sex>>h;
		if(sex[0]=='f')
			f[count1++]=h;
		else
			m[count2++]=h;
	}                                  //??count1?count2??????????????
	for(i=0;i<count1-1;i++)             //???????????,??
		for(j=count1-1;j>i;j--)
			if(f[j]>f[j-1])
			{t=f[j];f[j]=f[j-1];f[j-1]=t;}
	for(i=0;i<count2-1;i++)             //???????????
		for(j=count2-1;j>i;j--)
			if(m[j]<m[j-1])
			{t=m[j];m[j]=m[j-1];m[j-1]=t;}
	cout<<fixed<<setprecision(2);      //????????
	for(i=0;i<count2;i++)              //??????
		cout<<m[i]<<' ';
	for(i=0;i<count1-1;i++)            //??????
		cout<<f[i]<<' ';
	cout<<f[count1-1];
	return 0;
}
int main()
{
	int n,i;
	scanf("%d",&n);
	
	struct student
	{
		char gender[7];
		float h;
	};
	struct student stu[40];
	for(i=0;i<n;i++)
		scanf("%s %f",stu[i].gender,&stu[i].h);
	
	float a[40],b[40]; 
	char m[5]="male";
	int j=0,t=0; 
	for(i=0;i<n;i++)
	{
		if(strcmp(stu[i].gender,m)==0)
		{
			a[j]=stu[i].h;
			j++;
		}
		else
		{
			b[t]=stu[i].h;
			t++;
		}
	}
	
	int k,q	;
	float e; 
	for(i=0;i<j-1;i++)
	{
		k=i;
		for(q=i+1;q<j;q++)
			if(a[k]>a[q])
				k=q;
		e=a[k]; 
		a[k]=a[i];
		a[i]=e;
	} 
	
	for(i=0;i<t-1;i++)
	{
		k=i;
		for(q=i+1;q<t;q++)
			if(b[k]<b[q])
				k=q;
		e=b[k]; 
		b[k]=b[i];
		b[i]=e;
	}
	
	for(i=0;i<j;i++)
		printf("%.2f ",a[i]);
	for(i=0;i<t-1;i++)
		printf("%.2f ",b[i]);
	printf("%.2f",b[t-1]);
	 
	return 0;
}