semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int main(){
    int i,j,k,o=0,p=0,n;
    char c[50][10],f[]={"female"},m[]={"male"};
    float h[50],a[50],b[50],u;
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%s %f",c[i],&h[i]);
        }
    for(i=0;i<n;i++){
        if(strcmp(c[i],m)==0){
            a[o++]=h[i];
            }
        else if(strcmp(c[i],f)==0){
            b[p++]=h[i];
            }
        }
    for(k=1;k<o;k++){
        for(i=0;i<o-k;i++){
            if(a[i]>a[i+1]){
                u=a[i+1];
                a[i+1]=a[i];
                a[i]=u;
                }
            }
        }
     for(k=1;k<p;k++){
        for(i=0;i<p-k;i++){
            if(b[i]<b[i+1]){
                u=b[i+1];
                b[i+1]=b[i];
                b[i]=u;
                }
            }
        }
    for(i=0;i<o;i++){
        printf("%.2f ",a[i]);
        }
    for(i=0;i<p-1;i++){
        printf("%.2f ",b[i]);
        }
    printf("%.2f",b[p-1]);
    
    scanf("%d",&i);
    return 0;
}
int main()
{
 int n;
 scanf("%d",&n);
 double shengao[40];
 char xingbie[40][10];
 double nansheng[40],nvsheng[40];
 int m=0,f=0;
 int i;
 for(i=0;i<n;i++)
 {
  scanf("%s",xingbie[i]);
  scanf("%lf",&shengao[i]);
 }
 for(i=0;i<n;i++)
 {
  if (strcmp(xingbie[i],"male")==0)
  {
   nansheng[m]=shengao[i];
   m++;
  }
  else if(strcmp(xingbie[i],"female")==0)
  {
   nvsheng[f]=shengao[i];
   f++;
  }
 }
 int j;
 double t;
 for(j=1;j<m;j++)
 {
  for (i=0;i<m-j;i++)
  {
   if (nansheng[i]>nansheng[i+1])
   {
    t=nansheng[i];
    nansheng[i]=nansheng[i+1];
    nansheng[i+1]=t;
   }
  }
 }
 double r;
 for (j=1;j<f;j++)
 {
  for(i=0;i<f-j;i++)
  {
   if(nvsheng[i]<nvsheng[i+1])
   {
    r=nvsheng[i];
    nvsheng[i]=nvsheng[i+1];
    nvsheng[i+1]=r;
   }
  }
 }
 for (i=0;i<m;i++)
 {
  printf("%.2lf ",nansheng[i]);
 }
 for(i=0;i<f;i++)
 {
  if(i<f-1)
{
printf("%.2lf ",nvsheng[i]);
}
else if(i==f-1)
{
printf("%.2lf",nvsheng[i]);
}
 }
 return 0;
}
typedef long long ll;

const int maxn = 100;
double d0[maxn], d1[maxn];
int cnt0, cnt1;
int n;

