semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int main()
{
	int n,i,j,k,nmale=0,nfemale=0;
	char s[40][7];
	double a[40],e;
	double male[40],female[40];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s%lf",s[i],&a[i]);
	}
	for(i=0;i<n;i++)
	{
		if(strcmp(s[i],"male")==0)
		{
			male[nmale]=a[i];
			nmale++;
		}
		else
		{
			female[nfemale]=a[i];
			nfemale++;
		}
	}
	for(j=0;j<nmale;j++)
	{
		for(k=0;k<nmale-j-1;k++)
		{
			if(male[k]>male[k+1])
			{
				e=male[k];
				male[k]=male[k+1];
				male[k+1]=e;
			}
		}
	}
	for(j=0;j<nfemale;j++)
	{
		for(k=0;k<nfemale-j-1;k++)
		{
			if(female[k]<female[k+1])
			{
				e=female[k];
				female[k]=female[k+1];
				female[k+1]=e;
			}
		}
	}
	for(j=0;j<nmale;j++)
	{
		if(j==0)
		{
			printf("%.2lf",male[j]);
		}
		else
		{
			printf(" %.2lf",male[j]);
		}
	}
	for(j=0;j<nfemale;j++)
	{
		printf(" %.2lf",female[j]);
	}
	return 0;
}
double male[41];
double female[41];
int cmp_male(const void *a,const void *b)
{

	return *(double *)a - *(int *)b;
}
int cmp_female(const void *a,const void *b)
{
	return *(double *)b - *(double *)a;
}

