semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
main()
{
      int n,i,h,j,c;
      scanf("%d",&n);
      int e[10000];
      for(i=0;i<n;i++)
      e[i]=0;
      double a[10000];
      double f;
      char b[1000];
      for(i=0;i<n;i++)
      {
      scanf("%s",b);
      if(b[0]=='m')
      e[i]++;
      scanf("%lf",&a[i]);
      }
      for(i=0;i<n-1;i++)
      for(j=0;j<n-1;j++)
      if(a[j]>a[j+1])
      {
                     f=a[j];
                     a[j]=a[j+1];
                     a[j+1]=f;
                     c=e[j];
                     e[j]=e[j+1];
                     e[j+1]=c;
                     }
      for(i=0,h=0;i<n;i++)
      if(e[i]==1)
      {
      if(h==0)
      {
      h++;
      printf("%.2lf",a[i]);
      }
      else
      printf(" %.2lf",a[i]);
      }
      for(i=n-1;i>=0;i--)
      if(e[i]==0)
      printf(" %.2lf",a[i]);
      }
int main()
{
	int n;
	int i,j,k=0,kk=0;
	char zs[9];
	double xb[999],sg[999];
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		scanf("%s",zs);
		if(zs[0]=='m')
		{
			xb[i]=1;
		}
		if(zs[0]=='f')
		{
			xb[i]=0;
		}
		scanf("%lf",&sg[i]);
	}
	int sx[999];
	int xs[999];
	int e;
	for(i=1;i<=n;i++)
	{
		if(xb[i]==1)
		{
			k++;
			sx[k]=i;
		}
	}
	for(i=1;i<=k-1;i++)
	{
		for(j=1;j<=k-i;j++)
		{
			if(sg[sx[j]]>sg[sx[j+1]])
			{
				e=sx[j];
				sx[j]=sx[j+1];
				sx[j+1]=e;
			}
		}
	}


	for(i=1;i<=n;i++)
	{
		if(xb[i]==0)
		{
			kk++;
			xs[kk]=i;
		}
	}
	for(i=1;i<=kk-1;i++)
	{
		for(j=1;j<=kk-i;j++)
		{
			if(sg[xs[j]]>sg[xs[j+1]])
			{
				e=xs[j];
				xs[j]=xs[j+1];
				xs[j+1]=e;
			}
		}
	}
	printf("%.2lf",sg[sx[1]]);
	for(i=2;i<=k;i++)
	{
		printf(" %.2lf",sg[sx[i]]);
	}
	for(i=kk;i>=1;i--)
	{
		printf(" %.2lf",sg[xs[i]]);
	}
	return 0;
}
main()
{
    struct line
    {
         char x[10];
         double y;
    };
    int n,a,b,m;
    double c;
    scanf("%d",&n);
    struct line *p=(struct line *)malloc(n*sizeof(struct line));
    for(a=0;a<=n-1;a++)
    {
        scanf("%s",((p+a)->x));
        scanf("%lf",&((p+a)->y));
    }
    for(a=0;a<=n-2;a++)
    {
        if(*((p+a)->x)=='m')
        {
            for(b=a+1;b<=n-1;b++)
            {
                if(*((p+b)->x)=='m')
                {
                    if(((p+b)->y)<((p+a)->y))
                    {
                        c=(p+b)->y;
                        ((p+b)->y)=((p+a)->y);
                        ((p+a)->y)=c;
                    }
                    else;
                }
                else;
            }
        }
        else
        {
             for(b=a+1;b<=n-1;b++)
            {
                if(*((p+b)->x)=='f')
                {
                    if(((p+b)->y)>((p+a)->y))
                    {
                        c=(p+b)->y;
                        ((p+b)->y)=((p+a)->y);
                        ((p+a)->y)=c;
                    }
                    else;
                }
                else;
            }
        }
    }
    for(a=0;a<=n-1;a++)
    {
        if(*((p+a)->x)=='m')
        printf("%.2lf ",((p+a)->y));
        else;
    }
    for(a=0;a<=n-1;a++)
    {
        if(*((p+a)->x)=='f')
        m=a;
        else;
    }
    for(a=0;a<=n-1;a++)
    {
        if(*((p+a)->x)=='f')
        {
            if(a!=m)
            printf("%.2lf ",((p+a)->y));
            else
            printf("%.2lf",((p+a)->y));
        }
        else;
    }
}
int main()
{
    int i,j,k,a,b,x,n;
    char s[10];
    float h,m[1000],f[1000];
    scanf("%d",&n);
    a=0;
    b=0;
    for(i=0;i<n;i++)
    {
                    scanf("%s %f",s,&h);
                    x=strcmp(s,"male");
                    if(x==0)
                    {
                            m[a]=h;
                            a++;
                    }
                    else
                    {
                        f[b]=h;
                        b++;
                    }
    }
    for(i=0;i<a;i++)
    {
                    for(j=0;j<(a-1);j++)
                    {
                                        if(m[j]>m[j+1])
                                        {
                                                       h=m[j];
                                                       m[j]=m[j+1];
                                                       m[j+1]=h;
                                        }
                    }
    }
    for(i=0;i<b;i++)
    {
                    for(j=0;j<(b-1);j++)
                    {
                                        if(f[j]<f[j+1])
                                        {
                                                       h=f[j];
                                                       f[j]=f[j+1];
                                                       f[j+1]=h;
                                        }
                    }
    }
    if(a==0)
    {
            printf("%.2f",f[0]);
            for(i=1;i<b;i++) printf(" %.2f",f[i]);
    }
    if(b==0)
    {
            printf("%.2f",m[0]);
            for(i=1;i<a;i++) printf(" %.2f",m[i]);
    }
    else
    {
        printf("%.2f",m[0]);
        for(i=1;i<a;i++) printf(" %.2f",m[i]);
        for(i=0;i<b;i++) printf(" %.2f",f[i]);
    }
}
int main()
{
	int n , malecount = 0 , femalecount = 0;
	cin >> n;
	float t;
	char a[41][6];
	float b[41] , m[41] , f[41];
	int i , j;
	for (i = 1 ; i <= n ; i++)
	{
		cin >> a[i] >> b[i];
		if (a[i][0] == 'm')
		{
		   	malecount++;
			m[malecount] = b[i];
		}
		else 
		{
			femalecount++;
			f[femalecount] = b[i];
		}
	}
	for (i = 1 ; i <= malecount - 1 ; i++)
	{
		for (j = 1 ; j <=  malecount - i ; j++)
		{
			if (m[j] > m[j + 1])
		    {
				t = m[j];
				m[j] = m[j + 1];
			    m[j + 1] = t;
		    }
		}
	}
	for (i = 1 ; i <= femalecount - 1 ; i++)
	{
		for (j = 1 ; j <= femalecount - i ; j++)
		{
			if (f[j] < f[j + 1])
			{
				t = f[j];
				f[j] = f[j + 1];
			    f[j + 1] = t;
			}
		}
	}
	cout << fixed;
	cout << setprecision(2) << m[1];
	for (i = 2 ; i <= malecount ; i++)
	{
		cout << " " << setprecision(2) << m[i];
	}
	for (i = 1 ; i <= femalecount ; i++)
	{
		cout <<  " " << setprecision(2) << f[i];
	}
	return 0;
}
int main()
{
	int n;
	double nan[40]={0},nv[40]={0};
	int i,j=0,k=0,p,l,x,y,z,q;
	char a[10];
	double b,c;
	cin>>n;
	for(i=1;i<=n;i++)
	{
		cin>>a>>b;
		if(strcmp(a,"male")==0)
			nan[j++]=b;
		else
			nv[k++]=b;
	}
	for(p=0;p<j-1;p++)
	{
		for(l=0;l<j-1-p;l++)
		{
			if(nan[l]>nan[l+1])
			{
				b=nan[l];
				nan[l]=nan[l+1];
				nan[l+1]=b;
			}
		}
	}
	for(x=0;x<k-1;x++)
	{
		for(y=0;y<k-1-x;y++)
		{
			if(nv[y]<nv[y+1])
			{
				c=nv[y];
				nv[y]=nv[y+1];
				nv[y+1]=c;
			}
		}
	}
	for(z=0;z<j;z++)
		cout<<fixed<<setprecision(2)<<nan[z]<<" ";
	for(q=0;q<k-1;q++)
		cout<<fixed<<setprecision(2)<<nv[q]<<" ";
	cout<<fixed<<setprecision(2)<<nv[k-1];
	return 0;
}
int main()
{
	int n, male1 = 0, female1 = 0, i, j;
	float height[41], male[41], female[41], t;
	char a[41][7];
	cin >> n;
	for (i = 1; i <= n; i++)
	{
		cin >> a[i] >> height[i];
		if (strcmp(a[i], "male") == 0)
		{
			male1 += 1;
			male[male1] = height[i];
		}
		else
		{
			female1 += 1;
			female[female1] = height[i];
		}
	}
	for (i = 1; i < male1; i++)
		for (j = 1; j <= male1 - i; j++)
			if (male[j] > male[j +1])
			{
				t = male[j];
				male[j] = male [j + 1];
				male[j + 1] = t;
			}
	for (i = 1; i < female1; i++)
		for (j = 1; j <= female1 - i; j++)
			if (female[j] < female[j + 1])
			{
				t = female[j];
				female[j] = female[j + 1];
				female[j + 1] = t;
			}
	for (i = 1; i <= male1; i++)
		cout << fixed << setprecision(2) << male[i] << " ";
	for (i = 1; i < female1; i++)
		cout << fixed << setprecision(2) << female[i] << " ";
	cout << female[female1] << endl;

	return 0;
}
struct human
{
       char ch[7];
       float tall;
       };
