semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int main()
{
	char s[7];
	int p,ma,cf=0,cm=0,i,j;
	float h,m[40],f[40];
	scanf("%d",&p);
	for(i=0;i<p;i++){
		scanf("%s %f",s,&h);
		if(strcmp("female",s)==0){
			f[cf]=h;cf++;
		}else{
			m[cm]=h;cm++;
		}
	}
	for(i=0;i<cm;i++){
		ma=i;
		for(j=i;j<cm;j++){
			if(m[j]<m[ma]){
				ma=j;
			}
		}
		h=m[ma];m[ma]=m[i];m[i]=h;
		printf("%.2f ",m[i]);
	}
	for(i=0;i<cf;i++){
		ma=i;
		for(j=i;j<cf;j++){
			if(f[j]>f[ma]){
				ma=j;
			}
		}
		h=f[ma];f[ma]=f[i];f[i]=h;
		printf("%.2f",f[i]);
		if(i!=cf-1){
			printf(" ");
		}
	}
	return 0;
}
int main(int argc, char* argv[])
{
	int n,i,j,mp=0,fp=0;
	double male[40],female[40],h,tmp;
	scanf("%d",&n);
	char s[10];
	for(i=0;i<n;i++){
		scanf("%s",&s);
		scanf("%lf",&h);
		if(s[0]=='f'){
			female[fp]=h;
			fp++;
		}else{
			male[mp]=h;
			mp++;
		}
	}
	for(i=0;i<mp;i++){
		for(j=0;j<mp-1;j++){
			if(male[j]>male[j+1]){
				tmp=male[j];
				male[j]=male[j+1];
				male[j+1]=tmp;
			}
		}
	}
	for(i=0;i<fp;i++){
		for(j=0;j<fp-1;j++){
			if(female[j]<female[j+1]){
				tmp=female[j];
				female[j]=female[j+1];
				female[j+1]=tmp;
			}
		}
	}
	for(i=0;i<mp;i++){
		printf("%.2lf ",male[i]);
	}
	for(i=0;i<fp;i++){
		printf("%.2lf",female[i]);
		if(i!=fp-1){
			printf(" ");
		}
	}
	
	return 0;
}
main()
{
    int n,h=0,i=0,j=0,k=0;
    scanf("%d",&n);
    char x[n][10];
    float a[n],m[n],f[n];
    float t;
    do
    {
        scanf("%s %f",&x[i],&a[i]);
        i=i+1;
    }
    while(i<n);
    i=0;
    do
    {
        if(x[i][0]=='m')
        {
            m[j]=a[i];
            j=j+1;
        }
        else
        {
            f[k]=a[i];
            k=k+1;
        }
        i=i+1;
    }
    while(i<n);
    for(h=0;h<j-1;h++)
    {
        for(i=0;i<j-1-h;i++)
        {
            if(m[i]>m[i+1])
            {
                t=m[i];
                m[i]=m[i+1];
                m[i+1]=t;
            }
        }
    }
    for(h=0;h<k-1;h++)
    {
        for(i=0;i<k-1-h;i++)
        {
            if(f[i]<f[i+1])
            {
                t=f[i];
                f[i]=f[i+1];
                f[i+1]=t;
            }
        }
    }
    printf("%.2f",m[0]);
    if(j>1)
    {
        i=1;
        do
        {
        printf(" %.2f",m[i]);
        i=i+1;
        }
        while(i<j);
    }
    i=0;
    do
    {
        printf(" %.2f",f[i]);
        i=i+1;
    }
    while(i<k);
}
/*
 * poj03.cpp
 *
 *  Created on: 2011-9-23
 *      Author: G199
 */


