semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
void main()
{
	int max,n,i,g=0,sum,qimo,banji,lunwen,zong[200];
	char name[200][20],ganbu,xibu;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s %d %d %c %c %d",name[i],&qimo,&banji,&ganbu,&xibu,&lunwen);
		zong[i]=0;
		if(qimo>80&&lunwen>=1)
				zong[i]=zong[i]+8000;
			if(banji>80&&qimo>85)
				zong[i]=zong[i]+4000;
				if(qimo>90)
				zong[i]=zong[i]+2000;
					if(qimo>85&&xibu=='Y')
				zong[i]=zong[i]+1000;
						if(banji>80&&ganbu=='Y')
				zong[i]=zong[i]+850;
	}

max=zong[0];
sum=zong[0];
for(i=1;i<n;i++)
{
if(zong[i]>max)
{
max=zong[i];
g=i;
}
	sum=sum+zong[i];
}
for(i=0;i<strlen(name[g]);i++)
	printf("%c",name[g][i]);
printf("\n%d\n%d",zong[g],sum);
}
int main(){
    struct scholar {
           char z[21];
           int qm;
           int bj;
           char gb;
           char xb;
           int paper;
           int total;
           };
           
           struct scholar a[1000];
           
    int n, i;  
    scanf("%d", &n);
    
    for (i=0; i<n; i++){
        scanf("%s %d %d %c %c %d", a[i].z, &a[i].qm, &a[i].bj, &a[i].gb, &a[i].xb, &a[i].paper);
        a[i].total=0;
        } 
    
    for (i=0; i<n; i++){
        if (a[i].qm>80&&a[i].paper>0)
        a[i].total+=8000;
        if (a[i].qm>85&&a[i].bj>80)
        a[i].total+=4000;
        if (a[i].qm>90)
        a[i].total+=2000; 
        if (a[i].qm>85&&a[i].xb=='Y')
        a[i].total+=1000;
        if (a[i].bj>80&&a[i].gb=='Y')
        a[i].total+=850;    
        }
        
        int max=0;
        char name[22];
        int total=0;
    
    for (i=0; i<n; i++){
        if (a[i].total>max){
                            max=a[i].total;
                            strcpy(name, a[i].z);
                            }
        total+=a[i].total;
        }
        
    printf("%s\n%d\n%d\n", name, max, total);
        
        
    return 0;    
    
    }