int main()
{
	int n,i,mi=0,fi=0;
	double h;
	char tmp[10];

	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s %lf",&tmp,&h);
		if(tmp[0] == 'm')
		{
			male[mi] = h ;
			mi++;
		}
		else
		{
			female[fi] = h;
			fi++;
		}
	}
	sort(male,male + mi);
	sort(female,female + fi);
	for(i=0;i<mi;i++)
		printf("%.2lf ",male[i]);
	for(i=fi-1;i>=0;i--)
	{
		if(i==0)
			printf("%.2lf",female[i]);
		else		
			printf("%.2lf ",female[i]);
	}

	printf("\n");
	return 0;
}
int main()
{  
	int n,i,t=0,m=0,j;
	double b,c[100],h[100],s,k;
	char f[100];
	scanf("%d",&n);
    for(i=0;i<n;i++){
		scanf("%s %lf",f,&b);
		c[i]=0.0;
		h[i]=0.0;
		if(strcmp(f,"male")==0) {c[i]=b;}
		else if (strcmp(f,"female")==0){m++;h[i]=b;}
}
for(i=1;i<n;i++){
	for(j=0;j<n-i;j++){
		if(c[j]>c[j+1]){
			s=c[j];
			c[j]=c[j+1];
			c[j+1]=s;
		}
		if(h[j]<h[j+1]){
			k=h[j];
			h[j]=h[j+1];
			h[j+1]=k;
		}
	}
}
  for(i=0;i<n;i++){
	  if(c[i]!=0) printf("%.2lf ",c[i]);
  }
  for(i=0;i<n;i++){
	  if(h[i]!=0){ if(t<m-1) {printf("%.2lf ",h[i]);t++;}
	  else { printf("%.2lf",h[i]);}
  }
  }
   return 0;

}
int main(){
	int n,i,k=0,j=0,m,b;
	scanf("%d\n",&n);
	char s[100];
	double ma[40],f[40],t,a;
	for(i=0;i<n;i++){
		scanf("%s %lf\n",s,&a);
		if(strcmp(s,"male")==0){
			ma[k]=a;
			k++;
		}
		else{
			f[j]=a;
			j++;
		}
	}
	for(m=1;m<k+1;m++){
		for(b=0;b<k+1-m;b++){
			if(ma[b]>ma[b+1]){
				t=ma[b+1];
				ma[b+1]=ma[b];
				ma[b]=t;
			}
		}
	}
    for(m=1;m<j+1;m++){
		for(b=0;b<j+1-m;b++){
			if(f[b]<f[b+1]){
				t=f[b+1];
				f[b+1]=f[b];
				f[b]=t;
			}
		}
	}
	for(i=1;i<=k;i++){
		printf("%.2lf ",ma[i]);
	}
	for(i=0;i<j-1;i++){
		printf("%.2lf ",f[i]);
	}
       printf("%.2lf",f[j-1]);
	return 0;
}
//????
int main()
{
	int n = 0, i = 0, j = 0;
	cin >> n;
	char str[41][7];
	double a[41];
	for (i = 1; i <= n; i++)
	{
		cin >> str[i] >> a[i];
	}
	double temp1 = 0;
	char temp2[7];
	for (i = 1; i < n; i++)
		for (j = 1; j <= n - i; j++)
		{
			if (strlen(str[j]) > 5 && strlen(str[j + 1]) < 5)
			{
				strcpy(temp2, str[j]);
				strcpy(str[j], str[j + 1]);
				strcpy(str[j + 1], temp2);
				temp1 = a[j];
				a[j] = a[j + 1];
				a[j + 1] = temp1;
			}
		}
		int m = 0;
		for (i = 1; i <= n; i++)
		{
			if (strlen(str[i]) > 5)
				break;
		}
		m = i - 1;
		for (i = 1; i < m; i++)
			for (j = 1; j <= m - i; j++)
			{

				if (a[j] > a[j + 1])
				{
					temp1 = a[j];
					a[j] = a[j + 1];
					a[j + 1] = temp1;
				}
			}
			for (i = m + 1; i < n; i++)
				for (j = m + 1; j <= (n - i + m); j++)
				{
					if (a[j] < a[j + 1])
					{
						temp1 = a[j];
						a[j] = a[j + 1];
						a[j + 1] = temp1;
					}
				}
				cout << fixed << setprecision(2) <<  a[1];
				for (i = 2; i <= n; i++)
				{
					cout << ' ' << a[i];
				}
				cout << endl;
				return 0;
}
int main()
{
	double m[41],f[41],tmp;
	int n,nm,nf,i,j;
	char sex[10];
	scanf("%d",&n);
	nm=nf=0;
	for(i=0;i<n;i++)
	{
		scanf("%s",sex);
		if(strcmp(sex,"male")==0)
		{
			scanf("%lf",&m[nm++]);
		}
		else
		{
			scanf("%lf",&f[nf++]);
		}
	}

	for(i=0;i<nm;i++)
		for(j=i+1;j<nm;j++)
		{
			if(m[i]>m[j])
			{
				tmp=m[i];
				m[i]=m[j];
				m[j]=tmp;
			}
		}
	for(i=0;i<nf;i++)
		for(j=i+1;j<nf;j++)
			if(f[i]<f[j])
			{
				tmp=f[i];
				f[i]=f[j];
				f[j]=tmp;
			}
	for(i=0;i<nm;i++)
		printf("%.2f ",m[i]);
	for(i=0;i<nf-1;i++)
		printf("%.2f ",f[i]);
	printf("%.2f\n",f[nf-1]);
	return 0;
}
int main(){
	int i,k,n;
	double sz[99],e;
	char tmp[9],sex[99][99];
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s%lf",sex[i],&sz[i]);
	
	}
	for(k=0;k<n;k++){
		for(i=0;i<(n-k);i++){
			if(sex[i][0]=='m'&&sex[i+1][0]=='m'&&sz[i]>sz[i+1]||sex[i][0]=='f'&&sex[i+1][0]=='m'||sex[i][0]=='f'&&sex[i+1][0]=='f'&&sz[i]<sz[i+1])
			{
				strcpy(tmp,sex[i]);
				strcpy(sex[i],sex[i+1]);
				strcpy(sex[i+1],tmp);
				e=sz[i];
				sz[i]=sz[i+1];
				sz[i+1]=e;
			}
		}
	}
	for(i=0;i<n;i++){
		if(i==0){
			printf("%.2lf",sz[i]);
		}else{
			printf(" %.2lf",sz[i]);
		}
	}





