semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int main()
{
	char sex[7];
	int i, n, j = 0, k = 0, h;
	float male[40] = {0.0}, female[40] = {0.0}, height = 0.00;
	cin >> n;
	for (i = 0; i < n; i++)
	{
		cin >> sex >> height;
		if (sex[0] == 'm')
			male[j++] = height;
		else
			female[k++] = height;
	}
	for (i = 0; i <= j - 1; i++)
	{
		for (h = i + 1; h <= j - 1; h++)
		{
			if (male[i] > male[h])
			{
				height = male[i];
				male[i] = male[h];
				male[h] = height;
			}
		}
	}
	for (i = 0; i <= j - 1; i++)
		cout << setprecision(2) << fixed << male[i] << " ";
	for (i = 0; i <= k - 1; i++)
	{
		for (h = i + 1; h <= k - 1; h++)
		{
			if (female[i] < female[h])
			{
				height = female[i];
				female[i] = female[h];
				female[h] = height;
			}
		}
	}
	for (i = 0; i <= k - 2; i++)
		cout << setprecision(2) << female[i] << " ";
	cout << setprecision(2)  << female[k - 1];
	return 0;
}
int main()
{
	int u,t,e,r,k,l,h=0,n,i,j,m=0;
	double s[41],sm[41],sf[41],tmp,tmpp;
    char z[41][7];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s %lf",z[i],&s[i]);
	}
	for(j=0;j<n;j++)
	{
		if(z[j][0]=='m')
		{
			 sm[m]=s[j];
			 m++;
		}
		if(z[j][0]=='f')
		{
			sf[h]=s[j];
            h++;
		}
	}
	for(k=1;k<=m;k++)
	{
		for(l=0;l<m-k;l++)
		{
			if(sm[l]>sm[l+1])
			{
				tmp=sm[l+1];
				sm[l+1]=sm[l];
				sm[l]=tmp;
			}
		}
	}
	for(e=1;e<=h;e++)
	{
		for(r=0;r<h-e;r++)
		{
			if(sf[r]<sf[r+1])
			{
				tmpp=sf[r+1];
				sf[r+1]=sf[r];
				sf[r]=tmpp;
			}
		}
	}
    for(u=0;u<m;u++)
	{
		printf("%.2lf ",sm[u]);
	}
    for(t=0;t<h-1;t++)
	{
		printf("%.2lf ",sf[t]);
	}
	printf("%.2lf",sf[h-1]);
    return 0;
}
int main()
{
	int n,i,j,numm=-1,numf=-1;
	double e,h[40],m[39]={0},f[39]={39};
	char sex[40][7];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s %lf",sex[i],&h[i]);
		if(sex[i][0]=='m')
		{
			numm++;
			m[numm]=h[i];
		}
		else
		{
			numf++;
			f[numf]=h[i];
		}
	}
	for(j=1;j<=numm;j++)
	{
		for(i=0;i<=numm-j;i++)
		{
			if(m[i]>m[i+1])
			{
				e=m[i];
				m[i]=m[i+1];
				m[i+1]=e;
			}
		}
	}
	for(j=1;j<=numf;j++)
	{
		for(i=0;i<=numf-j;i++)
		{
			if(f[i]<f[i+1])
			{
				e=f[i];
				f[i]=f[i+1];
				f[i+1]=e;
			}
		}
	}
	for(i=0;i<=numm;i++)
	{
		printf("%.2lf ",m[i]);
	}
	for(i=0;i<numf;i++)
	{
		printf("%.2lf ",f[i]);
	}
	printf("%.2lf",f[numf]);
	return 0;
}
const int maxn=105; 
double a[maxn], b[maxn]; 