int main()
{
	int n, i, j, m, f;
	double male[50], female[50], h, temp;
	char sex[20];
	cin >> n;
	m = f = 0;
	while(n--)
	{
		cin >> sex >> h;
		if(sex[0] == 'm')
		{
			male[m++] = h;
		}
		else
		{
			female[f++] = h;
		}
	}
	for(i = 0; i < m; i++)
	{
		for(j = m-1; j > i; j--)
		{
			if(male[j-1] > male[j])
			{
				temp = male[j-1];
				male[j-1] = male[j];
				male[j] = temp;
			}
		}
	}
	for(i = 0; i < f; i++)
	{
		for(j = f-1; j > i; j--)
		{
			if(female[j-1] < female[j])
			{
				temp = female[j-1];
				female[j-1] = female[j];
				female[j] = temp;
			}
		}
	}
	for(i = 0; i < m; i++)
	{
		cout << fixed << setprecision(2) << male[i] << ' ';
	}
	for(i = 0; i < f-1; i++)
	{
		cout << fixed << setprecision(2) << female[i] << ' ';
	}
	cout << female[f-1] << endl;
	return 0;
}
void arrange(float *arrangearry,int nt,int kd_order)
{
	int flagi,flagj;
	float temporary;
	if(kd_order==1)
	{
		for(flagi=nt-1;flagi>0;flagi--)
		{
			for(flagj=0;flagj<flagi;flagj++)
			{
				if(arrangearry[flagj]<arrangearry[flagj+1])
				{
					temporary=arrangearry[flagj];
					arrangearry[flagj]=arrangearry[flagj+1];
					arrangearry[flagj+1]=temporary;
				}
			}
		}
	}
	else
	{
		for(flagi=nt-1;flagi>0;flagi--)
		{
			for(flagj=0;flagj<flagi;flagj++)
			{
				if(arrangearry[flagj]>arrangearry[flagj+1])
				{
					temporary=arrangearry[flagj];
					arrangearry[flagj]=arrangearry[flagj+1];
					arrangearry[flagj+1]=temporary;
				}
			}
		}
	}
}
int main()
{
	int i,n,len,male=0,female=0;
	float a[40],b[40],height;
	char sex[10];
	cin>>n;
	for(i=0;i<n;i++)
	{
		scanf("%s%f",sex,&height);
		len=strlen(sex);
		if(len==4)
		{
			a[male]=height;
			male++;
		}
		if(len==6)
		{
			b[female]=height;
			female++;
		}
	}
	arrange(a,male,0);
	arrange(b,female,1);
	printf("%.2f",a[0]);
	for(i=1;i<male;i++)
		printf(" %.2f",a[i]);
	for(i=0;i<female;i++)
		printf(" %.2f",b[i]);
	return 0;
}
main()
{
	int n,i,j=0,k=0,l;
	scanf("%d",&n);
	double a[43],f[43],m[43],z;
	char sex[10];
	char male[10]="female";
	for(i=0;i<n;i++)
	{
		scanf("%s",sex);
		scanf("%lf",&a[i]);
		if(strcmp(sex,male)==0)
		{
			m[j]=a[i];
			j++;
		}
		else
		{
			f[k]=a[i];
			k++;
		}
	}
	printf("\n");
	for(i=0;i<j-1;i++)
	{
		for(l=0;l<j-1;l++)
		{
			if(m[l]<m[l+1])
			{
				z=m[l];
				m[l]=m[l+1];
				m[l+1]=z;
			} 
		}
	}
	for(i=0;i<k-1;i++)
	{
		for(l=0;l<k-1;l++)
		{
			if(f[l]>f[l+1])
			{
				z=f[l];
				f[l]=f[l+1];
				f[l+1]=z;
			} 
		}
	}
	printf("%.2f",f[0]);
	for(i=1;i<n;i++)
	{
		if(i<k)
		{
			printf(" %.2f",f[i]);
		}
		else
		printf(" %.2f",m[i-k]);
	}
}
int main()
{
	char gender[10];
	float h[2][40]={0},t;

	int i,j,n,l=0,k=0;

	scanf("%d\n",&n);

	for(i=0;i<n;i++)
	{
		scanf("%s %f",gender,&t);

		if(strcmp(gender,"male")==0)
		{
			h[0][k]=t;
			k++;
		}
		else
		{
			h[1][l]=t;
			l++;
		}
	}
	for(i=0;i<k;i++)
	{
		for(j=i;j<k;j++)
		{
			if(h[0][i]>h[0][j])
			{
				t=h[0][i];
				h[0][i]=h[0][j];
				h[0][j]=t;
			}
		}
	}
	for(i=0;i<l;i++)
	{
		for(j=i;j<l;j++)
		{
			if(h[1][i]<h[1][j])
			{
				t=h[1][i];
				h[1][i]=h[1][j];
				h[1][j]=t;
			}
		}
	}

	for(i=0;i<k;i++)
	{
		if(i==0)
			printf("%.2f",h[0][i]);
		else
			printf(" %.2f",h[0][i]);
	}
	for(i=0;i<l;i++)
	{
		printf(" %.2f",h[1][i]);
	}
return 0;
}
int main(){
	int n,i,j=0,k=0,u,x;
	char s[8],use[2],s1[5]={"male"};
	float hi,e,a[41],b[41];

	scanf("%d",&n);
	gets(use);

	for(i=0;i<n;i++){
		scanf("%s",s);

		scanf("%f",&hi);
		x=strcmp(s,s1);
		if(x==0){
			a[j]=hi;
			j++;
		}
		else{
			b[k]=hi;
			k++;
		}
	}
	for(i=0;i<j;i++){
		for(u=0;u<j-i-1;u++){
			if(a[u]>a[u+1]){
				e=a[u];
				a[u]=a[u+1];
				a[u+1]=e;
			}
		}
	}
	for(i=0;i<k;i++){
		for(u=0;u<k-i-1;u++){
			if(b[u]<b[u+1]){
				e=b[u];
				b[u]=b[u+1];
				b[u+1]=e;
			}
		}
	}
	for(i=0;i<j;i++){
		printf("%.2f ",a[i]);
	}
	for(i=0;i<k;i++){
		if(i!=0){
			printf(" ");
		}
		printf("%.2f",b[i]);
	}
	return 0;
}
int main(){
    int n,i,j,o=0,k=0;
    double b[100],u,b1[100]={0.0},b2[100]={0.0};
    char a[100][10];
    scanf("%d",&n);
    getchar();
    for(i=0;i<n;i++){
        scanf("%s %lf",a[i],&b[i]);
        }
    for(i=0;i<n;i++){
        if(strcmp(a[i],"male")==0) b1[o++]=b[i];
        else if(strcmp(a[i],"female")==0) b2[k++]=b[i];            
            
        }
    for(j=1;j<=o;j++){
        for(i=0;i<o-j;i++){
            if(b1[i]>b1[i+1]){
                u=b1[i+1];
                b1[i+1]=b1[i];
                b1[i]=u;
                }
            }
        }
    for(j=1;j<=k;j++){
        for(i=0;i<k-j;i++){
            if(b2[i]<b2[i+1]){
                u=b2[i+1];
                b2[i+1]=b2[i];
                b2[i]=u;
                }
            }
        }
    for(i=0;i<o;i++) printf("%.2lf ",b1[i]);
    for(i=0;i<k-1;i++) printf("%.2lf ",b2[i]);
    printf("%.2lf",b2[k-1]);
   
    
    
    
    scanf("%d",&i);
    return 0;
    }