return 0;

}
int compare(const void *a,const void *b)
{
	if(*(float*)a>*(float*)b)return 1;
	if(*(float*)a<*(float*)b)return -1;
	if(*(float*)a==*(float*)b)return 0;
}
int main()
{
	int N,i,v,t,j;
	float r;
	scanf("%d",&N);
	struct kids
	{
		char s[10];
		float h;
	}kid[40];
	char c;
	for(i=0;i<=N-1;i++)
	{
		scanf("%s ",kid[i].s);
		scanf("%f",&kid[i].h);
	}
	float hm[40],fm[40];
	for(i=0,t=0,v=0;i<=N-1;i++)
	{
		if(strcmp(kid[i].s,"male")==0)
		{
			hm[t]=kid[i].h;
			t=t+1;
		}
		if(strcmp(kid[i].s,"female")==0)
		{
			fm[v]=kid[i].h;
			v=v+1;
		}
        
	}
	//int *p=(float*)malloc(N*sizeof(float));
	
	//qsort(hm,t,sizeof(hm[0]),compare);
	for(i=1;i<=t-1;i++)
	{
		for(j=0;j<=t-i-1;j++)
		{
			if(hm[j]>=hm[j+1])
			{
				r=hm[j];
				hm[j]=hm[j+1];
				hm[j+1]=r;
			}
		}
	}
	for(i=1;i<=v-1;i++)
	{
		for(j=0;j<=v-i-1;j++)
		{
			if(fm[j]<=fm[j+1])
			{
				r=fm[j];
				fm[j]=fm[j+1];
				fm[j+1]=r;
			}
		}
	}
	printf("%.2f",hm[0]);
	for(i=1;i<=t-1;i++)
	{
		printf(" %.2f",hm[i]);
	}
	//qsort(fm,v,sizeof(fm[0]),compare);
	//printf("%.2f",fm[0]);
	for(i=0;i<=v-1;i++)
	{
		printf(" %.2f",fm[i]);
	}
    
    
    
    
}
int main() {
	int n;
	scanf("%d\n",&n);
	char ren[40][7];
	double sg[40];
	int i,j;
	for(i=0;i<n;i++){
		scanf("%s %lf",&ren[i],&sg[i]);
	}
	double nssg[40];
	double vssg[40];
	double e;
	int m,t;
	m=0;
	t=0;
	for(i=0;i<n;i++){
		if(ren[i][0]=='m'){
			nssg[m]=sg[i];
			m++;
		}else{
			vssg[t]=sg[i];
			t++;
		}
	}
	for(i=1;i<=m;i++){
		for(j=0;j<m-i;j++){
			if(nssg[j]>nssg[j+1]){
				e=nssg[j+1];
				nssg[j+1]=nssg[j];
				nssg[j]=e;
			}
		}
	}
	for(i=1;i<=t;i++){
		for(j=0;j<t-i;j++){
			if(vssg[j]>vssg[j+1]){
				e=vssg[j+1];
				vssg[j+1]=vssg[j];
				vssg[j]=e;
			}
		}
	}
	for(i=0;i<m;i++){
		printf("%.2lf ",nssg[i]);
	}
	for(i=t-1;i>0;i--){
		printf("%.2lf ",vssg[i]);
	}
	printf("%.2lf\n",vssg[0]);
	return 0;
}
int main (){
	int n,a=0,b=0;
	double sz[40],men[40],wo[40],x,y;
	char sx[40][7];
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%s %lf",sx[i],&sz[i]);
		if(strcmp(sx[i],"male")==0){
			men[a]=sz[i];
			a++;
		}else{
			wo[b]=sz[i];
			b++;
		}
	}
	for(int c=1;c<=a;c++){
		for(int d=0;d<a-c;d++){
			if(men[d]>men[d+1]){
				x=men[d+1];
				men[d+1]=men[d];
				men[d]=x;
			}
		}
	}
    for(int v=1;v<=b;v++){
		for(int q=0;q<b-v;q++){
			if(wo[q]>wo[q+1]){
				y=wo[q+1];
				wo[q+1]=wo[q];
				wo[q]=y;
			}
		}
	}
	for(int df=0;df<a;df++){
		printf("%.2lf ",men[df]);
	}
	for(int se=b-1;se>0;se--){
		printf("%.2lf ",wo[se]);
	}
	printf("%.2lf",wo[0]);
	return 0;
}
int main()
{
 int n,i,j,m,p;
 cin>>n;
 char str[n][7];
 double a[n],b[n],c[n],t;
 for(i=0;i<=n-1;i++)
 {cin>>str[i];
  cin>>a[i];
 }
 m=0;
 for(i=0;i<=n-1;i++)
 {if(str[i][0]=='m')
  {b[m]=a[i];
   m=m+1;}
  }
  p=0;
  for(i=0;i<=n-1;i++)
  {if(str[i][0]=='f')
   {c[p]=a[i];
    p=p+1;}
  }
  for(j=0;j<m-1;j++)
  {for(i=0;i<m-1-j;i++)
   {if(b[i]>b[i+1])
    {t=b[i];b[i]=b[i+1];b[i+1]=t;}
   }
  }
  for(j=0;j<p-1;j++)
  {for(i=0;i<p-1-j;i++)
   {if(c[i]<c[i+1])
    {t=c[i];c[i]=c[i+1];c[i+1]=t;}
   }
  }
  cout<<fixed<<setprecision(2)<<b[0];
  if(m>1)
  {for(i=1;i<=m-1;i++)
   {cout<<" "<<fixed<<setprecision(2)<<b[i];}
   }
  for(i=0;i<=p-1;i++)
  {cout<<" "<<fixed<<setprecision(2)<<c[i];}
 return 0;
}
int main(){
int n,i,k,f,j;
double e;
k=0;
f=0;
double z;
double a[40];
double b[40];
char c[10];
for(i=0;i<40;i++){
a[i]=0;
b[i]=0;
}
scanf("%d",&n); 
for(i=0;i<n;i++){
scanf("%s%lf",c,&z);
if(c[0]=='m'){
a[k]=z;
k=k+1;
}
else{
b[f]=z;
f=f+1;
}
}
for(n=k-1;n>=1;n--){
for(i=0;i<n;i++){
if(a[i]>a[i+1]){
e=a[i];
a[i]=a[i+1];
a[i+1]=e;
}
}
}
for(n=f-1;n>=1;n--){
for(i=0;i<n;i++){
if(b[i]<b[i+1]){
e=b[i];
b[i]=b[i+1];
b[i+1]=e;
}
}
}
printf("%.2lf",a[0]);
if(k>1){
for(i=1;i<=k-1;i++){
printf(" %.2lf",a[i]);
}
}
for(i=0;i<=f-1;i++){
printf(" %.2lf",b[i]);
}
return 0;
}
/*??
    ?????????????????????????????????????????????????????????????????????????????????????????????????????????????

????
??????n?2 <= n <= 40?????1????1????
????n??????????????male?female?????????????????????????

????
n????????????????????????????????2???*/