int main()
{
    char str[20], n, m, i, j, T; 
    while (scanf ("%d", &T)!=EOF)
    {
        n=0; m=0; 
        while (T--)
        {
            scanf ("%s", str); 
            if (str[0]=='m')
            {
                scanf ("%lf", a+n); 
                n++;     
            }
            else{
                scanf ("%lf", b+m); 
                m++;     
            }
        }
        sort (a, a+n); sort (b, b+m); 
        for (i=0; i<n; i++)
            printf ("%.2lf ", a[i]); 
        for (i=m-1; i>=0; i--)
        {
            printf ("%.2lf", b[i]);
            if (i) printf (" "); 
            else printf ("\n");  
        }
    } 
    return 0; 
}
int main(){
	int n,i,j,x=0,y=0;
	double h,a[100],b[100];
	char c[100];
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s %lf",c,&h);
		if(c[0]=='m'){
			a[x]=h;
			x++;
		}
		else if(c[0]=='f'){
			b[y]=h;
			y++;
		}
		
	}
	double e;
	for(i=1;i<=x;i++){
		for(j=0;j<x-i;j++){
			if(a[j]>a[j+1]){
				e=a[j];
				a[j]=a[j+1];
				a[j+1]=e;
			}
		}
	}
	double f;
	for(i=1;i<=y;i++){
		for(j=0;j<y-i;j++){
			if(b[j]<b[j+1]){
				f=b[j];
				b[j]=b[j+1];
				b[j+1]=f;
			}
		}
	}
	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,i=0,j=0,f=0,m=0;
	double h,t=0;
	double male[MAX]={0},fe[MAX]={0};
	char s[7];
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s%lf",s,&h);
		int r=strcmp(s,"female");
		if(r==0){
			fe[f]=h;
			f++;
		}
		else if(r!=0){
			male[m]=h;
			m++;
		}
	}
	for(i=f-1;i>0;i--){
		for(j=0;j<i;j++){
			if(fe[j]<fe[j+1]){
				t=fe[j];
				fe[j]=fe[j+1];
				fe[j+1]=t;
			}
		}
	}
	for(i=m-1;i>0;i--){
		for(j=0;j<i;j++){
			if(male[j]>male[j+1]){
				t=male[j+1];
				male[j+1]=male[j];
				male[j]=t;
			}
		}
	}
	for(i=0;i<m;i++)
		printf("%.2lf ",(male[i]));
	for(i=0;i<f-1;i++)
		printf("%.2lf ",(fe[i]));
	printf("%.2lf",(fe[f-1]));
	return 0;
}
int main()
{
 int n,a=0,b=0,paohuihaoduo;
 char zonggong[]={"female"},paohui[7];
 float hanzi[40],meizi[40],paohuierhao;
 scanf("%d",&n);
 for(int i=0;i<n;i++)
 {
  scanf("%s",&paohui);
  paohuihaoduo=strcmp(paohui,zonggong);
  if(paohuihaoduo==0)
  {
   scanf("%f",&meizi[a]);
   a++;
  }
  else
  {
   scanf("%f",&hanzi[b]);
   b++;
  }
 }
 for(int i=0;i<b-1;i++)
 {
  for(int j=i+1;j<b;j++)
  {
   if(hanzi[i]>hanzi[j])
   {
    paohuierhao=hanzi[i];
    hanzi[i]=hanzi[j];
    hanzi[j]=paohuierhao;
   }
  }
 }
 for(int i=0;i<a-1;i++)
 {
  for(int j=i+1;j<a;j++)
  {
   if(meizi[i]<meizi[j])
   {
    paohuierhao=meizi[i];
    meizi[i]=meizi[j];
    meizi[j]=paohuierhao;
   }
  }
 }
 for(int i=0;i<b;i++)
  printf("%.2f ",hanzi[i]);
 for(int i=0;i<a;i++)
 {
  if(i==a-1)
   printf("%.2f",meizi[i]);
  else
   printf("%.2f ",meizi[i]);
 }
 return 0;
}
void main()
{
	int n;
	int i,j;
	float tmp;
	float a[40]={0};
	float b[40]={0};
	int t=0;
	int s=0;
	struct 
	{
		char sex[5];
		float high;
	}stu[40];



	scanf("%d",&n);
	for (i=0;i<n;i++)
	{
		scanf("%s",&stu[i].sex);
		scanf("%f",&stu[i].high);
	}
	
	for (i=0;i<n;i++)
	{
		if (strcmp(stu[i].sex,"male")==0)
		{
			a[t]=stu[i].high;
			t=t+1;
		}
		else
		{
			b[s]=stu[i].high;
			s=s+1;
		}
	}

	for (i=0;i<t-1;i++)
	{
		for (j=i+1;j<t;j++)
		{
			if (a[i]>a[j])
			{
				tmp=a[i];
				a[i]=a[j];
				a[j]=tmp;
			}
		}
	}

	for (i=0;i<s-1;i++)
	{
		for (j=i+1;j<s;j++)
		{
			if (b[i]<b[j])
			{
				tmp=b[i];
				b[i]=b[j];
				b[j]=tmp;
			}
		}
	}

	for (i=0;i<t;i++)
		stu[i].high=a[i];
	for (i=t;i<s+t;i++)
		stu[i].high=b[i-t];
	printf("%.2f",stu[0].high);
	for (i=1;i<s+t;i++)
		printf("% .2f",stu[i].high);
}
int n;
double b[40];
double c[40];
int main()
{
	char a[10];
	int  t=0,k=0;
	double len;
	double temp;
	int i,j;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s",a);
		scanf("%lf",&len);
		if(a[0]=='m')
			b[k++]=len;
		else
			c[t++]=len;
	}
	for(i=0;i<k-1;i++)
		for(j=0;j<k-i-1;j++)
		{
			if(b[j]>b[j+1])
			{
				temp=b[j];
				b[j]=b[j+1];
				b[j+1]=temp;
			}
		}
	for(i=0;i<t-1;i++)
		for(j=0;j<t-i-1;j++)
		{
			if(c[j]<c[j+1])
			{
				temp=c[j];
				c[j]=c[j+1];
				c[j+1]=temp;
			}
		}
		
	for(i=0;i<k;i++)
		printf("%.2f ",b[i]);
	for(i=0;i<t-1;i++)
		printf("%.2f ",c[i]);
		printf("%.2f",c[t-1]);
}
main()
{
      int n,i,j,p,n1,n2;
      char s[10];
      double c,t;
      double a[100],b[100];
      scanf("%d",&n);      
      n1=0; n2=0;
      for (i=1;i<=n;i++)
      {
          scanf("%s",s);
          scanf("%lf",&t);
          if (s[0]=='m') {n1++; a[n1]=t;}
          else {n2++; b[n2]=t;}
      }
      
      for (i=1;i<=n1-1;i++)
      {p=i;
       for (j=i+1;j<=n1;j++)
       if (a[j]<a[p]) p=j;
       c=a[i]; a[i]=a[p]; a[p]=c;
       }
       
       /*for (i=1;i<=n1;i++) printf("%.2lf ",a[i]);*/
       
       for (i=1;i<=n2-1;i++)
      {p=i;
       for (j=i+1;j<=n2;j++)
       if (b[j]>b[p]) p=j;
       c=b[i]; b[i]=b[p]; b[p]=c;
       }
       
       for (i=1;i<=n1;i++) printf("%.2lf ",a[i]);
       for (i=1;i<=n2;i++) if (i<n2) printf("%.2lf ",b[i]); else printf("%.2lf\n",b[i]);
       
}
//*************************************************
//***???????***
//***??????***
//***???2012.12.24***
//*************************************************
int main ()
{
	int n,x = 0,y = 0,i,j,temp;
	char a[7];
	double male[40],female[40];
	cin >> n;
	for (i = 0; i < n; i++)
	{
		cin >> a;
		if (strcmp(a,"male") == 0)
		{
			cin >> male[x++];
		}
		else if (strcmp(a,"female") == 0)
		{
			cin >> female[y++];
		}
	}
	temp = 0;
	for (i = 0; i < x; i++)
	{
		if (male[i] < male[temp])
			temp = i;
	}
	cout << fixed << setprecision(2) << male[temp];
	male[temp] = 0;
	for (i = 0; i < x - 1; i++)
	{
		for (j = 0; j < x; j++)
		{
			if (male[j] > 1)
			{
				temp = j;
				break;
			}
		}
		for (;j < x; j++)
		{
			if (male[j] > 1 && male[j] < male[temp])
				temp = j;
		}
		cout << " " << male[temp];
		male[temp] = 0;
	}
	for (i = 0; i < y; i++)
	{
		temp = 0;
		for (j = 0; j < y; j++)
		{
			if (female[j] > female[temp])
			{
				temp = j;
			}
		}
		cout << " " << female[temp];
		female[temp] = 0;
	}
	return 0;
}
struct people
{
    char a[7];
    float l;
};
int main()
{
    int n,i,j;
    struct people* p;
    struct people pp;
    char* v="male";
    scanf("%d",&n);
    p=(struct people*)malloc(n*sizeof(struct people));
    for(i=0;i<n;i++)
        scanf("%s %f",p[i].a,&p[i].l);
    for(i=0;i<n-1;i++)
    {
        for(j=i+1;j<n;j++)
        if(strcmp(p[i].a,p[j].a)<0)
        {
            pp=p[i];
            p[i]=p[j];
            p[j]=pp;
        }
        else
        {
        if(p[i].l>p[j].l&&strcmp(p[i].a,v)==0&&strcmp(p[j].a,v)==0)
        {
            pp=p[i];
            p[i]=p[j];
            p[j]=pp;
        }
        if(p[i].l<p[j].l&&strcmp(p[i].a,v)!=0&&strcmp(p[j].a,v)!=0)
        {
            pp=p[i];
            p[i]=p[j];
            p[j]=pp;
        }
        }
    }
    for(i=0;i<n-1;i++)
    printf("%.2f ",p[i].l);
    printf("%.2f",p[n-1].l);
    free(p);
    return 0;
}
int main ()
{
	int n;
	double a[40],c[40],k;
	double temp;
	char b[40];
	int len1=0,len2=0;
	cin>>n;
	//cout<<n<<"m"<<endl;
	for(int i=0;i<n;i++)
	{
		cin>>b>>k;
		if(b[0]=='f')
			a[len1++]=k;
		else c[len2++]=k;
	}
	for(int i=0;i<len1-1;i++)
		for(int j=0;j<len1-1-i;j++)
			{
				if(a[j]<a[j+1])
				{
				    temp=a[j];a[j]=a[j+1];a[j+1]=temp;
				}
			}
	for(int i=0;i<len2-1;i++)
				for(int j=0;j<len2-1-i;j++)
				{
					if(c[j]>c[j+1])
					{
						temp=c[j];c[j]=c[j+1];c[j+1]=temp;
					}
				}

	for(int i=0;i<len2;i++)
		cout<<fixed<<setprecision(2)<<c[i]<<" ";
	for(int i=0;i<len1;i++)
		{if(i==0)
			cout<<a[i];
		else cout<<fixed<<setprecision(2)<<" "<<a[i];}
	return 0;
}
int main()
{
	int n,i,j=0,k=0,p;
	double h[40],mh[40],e,wh[40];
	char s[40][10];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s%lf",s[i],&h[i]);
		if(strcmp(s[i],"male")==0)
		{
			mh[j]=h[i];
			j++;
		}else if(strcmp(s[i],"female")==0)
		{
			wh[k]=h[i];
			k++;
		}
	}
	for( p = 1; p <= j; p++){
		for( i = 0; i < j- p; i++){
			if(mh[i] > mh[i+1]){
				e = mh[i+1];
				mh[i+1] = mh[i];
				mh[i] = e;
			}
	}}
		for( p = 1; p <= k; p++){
		for(i = 0; i < k- p; i++){
			if(wh[i] > wh[i+1]){
				e = wh[i+1];
				wh[i+1] = wh[i];
				wh[i] = e;
			}
		}}
		printf("%.2lf",mh[0]);
	for(i=1;i<j;i++)
	{
		printf(" %.2lf",mh[i]);
	}
	for(i=k-1;i>=0;i--)
	{
		printf(" %.2lf",wh[i]);
	}
	return 0;
}
float height;
float p1[nMax],p2[nMax];
char ss[10];
int cmp(const void *a,const void *b){
    return *(float *)a-*(float *)b;
}
int main (){
    int n;
    scanf("%d",&n);
    int i;
    int u=0,v=0;
    for(i=0;i<n;i++){
        scanf("%s%f",ss,&height);
        if(strcmp(ss,"male")==0){p1[u]=height;u++;}
        else if(strcmp(ss,"female")==0){p2[v]=height;v++;}
    }
    sort(p1,p1+u);
    sort(p2,p2+v);
    for(i=0;i<u;i++){
        printf("%.2f ",p1[i]);
    }
    for(i=v-1;i>=0;i--){
        printf("%.2f",p2[i]);
        if(i!=0){
            printf(" ");
        }
    }
    printf("\n");
        return 0;
}
int main()
{
	int n, i, j = 1, k = 1;
	cin >> n;
	char sex[40][10];
	double male[40], female[40];
	for (i = 1; i <= n; i++)
	{
		cin >> sex[i];
		if (sex[i][0] == 'm')
		{
			 cin >> male[j];
			 j++;
		}
		else
		{
			cin >> female[k];
			k++;
		}
	}
	int j0 = j - 1, k0 = k - 1;
	for (k = 1; k <= j0; k++)
	{
		for (i = 1; i <= j0 - k; i++)
		{
			if (male[i] > male[i+1])
			{
				male[0] = male[i];
				male[i] = male[i+1];
				male[i+1] = male[0];
			}
		}
	}
	for (k = 1; k <= k0; k++)
	{
		for (j = 1; j <= k0 - k; j++)
		{
			if (female[j] < female[j+1])
			{
				female[0] = female[j];
				female[j] = female[j+1];
				female[j+1] = female[0];
			}
		}
	}
	for (i = 1; i <= j0; i++)
	{
		cout << fixed << setprecision(2) << male[i] << " ";
	}
	for (j = 1; j < k0; j++)
	{
		cout << fixed << setprecision(2) << female[j] << " ";
	}
	cout << fixed << setprecision(2) << female[j];

return 0;
}
main()                                
{
   int n,i,j=0,y=0,t;
   double s;
   scanf("%d",&n);
   char c[n];
   double a[n],b[n];
   for(i=0;i<n;i++)
   {
     scanf("%s %lf",&c,&s);
     t=strlen(c);
     if(t==4)
     {a[j]=s;
     j++;} 
     else
     {b[y]=s;
     y++;}                 
   }
   
   for(i=0;i<j;i++)
   {
    for(t=0;t<j-1-i;t++)
    {
    if(a[t]>a[t+1])
       {double e=a[t];
       a[t]=a[t+1];
       a[t+1]=e; }                
    }                
   }
   for(i=0;i<y;i++)
   {
    for(t=0;t<y-1-i;t++)
    {
       if(b[t]<b[t+1])                 
      { double  e=b[t];
       b[t]=b[t+1];
       b[t+1]=e; }                
    }                
   }
   for(i=0;i<j;i++)
   {printf("%.2lf ",a[i]);}
    for(i=0;i<y;i++)
   {
    if(i==y-1)
   {printf("%.2lf",b[i]);}
   else
   {printf("%.2lf ",b[i]);}
   } 
        
getchar();
getchar();
getchar();
}
int main(){
	int i,n,male=1,female,j,k;
	double shengao,pai[45],huan;
	char x[10];
	scanf("%d",&n);
	female=n;
	for(i=0;i<n;i++){
		scanf("%s\n %lf",x,&shengao);
		if(x[0]=='m'){
			pai[male]=shengao;
			male++;
		}
		if(x[0]=='f'){
			pai[female]=shengao;
			female--;
		}
	}
		male--;
		female++;
		for(j=1;j<=male;j++){
			for(k=j;k<=male;k++){
				if(pai[k]<pai[j]){
					huan=pai[k];
					pai[k]=pai[j];
					pai[j]=huan;
				}
			}
		}
		for(j=male+1;j<=n;j++){
			for(k=j;k<=n;k++){
				if(pai[k]>pai[j]){
					huan=pai[k];
					pai[k]=pai[j];
					pai[j]=huan;
				}
			}
		}
		for(i=1;i<n;i++)
		printf("%.2lf ",pai[i]);
		printf("%.2lf\n",pai[n]);
		return 0;
}
int main(){
	char xb[40][8];
	double sg[40],sz[40],ns[40];
	int i,n,k=0,j=0,t;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s%lf",&xb[i],&sg[i]);
	}
	for(i=0;i<n;i++){
		if(xb[i][0]=='m'){
			sz[k]=sg[i];
			k++;
		}else{
			ns[j]=sg[i];
			j++;
		}
	}
    for(t=1;t<=k;t++){
        double e;
		for(i=0;i<k-t;i++){
			if(sz[i] > sz[i+1]){
				e = sz[i+1];
				sz[i+1] = sz[i];
				sz[i] = e;
			}
		}
	}
	printf("%.2lf",sz[0]);
	for(i=1;i<k;i++){
		printf(" %.2lf",sz[i]);
	}
	for(t=1;t<=j;t++){
        double e;
		for(i=0;i<j-t;i++){
			if(ns[i] < ns[i+1]){
				e = ns[i+1];
				ns[i+1] = ns[i];
				ns[i] = e;
			}
		}
	}
	for(i=0;i<j;i++){
		printf(" %.2lf",ns[i]);
	}
	return 0;
}
main()
{
	int i,j,k,n,m,x,t=0;
	struct stu
	{
    	float h;
		char s[SEX+1];
	}a[MAX];
	scanf("%d",&n);
	for(i=0;i<n;i++) 
    scanf("%s%f",a[i].s,&a[i].h);
	 
	for(i=0;i<n;i++)
	{
		k=i;
		if(strcmp(a[i].s,"male" )==0)
		{   t++; 
			for(j=i+1;j<n;j++)
			{
				if( strcmp(a[j].s,"male" )==0&&a[j].h<a[k].h){
				k=j;}
				else continue;
			}
		 if(t==1)printf("%.2f",a[k].h);
	 	 else printf(" %.2f",a[k].h);
				
		 
			  
		 	a[k]=a[i];
		}
	}
	for(i=0;i<n;i++)
	{
		k=i;
		if(strcmp(a[i].s,"female" )==0 )
		{
			for(j=i+1;j<n;j++)
			{
				if(strcmp(a[j].s,"female" )==0 &&a[j].h>a[k].h)k=j;
			}
		 	    
				 printf(" %.2f",a[k].h);
				
			 
		 	a[k]=a[i];
		}
		else continue;
	}
}
int main(){
	int n,p=0,q=0;
	scanf("%d",&n);
	char sex[100][100];
	double m[100],f[100];
	for(int a=0;a<n;a++){
		scanf("%s",sex[a]);
		if(sex[a][0]=='m'){
			scanf("%lf",&m[p]);
			p++;
		}else{
			scanf("%lf",&f[q]);
			q++;
		}
	}
	for(int k=1;k<=p;k++){
        double e;
        for(int i=0;i<p-k;i++){
            if(m[i]>m[i+1]){
            e=m[i+1];
            m[i+1]=m[i];
            m[i]=e;
			}
		}
	}
	for(int b=1;b<=q;b++){
        double c;
        for(int i=0;i<q-b;i++){
            if(f[i]<f[i+1]){
            c=f[i+1];
            f[i+1]=f[i];
            f[i]=c;
			}
		}
	}
	for(int h=0;h<p;h++){
		printf("%.2lf ",m[h]);
	}
	for(int j=0;j<q-1;j++){
		printf("%.2lf ",f[j]);
	}
	printf("%.2lf",f[q-1]);
	return 0;
}
int main(){
	double h[40],tmp;
	int n,i,j,k=0;
	char c[7];   //???female?6???????????????7
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s %lf",c,&h[i]);
		if(c[0]=='f'){
			h[i]=(-1)*h[i];
			k++;
		}
	}
	for(i=n-1;i>0;i--){
		for(j=0;j<i;j++){
			if(h[j]>h[j+1]){
				tmp=h[j+1];
				h[j+1]=h[j];
				h[j]=tmp;
			}
		}
	}
	for(i=k;i<n;i++){
		printf("%.2lf ",h[i]);
	}
    for(i=0;i<k-1;i++){
		printf("%.2lf ",(-1*h[i])); //??????-h[i]
	}
	printf("%.2lf\n",(-1*h[k-1]));  //??????????????????????
	return 0;
}
int main ()
{
	int i, j, n;
	int num1 = 1,num2 = 1;
	float t = 0;
	char gender[10] = {0};
	float h[3][50] ={0};
	cin >> n;
	for ( i = 1; i <= n; i++ )
	{
		cin >> gender;
		if (strlen(gender) == 4 )
			cin >> h[1][num1], num1++;
		else 
			cin >> h[2][num2], num2++;
	}
	for ( i = 1; i <= num1 - 2; i++ )
	{
		for( j = 1; j <= num1 -1- i; j++ )
			if ( h[1][j] > h[1][j+1] )
				t = h[1][j], h[1][j] = h[1][j+1] , h[1][j+1] = t;
	}
	for ( i = 1; i <= num2 - 2; i++ )
	{
		for ( j = 1; j <= num2 - 1 - i; j++ )
			if ( h[2][j] < h[2][j+1] )
				t = h[2][j] , h[2][j] = h[2][j+1], h[2][j+1] = t;
	}
	for ( i = 1; i <= num1 -1; i++ )
		cout <<fixed << setprecision(2) << h[1][i] << " ";
	for ( i = 1; i <= num2 - 2; i++ )
		cout << h[2][i] << " ";
	cout<< fixed << setprecision(2) <<  h[2][num2 - 1] << endl;
	return 0;
}
int main(){
	int i,n,a[40];
	double hei[40],nan[40],nv[40];
	char b[7];
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s%lf",b,&hei[i]);
		if(b[0]=='m'){
			a[i]=1;
		}
		else {
			a[i]=0;
		}
	}
	int k,l;
	k=0;
	l=0;
	for(i=0;i<n;i++){
		if(a[i]==1){
			nan[k]=hei[i];
			k++;
		}
		else {
			nv[l]=hei[i];
			l++;
		}
	}
	int x,y;
	double e;
	for(x=1;x<k;x++){
		for(y=0;y<k-x;y++){
			if(nan[y]>nan[y+1]){
			e=nan[y];
			nan[y]=nan[y+1];
			nan[y+1]=e;
			}
		}
	}
	for(x=0;x<k;x++){
		printf("%.2lf ",nan[x]);
	}
    for(x=1;x<l;x++){
		for(y=0;y<l-x;y++){
			if(nv[y]<nv[y+1]){
			e=nv[y];
			nv[y]=nv[y+1];
			nv[y+1]=e;
			}
		}
	}
	for(x=0;x<l;x++){
		if(x!=(l-1)){
			printf("%.2lf ",nv[x]);
		}
		else printf("%.2lf",nv[x]);
	}
	return 0;
}
int main()
{
	int n,i,j,m=0,f=0;
	char sex[10];
	double male[40],female[40];
	double t;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		scanf("%s",sex);
		if(strcmp(sex,"male")==0)
		{
			scanf("%lf",&male[m]);
			m++;
		}
		else
		{
			scanf("%lf",&female[f]);
			f++;
		}
	}
	for(i=0;i<=m-2;i++)
		for(j=0;j<=m-2-i;j++)
			if(male[j]>male[j+1])
			{
				t=male[j];
				male[j]=male[j+1];
				male[j+1]=t;
			}
	for(i=0;i<=f-2;i++)
		for(j=0;j<=f-2-i;j++)
			if(female[j]<female[j+1])
			{
				t=female[j];
				female[j]=female[j+1];
				female[j+1]=t;
			}
	printf("%.2f",male[0]);
	for(i=1;i<=m-1;i++)
		printf(" %.2f",male[i]);
	for(i=0;i<=f-1;i++)
		printf(" %.2f",female[i]);
	printf("\n");
	return 0;
}
int main(){
  float male[42];
  float female[40];
  char  sex[8];
  char  ma[]="male";
  char  fe[]="female";
  float height;
  int n,i=0,j=0,m_num=0,f_num=0;
  scanf("%d",&n);
  while(n){
    scanf("%s %f",&sex,&height);
    if(strcmp(sex,ma)==0){
      male[i]=height;
	  i++;
	  m_num++;
    }else{
		female[j]=height;
		j++;
		f_num++;
	}
    n--;
  }
  float tmp;
  for(i=1;i<=m_num;i++){
	  for(j=0;j<m_num-1;j++){
		  if(male[j]>male[j+1])
		  {
			tmp=male[j];
			male[j]=male[j+1];
			male[j+1]=tmp;
		  }
	  }
  }

  for(i=1;i<=f_num;i++){
	  for(j=0;j<f_num-1;j++){
		  if(female[j]<female[j+1])
		  {
			tmp=female[j];
			female[j]=female[j+1];
			female[j+1]=tmp;
		  }
	  }
  }

  for(i=1;i<=f_num;i++){
	  male[i+m_num-1]=female[i-1];
  }

  for(i=0;i<m_num+f_num-1;i++){
	  printf("%.2f ",male[i]);
  }
  printf("%.2f",male[m_num+f_num-1]);
  return 0;
}
int main()
{
	int n, m = 1, p = 1;
	double a[50],b[50],c[50],t1, t2;
	char s[50][10], w[10] = "male", f[10] = "female";
	cin >> n;
	for (int i = 1; i <= n; i++)
	{
		cin >> s[i] >> a[i];
		if (strcmp(s[i],w) == 0)
		{
			b[m++] = a[i];
		}
		else
		{
			c[p++] = a[i];
		}
	}
	for (int i = 1; i <= m - 1; i++)
	{
		for (int j = 1; j <= m - i; j++)
		{
			if (b[j] > b[j + 1])
			{
				t1 = b[j];
				b[j] = b[j + 1];
				b[j + 1] = t1;

			}
		}

	}
	for (int i = 1; i <= p - 1; i++)
		{
			for (int j = 1; j <= p - i; j++)
			{
				if (c[j] < c[j + 1])
				{
					t2 = c[j];
					c[j] = c[j + 1];
					c[j + 1] = t2;

				}
			}

		}
	cout << fixed << setprecision(2);
	for (int i = 2; i <= m; i++)
	{
		cout << b[i] << " ";
	}
	for (int j = 1; j <= p - 1; j++)
	{
		cout << c[j];
		if (j != p - 1)
			cout << " ";
	}
	cout << endl;
	return 0;
}
char sex[50][7];
float tall[50];
float sort1[50]={0};
float sort2[50]={0};
char m[7]="male";
char f[7]="female";