//******************************************
//*???????.cpp                     **
//*??: ??     1100012808              **
//*???2011.11.03                       **
//******************************************
int main()  //???
{        //?????
	float h[41] = {0.0},m[41] = {0.0},f[41] = {0.0}, t;
	char sex[41][10];
	int i = 0, j = 1, k = 1, n = 0, l = 0 ;
	cin >> n;
	for (i = 1; i <= n; i++)
	{
		cin >> sex[i] >> h[i];
		if (sex[i][0] == 'm')
		{
			m[j] = h[i];
			j++;
		}
		else 
		{
			f[k] = h[i];
			k++;
		}
	}
	for (l = 1; l < j - 1; l++)
		for (i = 1; i < j - l; i++)
			if (m[i] > m[i + 1])
			{
				t = m[i];
				m[i] = m[i + 1];
				m[i + 1] = t;
			}
	for (l = 1; l < k - 1; l++)
		for (i = 1; i < k - l; i++)
			if (f[i] < f[i + 1])
			{
				t = f[i];
				f[i] = f[i + 1];
				f[i + 1] = t;
			}
	cout << fixed << setprecision(2) << m[1];
	for (i = 2; i < j; i++)
		cout << fixed << setprecision(2) << " " << m[i] ;
	for (i = 1; i < k; i++)
		cout << fixed << setprecision(2) << " " << f[i] ;
	return 0;
}
int main(){
char s[7];
int i,n,j;
scanf("%d",&n);
double a[n],b[n],m,t;
for(i=0;i<n;i++){
a[i]=0;
b[i]=0;
scanf("%s%lf",s,&m);
if(s[0]=='m'){
a[i]=m;
}
else b[i]=m;
}
for(i=0;i<n-1;i++){
for(j=0;j<n-1;j++){
if(a[j]>a[j+1]){
t=a[j];
a[j]=a[j+1];
a[j+1]=t;
}
if(b[j]<b[j+1]){
t=b[j];
b[j]=b[j+1];
b[j+1]=t;
}
}
}
for(i=0;i<n;i++){
if(a[i]!=0){
printf("%.2lf",a[i]);
t=a[i];
break;
}
}
for(i=0;i<n;i++){
if(a[i]>t){
printf(" %.2lf",a[i]);
}
}
for(i=0;i<n;i++){
if(b[i]>0){
printf(" %.2lf",b[i]);
}
}
return 0;
}
int main()
{
	int n,i=0,j=0,ttt;
	cin>>n;
	double f[44],m[44];
	char sex[10];		
	double height;
	for(ttt=1;ttt<=n;ttt++)
	{
		
		cin>>sex>>height;
		if(sex[0]=='m')
		{
			m[i]=height;
			i++;
		}
		else if(sex[0]=='f')
		{
			f[j]=height;
			j++;
		}
	}
	int p=i-1,q=j-1;
	double tt;
	int h1,h2;
	for(h1=0;h1<p;h1++)
	{
		for(h2=0;h2<p;h2++)
		{
			if(m[h2]>m[h2+1])
			{
				tt=m[h2];m[h2]=m[h2+1];m[h2+1]=tt;
			}
		}
	}
	cout<<fixed<<setprecision(2)<<m[0];
	for(h1=1;h1<=p;h1++)
		cout<<fixed<<setprecision(2)<<" "<<m[h1];
	for(h1=0;h1<q;h1++)
	{
		for(h2=0;h2<q;h2++)
		{
			if(f[h2]<f[h2+1])
			{
				tt=f[h2];f[h2]=f[h2+1];f[h2+1]=tt;
			}
		}
	}
	for(h1=0;h1<=q;h1++)
		cout<<fixed<<setprecision(2)<<" "<<f[h1];
	return 0;
}
float male[50];
int nm=0;
float fema[50];
int nf=0;