int main(){
	int n,i,j,k,a,b;
	double g,s[48],m[48],f[48];
	char qb[48][9];
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s %lf",qb[i],&s[i]);
	}
	j=0;
	k=0;
	for(i=0;i<n;i++){	
		if(strlen(qb[i])==4){
			m[j]=s[i];
			j++;
		}
		else{
			f[k]=s[i];
			k++;
		}
	}
	for(a=1;a<=j;a++){
		for(b=0;b<j-a;b++){
			if(m[b]>m[b+1]){
				g=m[b];
				m[b]=m[b+1];
				m[b+1]=g;
			}
		}
	}
	for(a=1;a<=k;a++){
		for(b=0;b<k-a;b++){
			if(f[b]<f[b+1]){
				g=f[b];
				f[b]=f[b+1];
				f[b+1]=g;
			}
		}
	}
	for(a=0;a<j;a++){
		if(a==0)
			printf("%.2lf",m[a]);
		else
			printf(" %.2lf",m[a]);			
	}
	for(b=0;b<k;b++){
		printf(" %.2lf",f[b]);
	}
	return 0;	
}
int main()
{
    int n, num_m, num_w, i, j;
    float a[50], b[50];
    float t;
    char s[10];
    scanf("%d", &n);
    num_m=0;
    num_w=0;
    for(i=1; i<=n; i++)
    {
        scanf("%s %f", s, &t);
        if(s[0]=='m') a[++num_m]=t;
        else b[++num_w]=t;
    }
    for(i=num_m-1; i>=1; i--)
        for(j=1; j<=i; j++)
            if(a[j]>a[j+1])
            {
                t=a[j];a[j]=a[j+1];a[j+1]=t;
            }
    for(i=num_w-1; i>=1; i--)
        for(j=1; j<=i; j++)
            if(b[j]<b[j+1])
            {
                t=b[j];b[j]=b[j+1];b[j+1]=t;
            }
    for(i=1; i<=num_m; i++)
        printf("%.2f ", a[i]);
    for(i=1; i<num_w; i++)
        printf("%.2f ", b[i]);
    printf("%.2f\n", b[num_w]);
    return 0;
}
int main(){
	int n,i,j=0,s=0,c;
	char a[10],d[10]={'m','a','l','e','\0'};
	double m[42],k[42],h,f;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s %lf",a,&h);
		if(strcmp(a,d)==0){
			m[j]=h;
			j++;
		}else{
			k[s]=h;
			s++;
		}
	}
	for(c=0;c<j;c++){
		for(i=0;i<j-1;i++){
			if(m[i]>m[i+1]){
				f=m[i];
				m[i]=m[i+1];
				m[i+1]=f;
			}
		}
	}
     for(c=0;c<s;c++){
		for(i=0;i<s-1;i++){
			if(k[i]<k[i+1]){
				f=k[i];
				k[i]=k[i+1];
				k[i+1]=f;
			}
		}
	}
	 for(i=0;i<j;i++){
		 printf("%.2lf ",m[i]);
	 }
	 for(i=0;i<s-1;i++){
		 printf("%.2lf ",k[i]);
	 }
	 printf("%.2lf",k[s-1]);
	 return 0;
}
int main(){
	int n,i,j=0,q=0;
        scanf("%d",&n);
	char sex[7];
	double h[41],mh[41],fh[41];
	double cs,sf;
	for(i=0;i<n;i++){
		scanf("%s %lf",sex,&h[i]);
		if(sex[0]=='m'){
			mh[j]=h[i];
			j++;
		}
		else{
			fh[q]=h[i];
			q++;
		}
	}
	for(int k=0;k<j;k++){
		for(int m=0;m<j;m++){
			if(mh[m]>mh[m+1]){
				cs=mh[m];
				mh[m]=mh[m+1];
				mh[m+1]=cs;
			}
		}
	}
	for(int r=1;r<=j;r++){
		printf("%.2lf ",mh[r]);
	}
	for(int l=0;l<q;l++){
		for(int d=0;d<q;d++){
			if(fh[d]<fh[d+1]){
				sf=fh[d];
				fh[d]=fh[d+1];
				fh[d+1]=sf;
			}
		}
	}
	for(int o=0;o<q-1;o++){
		printf("%.2lf ",fh[o]);
	}
        printf("%.2lf",fh[q-1]);
	return 0;
}
double male[42]={0};
double female[42]={0};
int m=0;
int f=0;
int main()
{
	int n;
	scanf("%d",&n);
	int i;
	for(i=0;i<n;i++)
	{
		char temp[10];
		double templen;
		scanf("%s",temp);
		scanf("%lf",&templen);
		if(temp[0]=='m')
		{
			male[m]=templen;
			m++;
		}
		else
		{
			female[f]=templen;
			f++;
		}
	}
	sort(male,male+m);
	sort(female,female+f);
	reverse(female,female+f);
	for(i=0;i<m;i++)
	{
		printf("%.2lf ",male[i]);
	}
	for(i=0;i<f-1;i++)
	{
		printf("%.2lf ",female[i]);
	}
	printf("%.2lf\n",female[i]);
	return 0;
}
main()
{
      int n,i,p,q,t,Flag,j;
      double temp;
      scanf("%d",&n);
    //  printf("%d",n);
      char a[100][6];
      p=0;q=0;
      double h[1000],g[1000],f[1000];
      for(i=0;i<n;i++)
      {Flag=0;
             scanf("%s %lf",a[i],&h[i]);
                    //  printf("%s\n",a[i]);
                         if(a[i][0]=='m'&&a[i][1]=='a'&&a[i][2]=='l'&&a[i][3]=='e')
                              Flag=1;
                        // printf("%d\n",Flag);
                    if(Flag==1)          
                      {
                      g[p]=h[i];
                      //printf("%lf\n",g[p]);
                      p++;
                      //printf("%lf\n",h[i]);
                      //printf("%d\n",p);
                      }
                      else
                      {
                          f[q]=h[i];
                          q++;
                        //  printf("%lf\n",f[q]);
                      }
                      }
                // printf("%lf %lf %lf\n",g[0],g[1],g[2]);    
               // printf("%d",p); 
      for(i=0;i<p;i++)
             for(j=i;j<p;j++)
      
          
             
             
             if(g[i]>g[j])
     {temp=g[i]; g[i]=g[j];g[j]=temp;}
       //printf("%lf %lf %lf\n",g[0],g[1],g[2]);     
       for(i=0;i<q;i++)
             for(j=i+1;j<q;j++)
      if(f[i]<f[j])
    { temp=f[i]; f[i]=f[j];f[j]=temp;}
     
     if(q==0)
     {for(i=0;i<p-1;i++)
         printf("%.2lf ",g[i]);
         printf("%.2lf",g[p-1]);}
     else
      {for(i=0;i<p;i++)
         printf("%.2lf ",g[i]);
         }
      
      for(i=0;i<q-1;i++)
         printf("%.2lf ",f[i]);
         if(q>0) printf("%.2lf",f[q-1]);
        
      }