main()
{
      int n,m,s,i,j;
      int q=0;
      int x=0;
      scanf("%d",&n);
      struct human hu[n],Hn[n],Hu[n];
      for(i=0;i<n;i++)
      {
          scanf("%s %f\n",hu[i].ch,&hu[i].tall);
      }
       for(i=0;i<n;i++)
      {
         if(strcmp(hu[i].ch,"male")==0)
          {Hn[q]=hu[i];
           q++;}
         else 
          {Hu[x]=hu[i];
           x++;}
       }
       for(i=0;i<q;i++)
       {m=i;
         for(j=i+1;j<q;j++)
          {if(Hn[j].tall<Hn[m].tall)
            m=j;
          }
           if(i==0)
              printf("%.2f",Hn[m].tall);
           if(i!=0) 
              printf(" %.2f",Hn[m].tall);
         Hn[m].tall=Hn[i].tall;
       }
       
        for(i=0;i<x;i++)
         {s=i;
           for(j=i+1;j<x;j++)
            {if(Hu[j].tall>Hu[s].tall){
             s=j;}
            }
         printf(" %.2f",Hu[s].tall);
         Hu[s].tall=Hu[i].tall;
         }
       
}
int main()
{
	float a[40], b[40], t;
	char c[41][7];
	int i, j, n, m, N;
	n = 0;
	m = 0;
	cin >> N;
	for (i = 1; i <= N; i++)
	{
		cin >> c[i];
		if (c[i][0] == 'm')
		{
			n++;
			cin >> a[n];
		}
		if (c[i][0] == 'f')
		{
			m++;
			cin >> b[m];
		}
	}
	for (i = 1; i <= n; i++)
		for (j = 1; j < i; j++)
			if (a[i] < a[j])
			{
				t = a[i];
				a[i] = a[j];
				a[j] = t;
			}
	for (i = 1; i <= m; i++)
		for (j = 1; j < i; j++)
			if (b[i] > b[j])
			{
				t = b[i];
				b[i] = b[j];
				b[j] = t;
			}
   for (i = 1; i <= n; i++)
   {
       cout << fixed << setprecision(2) << a[i] <<" ";
   }
    for(i = 1; i <= m; i++)
	{
       cout << fixed << setprecision(2) << b[i] ;
	   if (i != m)
		   cout << " ";
	}
	return 0;
}
int main(){
	int n,i=0,j=0;
	char sex[41][7];
	double height[41],male[41]={0},female[41]={0},ex;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s",sex[i]);
		scanf("%lf",&height[i]);
	}
	for(i=0;i<n;i++){
		if(sex[i][0]=='m'){
			male[i]=height[i];
		}else{
			female[i]=height[i];
		}
	}
	for(i=0;i<41;i++){
		for(j=0;j<40;j++){
			if(male[j]>male[j+1]){
				ex=male[j];
				male[j]=male[j+1];
				male[j+1]=ex;
			}
		}
	}
	for(i=0;i<41;i++){
		for(j=0;j<40;j++){
			if(female[j]<female[j+1]){
				ex=female[j];
				female[j]=female[j+1];
				female[j+1]=ex;
			}
		}
	}
	for(i=0;i<41;i++){
		if(male[i]!=0){
			printf("%.2lf ",male[i]);
		}
	}
	printf("%.2lf",female[0]);
	for(i=1;female[i]!=0;i++){
		printf(" %.2lf",female[i]);
	}
	return 0;

}
int main()
{
  int i,j,m,n,a,b=0,c=0;
  double e,x[40],y[40],z[40];
  char k[40][10]; scanf("%d",&n);
  for(i=0;i<n;i++)
  {scanf("%s%lf",k[i],&z[i]);
   } 
   for(i=0;i<n;i++)
   {if(k[i][0]=='m') {x[c]=z[i]; c++;}
    else {y[b]=z[i]; b++;}
     }
  for(i=0;i<c+1;i++) 
  { for(j=1;j<c+1-i;j++)
    { if(x[j]<x[j-1]) {e=x[j]; x[j]=x[j-1]; x[j-1]=e;}
     }
   }
    for(i=0;i<b+1;i++) 
  { for(j=1;j<b+1-i;j++)
    { if(y[j]>y[j-1]) {e=y[j]; y[j]=y[j-1]; y[j-1]=e;}
     }
   } printf("%.2lf",x[1]);
  for(i=2;i<=c;i++) printf(" %.2lf",x[i]);
  for(i=0;i<b;i++) printf(" %.2lf",y[i]);
   return 0;
}
int main()
{
int n,b=0,g=0;
float m[40],f[40],e;
char x[10];
scanf("%d",&n);
for(int i=0;i<n;i++){
        scanf("%s",x);
        if(x[0]=='m'){
                     
                     scanf("%f",&m[b]);
                     b++;
                      
                      }
               if(x[0]=='f'){
                     
                     scanf("%f",&f[g]);
                     g++;
                      
                      }   
        }

for(int j=0;j<b;j++){
        for(int k=0;k<b;k++){
                if(m[j]>m[k]&&j<k){
                                   e=m[j];
                                   m[j]=m[k];
                                   m[k]=e;
                                   }
                
                
                }
        
        
        }
for(int j=0;j<g;j++){
        for(int k=0;k<g;k++){
                if(f[j]>f[k]&&j>k){
                                   e=f[j];
                                   f[j]=f[k];
                                   f[k]=e;
                                   }
                
                
                }
        
        
        }
       for(int j=0;j<b;j++){ 
printf("%.2f ",m[j]);

}
for(int j=0;j<g;j++){ 
if(j==g-1){
        printf("%.2f",f[j]);
        }
else{
printf("%.2f ",f[j]);
}
}
int hou;
scanf("%d",&hou);
return 0;
}
int main()
{
    float male[40],female[40],all[41];
    int count1=0;
    int count2=0;
    int n,i,j,k;
    float s,t,y;
    char x[7],c;
    scanf("%d",&n);
    for(i=1;i<=n;i++)
    {
         scanf("%s",x);
         scanf("%f",&y);
         //printf("%s,%f\n",x,y);
         if(strlen(x)==4)
         {
              male[count1]=y;
              count1++;
         }
         else
         {
              female[count2]=y;
              count2++;
         }
    }
         for(i=0;i<=count1-2;i++)
           for(j=i+1;j<=count1-1;j++)
           {
                if(male[i]>male[j])
                {
                s=male[i];
                male[i]=male[j];
                male[j]=s;
                }
           }
         for(i=0;i<=count2-2;i++)
           for(j=i+1;j<=count2-1;j++)
           {
                if(female[i]<female[j])
                {
                t=female[i];
                female[i]=female[j];
                female[j]=t;
                }
           }
         for(k=0;k<=count1-1;k++)
            all[k]=male[k];
         for(k=count1;k<=count1+count2-1;k++)
            all[k]=female[k-count1];
for(k=0;k<=count1+count2-2;k++)
{
printf("%.2f ",all[k]);
}
printf("%.2f",all[count1+count2-1]);
}
struct people
{
    char a[10];
    float h;
};
int com1(const void *x,const void *y)
{
    return *(int *)x-*(int *)y;
}
int com2(const void *x,const void *y)
{
    return *(int *)y-*(int *)x;
}
int main()
{
    struct people p[40];
    int n,i,j,k;
    float m[40],f[40];
    scanf("%d",&n);
    j=0;
    k=0;
    for(i=0;i<n;i++)
    {
        scanf("%s %f",&p[i].a,&p[i].h);
        if(p[i].a[0]=='m')
        {
            m[j]=p[i].h;
            j=j+1;
        }
        else
        {
            f[k]=p[i].h;
            k=k+1;
        }
    }
    qsort(m,j,sizeof(m[0]),com1);
    qsort(f,k,sizeof(f[0]),com2);
    for(i=0;i<j;i++)
    {
        printf("%.2f ",m[i]);
    }
    for(i=0;i<k-1;i++)
    {
        printf("%.2f ",f[i]);
    }
    printf("%.2f",f[k-1]);
    return 0;
}
int main()
{
	int n,i,a=0,b=0,k,q,p;
	double sg[100],e,nan[100],nv[100];
	char xb[100][100];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
       scanf("%s %lf",xb[i],&sg[i]);
	   p=strlen(xb[i]);
	   if(p==4)
	   {
		   nan[a]=sg[i];
		   a=a+1;
	   }
	   if(p==6)
	   {
		   nv[b]=sg[i];
		   b=b+1;
	   }
	}
	for(k=1;k<a;k++)
	{
		for(q=0;q<a-k;q++)
		{
            if(nan[q]<nan[q+1])
			{
				e=nan[q+1];
				nan[q+1]=nan[q];
				nan[q]=e;
			}
		}
	}
	k=1;q=0;
    for(k=1;k<b;k++)
	{
		for(q=0;q<b-k;q++)
		{
            if(nv[q]<nv[q+1])
			{
				e=nv[q+1];
				nv[q+1]=nv[q];
				nv[q]=e;
			}
		}
	}
	for(int r=0;r<a;r++)
	{
	    printf("%.2lf ",nan[a-r-1]);
	}
	for(int t=0;t<b;t++)
	{
	    if(t<b-1)
		{
		  printf("%.2lf ",nv[t]);
		}
		else
		{
                    printf("%.2lf",nv[t]);
                   }
	}
	return 0;
}
main()
{
      int n,i,h,j,c;
      scanf("%d",&n);
      int e[n];
      for(i=0;i<n;i++)
      e[i]=0;
      double a[n];
      double f;
      char b[7];
      for(i=0;i<n;i++)
      {
      scanf("%s",b);
      if(b[0]=='m')
      e[i]++;
      scanf("%lf",&a[i]);
      }
      for(i=0;i<n-1;i++)
      for(j=0;j<n-1;j++)
      if(a[j]>a[j+1])
      {
                     f=a[j];
                     a[j]=a[j+1];
                     a[j+1]=f;
                     c=e[j];
                     e[j]=e[j+1];
                     e[j+1]=c;
                     }
      for(i=0,h=0;i<n;i++)
      if(e[i]==1)
      {
      if(h==0)
      {
      h++;
      printf("%.2lf",a[i]);
      }
      else
      printf(" %.2lf",a[i]);
      }
      for(i=n-1;i>=0;i--)
      if(e[i]==0)
      printf(" %.2lf",a[i]);

      }