struct student
{
	char name[25];
	int qimo;
	int banji;
	char ganbu;
	char xibu;
	int lunwen;
	int jiangjin;

};
void main()
{
	int n,q=0;
	struct student stu[100];
	int i,j,k,r,m=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s%d%d %c %c%d",stu[i].name,&stu[i].qimo,&stu[i].banji,&stu[i].ganbu,&stu[i].xibu,&stu[i].lunwen);
//		scanf("%d",&stu[i].qimo);
//		scanf("%d",&stu[i].banji);
//		scanf("&c",&stu[i].ganbu);
//		scanf("%c",&stu[i].xibu);
//		scanf("%d",&stu[i].lunwen);
		stu[i].jiangjin=0;
	}

	for(i=0;i<n;i++)
	{
		if(stu[i].qimo>80&&stu[i].lunwen>=1)stu[i].jiangjin=stu[i].jiangjin+8000;
		if(stu[i].qimo>85&&stu[i].banji>80)stu[i].jiangjin=stu[i].jiangjin+4000;
		if(stu[i].qimo>90)stu[i].jiangjin=stu[i].jiangjin+2000;
		if(stu[i].qimo>85&&stu[i].xibu=='Y')stu[i].jiangjin=stu[i].jiangjin+1000;
		if(stu[i].banji>80&&stu[i].ganbu=='Y')stu[i].jiangjin=stu[i].jiangjin+850;
		q=q+stu[i].jiangjin;
	}
	for(i=0,q=0;i<n;i++)
	{
		if(stu[i].jiangjin>m)m=stu[i].jiangjin;
		q=q+stu[i].jiangjin;
	}
	for(i=0;i<n;i++)
	{
		if(stu[i].jiangjin==m)
		{
			printf("%s\n",stu[i].name);
			printf("%d\n",m);
			printf("%d",q);
			break;

		}

	}

}
struct stu
{
	char nam[40];
	int qi;
	int pi;
	char gan;
	char xi;
	int lun;
	int ji;
}stu[102];
void main()
{
	int total=0;
	int i,n,k=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s %d %d %c %c %d",stu[i].nam,&stu[i].qi,&stu[i].pi,&stu[i].gan,&stu[i].xi,&stu[i].lun);
	}
	for(i=0;i<n;i++)
	{
		stu[i].ji=0;
		if(stu[i].qi>80&&stu[i].lun>0)
            stu[i].ji+=8000;
		if(stu[i].qi>85&&stu[i].pi>80)
			stu[i].ji+=4000;
		if(stu[i].qi>90)
			stu[i].ji+=2000;
		if(stu[i].qi>85&&stu[i].xi=='Y')
			stu[i].ji+=1000;
		if(stu[i].pi>80&&stu[i].gan=='Y')
			stu[i].ji+=850;
	}
	for(i=0;i<n;i++)
	{
		total+=stu[i].ji;
	}
	for(i=1;i<n;i++)
	{
		if(stu[i].ji>stu[k].ji)
			stu[k]=stu[i];
	}
	printf("%s\n",stu[k].nam);
	printf("%d\n",stu[k].ji);
	printf("%d\n",total);
}
void main()
{
	char name[100][21],gan[100],west[100],temp1[21];
	int end[100],cls[100],esy[100],rmb[100];
	int n,i,j,sum,temp2;
	char a='Y';
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s %d %d %c %c %d",name[i],&end[i],&cls[i],&gan[i],&west[i],&esy[i]);
	}
	for(i=0;i<n;i++)
	{
		rmb[i]=0;
		if(end[i]>80&&esy[i]>0) rmb[i]+=8000;
		if(end[i]>85&&cls[i]>80) rmb[i]+=4000;
		if(end[i]>90) rmb[i]+=2000;
		if(end[i]>85&&west[i]==a) rmb[i]+=1000;
		if(cls[i]>80&&gan[i]==a) rmb[i]+=850;
	}
	for(i=0,sum=0;i<n;i++)
	{
        sum+=rmb[i];
	}
	for(i=0;i<n;i++)
	{
		for(j=0;j<n-i-1;j++)
		{
			if(rmb[j]>=rmb[j+1])
			{
				temp2=rmb[j];
				rmb[j]=rmb[j+1];
				rmb[j+1]=temp2;
				strcpy(temp1,name[j]);
				strcpy(name[j],name[j+1]);
				strcpy(name[j+1],temp1);
			}
		}
	}
	printf("%s\n",name[n-1]);
	printf("%d\n",rmb[n-1]);
	printf("%d\n",sum);
}
struct stu
{
	char name[25];
	int score;
	int clas;
	char job;
	char west;
	int paper;
	int sum;
	struct stu*next;
};

void main()
{
	int n,m=0,max=0,all=0;
	char c[25]={'\0'};
	scanf("%d",&n);
	struct stu*p1,*p2,*head;
	struct stu*p;

	p1=(struct stu*)malloc(LEN);
	scanf("%s%d%d %c %c %d",p1->name,&p1->score,&p1->clas,&p1->job,&p1->west,&p1->paper);
	p1->sum=0;
	head=NULL;

	while(n)
	{
		m+=1;
		if(m==1)
			head=p1;
		else p2->next=p1;
		p2=p1;
		p1=(struct stu*)malloc(LEN);
		scanf("%s%d%d %c %c %d",p1->name,&p1->score,&p1->clas,&p1->job,&p1->west,&p1->paper);
		p1->sum=0;
		n--;
	}
	p2->next=NULL;

	p=head;
	while(p)
	{
		if(p->clas>80)
		{
			if(p->job=='Y')
				p->sum+=850;
			if(p->score>85)
				p->sum+=4000;
		}
		if(p->score>80)
		{
			if(p->paper)
				p->sum+=8000;
			if(p->score>85)
			{
				if(p->west=='Y')
					p->sum+=1000;
			    if(p->score>90)
					p->sum+=2000;
			}
		}
		if(p->sum>max)
		{
			max=p->sum;
			strcpy(c,p->name);
		}
		all+=p->sum;
		p=p->next;
	}
	puts(c);
	printf("%d\n%d",max,all);
}
struct file
{
	char name[50];
	int exam;
	int judge;
	char worker;
	char west;
	int paper;
	int scholarship;
};
int yuanshi(int exam,int paper)
{
	if(exam>80&&paper>=1)
	{
		return 1;
	}
	else
	{
		return 0;
	}
}
int wusi(int exam,int judge)
{
	if(exam>85&&judge>80)
	{
		return 1;
	}
	else
	{
		return 0;
	}
}
int chengji(int exam)
{
	if(exam>90)
	{
		return 1;
	}
	else
	{
		return 0;
	}
}
int xibu(int exam,char west)
{
	if(exam>85&&west=='Y')
	{
		return 1;
	}
	else
	{
		return 0;
	}
}
int banji(int judge,char worker)
{
	if(judge>80&&worker=='Y')
	{
		return 1;
	}
	else
	{
		return 0;
	}
}
void main()
{
	struct file a[110];
	int i,n,sum=0,max=0,orient;
	for(i=1;i<=110;i++)
	{
		a[i-1].scholarship=0;
	}
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		scanf("%s %d %d %c %c %d",&a[i].name,&a[i].exam,&a[i].judge,&a[i].worker,&a[i].west,&a[i].paper);
		if(yuanshi(a[i].exam,a[i].paper))
		{
			a[i].scholarship+=8000;
		}
		if(wusi(a[i].exam,a[i].judge))
		{
			a[i].scholarship+=4000;
		}
		if(chengji(a[i].exam))
		{
			a[i].scholarship+=2000;
		}
		if(xibu(a[i].exam,a[i].west))
		{
			a[i].scholarship+=1000;
		}
		if(banji(a[i].judge,a[i].worker))
		{
			a[i].scholarship+=850;
		}
		sum+=a[i].scholarship;
	}
	for(i=1;i<=n;i++)
	{
		if(a[i].scholarship>max)
		{
			max=a[i].scholarship;
			orient=i;
		}
	}
	printf("%s\n%d\n%d",a[orient].name,max,sum);
}
struct student
{
	char name[20];
	int final;
	int cla;
	char job;
	char west;
	int essay;
	int bonus;
};