main()
{
      int n,i,j,x;
      float t;
      struct person
      {
             char sex[6];
            float h;       
      };
      scanf("%d",&n);
      struct person per[40];
      for(i=0;i<n;i++)
      {
                      scanf("%s",per[i].sex);
                      scanf("%f",&per[i].h);                
      }
      for(i=0;i<n;i++)
      {if(strcmp(per[i].sex,"female")==0)
      continue;
                      for (j=i+1;j<n;j++)
                      {
                         if(strcmp(per[j].sex,"female")==0)
                         continue; 
                         if(per[i].h>per[j].h)
                         {
                                     t=per[i].h;
                                     per[i].h=per[j].h;
                                     per[j].h=t;                     
                         }                   
                      }
                      printf("%.2f ",per[i].h);                             
      }
      x=0;
      for(i=0;i<n;i++)
      {if(strcmp(per[i].sex,"male")==0)
      continue;
                      for (j=i+1;j<n;j++)
                      {
                         if(strcmp(per[j].sex,"male")==0)
                         continue; 
                         if(per[i].h<per[j].h)
                         {
                                     t=per[i].h;
                                     per[i].h=per[j].h;
                                     per[j].h=t;                     
                         }                   
                      }
                      if(x==0)
                      {printf("%.2f",per[i].h);
                      x=1;}
                      else
                      {printf(" %.2f",per[i].h);}                               
      }     
}
int main(){
int n,i,j1=0,j2=0;
double sz[40];
double male[40],female[40],tmp;
char sex[40][10];
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%s%lf",&sex[i],&sz[i]);
}
for(i=0;i<n;i++){if(sex[i][0]=='f'){female[j1]=sz[i];j1++;}else{male[j2]=sz[i];j2++;}}
for(i=0;i<j2-1;i++){
	if(male[i]>male[i+1]){
		tmp=male[i];
		male[i]=male[i+1];
		male[i+1]=tmp;
		if(i!=0){i=i-2;}
	}
}
for(i=0;i<j1-1;i++){
	if(female[i]<female[i+1]){
		tmp=female[i];
		female[i]=female[i+1];
		female[i+1]=tmp;
		if(i!=0){i=i-2;}
	}
}
for(i=0;i<j2;i++){printf("%.2lf ",male[i]);}
for(i=0;i<j1-1;i++){printf("%.2lf ",female[i]);}
printf("%.2lf",female[j1-1]);
return 0;
}
int main(){
	double a[50],sg,e=0;
	int n=0,z=0,i=0,j=0,k=0,y=0;
	char xb[50];
	scanf("%d",&n);
	y=n;
	for(i=0;i<n;i++){
		scanf("%s %lf",xb,&sg);
		if(xb[0]=='m'){
			a[z]=sg;
			z++;}
		else{
			a[y]=sg;
			y--;}
	}
		for(j=0;j<z-1;j++){
			for(k=j;k<z;k++){
				if(a[j]>a[k])
			{
				e=a[j];
				a[j]=a[k];
				a[k]=e;
				}
			}
		printf("%.2lf ",a[j]);
	}
	printf("%.2lf ",a[z-1]);

			for(j=n;j>y+1;j--){
				for(k=j;k>y;k--){
					if(a[j]>a[k])
			{
				e=a[j];
				a[j]=a[k];
				a[k]=e;}
			}}
			for(i=y+1;i<n;i++)
		printf("%.2lf ",a[i]);
       	printf("%.2lf",a[n]);

				return 0;
			}