void main()
{
	float a[40],s1[40],s2[40],temp;
	int n,i1=0,i2=0,i,j,temp1=0,m;
	char b[7];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s",b);
		scanf("%f",&a[i]);
		if(b[0]=='m')
		{
			s1[i1]=a[i];
			i1++;
		}
		if(b[0]=='f')
		{
			s2[i2]=a[i];
			i2++;
		}
	}
	
	for(i=0;i<i1-1;i++)
	{
		temp1=i;
		temp=s1[i];
		for(j=i+1;j<i1;j++)
		{
			if(temp>s1[j])
			{
				temp=s1[j];
				temp1=j;
			}
		}
		s1[temp1]=s1[i];
		s1[i]=temp;
	}
	temp1=0;
	for(i=0;i<i2-1;i++)
	{
		temp1=i;
		temp=s2[i];
		for(j=i+1;j<i2;j++)
		{
			if(temp>s2[j])
			{
				temp=s2[j];
				temp1=j;
			}
		}
		s2[temp1]=s2[i];
		s2[i]=temp;
	}
	for(i=0;i<i1;i++)
	{
		printf("%1.2f ",s1[i]);
	}
	for(i=i2-1;i>0;i--)
	{
		printf("%1.2f ",s2[i]);
	}
	printf("%1.2f",s2[0]);
}
int main()
{
	int n,i,j=0,k=0,l,p,q;
	double h,m[40],f[40],x,y;
	char sex[10],a[10]="male",b[10]="female";
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s",sex);
		scanf("%lf",&h);
		if(strcmp(sex,a)==0){
			m[j]=h;
			j++;
		}
		if(strcmp(sex,b)==0){
			f[k]=h;
			k++;
		}
	}
	p=j;
	q=k;
	for(l=0;l<p-1;l++){
		for(j=0;j<p-1-l;j++){
			if(m[j]>m[j+1]){
				x=m[j];
			    m[j]=m[j+1];
			    m[j+1]=x;
			}
		}
	}
	for(l=0;l<q-1;l++){
		for(k=0;k<q-1;k++){
			if(f[k]>f[k+1]){
				y=f[k];
				f[k]=f[k+1];
				f[k+1]=y;
			}
		}
	}
	for(j=0;j<p;j++){
		if(j==0)
			printf("%.2lf",m[0]);
		else printf(" %.2lf",m[j]);
	}
	for(k=q-1;k>=0;k--)
		printf(" %.2lf",f[k]);
	return 0;
}
int main()
{ 
	int num,i,m=0,n=0,j;
	scanf("%d",&num);
	double a[50],c[50],d[50],temp;
	char b[50][10];
	for(i=0;i<num;i++)
	{
		scanf("%s%lf",b[i],&a[i]);
	}
		for(i=0;i<num;i++)
	{ 
		if(b[i][0]=='m')
		{
			c[m]=a[i];
			m++;
		}
		if(b[i][0]=='f')
		{
			d[n]=a[i];
			n++;
		}
	}
		for(i=0;i<m;i++)
		{
			for(j=m-1;j>i;j--)
			{
				if(c[j-1]>c[j])
				{
					temp=c[j];
				   c[j]=c[j-1];
				   c[j-1]=temp;
				}
			}
		}
			for(i=0;i<n;i++)
		{
			for(j=n-1;j>i;j--)
			{
				if(d[j-1]<d[j])
				{
					temp=d[j];
				   d[j]=d[j-1];
				   d[j-1]=temp;
				}
			}
		}
         for(i=0;i<m;i++)
		{
			 printf("%.2lf ",c[i]);
		 }
		  for(i=0;i<n;i++)
		{
			  if(i!=n-1)
			 printf("%.2lf ",d[i]);
			  else
				  printf("%.2lf",d[i]);
		 }

	return 0;
}
main()
{
      void paixu(float *p,int x);
      float h[45],m[45],f[45];
      char a[45][10];
      int i,n,j1=1,j2=1;
      scanf("%d",&n);
      for(i=1;i<=n;i++)
      {
          scanf("%s%f",a[i],&h[i]);
      }
      for(i=1;i<=n;i++)
      {
          if(a[i][0]=='m'){m[j1]=h[i];j1++;}
          if(a[i][0]=='f'){f[j2]=h[i];j2++;}
      }//tiqu
      paixu(m,j1-1);
      paixu(f,j2-1);
      for(i=1;i<=j1-1;i++)
      {
          printf("%.2f ",m[i]);
      }
      for(i=j2-1;i>=2;i--)
      {
          printf("%.2f ",f[i]);
      }   printf("%.2f\n",f[1]);
}