int sco1(struct student a);
int sco2(struct student a);
int sco3(struct student a);
int sco4(struct student a);
int sco5(struct student a);
void bubble(struct student *p,int n);

void main()
{
	int n,i,total=0;
	struct student stu[101]={0,0,0,0,0,0,0};
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s %d %d %c %c %d",stu[i].name,&stu[i].final,&stu[i].cla,&stu[i].job,&stu[i].west,&stu[i].essay);
		stu[i].bonus=sco1(stu[i])+sco2(stu[i])+sco3(stu[i])+sco4(stu[i])+sco5(stu[i]);
		total=total+stu[i].bonus;
	}
	bubble(stu,n);
	printf("%s\n%d\n%d",stu[0].name,stu[0].bonus,total);
}

int sco1(struct student a)
{
	if(a.final>80&&a.essay>0)
		return 8000;
	else
		return 0;
}
int sco2(struct student a)
{
	if(a.final>85&&a.cla>80)
		return 4000;
	else
		return 0;
}
int sco3(struct student a)
{
	if(a.final>90)
		return 2000;
	else
		return 0;
}
int sco4(struct student a)
{
	if(a.final>85&&a.west=='Y')
		return 1000;
	else
		return 0;
}
int sco5(struct student a)
{
	if(a.cla>80&&a.job=='Y')
		return 850;
	else
		return 0;
}
void bubble(struct student * p,int n)
{
	int i,j;
	struct student t;
	for(i=0;i<n-1;i++)
	{
		for(j=0;j<n-i-1;j++)
		{
			if(p[j].bonus<p[j+1].bonus)
			{t=p[j];p[j]=p[j+1];p[j+1]=t;}
		}
	}
}
void main()
{
	int n,all=0,i,j,m;
	struct student
	{
		char name[20];
		int score1;
		int score2;
		char monitor;
		char west;
		int paper;
		int money;
	}stu[100];
	scanf("%d",&n);
    for(i=0;i<n;i++)
	{
		scanf("%s %d %d %c %c %d",&stu[i].name,
			&stu[i].score1,&stu[i].score2,&stu[i].monitor,&stu[i].west,
			&stu[i].paper);
	}
	for(i=0;i<n;i++)
	{
		stu[i].money=0;
		if(stu[i].score1>80 && stu[i].paper>=1)
			stu[i].money+=8000;
		if(stu[i].score1>85 && stu[i].score2>80)
			stu[i].money+=4000;
		if(stu[i].score1>90)
			stu[i].money+=2000;
		if(stu[i].score1>85 && stu[i].west=='Y')
			stu[i].money+=1000;
		if(stu[i].score2>80 && stu[i].monitor=='Y')
			stu[i].money+=850;
	}
    m=stu[0].money;
	j=0;
	for(i=0;i<n;i++)
	{
		
			if(stu[i].money>m)
			{
				m=stu[i].money;j=i;
			}
		
	}
	for(i=0;i<n;i++)
		all+=stu[i].money;
	printf("%s\n%d\n",stu[j].name,stu[j].money);
	
	
	printf("%d\n",all);
}
struct student
{
	char name[20];
	int exam;
	int chara;
	char ganbu;
	char west;
	int paper;
};