void x(float s[50],int n)
{
	int i,j;
	float tmp;
	for(i=n-1;i>0;i--)
	{
		for(j=0;j<i;j++)
		{
			if(s[j]>s[j+1])
			{
				tmp=s[j];
				s[j]=s[j+1];
				s[j+1]=tmp;
			}
		}
	}
}

void x1(float s[50],int n)
{
	int i,j;
	float tmp;
	for(i=n-1;i>0;i--)
	{
		for(j=0;j<i;j++)
		{
			if(s[j]<s[j+1])
			{
				tmp=s[j];
				s[j]=s[j+1];
				s[j+1]=tmp;
			}
		}
	}
}

int main()
{
	int N,count;
	int i=0;
	int j=0;
	scanf("%d",&N);
	count = N;
	while(N--)
	{
		scanf("%s",sex[i]);
		scanf("%f",&tall[i]);
		i++;
	}

	for(i=0,j=0;i<count;i++)
	{
		if(!strcmp(sex[i],"male"))
		{
			sort1[j]=tall[i];
			j++;
		}	
	}

	x(sort1,j);

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

	for(i=0,j=0;i<count;i++)
	{
		if(!strcmp(sex[i],"female"))
		{
			sort2[j]=tall[i];
			j++;
		}	
	}

	x1(sort2,j);

	for(i=0;i<j-1;i++)
	{
		printf("%.2f ",sort2[i]);
	}
    printf("%.2f",sort2[j-1]);
	printf("\n");
	return 0;
}
int main()
{
	int n,i,k,m=0,f=0;
	char s[40][10];
	double c[40];
	double a[40]={0};
	double b[40]={0};
	double e;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s",s[i]);
		scanf("%lf",&(c[i]));
	}
    for(i=0;i<n;i++)
	{
		if(s[i][0]=='m')
		{
			a[i]=c[i];
			m++;
		}
		if(s[i][0]=='f')
		{
			b[i]=c[i];
			f++;
		}
	}
	for(k=1;k<=40;k++)
	{
		for(i=0;i<40-k;i++)
		{
			if(a[i]>a[i+1])
			{
				e=a[i+1];
				a[i+1]=a[i];
				a[i]=e;
			}
		}
	}
    for(k=1;k<=40;k++)
	{
		for(i=0;i<40-k;i++)
		{
			if(b[i]>b[i+1])
			{
				e=b[i+1];
				b[i+1]=b[i];
				b[i]=e;
			}
		}
	}
   for(i=40-m;i<40;i++)
	{
		printf("%.2lf ",a[i]);
	}
   for(i=39;i>40-f;i--)
	{
		printf("%.2lf ",b[i]);
	}
   printf("%.2lf",b[40-f]);
    return 0;
}
int main(){
int n,i,j,x1=0,x2=0;
double h1[100],h2[100],h[100];
double t;
char c[100];
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%s",c);
if(c[0]=='m'){
scanf("%lf",&(h1[x1]));
x1++;
}
else{
scanf("%lf",&(h2[x2]));
x2++;
}
}
for(i=0;i<x1-1;i++){
	for(j=0;j<x1-1-i;j++){
		if(h1[j]>h1[j+1]){
t=h1[j];
h1[j]=h1[j+1];
h1[j+1]=t;
		}
	}
}
for(i=0;i<x2-1;i++){
	for(j=0;j<x2-1-i;j++){
		if(h2[j]<h2[j+1]){
t=h2[j];
h2[j]=h2[j+1];
h2[j+1]=t;
		}
	}
}
for(i=0;i<x1;i++){
printf("%.2lf ",h1[i]);
}
for(i=0;i<x2-1;i++){
printf("%.2lf ",h2[i]);
}
printf("%.2lf",h2[x2-1]);