int main()
{
	while(scanf("%d", &n) == 1)
	{
		cnt0 = cnt1 = 0;
		for(int i = 0; i < n; i++)
		{
			char s[100];
			double tmp;
			
			scanf("%s%lf", s, &tmp);	
			if(s[0] == 'm')
				d0[cnt0++] = tmp;
			else
				d1[cnt1++] = tmp;
		}
		
		sort(d0, d0 + cnt0);
		sort(d1, d1 + cnt1);
		char flag = 0;
		for(int i = 0; i < cnt0; i++)
		{
			if(flag)	putchar(' ');
			flag = 1;
			printf("%.2lf", d0[i]);	
		}
		
		for(int i = cnt1 - 1; i >= 0; i--)
		{
			if(flag)	putchar(' ');
			flag = 1;
			
			printf("%.2lf", d1[i]);	
		}
		
		puts("");
	}
	return 0;	
}
int main()
{
    int s,m1,m2,n,i,j,que,f;
	char ch[50];
	float b[41],g[41],height,temp;
    
	scanf("%d",&n);
	m1=-1;
	m2=-1;
	for(i=0;i<n;i++)
	{
	    scanf("%s%f",ch,&height);
		if(ch[0]=='m')
		{
		    m1++;
			b[m1]=height;
		}
		else
		{
		    m2++;
			g[m2]=height;
		}
	}

	for(i=0;i<m1;i++)
	{
	    f=i;
		for(j=i+1;j<=m1;j++)
			if(b[f]>b[j])
				f=j;
		if(f!=i)
		{
		    temp=b[i];
			b[i]=b[f];
			b[f]=temp;
		}
	}

	for(i=0;i<m2;i++)
	{
	    f=i;
		for(j=i+1;j<=m2;j++)
			if(g[f]<g[j])
				f=j;
		if(f!=i)
		{
		    temp=g[i];
			g[i]=g[f];
			g[f]=temp;
		}
	}

	printf("%.2f",b[0]);
	for(i=1;i<=m1;i++)
		printf(" %.2f",b[i]);
	for(i=0;i<=m2;i++)
	    printf(" %.2f",g[i]);
	
	return 0;
}
int main()
{
	int n;
	double a[41], b[41];
	char str[7];
	int p, q;
	double temp;

	cin >> n;
	p = 0; q = 0;
	for (int i = 1; i <= n; i++)
	{
		cin.get();
		cin >> str;
		if (str[0] == 'm')
		{
			p++;
			cin >> a[p];
		}
		else
		{
			q++;
			cin >> b[q];
		}
	}
	for (int i = 1; i <= p - 1; i++)
		for (int j = 1; j <= p - i; j++)
			if (a[j] > a[j + 1])
			{
				temp = a[j];
				a[j] = a[j + 1];
				a[j + 1] = temp;
			}
	for (int i = 1; i <= q - 1; i++)
		for (int j = 1; j <= q - i; j++)
			if (b[j] < b[j + 1])
			{
				temp = b[j];
				b[j] = b[j + 1];
				b[j + 1] = temp;
			}
	for (int i = 1; i <= p; i++)
		cout << fixed << setprecision(2) << a[i] << " ";
	for (int i = 1; i <= q - 1; i++)
		cout << b[i] << " ";
	cout << b[q];
	return 0;
}
const int MAXN = 50;
int n;
double a[MAXN], b[MAXN];
int nummale, numfemale;
int main() {
    nummale = 0;
    numfemale = 0;
    scanf("%d", &n);
    char sex[10];
    double h;
    for (int i = 0; i < n; ++i) {
        scanf("%s%lf", sex, &h);
        if (strcmp(sex, "male") == 0) {
                        a[nummale++] = h;
        } else {
               b[numfemale++] = h;
        }
        }
        sort(a, a + nummale);
        sort(b, b + numfemale);
        for (int i = 0; i < nummale; ++i)
            printf("%.2lf ", a[i]);
        for (int i = numfemale - 1; i > 0; --i)
            printf("%.2lf ", b[i]);
        if (numfemale > 0)
           printf("%.2lf\n", b[0]);
    
    return 0;
}
double a[45];int m=0;
double b[45];int f=0;
char sex[10];


int main()
{
	int n;
	scanf("%d",&n);
	
	int i,j=0,k=0;
	for(i=0;i<n;i++)
	{
		cin>>sex;
		if(strcmp(sex,"male")==0)
			cin>>a[m++];
//			scanf("%g",&a[m++]);
		else
			cin>>b[f++];
//			scanf("%g",&b[f++]);
	}
//	cout<<"male"<<m<<"famle"<<f<<endl;
	sort(a,a+m);
	sort(b,b+f);
	if(m==0)
		goto l;
	for(i=0;i<m;i++)
		printf("%.2f ",a[i]);
//		cout<<a[i]<<" ";
	if(f==0)
		goto l2;
l:	for(i=f-1;i>0;i--)
		printf("%.2f ",b[i]);
//		cout<<b[i]<<" ";
	printf("%.2f\n",b[0]);
l2:	n=0;
	return 0;
}
int main(){
	char sex[10];
	double shengao[40],m[40],f[40];
	int n,i,male=0,female=0;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s %lf",sex,&shengao[i]);
		if(sex[0]=='m') {
			m[male++]=shengao[i];//??????
		}
		if(sex[0]=='f'){
			f[female++]=shengao[i];//???i????female???
		}
	}

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


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