int scholarship(struct student stu)
{
	int s=0;
	if(stu.exam>80&&stu.paper>0)
		s=s+8000;
	if(stu.exam>85&&stu.chara>80)
		s=s+4000;
	if(stu.exam>90)
		s=s+2000;
	if(stu.exam>85&&(stu.west=='Y'))
		s=s+1000;
	if((stu.ganbu=='Y')&&stu.chara>80)
		s=s+850;
	return(s);

}

void main()
{
	int n,c[100],i,sum=0,max,k;
	struct student stu[100];
	 
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
	scanf("%s %d %d %c %c %d",stu[i].name,&stu[i].exam,&stu[i].chara,&stu[i].ganbu,&stu[i].west,&stu[i].paper);
	}

	for(i=0;i<n;i++)
	{
		c[i]=scholarship(stu[i]);
		sum=sum+c[i];
	}

	max=c[0];
	k=0;
	for(i=1;i<n;i++)
	{
		if(c[i]>max)
		{
			max=c[i];
			k=i;
		}
	}

	printf("%s\n",stu[k].name);
	printf("%d\n",c[k]);
	printf("%d\n",sum);

}
struct student
{
	char name[21],a,b;
	int score,c,e,scholar;
};
struct student stu[100],temp;
void main()
{
	int n,i,j,k=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s %d %d %c %c %d",stu[i].name,&stu[i].score,&stu[i].c,&stu[i].a,&stu[i].b,&stu[i].e);
	}
	/*for(i=0;i<n;i++)
	{
		printf("%s %d %d %c %c %d\n",stu[i].name,stu[i].score,stu[i].c,stu[i].a,stu[i].b,stu[i].e);
	}*/

	for(i=0;i<n;i++)
	{
		stu[i].scholar=0;
		if(stu[i].c>80&&stu[i].a=='Y')
		{
			stu[i].scholar+=850;
		}
		if(stu[i].score>85&&stu[i].b=='Y')
		{
			stu[i].scholar+=1000;
		}
		if(stu[i].score>90)
		{
			stu[i].scholar+=2000;
		}
		if(stu[i].score>85&&stu[i].c>80)
		{
			stu[i].scholar+=4000;
		}
		if(stu[i].score>80&&stu[i].e>=1)
		{
			stu[i].scholar+=8000;
		}
	}
	for(j=1;j<n;j++)
	{
		if(stu[0].scholar<stu[j].scholar)
		{
			temp=stu[0];
			stu[0]=stu[j];
			stu[j]=temp;
		}
	}
	for(j=0;j<n;j++)
		k+=stu[j].scholar;
	printf("\n%s\n%d\n%d",stu[0].name,stu[0].scholar,k);
}
int main ()
{
	char name[100][30];
	int n,i,totle=0,m,mast=0;
	int s[100][4];
	char x;
	char g;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		s[i][3]=0;
		scanf("%s%d%d %c %c%d",name[i],&s[i][0],&s[i][1],&g,&x,&s[i][2]);
		if(s[i][0]>80){
			if(s[i][2]!=0){
				s[i][3]=s[i][3]+8000;
			}
		}
		if(s[i][0]>85){
			if(s[i][1]>80){
				s[i][3]=s[i][3]+4000;
			}
			if(x=='Y'){
				s[i][3]=s[i][3]+1000;
			}
		}
		if(s[i][0]>90){
			s[i][3]=s[i][3]+2000;
		}
		if(s[i][1]>80&&g=='Y'){
			s[i][3]=s[i][3]+850;
		}
		if(s[i][3]>mast){
			mast=s[i][3];
			m=i;
		}
		totle=totle+s[i][3];
	}
	printf("%s",name[m]);
	printf("\n%d\n%d",mast,totle);
	return 0;
}
int main()
{
    int i,n,zong=0,max;
	int a[100],b[100],r[100];
    char name[100][21],s[100],t[100],temp[20];

	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s %d %d %c %c %d",&name[i],&a[i],&b[i],&s[i],&t[i],&r[i]);
	}
    	int sum[100]={0};
	for(i=0;i<n;i++){
		if((a[i]>80)&&(r[i]>=1)){
			sum[i]+=8000;
		}
	    if((a[i]>85)&&(b[i]>80)){
			sum[i]+=4000;
		}
		if(a[i]>90){
			sum[i]+=2000;
		}
		if((a[i]>85)&&(t[i]=='Y')){
			sum[i]+=1000;
		}
	    if((b[i]>80)&&(s[i]=='Y')){
			sum[i]+=850;
		}
	}
	max=sum[0];
	for(i=0;i<n;i++){
		if(sum[i]>max){
			max=sum[i];
			strcpy(temp,name[i]);
		}
	}
	for(i=0;i<n;i++){
		zong+=sum[i];
	}
	printf("%s\n",temp);
	printf("%d\n",max);
	printf("%d\n",zong);
	return 0;
}
void main()
{
	int n,i,r;
	char a[101][50],b[101],c[101];
	int d[101],e[101],f[101],g[150];
	scanf("%d",&n);
	for (i=0;i<n;i++)
	{
		g[i]=0;
		scanf("%s %d %d %c %c %d",a[i],&d[i],&e[i],&b[i],&c[i],&f[i]);
		if (d[i]>80&&f[i]>=1)
			g[i]=g[i]+8000;
		if (d[i]>85&&e[i]>80)
			g[i]=g[i]+4000;
		if (d[i]>90)
			g[i]=g[i]+2000;
		if (d[i]>85&&c[i]=='Y')
			g[i]=g[i]+1000;
		if (e[i]>80&&b[i]=='Y')
			g[i]=g[i]+850;
	}
	g[101]=0;g[102]=0;
	for (i=0;i<n;i++)
	{
		g[102]=g[102]+g[i];
		if (g[i]>g[101])
		{
			g[101]=g[i];r=i;
		}

	}
	
	printf("%s\n",a[r]);
	printf("%d\n",g[101]);
	printf("%d\n",g[102]);

}
struct student
  {
   char name[20];
   int mark[2];
   char leader;
   char west;
   int paper;
   int money;
  }stu[100];