int main()
{
    char a[8];                               //?????,????
    double height;
    double female[40];
    double male[40];
    int n;
    int femalecount = 0;
    int malecount = 0;
    int i;
    cin >>n;
    for (i = 0; i < n; i++)
    {
        cin >> a;
        cin >> height;
        if (strlen(a) == 6)                          //???????6,??????
        {
            female[femalecount] = height;            //???????????
            femalecount++;
        }
        else
        {
            male[malecount] = height;               //??????,????????????
            malecount++;
        }
    }
    sort(male,male + malecount);                    //????
    sort(female,female + femalecount);              //????
    for (i = 0; i < malecount; i++)
    {
        cout << fixed << setprecision(2);
        cout << male[i] << " ";                       //???????????
    }
    for (i = femalecount - 1; i > 0; i--)
    {
        cout << female[i] << " ";                    //???????????
    }
    cout << female[0];
    return 0;
}
int pfCb(const void *x ,const void *y)
{
    return *((int*)x)-*((int*)y); 
}

int pfCg(const void *x ,const void *y)
{
    return *((int*)y)-*((int*)x); 
}

main()
{
      int n,j=0,k=0;
      char gender[7];
      float m[40],f[40],height;
      scanf("%d",&n);
      for(int i=0;i<n;i++)
      {
              scanf("%s %f",gender,&height);
              if(gender[0]=='m')
              {
                  m[j]=height;
                  j++;
              }
              else
              {
                  f[k]=height;
                  k++;
              }
      }
      qsort(m,j,sizeof(float),pfCb);
      qsort(f,k,sizeof(float),pfCg);
      printf("%.2f",m[0]);
      for(int t=1;t<j;t++)
      {
              printf(" %.2f",m[t]);
      }
      for(int t=0;t<k;t++)
      {
              printf(" %.2f",f[t]);
      }
}
int main()
{
	int n;
	double x;
	double a[40];
	double b[40];
	int counta = 0;
	int countb = 0;
	
	cin >> n;
	
	for(int i = 0; i < n; i ++)
	{
		char ch[10];
		
		cin >> ch >> x;
		
		if(ch[0] == 'm')
		{
			a[counta] = x;
			counta ++;
		}
		else
		{
			b[countb] = x;
			countb ++;
		}
	}
	
	
	
	
	for(int i = 0; i < counta - 1; i ++)
	for(int j = 0; j < counta - 1 - i; j ++)
	{
		if(a[j] > a[j + 1])
		{
			x = a[j];
			a[j] = a[j + 1];
			a[j + 1] = x;
		}
	}
	
	for(int i = 0; i < countb - 1; i ++)
	for(int j = 0; j < countb - 1 - i; j ++)
	{
		if(b[j] < b[j + 1])
		{
			x = b[j];
			b[j] = b[j + 1];
			b[j + 1] = x;
		}
	}	
	
	cout << fixed << setprecision(2);
	
	cout << a[0];
	
	for(int i = 1; i < counta ; i ++)
	cout << " " << a[i];
	
	for(int i = 0; i < countb ; i ++)
	cout << " " << b[i];
	
	
	return 0;
}
int main() {
int n,i,nan=0,nv=0,j;
double h[40],h1[40],h2[40],e;
char a[40][7];
scanf("%d",&n);
for (i=0;i<n;i++) {
    scanf("%s %lf",a[i],&h[i]);
    for (j=0;j<10;j++){
        if (a[i][j]=='f') {
        h1[nv]=h[i];
        nv++;
        break;
        } else if (a[i][j]=='m') {
           h2[nan]=h[i];
           nan++;
           break;
                      }
                      }
                      }
        for (i=0;i<nan;i++) {
            for (j=0;j<nan-i-1;j++) {
                if (h2[j]>h2[j+1]) {
                            e=h2[j];
                            h2[j]=h2[j+1];
                            h2[j+1]=e;
                            }
                            }
                            }  
       for (i=0;i<nv;i++) {
            for (j=0;j<nv-i-1;j++) {
                if (h1[j]<h1[j+1]) {
                            e=h1[j];
                            h1[j]=h1[j+1];
                            h1[j+1]=e;
                            }
                            }
                            } 
                 for (i=0;i<nan;i++) {
                  printf("%.2lf ",h2[i]);
                  }            
                  
                     for (i=0;i<nv-1;i++) {
                  printf("%.2lf ",h1[i]);
                  }
                  printf("%.2lf",h1[nv-1]);                                        
                     
    



             return 0;
            
             }