int mcmp(const void *a, const void *b)
{
	float x = *(float*)a;
	float y = *(float*)b;
	if(x>y) return 1;
	if(x==y) return 0;
	if(x<y) return -1;
}

int fcmp(const void *a, const void *b)
{
	return -mcmp(a,b);
}

void main()
{
	char buf[100];
	char *p;
	int n;
	int i;
	float a;

	fgets(buf, sizeof(buf), stdin);
	n=atoi(buf);
	for(;n>0;n--)
	{
		fgets(buf, sizeof(buf), stdin);
		p=strtok(buf, " ");
		a = atof(strtok(NULL, " "));
		if(strcmp(p,"male")==0)
			male[nm++]=a;
		else
			fema[nf++]=a;
	}

	qsort(male, nm, sizeof(float), mcmp);
	qsort(fema, nf, sizeof(float), fcmp);

	for(i=0;i<nm;i++)
		printf("%.2f ", male[i]);
	for(i=0;i<nf-1;i++)
		printf("%.2f ", fema[i]);
	printf("%.2f", fema[i]);

}
main()
{     char s[100];
      double m[40];
      double f[40];
      int n,j=0,k=0;
      scanf("%d",&n);
      for(int i=0;i<n;i++){
              scanf("%s",s);
              if(s[0]=='m'){
                            scanf("%lf",&m[j]);j++;}
              else if(s[0]=='f'){
                            scanf("%lf",&f[k]);k++;}
              }
      
      for(int jj=j-1;jj>0;jj--)
      {
      for(int r=0;r<jj;r++)
        {if(m[r]>m[r+1])
        {double tmp;
         tmp=m[r+1];
         m[r+1]=m[r];
         m[r]=tmp;
        }
        }
                           
        }    
        
        for(int jj=k-1;jj>0;jj--)
      {
      for(int r=0;r<jj;r++)
        {if(f[r]<f[r+1])
        {double tmp;
         tmp=f[r+1];
         f[r+1]=f[r];
         f[r]=tmp;
        }
        }
                           
        }  
        
        for(int ii=0;ii<j;ii++){
        printf("%.2f ",m[ii]);}
for(int ii=0;ii<k;ii++){
        printf("%.2f",f[ii]);
        if(ii<k-1)
        printf(" ");}  
      
      
      
      
      }