void main()
{
  int n,i,j,max,sum=0;
  scanf("%d",&n);
  for (i=0;i<n;i++)
     {scanf("%s %d %d %c %c %d",stu[i].name,&stu[i].mark[0],&stu[i].mark[1],
                               &stu[i].leader,&stu[i].west,&stu[i].paper);
      stu[i].money=0;
      if (stu[i].mark[0]>80 && stu[i].paper>=1) stu[i].money+=8000;
      if (stu[i].mark[0]>85 && stu[i].mark[1]>80) stu[i].money+=4000;
      if (stu[i].mark[0]>90) stu[i].money+=2000;
      if (stu[i].mark[0]>85 && stu[i].west=='Y') stu[i].money+=1000;
      if (stu[i].mark[1]>80 && stu[i].leader=='Y') stu[i].money+=850;
      sum+=stu[i].money;
       }
    max=stu[0].money;
  for (i=1;i<n;i++)
      {
       if (stu[i].money>max) {max=stu[i].money;j=i;}
       }
  printf("%s\n%d\n",stu[j].name,stu[j].money);
  printf("%d",sum);
}
struct stu
{char name[24];
 int score;
 int ass;
 char pos;
 char west;
 int paper;
 int fel;
};
int f(struct stu*q)
{int z=0;
 if( q->score>80 && q->paper>0 ) z=z+8000;
 if( q->score>85 && q->ass>80 ) z=z+4000;
 if( q->score>90) z=z+2000;
 if( q->score>85 && q->west=='Y' ) z=z+1000;
 if( q->ass>80 && q->pos=='Y' ) z=z+850;
 return(z);
}
void main()
{struct stu* p;
 int n,i,m=0,t=0;
 scanf("%d",&n);
 p=(struct stu*)malloc(n*sizeof(struct stu));
 for(i=0;i<n;i++)
 {scanf("%s %d %d %c %c %d",(p+i)->name,&(p+i)->score,&(p+i)->ass,&(p+i)->pos,&(p+i)->west,&(p+i)->paper);
  (p+i)->fel=f(p+i);
   t=t+(p+i)->fel;
  }
 for(i=1;i<n;i++)
  if( (p+i)->fel > (p+m)->fel ) m=i;
 printf("%s\n%d\n%d",(p+m)->name,(p+m)->fel,t);
}
struct student
{char name[20];
 int endmark;
 int mark;
 char ganbu;
 char xibu;
 int essay;
}stu[100];
void main()
{
	int n,i,max,p,sum=0;
	int scholar[100]={0};
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s %d %d %c %c %d",stu[i].name,&stu[i].endmark,&stu[i].mark,&stu[i].ganbu,&stu[i].xibu,&stu[i].essay);
	}
	for(i=0;i<n;i++)
	{
		if(stu[i].endmark>80&&stu[i].essay>=1)  scholar[i]=scholar[i]+8000;
		if(stu[i].endmark>85&&stu[i].mark>80)  scholar[i]=scholar[i]+4000;
		if(stu[i].endmark>90)  scholar[i]=scholar[i]+2000;
		if(stu[i].endmark>85&&stu[i].xibu=='Y')  scholar[i]=scholar[i]+1000;
		if(stu[i].mark>80&&stu[i].ganbu=='Y')  scholar[i]=scholar[i]+850;
	}
	max=scholar[0];
	for(i=0;i<n;i++)
	{
		if(scholar[i]>max)  max=scholar[i];
	}
	for(i=n-1;i>=0;i--)
	{
		if(scholar[i]==max)  p=i;
	}
	for(i=0;i<n;i++)
	{
		sum=sum+scholar[i];
	}
	printf("%s\n%d\n%d\n",stu[p].name,max,sum);
}
int main()
{
    struct stud
	{
		char na[25];
		int ag,cg,l;
		int t;
		char gb,x;
	}st[101];
	int i,n,num=0,re,max=0;
	long total;
	total=0;

	scanf("%d",&n);
	for (i=0;i<n;i++)
	{
		st[i].t=0;
		scanf("%s",st[i].na);
		scanf("%d %d %c %c %d",&st[i].ag,&st[i].cg,&st[i].gb,&st[i].x,&st[i].l);
		if ((st[i].ag>85) && (st[i].x=='Y'))
			st[i].t=st[i].t+1000;

		if ((st[i].ag>85) && (st[i].cg>80))
			st[i].t=st[i].t+4000;
		
		if ((st[i].ag>80) && (st[i].l>=1))
			st[i].t=st[i].t+8000;
		
		if ((st[i].gb=='Y') && (st[i].cg>80))
			st[i].t=st[i].t+850;

		if (st[i].ag>90)
			st[i].t=st[i].t+2000;

		total=(long)(total+st[i].t);
	}

	for (i=0;i<n;i++)
	{
		if (st[i].t>=max)
		{
		  max=st[i].t;
		  num++;
		  re=i;
		}		
	}
	
	if (num==1)
		printf("%s\n%d\n%ld\n",st[re].na,st[re].t,total);
	else 
	{
		num=0;
		for (i=0;num<1;i++)
		{
			if (st[i].t==max)
			{
				printf("%s\n%d\n%d\n",st[i].na,st[i].t,total);
				num++;
			}
		}
	}
	return 0;
}
struct l
{
	char a[22];
	int x;
	int y;
	char m;
	char n;
	int h;
};