void paixu(float *p,int x)
{
     int k,mo;
     float huan;
     for(mo=x-1;mo>=1;mo--)
     {
         for(k=1;k<=mo;k++)
         {
              if(p[k]>p[k+1]) 
              {
                  huan=p[k];p[k]=p[k+1];p[k+1]=huan;
}    }   }    }
int main(){
int n,i,k,x=0,y=0;
double su[40],zu[40],a,b,tu[40];
char af[40][10];
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%s %lf",af[i],&su[i]);
if(strlen(af[i])==4)
{zu[x]=su[i];x++;}
else if(strlen(af[i])==6)
{tu[y]=su[i];y++;}
}
for(k=1;k<x;k++)
for(i=0;i<x-k;i++)
if(zu[i+1]<zu[i])
{a=zu[i];
zu[i]=zu[i+1];
zu[i+1]=a;
}
for(k=1;k<y;k++)
for(i=0;i<y-k;i++)
if(tu[i+1]>tu[i])
{b=tu[i];
tu[i]=tu[i+1];
tu[i+1]=b;
}
printf("%.2lf",zu[0]);
for(k=1;k<x;k++)
printf(" %.2lf",zu[k]);
for(k=0;k<y;k++)
printf(" %.2lf",tu[k]);
return 0;
}
int main(){
	int n,i,j,l=0;
	double h[50],t;
	char x[50][30],x1[50][30];
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s %lf",x[i],&h[i]);
	}
	for(i=n-1;i>0;i--){
		for(j=0;j<i;j++){
			if((x[j][0]=='f')&&(x[j+1][0]=='m')){
				strcpy(x1[j],x[j]),  t=h[j];
				strcpy(x[j],x[j+1]), h[j]=h[j+1];
				strcpy(x[j+1],x1[j]),h[j+1]=t;
			}
		}
	}
	for(i=n-1;i>0;i--){
		for(j=0;j<i;j++){
			if((x[j][0]=='m')&&(x[j+1][0]=='m')){
				if(h[j]>h[j+1]){
					t=h[j];
					h[j]=h[j+1];
					h[j+1]=t;
				}
			}
			if((x[j][0]=='f')&&(x[j+1][0]=='f')){
				if(h[j]<h[j+1]){
					t=h[j];
					h[j]=h[j+1];
					h[j+1]=t;
				}
			}
		}
	}
	for(i=0;i<n;i++){
		if(l==0){
			printf("%.2lf",h[i]);
			l++;
		}else{
			printf(" %.2lf",h[i]);
		}
	}
	return 0;
}
int comparemale(const void*x,const void*y)
{
    int *p1=(int*)x;
    int *p2=(int*)y;
    return (*p1)-(*p2);
}
main()
{
      int n,i,j,k;
      char c[300]={'\0'};
      float a[50]={0},m[40]={0},s[40]={0};
      scanf("%d",&n);
      for(i=0;i<n;i++)
      {
                      scanf("%s %f",&c[7*i],&a[i]);
      }
      for(i=0,j=0,k=0;i<n;i++)
      {
                      if(c[7*i]=='m')
                      {
                                     m[j]=a[i];
                                     j++;
                      }
                      if(c[7*i]=='f')
                      {
                                     s[k]=a[i];
                                     k++;
                      }
      }
      qsort(m,j,sizeof(float),comparemale);
      qsort(s,k,sizeof(float),comparemale);
      for(i=0;i<j;i++)printf("%.2f ",m[i]);
      for(i=k-1;i>-1;i--)
      {
                        if(i==0)printf("%.2f",s[0]);
                        else printf("%.2f ",s[i]);
      }
}
struct person
{
    char s[6];
    float h;
};
struct person p[50];
int main()
{
    int i,j,n,man,woman;
    float m[50],w[50];
    scanf("%d",&n);
    for(i=0;i<n;i++)
    scanf("%s%f",p[i].s,&p[i].h);
    man=0;
    woman=0;
    for(i=0;i<n;i++)
    if(p[i].s[0]=='m')
    {
        m[man]=p[i].h;
        man++;
    }
    else
    {
        w[woman]=p[i].h;
        woman++;
    }
    for(j=man-1;j>=0;j--)
    for(i=0;i<j;i++)
    if(m[i]>m[i+1])
    {
        m[i]=m[i]+m[i+1];
        m[i+1]=m[i]-m[i+1];
        m[i]=m[i]-m[i+1];
    }
    for(i=0;i<man;i++)
    printf("%.2f ",m[i]);
    for(j=woman-1;j>=0;j--)
    for(i=0;i<j;i++)
    if(w[i]<w[i+1])
    {
        w[i]=w[i]+w[i+1];
        w[i+1]=w[i]-w[i+1];
        w[i]=w[i]-w[i+1];
    }
    for(i=0;i<woman;i++)
    if(i!=woman-1)
    printf("%.2f ",w[i]);
    else
    printf("%.2f",w[i]);
}
int main(){
    int n,i,fea=0,ma=0,k;
	double shengao[50],fe[50],m[50],e;
	char sex[50][8];
	scanf("%d",&n);
	for(i=0;i<n;i++){
        scanf("%s %lf",sex[i],&shengao[i]);
		if(strcmp(sex[i],"male")==0){
            ma++;
			m[ma-1]=shengao[i];
		}else{
			fea++;
			fe[fea-1]=shengao[i];
		}
	}
    for(k=1;k<=ma;k++){
        for(i=0;i<ma-k;i++){
		    if(m[i]>m[i+1]){
				e=m[i+1];
				m[i+1]=m[i];
				m[i]=e;
			}
		}
    }
	for(k=1;k<=fea;k++){
        for(i=0;i<fea-k;i++){
		    if(fe[i]<fe[i+1]){
				e=fe[i+1];
				fe[i+1]=fe[i];
				fe[i]=e;
			}
		}
    }
	for(i=0;i<ma;i++){
		printf("%.2lf ",m[i]);
	}
	for(i=0;i<fea;i++){
		if(i==fea-1){
			printf("%.2lf",fe[i]);
		}else{
	    	printf("%.2lf ",fe[i]);
		}
	}
	return 0;
}
int nancom(const void *a,const void *b)
{
	return *(int *)a-*(int *)b;
}
int nvcom(const void *a,const void *b)
{
	return *(int *)b-*(int *)a;
}