int main()
{
    int n,sum=0;
    float h[100];
    char gender[10];
    cin>>n;
    for (int i=1;i<=n;i++)
    {cin>>gender>>h[i];
    if (strcmp(gender,"male")==0)
    { h[i]=h[i]*10;
    sum++;}
    
    }
    sort(h+1,h+n+1);
    for (int i=n-sum+1;i<=n;i++)
    printf("%.2lf ",h[i]/10);
    for (int i=n-sum;i>=2;i--)
    printf("%.2lf ",h[i]);
 
    printf("%.2lf",h[1]);
    
   
    return 0;
}
/*
*/
int main(){
	int n,i,j,b,a;
	char x,str[41][21];
	double sz[41],male[41],female[41],t;
    scanf("%d",&n);
	for(i=0;i<41;i++){
		male[41]=-1;
		female[41]=-1;
	}
	for(i=0;i<n;i++){
		scanf("%c",&x);
		scanf("%s %lf",str[i],&sz[i]);
	}
	a=0;
	b=0;
	for(i=0;i<n;i++){
		if(str[i][0]=='m'){
			male[a]=sz[i];
			a++;
		}else if(str[i][0]='f'){
			female[b]=sz[i];
			b++;
		}
	}
	for(i=1;i<a;i++){
		for(j=0;j<a-i;j++){
			if(male[j]>male[j+1]){
				t=male[j];
				male[j]=male[j+1];
				male[j+1]=t;
			}
		}
	}
	for(i=1;i<b;i++){
		for(j=0;j<b-i;j++){
			if(female[j]<female[j+1]){
				t=female[j];
				female[j]=female[j+1];
				female[j+1]=t;
			}
		}
	}
	for(i=0;i<a;i++){
		printf("%.2lf ",male[i]);
	}
	for(i=0;i<b;i++){
		if(i<b-1){
			printf("%.2lf ",female[i]);
		}else{
            printf("%.2lf\n",female[i]);
		}
	}
	return 0;
}
void insertSort(float* arr,long len)
{
	long i=0,j=0;
	float tmpData;
	for(i=1;i<len;i++)
	{
		j=i;
		tmpData=*(arr + i);
		while(j > 0 && tmpData < arr[j-1])
		{
			arr[j]=arr[j-1];
			j--;
		}
		arr[j]=tmpData;
	}
}