int main()
{
	int n,i;
	cin>>n;
	struct l s[101];
	int f=0,j,c=0;
	for(i=1;i<=n;i++)
	{
		int p=0;
		cin>>s[i].a;
		cin>>s[i].x;
		cin>>s[i].y;
		cin>>s[i].m;
		cin>>s[i].n;
		cin>>s[i].h;
	if(s[i].x>80&&s[i].h>=1)
		p+=8000;
	if(s[i].x>85&&s[i].y>80)
		p+=4000;
	if(s[i].x>90)
		p+=2000;
	if(s[i].x>85&&s[i].n=='Y')
		p+=1000;
	if(s[i].y>80&&s[i].m=='Y')
		p+=850;
	c+=p;
	if(p>f)
	{
		f=p;
		j=i;
	}
	}


	cout<<s[j].a<<endl;
	cout<<f<<endl;
	cout<<c<<endl;
	return 0;
}
struct student 
{
	char name[21];
	int qimo;
	int pingyi;
	char ganbu;
	char xibu;
	int paper;
	int money;
};

int main()
{
	int n,i,j,e,moneyzong=0;
	char name1[21];
	scanf("%d",&n);
	struct student*a=(struct student*)malloc(sizeof(struct student)*n);
	for(i=0;i<n;i++)
	{
		a[i].money=0;
	}
	for(i=0;i<n;i++)
	{
		scanf("%s %d %d %c %c %d",a[i].name,&a[i].qimo,&a[i].pingyi,&a[i].ganbu,&a[i].xibu,&a[i].paper);
		if(a[i].qimo>80&&a[i].paper>=1)
			a[i].money+=8000;
		if(a[i].qimo>85&&a[i].pingyi>80)
			a[i].money+=4000;
		if(a[i].qimo>90)
			a[i].money+=2000;
		if(a[i].qimo>85&&a[i].xibu=='Y')
			a[i].money+=1000;
		if(a[i].pingyi>80&&a[i].ganbu=='Y')
			a[i].money+=850;
	}
	for(i=0;i<n;i++)
	{
		moneyzong+=a[i].money;
	}

	for(i=0;i<n-1;i++)
	{
		for(j=0;j<n-1;j++)
		{
			if(a[i].money>=a[i+1].money)
			{
				e=a[i].money;
				a[i].money=a[i+1].money;
				a[i+1].money=e;
				strcpy(name1,a[i].name);
				strcpy(a[i].name,a[i+1].name);
				strcpy(a[i+1].name,name1);
			}

		}
	}
	

	printf("%s\n%d\n%d\n",a[n-1].name,a[n-1].money,moneyzong);
	return 0;
}
int main()
{
     struct student
    {
           char name[21];
           int final;
           int cla;
           char l;
           char w;
           int paper;
           int total;
    };
    int k,i,t,max;
    t=max=0;
    struct student stu[100];
    scanf("%d",&k);
    for(i=0;i<=k-1;i++)
    {
                       scanf("%s %d%d %c %c %d",stu[i].name,&stu[i].final,&stu[i].cla,&stu[i].l,&stu[i].w,&stu[i].paper);
                       stu[i].total=0;
                       if(stu[i].final>80&&stu[i].paper>=1) stu[i].total=stu[i].total+8000;
                       if(stu[i].final>85&&stu[i].cla>80) stu[i].total=stu[i].total+4000;
                       if(stu[i].final>90) stu[i].total=stu[i].total+2000;
                       if(stu[i].final>85&&stu[i].w=='Y') stu[i].total=stu[i].total+1000;
                       if(stu[i].cla>80&&(stu[i].l=='Y')) stu[i].total=stu[i].total+850;
    }
    for(i=0;i<=k-1;i++)
    {
                       if(stu[i].total>max)
                       max=stu[i].total;
                       t=t+stu[i].total;
    }
    for(i=0;i<=k-1;i++)
    {
                       if(stu[i].total==max)
                       {
                       printf("%s\n",stu[i].name);
                       printf("%d\n",stu[i].total);
                       break;
                       }
    }
    printf("%d\n",t);
return 0;
}
int main()
{
	int n,i,a,b,c,j[100],j1[100],sum=0;
	char m,l,s[100][20];
	scanf("%d",&n);
	for(i=0;i<n;i++){
		j[i]=0;
		scanf("%s %d %d %c %c %d",s[i],&a,&b,&m,&l,&c);
		if(a>80&&c>=1){
			j[i]=j[i]+8000;
		}
		if(a>85&&b>80){
			j[i]=j[i]+4000;
		}
		if(a>90){
			j[i]=j[i]+2000;
		}
		if(l=='Y'&&a>85){
			j[i]=j[i]+1000;
		}
		if(m=='Y'&&b>80){
			j[i]=j[i]+850;
		}
	}
	for(i=0;i<n;i++){
		sum=sum+j[i];
		j1[i]=j[i];
	}
	for(i=0;i<n;i++){
		if(j[i]>j[i+1])
			j[i+1]=j[i];
	}
	for(i=0;i<n;i++){
		if(j1[i]==j[n-1])
		{
			printf("%s\n",s[i]);
		printf("%d\n",j[n-1]);
		break;
		}
	}
		printf("%d\n",sum);
		return 0;
}
struct stu
{
	char name[20];
	int chengji;
	int pingyi;
	char ganbu[1];
	char xibu[1];
	int lunwen;
	int scholarship;
	struct stu *next;
};
struct stu *creat(void)
{
	int i,n;
	struct stu *head;
	struct stu *p1,*p2;
	p1=p2=(struct stu*)malloc(LEN);
	head=NULL;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s %d %d %s %s %d",p1->name,&p1->chengji,&p1->pingyi,p1->ganbu,p1->xibu,&p1->lunwen);
		if(i==0)head=p1;
		else p2=p1;
		if(i!=(n-1))p1=p2->next=(struct stu*)malloc(LEN);
		else {p2->next=NULL;}
	}
	return(head);
}
struct stu *px(struct stu *head)
{
	struct stu *p1,*p2,*p3,*p4;
	int k,add=0,max=0;
	for(p2=head;p2!=NULL;p2=p2->next)
	{
		p2->scholarship=0;
	}
	for(p1=head;p1!=NULL;p1=p1->next)
	{
		if((p1->chengji>80)&&(p1->lunwen>=1))
			p1->scholarship=p1->scholarship+8000;
		if((p1->chengji>85)&&(p1->pingyi>80))
			p1->scholarship=p1->scholarship+4000;
		if(p1->chengji>90)
			p1->scholarship=p1->scholarship+2000;
		if((p1->chengji>85)&&(p1->xibu[0]=='Y'))
			p1->scholarship=p1->scholarship+1000;
		if((p1->pingyi>80)&&(p1->ganbu[0]=='Y'))
			p1->scholarship=p1->scholarship+850;
	}
	for(p3=head;p3!=NULL;p3=p3->next)
	{
		k=0;
		for(p4=head;p4!=NULL;p4=p4->next)
		{
			if(p3->scholarship<p4->scholarship)
				k++;
		}
		if(k==0)
		{
			printf("%s\n%d\n",p3->name,p3->scholarship);
			break;
		}
	}
	for(p1=head;p1!=NULL;p1=p1->next)
	{
		add=add+p1->scholarship;
	}
	printf("%d\n",add);
	return head;
}
void main()
{
	struct stu *a,*b;
	a=creat();
	b=px(a);
}
struct student
{
	char a[20];
	int chengji;
	int pingyi;
	char x;
	char y;
	int h;
	struct student *next;
};