return 0;
}
int main()
{
	int i,j,n,p=0,q=0,k;
	double h,d[40],e[40],l;
	char a[10];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s%lf",a,&h);
		if(strcmp(a,"male")==0)
		   {
   			d[p]=h;
   			p++;
   			}
   			else {e[q]=h;
   			q++;}
	}

	if(p>1)
	{
	for(k=p-2;k>=0;k--)
	  {
  		for(i=0;i<=k;i++)
  		{if(d[i]>d[i+1])
		  	{l=d[i];
		  	d[i]=d[i+1];
		  	d[i+1]=l;
		  	
		  	}
  		}	
	
		}
	
	}
	
		if(q>1)
	{
	for(k=q-2;k>=0;k--)
	  {
  		for(i=0;i<=k;i++)
  		{if(e[i]>e[i+1])
		  	{l=e[i];
		  	e[i]=e[i+1];
		  	e[i+1]=l;
		  	
		  	}
  		}	
	
		}
	
	}
	
	
	printf("%.2f",d[0]);
	
	for(i=1;i<p;i++)
	{
		printf(" %.2f",d[i]);
	}
	for(i=q-1;i>=0;i--)
	{
		printf(" %.2f",e[i]);
	}
	
return 0;	
}
int main(){
	int n,i,j,x=0,y=0;
	double a[100],b[100],c,s;
	char t[7];
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s%lf",t,&c);
		if(t[0]=='m'){
			a[x]=c;
			x+=1;
		}
		if(t[0]=='f'){
			b[y]=c;
			y+=1;
		}
	}
	for(i=0;i<x;i++){
		for(j=0;j<x-1;j++){
			if(a[j]>a[j+1]){
				s=a[j];
				a[j]=a[j+1];
				a[j+1]=s;
			}
		}
	}
	for(i=0;i<y;i++){
		for(j=0;j<y-1;j++){
			if(b[j]<b[j+1]){
				s=b[j];
				b[j]=b[j+1];
				b[j+1]=s;
			}
		}
	}
	printf("%.2lf",a[0]);
	for(i=1;i<x;i++)
		printf(" %.2lf",a[i]);
	for(i=0;i<y;i++)
		printf(" %.2lf",b[i]);
	return 0;
}
int main()
{
	int n,male=0,female=0;
	char sex[41][10];
	float high[41];
	float male_high[41];
	float female_high[41];
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%s %f",sex[i],&high[i]);
	}
	for(int i=1;i<=n;i++)
	{
		if(sex[i][0]=='m')
		{
			male++;
			male_high[male]=high[i];
		}
		else
		{
			female++;
			female_high[female]=high[i];
		}
	}
	sort(male_high+1,male_high+male+1);
	sort(female_high+1,female_high+female+1);
	for(int i=1;i<=male;i++)
		printf("%.2f ",male_high[i]);
	for(int i=female;i>=2;i--)
		printf("%.2f ",female_high[i]);
	printf("%.2f\n",female_high[1]);
	return 0;
}
int main(){
  int n,i;
  char xb[40][8];
  double h[40];
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%s %lf",xb[i],&h[i]);
  }
  double mh[40],fh[40];
  int m=0,f=0;
  char bx[8]="male";
  for(i=0;i<n;i++){
   if(strcmp(xb[i],bx)==0){
     mh[m]=h[i];
     m++;
   }else{
     fh[f]=h[i];
     f++;
   }
  }
  for(int p=1;p<=m;p++){
   for(i=0;i<m-p;i++){
     if(mh[i]>mh[i+1]){
     double e;
     e=mh[i];
     mh[i]=mh[i+1];
     mh[i+1]=e;
     }
   }
  }
  for(int a=1;a<=f;a++){
   for(i=0;i<f-a;i++){
     if(fh[i]<fh[i+1]){
     double e;
     e=fh[i];
     fh[i]=fh[i+1];
     fh[i+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 comp(const void*a,const void*b){
    return *(float*)a-*(float*)b;
    }

int main(){
    int n,count1=0,count2=0,i,j;
    float num,a[40],b[40],temp;
    char string[10];
    scanf("%d",&n);
    for(i=0;i<=n-1;i++){
        scanf("%s",string);  
        scanf("%f",&num);
        if(string[0]=='m')
             a[count1++]=num;
        else if(string[0]=='f')
             b[count2++]=num;
                             
    }
    //qsort(a,count1,sizeof(float),comp);
    //qsort(b,count2,sizeof(float),comp);
    for(i=0;i<=count1-2;i++)
        for(j=0;j<=count1-2-i;j++)
            if(a[j]>a[j+1]){
                temp=a[j];
                a[j]=a[j+1];
                a[j+1]=temp;                
            }
    for(i=0;i<=count2-2;i++)
        for(j=0;j<=count2-2-i;j++)
            if(b[j]<b[j+1]){
                temp=b[j];
                b[j]=b[j+1];
                b[j+1]=temp;                
            }
    for(i=0;i<=count1-1;i++)
        printf("%.2f ",((float)(a[i])));
    for(i=0;i<=count2-2;i++)
        printf("%.2f ",((float)(b[i])));
    printf("%.2f",((float)(b[count2-1])));
    printf("\n");
    
    return 0;
    }
int main()
{
	int n;
	int mi=1;
	int fi=1;
	char sex[10]="male";
	char s[10]={'\0'};

	float m[41]={0};
	float f[41]={0};

	int i=1,j=1;
	scanf("%d",&n);

	while(n--)
	{
			
		

			scanf("%s",s);
//			printf("%s\n",s);
			if(s[0]=='m') 	
			{
				scanf("%f",&m[mi++]);
//				printf("mmmm"); 
			}
			else
			{
				scanf("%f",&f[fi++]);
//				printf("ffff"); 
			}
//			printf("%s\n",s);
//			printf("%d\n",mi);
		
	}
//	printf("%d\n",mi);



	for(i=1;i<mi-1;i++)
	{
		for(j=mi-1;j>i;j--)
		{
			float tem;
			if(m[i]>m[j])
			{tem=m[i];m[i]=m[j];m[j]=tem;}
		}
	}

//
	for(i=1;i<mi;i++)
		{
			printf("%.2f ",m[i]);
		}


	for(i=1;i<fi-1;i++)
	{
		for(j=fi-1;j>i;j--)
		{
			float tem;
			if(f[i]<f[j])
			{tem=f[i];f[i]=f[j];f[j]=tem;}
		}
	}
//
		for(i=1;i<fi-1;i++)
		{
			printf("%.2f ",f[i]);
		}
	printf("%.2f\n",f[i]);


//	for(i=1;i<=mi;i++){printf("%d",m[i]);}
//	for(i=1;i<=fi;i++){printf("%d",f[i]);}

	mi=1;fi=1;

	return 0;
}
int main(){
 int x=0,y=0,i,j,n;
 double t,e;
 double h[45],girl[45],boy[45];
 char sex[10];
 scanf("%d",&n);
 for(i=0;i<n;i++){
   scanf("%s %lf",sex,&(h[i]));
   //printf("%c",sex[0]);
   if(sex[0]=='f') {
	   girl[x]=h[i];
	   x++;
   }
   else{
       boy[y]=h[i];
	   y++;
   }
 }
 for(i=x;i>0;i--){
	 for(j=0;j<i-1;j++){
		 if(girl[j]<girl[j+1]){
		   t=girl[j];
		   girl[j]=girl[j+1];
		   girl[j+1]=t;
		 }
	 }
 }
 for(i=y;i>0;i--){
	 for(j=0;j<i-1;j++){
		 if(boy[j]>boy[j+1]){
		   t=boy[j];
		   boy[j]=boy[j+1];
		   boy[j+1]=t;
		 }
	 }
 }
 for(i=0;i<y;i++) printf("%.2lf ",boy[i]);
 for(j=0;j<x-1;j++) printf("%.2lf ",girl[j]);
 printf("%.2lf",girl[x-1]);
 return 0;
}
int main()
{
	int n,i,j;
	float a[42],k,b;
	char l[10];
	scanf("%d",&n);
	int na=0,nv=n;
	for(i=0;i<n;i++)
	{
		scanf("%s %f",l,&b);
		if(l[0]=='m')
		{
			a[na]=b;
			na++;
		}
		else 
		{
			a[nv]=b;
			nv--;
		}
	}
	for(i=0;i<na-1;i++)
	{
		for(j=i;j<na;j++)
		{
			if(a[i]>a[j])
			{
				k=a[i];
				a[i]=a[j];
				a[j]=k;
			}
		}
		printf("%.2f ",a[i]);
	}
	printf("%.2f ",a[na-1]);
	for(i=n;i>nv+1;i--)
	{
		for(j=i;j>nv;j--)
		{
			if(a[i]>a[j])
			{
				k=a[i];
				a[i]=a[j];
				a[j]=k;
			}
		}
	}
	for(i=nv+1;i<n;i++)
		printf("%.2f ",a[i]);
	printf("%.2f",a[n]);
	

	return 0;
}
int main(){
int n,i,j=0,k=0,p,q;
char str[10];
double a[40],b[40],c[40],e;
scanf("%d",&n);
for(i=0;i<n;i++){
	scanf("%s%lf",str,&a[i]);
	if(str[0]=='m'){
		b[j]=a[i];
		j++;
	}else{
		c[k]=a[i];
		k++;
	}
}
p=j;q=k;
for(i=0;i<p-1;i++){
	for(j=0;j<p-1;j++){
		if(b[j]>b[j+1]){
			e=b[j];
			b[j]=b[j+1];
			b[j+1]=e;
		}
	}
}
for(i=0;i<q-1;i++){
	for(k=0;k<q-1;k++){
		if(c[k]<c[k+1]){
			e=c[k];
			c[k]=c[k+1];
			c[k+1]=e;
		}
	}
}
for(j=0;j<p;j++){
	printf("%.2lf ",b[j]);
}
for(k=0;k<q-1;k++){
	printf("%.2lf ",c[k]);
}
printf("%.2lf",c[q-1]);
return 0;
}
int main(){
	int n,i,t,p,q,j;
	double a[40],c[40],d[40],e;
	char b[40][6];
	p=0;
	q=0;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s %lf",b[i],&a[i]);
		t=strcmp(b[i],"female");
		if(t==0){
			d[q]=a[i];
			q++;
		}
		else{
			c[p]=a[i];
			p++;
		}
	}
	for(i=0;i<p;i++){
		for(j=0;j<p-1-i;j++){
			if(c[j]>c[j+1]){
				e=c[j+1];
				c[j+1]=c[j];
				c[j]=e;
			}
		}
	}
	for(i=0;i<q;i++){
		for(j=0;j<q-1;j++){
			if(d[j]<d[j+1]){
				e=d[j];
				d[j]=d[j+1];
				d[j+1]=e;
			}
		}
	}
	for(i=0;i<p;i++){
		printf("%.2lf ",c[i]);
	}
	for(i=0;i<q-1;i++){
		printf("%.2lf ",d[i]);
	}
	printf("%.2lf",d[q-1]);
	return 0;
}
int main()
{
	int n,t=0,q=0,i,k;
	double m[40],w[40],e;
	struct point
	{
		char x[20];
		double y;
	} a[50];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s",a[i].x);
		scanf("%lf",&a[i].y);
	}
	for(i=0;i<n;i++)
	{
		if(strlen(a[i].x)==4)
		{
			m[t]=a[i].y;
			t++;
		}
		if(strlen(a[i].x)==6)
		{
			w[q]=a[i].y;
			q++;
		}
	}
	for(i=0;i<t;i++)
	{
		for(k=0;k<t-i-1;k++)
		{
			if(m[k]>m[k+1])
			{
				e=m[k];
				m[k]=m[k+1];
				m[k+1]=e;
			}
		}
	}
for(i=0;i<q;i++)
	{
		for(k=0;k<q-i-1;k++)
		{
			if(w[k]<w[k+1])
			{
				e=w[k];
				w[k]=w[k+1];
				w[k+1]=e;
			}
		}
	}
for(i=0;i<t;i++)
{
	printf("%.2lf ",m[i]);
}
for(i=0;i<q-1;i++)
{
	printf("%.2lf ",w[i]);
}
printf("%.2lf",w[q-1]);
		
	return 0;

}
int main()
{
    int n, i, j;
    float height[40], hmale[40], hfemale[40];
    char sex[40][7];
    cin >> n;
    cin.get();
    for(i = 0; i < n; i++)
    {
        cin >> sex[i];
        cin >> height[i];
        cin.get();
    }
    int k = 0, m = 0;
    float t;
    for(i = 0; i < n; i++)
    {
        if(sex[i][0] == 'm')
        {
            hmale[m] = height[i];
            m++;
        }
        else
        {
            hfemale[k] = height[i];
            k++;
        }
    }
    for(i = 0; i < m - 1; i++)
        for(j = 0; j < m - 1 - i; j++)
    {
        if(hmale[j] > hmale[j + 1])
        {
            t = hmale[j + 1];
            hmale[j + 1] = hmale[j];
            hmale[j] = t;
        }

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

        if(hfemale[j] < hfemale[j + 1])
        {
            t = hfemale[j + 1];
            hfemale[j + 1] = hfemale[j];
            hfemale[j] = t;
        }
    }
    for(i = 0; i < m; i++)
        printf("%.2f ", hmale[i]);
    for(i = 0; i < k - 1; i++)
        printf("%.2f ", hfemale[i]);
    printf("%.2f", hfemale[k - 1]);
    return 0;
}
int compare1(const void *elem1,const void *elem2)
{
 float *p1,*p2;
 p1=(float *)elem1;
 p2=(float *)elem2;
 if(*p1>*p2)
	 return 1;
 else
	 return 0;
}

int compare2(const void *elem1,const void *elem2)
{
 float *p1,*p2;
 p1=(float *)elem1;
 p2=(float *)elem2;
 if(*p2>*p1)
	 return 1;
 else
	 return 0;
}

int main()
{
    int i,n,k1=0,k2=0;
	char c[7];
	float MH[40],FH[40];

	scanf("%d",&n);
	while(n--)
	{
		scanf("%s",c);
		if(strcmp(c,"male")==0)
			scanf("%f",&MH[k1++]);
		else if(strcmp(c,"female")==0)
			scanf("%f",&FH[k2++]);
	}
    qsort(MH,k1,sizeof(float),compare1);
	qsort(FH,k2,sizeof(float),compare2);
	for(i=0;i<k1;i++)
		printf("%.2f ",MH[i]);
	for(i=0;i<k2-1;i++)
		printf("%.2f ",FH[i]);
	printf("%.2f\n",FH[k2-1]);
	return 0;
}
int cmpdouble(const void *x, const void *y)  
{  
    return (*(double*)x > *(double*)y ? 1 : -1);  
}    
main()
{
int n,i,j,k;
double boy[41],girl[41];
scanf("%d",&n);
struct student
{char gender[10];
double height;
}student[41];
for(i=0;i<=n-1;i++)
scanf("%s %lf",&student[i].gender,&student[i].height);
i=0;
j=0;
k=0;
while(i<=n-1)
{
	if(student[i].gender[0]=='m')
	{boy[j]=student[i].height;
	j++;}
	else
	{girl[k]=student[i].height;
	k++;}
	i++;
}

qsort(boy,j,sizeof(boy[0]),cmpdouble);
qsort(girl,k,sizeof(girl[0]),cmpdouble);
for(i=0;i<=j-1;i++)
printf("%.2f ",boy[i]);
for(i=k-1;i>0;i--)
printf("%.2f ",girl[i]);
printf("%.2f",girl[0]);
}
int main()
{
int n,i,j,k,male,female;
double t;
char xingbie[50][10];
double shengao[50],nan[50],nv[50];
scanf("%d",&n);
for(j=0;j<n;j++){
                  scanf("%s",xingbie[j]);
                  scanf("%lf",&shengao[j]);
                  }
i=0;
k=0;
for(j=0;j<n;j++){
                 if(xingbie[j][0]=='m'){
                                        nan[i]=shengao[j];
                                        i++;
                                        }
                 else{
                      nv[k]=shengao[j];
                      k++;
                      }
                 }
male=i;
female=k;
for(i=0;i<male-1;i++){
                 for(j=0;j<male-i-1;j++){
                                     if(nan[j]>nan[j+1]){
                                                         t=nan[j];
                                                         nan[j]=nan[j+1];
                                                         nan[j+1]=t;
                                                         }
                                     }
                 }
 for(i=0;i<female;i++){
                 for(j=0;j<female-i-1;j++){
                                     if(nv[j]>nv[j+1]){
                                                         t=nv[j];
                                                         nv[j]=nv[j+1];
                                                         nv[j+1]=t;
                                                         }
                                     }
                 }
 for(i=0;i<male;i++){printf("%.2lf ",nan[i]);}
 for(i=female-1;i>0;i--){printf("%.2lf ",nv[i]);}
 printf("%.2lf",nv[0]);

return 0;
}
struct photo
{
       char gen[10];
       double height;
};
main()
{
      int n;
      scanf("%d",&n);
      struct photo a[50];
      struct photo b;
      int i,j,k=0;
      for(i=0;i<n;i++)
      scanf("%s %lf",a[i].gen,&a[i].height);
      for(i=0;i<n;i++)
      {
            for(j=0;j<n-1-i;j++)
            {
                if(a[j].height<a[j+1].height)
                {
                    b=a[j];
                    a[j]=a[j+1];
                    a[j+1]=b;
                }
            }
      }
      for(i=n-1;i>=0;i--)
      {
             if(strcmp(a[i].gen,"male")==0&&k!=0)
             printf(" %.2f",a[i].height);
             if(strcmp(a[i].gen,"male")==0&&k==0)
             {
                printf("%.2f",a[i].height);
                k=k+1;
             }
      }
      for(i=0;i<n;i++)
      {
             if(strcmp(a[i].gen,"female")==0)
             printf(" %.2f",a[i].height);
      }
      }
int main(){
	char s[40][7],es[7];
	double h[40];
	int n,i,j,m=0,w=0;
	double e;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s %lf",s[i],&h[i]);
	}
	for(i=0;i<n;i++){
		if(s[i][0]=='m'){
			m++;
		}
	}
	for(j=0;j<n;j++){
		for(i=0;i<n-j-1;i++){
			if(s[i][0]=='f'){
				strcpy(es,s[i]);
				strcpy(s[i],s[i+1]);
				strcpy(s[i+1],es);
				e=h[i];
				h[i]=h[i+1];
				h[i+1]=e;
			}
		}
	}
	for(i=0;i<m;i++){
		for(j=0;j<m-i-1;j++){
			if(h[j]>h[j+1]){
				e=h[j];
				h[j]=h[j+1];
				h[j+1]=e;
			}
		}
	}
	for(i=0;i<n-m;i++){
		for(j=m;j<n-i-1;j++){
			if(h[j]<h[j+1]){
				e=h[j];
				h[j]=h[j+1];
				h[j+1]=e;
			}
		}
	}
	for(i=0;i<n-1;i++){
		printf("%.2lf ",h[i]);
	}
	printf("%.2lf",h[n-1]);




	return 0;
}
int cmp(const void * a,const void *b)
{
	return *((int *)a)-*((int *)b);
}
typedef struct{
  int  sex;
  float high;
} Man;
Man man[41];
float male[41];
float female[41];
int main()
{
 int n;
 scanf("%d",&n);
 int i;
char  str[10];
int j=0;
int k=0;
 for(i=0;i<n;i++)
 {
	 scanf("%s%f",str,&man[i].high);

	 if(strcmp(str,"male")==0) 
	 {
		 man[i].sex=0; 
		 male[j++]=man[i].high;
	 }
	 else  {
		 man[i].sex=1;
		 female[k++]=man[i].high;
	 }
}
 qsort(male,j,sizeof(float),cmp);
 qsort(female,k,sizeof(float),cmp);
 for(i=0;i<j;i++)
  printf("%.2f ",male[i]);
  for(i=k-1;i>0;i--)
  printf("%.2f ",female[i]);
   printf("%.2f",female[i]);
  printf("\n");
return 0;
}
void px(double *sz,int n);
int main(){
	char s[10];
	double hehe;
	double b[40];
	double g[40];
	int by=0;
	int gl=0;
	int n;
	scanf("%d",&n);
	int i;
	for(i=0;i<n;i++){
		scanf("%s %lf",s,&hehe);
		if(strcmp(s,"female")==0){
			g[gl]=hehe;
			gl++;
		}else{
			b[by]=hehe;
			by++;
		}
	}
	px(b,by);
	px(g,gl);
	printf("%.2lf",b[0]);
	for(i=1;i<by;i++){
		printf(" %.2lf",b[i]);
	}
	for(i=gl-1;i>=0;i--){
		printf(" %.2lf",g[i]);
	}
	return 0;
}
void px(double *sz,int n){
	int i,k;
	for(k=1;k<=n;k++){
		for(i=0;i<=n-k-1;i++){
			if(sz[i]>=sz[i+1]){
				double ex;
				ex=sz[i];
				sz[i]=sz[i+1];
				sz[i+1]=ex;
			}
		}
	}
}
void array(double*A,int n)
{
	int i,j,k;
	double t;
	for(i=0;i<n;i++)
	{
		k=i;
		for(j=i+1;j<n;j++)
		{
			if(A[j]<A[k])
				k=j;
		}
		if(k!=i)
		{
			t=A[k];
			A[k]=A[i];
			A[i]=t;
		}
	}
}
int main(){
	int i,j,n,m=0,l=0;
	double h,nan[50],nv[50];
	char s[6];
	scanf("%d\n",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s\n",s);
		scanf("%lf",&h);
	if(s[0]=='m')
	{
		nan[m]=h;
		m++;
	
}
	else
	{
		nv[l]=h;
		l++;
	}
	}
array(nan,m);
for(i=0;i<m;i++)
       printf("%.2lf ",nan[i]);
array(nv,l);
for(i=l-1;i>0;i--)
printf("%.2lf ",nv[i]);
printf("%.2lf",nv[0]);
  return 0;
}
void main()
{

	int male=0,female=0,n,i,j;
	char cn,m,f;
	char exam1[]="mmm",exam2[]="fff";

    float an[40],bn[40],high,temp1;
    char temp[6];
	m=exam1[0];
	f=exam2[0];
	scanf("%d",&n);
    for(i=0;i<n;i++)
	{
        scanf("%s %f",&temp,&high);
			cn=temp[0];
		if(cn==m)
		{
			an[male]=high;
             male=male+1;
			 

		}
         if(cn==f)
		 {
			 bn[female]=high;
			 female=female+1;
		 }

	}

	for(i=0;i<female;i++)
	{
	 for(j=0;j<female-i-1;j++)
	 {
       if(bn[j]<bn[j+1])
	   {
          temp1=bn[j];
		  bn[j]=bn[j+1];
		  bn[j+1]=temp1;

	   }
	 }
	}

	for(i=0;i<male;i++)
	{
	 for(j=0;j<male-i-1;j++)
	 {
       if(an[j]>an[j+1])
	   {
          temp1=an[j];
		  an[j]=an[j+1];
		  an[j+1]=temp1;

	   }
	 }
	}

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

{
	printf("%.2f",bn[i]);
	printf(" ");
}
printf("%.2f",bn[female-1]);


	

}
int main(){
    int n,i,j,x=0,y=0;
    char a[10];
    float b[100],c[100],d[100],t;
    scanf("%d",&n);
    for(i=0;i<n;i++){
    	cin>>a;
    	cin>>b[i];
    	if(a[0]=='m'){
    		c[x]=b[i];
    		x++;
    	}
    	if(a[0]=='f'){
    		d[y]=b[i];
    		y++;
    	}
    }
    for(i=0;i<x;i++){
    for(j=x-1;j>i;j--){
    if(c[j]<c[j-1]){
    t=c[j];
    c[j]=c[j-1];
    c[j-1]=t;
    }
    }
    }
    for(i=0;i<y;i++){
    for(j=y-1;j>i;j--){
    if(d[j]>d[j-1]){
    t=d[j];
    d[j]=d[j-1];
    d[j-1]=t;
    }
    }
    }
    for(i=0;i<x;i++){
    	printf("%.2lf ",c[i]);
    }
    for(i=0;i<y-1;i++){
    	printf("%.2lf ",d[i]);
    }
    printf("%.2lf",d[y-1]);
    return 0;
}
main()
{
  int n,m=0,x=0,y=0,q,s;
  scanf("%d",&n);
  struct person
  {
    char sex[7];
    float height;
  };
  struct person people[n];
 
  for(int i=0;i<=n-1;i++)
    scanf("%s %f",people[i].sex,&people[i].height);
  for(int j=0;j<=n-1;j++)
  {
    if(people[j].sex[0]=='m')
    m++;
  }
  struct person male[m];
  struct person female[n-m];
  struct person b;
  for(int k=0;k<=n-1;k++)
  {
    if(people[k].sex[0]=='m')
    {
      male[x]=people[k];
      x++;
    }
    else
    {
      female[y]=people[k];
      y++;
    }
  }
  for(int p=0;p<=m-2;p++)
  {
     for(q=0;q<=m-2-p;q++)
     {
       if(male[q+1].height<male[q].height)
       {
         b=male[q+1];
         male[q+1]=male[q];
         male[q]=b;
       }
     }
  }
  for(int r=0;r<=y-2;r++)
  {
     for(s=0;s<=y-2-r;s++)
     {
       if(female[s+1].height>female[s].height)
       {
         b=female[s+1];
         female[s+1]=female[s];
         female[s]=b;
       }
     }
  }
  for(int t=0;t<=m-1;t++)
  {
    printf("%.2f ",male[t].height);
  }
  for(int u=0;u<=y-2;u++)
  {
    printf("%.2f ",female[u].height);
  }
  printf("%.2f",female[y-1].height);        
}