int main()
{
	int n = 0;
	float male[40];
	float female[40];
	int maleNum = 0;
	int femaleNum = 0;
	char sex[10];
	scanf("%d", &n);
	for (int i = 0; i < n; ++i)
	{
		scanf("%s", sex);
		if (strcmp(sex, "male") == 0)
			scanf("%f", &male[maleNum++]);
		else
			scanf("%f", &female[femaleNum++]);
	}

	insertSort(male, maleNum);
	insertSort(female, femaleNum);

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

	for (i = femaleNum - 1; i > 0; --i)
	{
		printf("%.2f ", female[i]);
	}
	printf("%.2f", female[i]);

	return 0;
}
int main ()
{
    int n,i,z,y,j;
    scanf("%d",&n);
    double c[n];
    struct ppp
    {
    char a[6];
    double b;
    }p[n+2];
    for (i=1;i<=n;i++)
    {
        scanf("%s%lf",p[i].a,&p[i].b);
    }
    for(i=1;i<=n;i++)
    {
                     for (j=1;j<n;j++)
                     {
                         if (p[j].b>p[j+1].b)
                         {
                                             p[0]=p[j];
                                             p[j]=p[j+1];
                                             p[j+1]=p[0];
                         }
                     }
    }
    z=0;
    y=n-1;
    for(i=1;i<=n;i++)
    {
                     if (strcmp(p[i].a,"male")==0)
                     {
                                        c[z]=p[i].b;
                                        z++;
                     }
                     else
                     {
                         c[y]=p[i].b;
                         y--;
                     }
    }
    for (i=0;i<n;i++)
    {
        if (i!=0)
        printf (" ");
        printf ("%.2lf",c[i]);
        
    }
    

    return 0;
}
int main(){
int n,j,t,i,m,b,u,v,k,e;
double tall[45],man[40],woman[40],q;
char sex[8];
j=0;
t=0;
scanf("%d",&n);
for(i=0;i<n;i++){
     scanf("%s %lf",sex,&tall[i]);
     if(sex[0]=='m'){
        man[j]=tall[i];
        j++;}
        else{
        woman[t]=tall[i];
        t++;}
}
for(k=1;k<j;k++){
	for(e=0;e<j-k;e++){
		if(man[e]>man[e+1]){
        q=man[e];
		man[e]=man[e+1];
		man[e+1]=q;
		}
	}

}

for(u=1;u<t;u++){
	for(v=0;v<t-u;v++){
		if(woman[v]<woman[v+1]){
        q=woman[v];
		woman[v]=woman[v+1];
		woman[v+1]=q;
		}
	}

}
 for(m=0;m<j;m++)
 {
 printf("%.2lf ",man[m]);
 }

 for(b=0;b<t-1;b++)
 {
 printf("%.2lf ",woman[b]);
 }
 printf("%.2lf",woman[t-1]);
 return 0;
}
int cmp(const void * x,const void * y)
{
	return *(float *)x>*(float *)y?1:-1;
}
int main()
{
   // ifstream if1("e:\\input1.txt");
	int n,ptra=0,ptrb=0;
    float a[40],b[40];
	char s[10];
//	if1>>n;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>s;
	//	if1>>s;
		if(s[0]=='m')
			cin>>a[ptra++];
	//	if1>>a[ptra++];
		else
			cin>>b[ptrb++];
	//	if1>>b[ptrb++];
	}
    qsort(a,ptra,sizeof(float),cmp);
	qsort(b,ptrb,sizeof(float),cmp);
	for(int j=0;j<ptra;j++)
	{
	//	cout<<setprecision(3)<<a[j]<<" ";
		printf("%.2f ",a[j]);
	}
	for(int k=ptrb-1;k>0;k--)
	{
	//	cout<<setprecision(3)<<b[k]<<" ";
		printf("%.2f ",b[k]);
	}
//	cout<<setprecision(3)<<b[0];
			printf("%.2f",b[0]);
	return 0;
}
int main(){
    int n,i,f,m;
    char sex[40][7];
    double height[40],female[40],male[40],c;
    scanf("%d",&n);
    f=0;
    m=0;
    for(i=0;i<n;i++){
                     scanf("%s %lf",sex[i],&height[i]);
                     if(sex[i][0]=='f'){
                                        female[f]=height[i];
                                        f++;
                                        }
                     if(sex[i][0]=='m'){
                                        male[m]=height[i];
                                        m++;
                                        }
                                        }
    for(n=1;n<m;n++){
                     for(i=0;i<m-n;i++){
                                        if(male[i]>male[i+1]){
                                                              c=male[i];
                                                              male[i]=male[i+1];
                                                              male[i+1]=c;
                                                              }
                                                              }
                                                              }
    for(n=1;n<f;n++){
                     for(i=0;i<f-n;i++){
                                        if(female[i]<female[i+1]){
                                                              c=female[i];
                                                              female[i]=female[i+1];
                                                              female[i+1]=c;
                                                              }
                                                              }
                                                              }
    for(i=0;i<m;i++){
                     printf("%.2lf ",male[i]);
                     }
    for(i=0;i<f-1;i++){
                       printf("%.2lf ",female[i]);
                       }
    printf("%.2lf",female[i]);
    return 0;
}
int main () {
    double ns[40],vs[40];
    char  xsz[45][10];
    int n,a,b,f,g;
    double c;
    f=0;
    g=0;
    scanf("%d",&n);
    for(a=0;a<n;a++){
          scanf("%s",xsz[a]);
          if(xsz[a][0]=='m'){
               scanf("%lf",&ns[f]);
               f++;
          }
          else{
                scanf("%lf",&vs[g]);
                g++;
          }
    }
    for(a=1;a<=f;a++){
         for(b=0;b<f-a;b++){
               if(ns[b]>ns[b+1]){
                     c=ns[b];
                     ns[b]=ns[b+1];
                     ns[b+1]=c;
               }
          }
     }
      for(a=1;a<=g;a++){
         for(b=0;b<g-a;b++){
               if(vs[b+1]>vs[b]){
                     c=vs[b];
                     vs[b]=vs[b+1];
                     vs[b+1]=c;
               }
          }
     }
     for(a=0;a<f;a++){
       
             printf("%.2lf ",ns[a]);
     }
     for(a=0;a<g-1;a++){
         printf("%.2lf ",vs[a]);
     }
     printf("%.2lf",vs[a]);
     return 0;
 }