int n;
struct student *creat()
{
	struct student *head;
	struct student *p1,*p2;
	int m;
	scanf("%d",&m);
	n=1;
	p1=p2=(struct student *)malloc(LEN);
	scanf("%s %d %d %c %c %d",p1->a,&p1->chengji,&p1->pingyi,&p1->x,&p1->y,&p1->h);
	head=NULL;
	do
	{
		
		if(n==1){head=p1;p2=p1;}
		else {
			p1=(struct student *)malloc(LEN);
	        scanf("%s %d %d %c %c %d",p1->a,&p1->chengji,&p1->pingyi,&p1->x,&p1->y,&p1->h);
			p2->next=p1;
			p2=p1;}
		n=n+1;
	
	
	}while(n<=m);
	p2->next=NULL;
	return(head);
}
void main()

{
	struct student *q,*head,*p;

	int max;
	int s,sum;
	sum=0;

	head=creat();
	q=head;
	
	max=0;
    while(q!=NULL)
	{
		s=0;
		if(q->chengji >80 && (q->h )>=1)  s=s+8000;
		if(q->chengji >85 && q->pingyi >80 ) s=s+4000;
		if(q->chengji >90 ) s=s+2000;
		if(q->chengji >85 && q->y=='Y') s=s+1000;
		if(q->pingyi >80 && q->x=='Y') s=s+850;
	
		
		if(s>max) max=s;
		sum=sum+s;
		q=q->next;
	}

    p=head;
 while(p!=NULL)
 {
 	
		s=0;
		if(p->chengji >80 && (p->h )>=1)  s=s+8000;
		if(p->chengji >85 && p->pingyi >80 ) s=s+4000;
		if(p->chengji >90 ) s=s+2000;
		if(p->chengji >85 && p->y=='Y') s=s+1000;
		if(p->pingyi >80 && p->x=='Y') s=s+850;
		if(s==max)
		{	printf("%s\n%d\n",p->a,s) ;break;}
		p=p->next;
 }
 printf("%d",sum);
}
char name[200][21];
int qmg[200];
int cg[200];
char gb[200];
char xb[200];
int lw[200];
int schsum[200];