int main()
{
	int nan[40]={0};
	int nv[40]={0};
	double hai = 0;
	int inthai=0;

	char tmp[8] = "";
	int i=0,j=0,num=0;
	int nanNum=0,nvNum=0;
	scanf("%d",&num);

	while(i<num)
	{
		scanf("%s %lf",tmp, &hai);
		inthai = hai*1000;

		if(tmp[0] == 'm')
			nan[nanNum++] =inthai;
		else
			nv[nvNum++] =inthai;
		i++;
	}

	qsort(&nan[0],nanNum,sizeof(int),nancom);
	qsort(&nv[0],nvNum,sizeof(int),nvcom);
	for(i=0;i<nanNum;i++)
	{
		hai = (double)nan[i]/1000;
		printf("%.2f ",hai);
	}
	
	for(i=0;i<nvNum;i++)
	{
		hai = (double)nv[i]/1000;
		if(i==0)
			printf("%.2f",hai);
		else
			printf(" %.2f",hai);
	}
	printf("\n");
	return 0;
}
int main()
{
	char sex[41][7];
	float height[41], b[41], t, s;
	int n, i, j, countM = 0, countF = 0;
	cin >> n;
	for (i = 1; i <= n; i++)
	{
		cin >> sex[i] >> height[i];
		if (sex[i][0] == 'm')
		{
			countM++;
			b[countM] = height[i];
		}
     	else
		{
			countF++;
			b[n+1-countF] = height[i];
		}
	}
	for (i = 1; i < countM; i++)
		for (j = i + 1; j <= countM; j++)
		{
			if (b[i] > b[j])
			{
				s = b[i];
				b[i] = b[j];
				b[j] = s;
			}
		}
	for (i = countM + 1; i < n; i++)
		for ( j = i + 1; j <= n; j++)
		{
			if (b[i] < b[j])
			{
				t = b[i];
				b[i] = b[j];
				b[j] = t;
			}
		}
	for (i = 1; i < n; i++)
		cout << fixed << setprecision(2) << b[i] << " ";
	cout << b[n] << endl;
return 0;
}