int main()
{
	int n,i,nm=0,nf=0,j;
	double m[40],f[40],t;
	struct people
	{
		char s[10];
		double l;
	}a[40];
	scanf("%d",&n);
	for (i=0;i<n;i++) 
	{
		scanf("%s%lf",a[i].s,&a[i].l);
		if (a[i].s[0]=='m') 
		{
			m[nm]=a[i].l;
			nm++;
		}
		else
		{
			f[nf]=a[i].l;
			nf++;
		}
	}
	for (i=0;i<nm-1;i++)
		for (j=i+1;j<nm;j++)
			if (m[j]<m[i]) 
			{
				t=m[i];
				m[i]=m[j];
				m[j]=t;
			}
	for (i=0;i<nf-1;i++)
		for (j=i+1;j<nf;j++)
			if (f[j]>f[i])
			{
				t=f[i];
				f[i]=f[j];
				f[j]=t;
			}
	for (i=0;i<nm;i++) printf("%.2lf ",m[i]);
	for (i=0;i<nf-1;i++) printf("%.2lf ",f[i]);
	printf("%.2lf\n",f[nf-1]);
	return 0;
}
char sex[45][7];
float height[45];
int seq[45];

int compare(const void* a, const void* b) {
	int i = *(int*)a;
	int j = *(int*)b;
	if( strcmp(sex[i],"male") == 0 && strcmp(sex[j],"female") == 0 )  return 0;
	if( strcmp(sex[i],"female") == 0 && strcmp(sex[j],"male") == 0 )  return 1;
	// else same sex
	if( strcmp(sex[i],"male") == 0 && strcmp(sex[j],"male") == 0 ) return height[i] > height[j];
	if( strcmp(sex[i],"female") == 0 && strcmp(sex[j],"female") == 0 ) return height[i] < height[j];
}