int main(){
	int n,i,num,whole;
	char str1[21];
	scanf("%d",&n);
	for(i=0;i<n;i++){
		int j;
		char str2[21],x4,x5;
		int x2,x3,x6;
		scanf("%s %d %d %c %c %d",str2,&x2,&x3,&x4,&x5,&x6);
		for (j=0;j<21;j++) name[i][j]=str2[j];
		qmg[i]=x2;
		cg[i]=x3;
		gb[i]=x4;
		xb[i]=x5;
		lw[i]=x6;
	    //puts(str2);
	}

	for(i=0;i<n;i++){
		schsum[i]=0;
		if(qmg[i]>80&&lw[i]>=1) schsum[i]+=8000;
		if(qmg[i]>85&&cg[i]>80) schsum[i]+=4000;
		if(qmg[i]>90) schsum[i]+=2000;
		if(xb[i]=='Y'&&qmg[i]>85) schsum[i]+=1000;
		if(gb[i]=='Y'&&cg[i]>80) schsum[i]+=850;
	}

	num=0;
	for(i=1;i<n;i++){
		if (schsum[num]<schsum[i]) num=i;
	}

	
	for(i=0;i<21;i++) str1[i]=name[num][i];

	puts(str1);
	printf("%d\n" ,schsum[num]);

	whole=0;
	for(i=0;i<n;i++){
		whole+=schsum[i];
	}
	
	printf("%d",whole);
	//printf("%d %d %d %d" ,schsum[0],schsum[1],schsum[2],schsum[3]);
	return 0;
}