int main()
{
	int n, i, j, count_male = 0, count_female = 39, emp;
	char sex[7];
	double hight[40];
	cin >> n;
	for (i = 0; i < n; i++)
	{
		cin >> sex;
		if (strcmp(sex, "female"))
			cin >> hight[count_male++];
		else
			cin >> hight[count_female--];
	}
	for (i = 0; i < count_male; i++)
	{
		emp = 0;
		for (j = 1; j < count_male; j++)
		{
			if (hight[j] <= hight[emp])
				emp = j;
		}
		cout << fixed << setprecision(2) <<hight[emp] << " ";
		hight[emp] = 3;
	}
	for (i = 39; i > count_female; i--)
	{
		emp = 39;
		for (j = 38; j > count_female; j--)
		{
			if (hight[j] >= hight[emp])
				emp = j;
		}
		cout << hight[emp];
		if (i != count_female+1)
			cout << " ";
		hight[emp] = 0;
	}
return 0;
}
int compmale(const void*a1,const void*a2)
{
 	float*p1,*p2;
 	p1=(float*)a1;
    p2=(float*)a2;
    if((*p1)-(*p2)>=0)
   return 1;
   else
   return -1;
}
int compfemale(const void*a1,const void*a2)
{
 	float*p1,*p2;
 	p1=(float*)a1;
    p2=(float*)a2;
   if((*p2)-(*p1)>=0)
   return 1;
   else
   return -1;
}
struct person
{
 	   char sex[10];
 	   float h;
}mate[40];
main()
{
 	  float m[40],f[40];
	   int n,i,j,a=0,b=0;
	   scanf("%d",&n);
	   
	   for(i=0;i<n;i++)
	   {
	   		scanf("%s %f",mate[i].sex,&mate[i].h);
			if(strcmp(mate[i].sex,"male")==0)
			{
			 	m[a]=mate[i].h;
				 a++;							   		   
		    }
			else if(strcmp(mate[i].sex,"female")==0)
			{
	 	        f[b]=mate[i].h;
				 b++;
		    }
       }
	   qsort(m,a,sizeof(float),compmale);
	   for(i=0;i<a;i++)
	   printf("%1.2f ",m[i]);
	   qsort(f,b,sizeof(float),compfemale);
	   for(i=0;i<b;i++)
	   {
	   	if(i<b-1)			   
	      printf("%1.2f ",f[i]);
	    else
		  printf("%1.2f",f[i]);
	  }
		  getchar();getchar();
}
int main()
{
	int n,i,j1,j2,j;
	double a[50],b[50],c[50];
	char xb[50][10];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s %lf",&xb[i],&a[i]);
	}
	j1=0;
	for(i=0;i<n;i++)
	{
	 if(strcmp(xb[i],"male")==0) {b[j1]=a[i];j1++;}
	}
	j2=0;
	for(i=0;i<n;i++)
	{
	 if(strcmp(xb[i],"female")==0) {c[j2]=a[i];j2++;}
	}
	for(i=j1-1;i>0;i--)
	{
		for(j=0;j<i;j++)
		{
			if(b[j]>b[j+1])
			{
				double t1;
				t1=b[j];
				b[j]=b[j+1];
				b[j+1]=t1;
			}
	    }
	}
	for(i=0;i<j1;i++)
	printf("%.2lf ",b[i]);
	for(i=j2-1;i>0;i--)
	{
		for(j=0;j<i;j++)
		{
			if(c[j]>c[j+1])
			{
				double t2;
				t2=c[j];
				c[j]=c[j+1];
				c[j+1]=t2;
			}
	    }
	}
	for(i=j2-1;i>0;i--)
	printf("%.2lf ",c[i]);
         printf("%.2lf",c[0]);
	scanf("%d",&i);
	return 0;
}
main()
{
      int n,t=0,i,m,k=0;char a[100][9],e[9];float b[100],g[100],c[100],d;
      scanf("%d",&n);
     for(i=0;i<n;i++)
      {scanf("%s %f",a[i],&b[i]);
      }
     for(i=0;i<n;i++)
    { if(a[i][0]=='m'){c[t]=b[i];t++;}
       else {g[k]=b[i];k++;}}
    for(i=0;i<t;i++)
    {for(m=0;m<t-1;m++)
    {if(c[m+1]>c[m])
    {d=c[m];c[m]=c[m+1];c[m+1]=d;}}}
    for(i=t-1;i>0;i--)printf("%.2f ",c[i]);printf("%.2f",c[0]);
     for(i=0;i<k;i++)
    {for(m=0;m<k-1;m++)
    {if(g[m]<g[m+1])
    {d=g[m];g[m]=g[m+1];g[m+1]=d;}}}
    for(i=0;i<=k-1;i++)printf(" %.2f",g[i]);
       getchar(); getchar(); getchar(); getchar(); getchar(); getchar(); getchar(); getchar();
      }