int main() {
	int n;
	cin >> n;
	for(int i=0; i<n; i++) {
		cin >> sex[i] >> height[i];
		seq[i] = i;
	}
	qsort(seq,n,sizeof(int),compare);
	int startFlag = true;
	for(int i=0;i<n;i++) {
		if(startFlag) {
			printf("%.2f",height[seq[i]]);
			startFlag = false;
		} else {
			printf(" %.2f",height[seq[i]]);
		}
	}
	cout << endl;

}
int main()
{
	int n;
	cin >> n;

	double male[40], female[40];
	int indm=0, indf=0;
	for(int k=0;k<n;k++)
	{
		char str[10];
		
		cin >> str;
		if(!strcmp(str,"male"))
		{
			cin >> male[indm];
			indm++;
		}
		else
		{
			cin >> female[indf];
			indf++;
		}
	}
	//sort
	int i,j;
	for(i=0;i<indm;i++)
		for(j=i;j<indm;j++)
			if(male[i] > male[j])
			{
				double t = male[i];
				male[i] = male[j];
				male[j] = t;
			}
	for(i=0;i<indf;i++)
		for(j=i;j<indf;j++)
			if(female[i] < female[j])
			{
				double t = female[i];
				female[i] = female[j];
				female[j] = t;
			}
	//show
	for(i=0;i<indm;i++)
		printf("%.2lf ",male[i]);
	for(i=0;i<indf-1;i++)
		printf("%.2lf ",female[i]);
	printf("%.2lf",female[indf-1]);
	cout << endl;

	return 0;
}
int main(){
	int n,i,k=0,s=0,g;
	char x[40][10]={0};
	double q,y[40]={0},m[40]={0},f[40]={0};
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s",x[i]);
		scanf("%lf",&y[i]);
	}
	for(i=0;i<n;i++){
		if(x[i][0]=='f'){
			f[s]=y[i];
			s++;
		}
		if(x[i][0]=='m'){
			m[k]=y[i];
			k++;
		}
	}
	for(i=1;i<k;i++){
		for(g=0;g<k-1;g++){
			if(m[g]>m[g+1]){
				q=m[g];
				m[g]=m[g+1];
				m[g+1]=q;
			}
		}
	}
	for(i=1;i<s;i++){
		for(g=0;g<s-1;g++){
			if(f[g]<f[g+1]){
				q=f[g];
				f[g]=f[g+1];
				f[g+1]=q;
			}
		}
	}
	for(i=0;i<k;i++){
		printf("%.2lf ",m[i]);
	}
	for(i=0;i<s-1;i++){
		printf("%.2lf ",f[i]);
	}
	printf("%.2lf",f[s-1]);
	return 0;
}
int compare1(const void *elem1,const void *elem2)
{
    float *p1,*p2;
    p1=(float *)elem1;
    p2=(float *)elem2;
    if(*p1-*p2<0) return -1;
    else if(*p1-*p2>0) return 1;
    else return 0;
}
int compare2(const void *elem1,const void *elem2)
{
    float *p1,*p2;
    p1=(float *)elem1;
    p2=(float *)elem2;
    if(*p1-*p2<0) return 1;
    else if(*p1-*p2>0) return -1;
    else return 0;
}
main()
{
      int n,i=0,g,j=0,a,b;
      char c[100];
      float m[100],f[100];
      float h;
      scanf("%d",&n);
      for(g=0;g<n;g++)
      {
                      scanf("%s %f",c,&h);
                      if(c[0]=='m') 
                      {
                                    m[i]=h;
                                    i++;
                      }
                      else 
                      {
                           f[j]=h;
                           j++;
                      }
      }
      a=i;
      b=j;
      qsort(m,a,sizeof(float),compare1);
      qsort(f,b,sizeof(float),compare2);
      for(i=0;i<a;i++)
      {
                       if(i==0) printf("%.2f",m[i]);
                       else printf(" %.2f",m[i]);
      }
      for(j=0;j<b;j++)
      {
                       printf(" %.2f",f[j]);
      }
      
}
int main()
{
	int n,i,j,p=0,q=0;
	char tmp[10];
	double man[50],woman[50],temp;
	int flag=0;
	scanf("%d",&n);
	while(n--)
	{
		scanf("%s",tmp);
		if(tmp[0]=='f')
		scanf("%lf",&woman[p++]);
		else scanf("%lf",&man[q++]);
	}
	for(i=p-1;i>0;i--)
	{
		for(j=0;j<i;j++)
		{
			if(woman[j]<woman[j+1])
			{
				temp=woman[j];
				woman[j]=woman[j+1];
				woman[j+1]=temp;
			}
		}
	}
	for(i=q-1;i>0;i--)
	{
		for(j=0;j<i;j++)
		{
			if(man[j]>man[j+1])
			{
				temp=man[j];
				man[j]=man[j+1];
				man[j+1]=temp;
			}
		}
	}
	for(i=0;i<q;i++)
	{
		if(flag==0) flag=1;
		else printf(" ");
		printf("%.2f",man[i]);
	}
	for(i=0;i<p;i++)
	{
		if(flag==0) flag=1;
		else printf(" ");
		printf("%.2f",woman[i]);
	}
}
void main(){
int n,i,j,min;
float re[40],t;
char str[40][8],tc[8];
scanf("%d",&n);
for(i=0;i<n;i++){
getchar();
scanf("%s%f",str[i],&re[i]);
}
for(i=0;i<n;i++){
min=i;
for(j=i;j<n;j++){
if(re[j]<re[min]){
min=j;
}
}
t=re[min];
strcpy(tc,str[min]);
re[min]=re[i];
strcpy(str[min],str[i]);
re[i]=t;
strcpy(str[i],tc);
}
for(i=0;i<n;i++){
if(str[i][0]=='m')
printf("%.2f ",re[i]);
}
i=n-1;
while(str[i][0]=='m')
i--;
printf("%.2f",re[i]);
for(i=i-1;i>=0;i--){
if(str[i][0]=='f')
printf(" %.2f",re[i]);
}
}