return 0;
}
int main(){
      double high[40];
      double manhigh[40];
      double womanhigh[40];
      double sa; 
      char sex[40][10];
      int n,i,j,k,a;
      char man[5]={'m','a','l','e'};
      char woman[7]={'f','e','m','a','l','e'};
      scanf("%d",&n);
      for(i=0;i<n;i++){
        scanf("%s %lf",sex[i],&high[i]);                 
      }
      j=0;
      k=0;
      for(i=0;i<n;i++){
        if(strcmp(sex[i],man)==0){
          manhigh[j]=high[i];
          j++;                          
        }else{
          womanhigh[k]=high[i];
          k++;  
        }                
      }
      for(i=0;i<j-1;i++){
         for(a=0;a<j-1-i;a++){
            if(manhigh[a]>manhigh[a+1]){
              sa=manhigh[a];
              manhigh[a]=manhigh[a+1];
              manhigh[a+1]=sa;                             
            }                     
         }                 
      }
      for(i=0;i<k-1;i++){
         for(a=0;a<k-1-i;a++){
            if(womanhigh[a]>womanhigh[a+1]){
              sa=womanhigh[a];
              womanhigh[a]=womanhigh[a+1];
              womanhigh[a+1]=sa;                             
            }                     
         }                 
      }
      for(i=0;i<j;i++){
        printf("%.2lf ",manhigh[i]);                 
      }
      if(k==1){
         printf("%.2lf",womanhigh[0]);
      }else{
       for(i=k-1;i>0;i--){
         printf("%.2lf ",womanhigh[i]);                 
       }
       printf("%.2lf",womanhigh[0]);
      }
    
    return 0;    
  }