semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
struct Student{
	char name[20];
	int Academy;
	int Class;
	char Stujob;
	char west;
	int paper;
};
void main()
{
	int N,i,j,scolar[100][6],max;
	long int sum=0;
    struct Student stu[100];
	struct Student* p;
	scanf("%d",&N);
	for(i=0;i<N;i++)
		for(j=0;j<6;j++)
			scolar[i][j]=0;
	for(p=stu;p<stu+N;p++)
		scanf("%s %d %d %c %c %d",p->name,&p->Academy,&p->Class,&p->Stujob,&p->west,&p->paper);
    for(i=0;i<N;i++)
	{
		if(stu[i].Academy>80&&stu[i].paper>=1)
			scolar[i][0]=8000;
		if(stu[i].Academy>85&&stu[i].Class>80)
			scolar[i][1]=4000;
		if(stu[i].Academy>90)
			scolar[i][2]=2000;
		if(stu[i].Academy>85&&stu[i].west=='Y')
			scolar[i][3]=1000;
		if(stu[i].Class>80&&stu[i].Stujob=='Y')
			scolar[i][4]=850;
	}
	for(i=0;i<N;i++)
		for(j=4;j>=0;j--)
			scolar[i][5]=scolar[i][5]+scolar[i][j];
	max=scolar[0][5];j=0;
	for(i=0;i<N;i++)
		if(scolar[i][5]>max)
		{	max=scolar[i][5];j=i;}
    printf("%s\n%d\n",stu[j].name,scolar[j][5]);
	for(i=0;i<N;i++)
		sum=sum+scolar[i][5];
	printf("%ld",sum);
}
struct score
{
	char name[20];
	int score1;
	int score2;
	char ganbu;
	char xibu;
	int lunwen;	
}student[100];
int main()
{
	int i,num,money,max=0,s=0;
	scanf("%d",&num);
	for(i=0;i<num;i++){
		scanf("%s%d%d",student[i].name,&student[i].score1,&student[i].score2);
		getchar();
		scanf("%c",&student[i].ganbu);
		getchar();
		scanf("%c%d",&student[i].xibu,&student[i].lunwen);
	}
	for(i=0;i<num;i++){
		money=0;
		if(student[i].score1>80&&student[i].lunwen>0)money+=8000;
		if(student[i].score1>85&&student[i].score2>80)money+=4000;
		if(student[i].score1>90)money+=2000;
		if(student[i].score1>85&&student[i].xibu=='Y')money+=1000;
		if(student[i].score2>80&&student[i].ganbu=='Y')money+=850;
		if(money>max)	max=money;	
		s+=money;
	}
	for(i=0;i<num;i++){
		money=0;
		if(student[i].score1>80&&student[i].lunwen>0)money+=8000;
		if(student[i].score1>85&&student[i].score2>80)money+=4000;
		if(student[i].score1>90)money+=2000;
		if(student[i].score1>85&&student[i].xibu=='Y')money+=1000;
		if(student[i].score2>80&&student[i].ganbu=='Y')money+=850;
		if(money==max){
			printf("%s\n%d\n",student[i].name,max);
			break;
		}
	}
	printf("%d",s);
	return 0;
}
struct SCL
{
    char stu[20];
    int avg;
    int rev;
    char ldr;
    char wst;
    int ppr;
    int sum;
}SCL[100];

int main()
{
    int n, max=0, sum=0;
    char *name;
    struct SCL *p;
    scanf("%d", &n);

    for(p=SCL; p<SCL+n; p++)
    {
        scanf("%s %d %d %c %c %d", p->stu, &p->avg, &p->rev, &p->ldr, &p->wst, &p->ppr);
        p->sum=0;

        if(p->avg>80 && p->ppr>0)
            p->sum+=8000;
        if(p->avg>85 && p->rev>80)
            p->sum+=4000;
        if(p->avg>90)
            p->sum+=2000;
        if(p->avg>85 && p->wst=='Y')
            p->sum+=1000;
        if(p->rev>80 && p->ldr=='Y')
            p->sum+=850;
    }

    for(p=SCL; p<SCL+n; p++)
    {
        if(p->sum>max)
        {
            max=p->sum;
            name=p->stu;
        }
        sum+=p->sum;
    }

    printf("%s\n%d\n%d\n", name, max, sum);

    return 0;
}
struct student 
{
	char name[20];
	int ss;
	int cs;
	char g[2];
	char w[2];
	int pa;
	int m;
	struct student *next;
};
void main()
{
	int i,n,mm=0,all=0;
	scanf("%d",&n);
	struct student *head,*p1,*p2,*p,*q;
	p1=p2=(struct student *)malloc(LEN);
	scanf("%s %d %d %s %s %d",p1->name,&p1->ss,&p1->cs,p1->g,p1->w,&p1->pa);
	head=NULL;
	while(mm<n-1)
	{
		mm=mm+1;
		if(mm==1) head=p1;
		else 
			p2->next=p1;
		p2=p1;
		p1=(struct student *)malloc(LEN);
		scanf("%s %d %d %s %s %d",p1->name,&p1->ss,&p1->cs,p1->g,p1->w,&p1->pa);
	}
	p2->next=p1;
	p2=p1;	
	p2->next=NULL;

/*?????*/
	p=head;
	do
	{
		p->m=0;
		if(p->ss>80&&p->pa>=1)
			p->m=p->m+8000;
		if(p->ss>85&&p->cs>80)
			p->m=p->m+4000;
		if(p->ss>90)
			p->m=p->m+2000;
		if(p->ss>85&&strcmp(p->w,"Y")==0)
			p->m=p->m+1000;
		if(p->cs>80&&strcmp(p->g,"Y")==0)
			p->m=p->m+850;
		p=p->next;
	}while(p!=NULL);
	p=q=head;	
	do
	{
		all=all+q->m;
		if(p->m<q->m)
			p=q;
		q=q->next;
	}while(q!=NULL);
	printf("%s\n%d\n%d\n",p->name,p->m,all);
}
/*???????????????????????????????????????????? 

1) ????????8000??????????80??>80??
?????????1??1????????????? 
2) ????????4000??????????85??>85??
??????????80??>80????????? 
3) ????????2000??????????90??>90?
???????? 
4) ????????1000??????????85??>85?
???????????? 
5) ????????850??????????80??>80?
?????????? 

????????????????????????????????????????????????????????87????????82????????????????????????????????????????4850?? 

??????????????????????????????????????????????????
???? 
?????????????????????????????????????????????????????????????????????????????????????????N?????????????
 
???? 
4
YaoLin 87 82 Y N 0
ChenRuiyi 88 78 N Y 1
LiXin 92 88 N N 0
ZhangQin 83 87 Y N 1

 
???? 
ChenRuiyi
9000
28700
 

 
*/
struct student{
		char name[30];
		int qimo,banji;
		char ganbu,xibu;
		int lunwen;
		int money;
	};





int suan(struct student *s){
	//1) ????????8000??????????80??>80??
	//?????????1??1?????????????
	int mon=0;
	if (s->qimo >80&&s->lunwen>=1) mon+=8000;
//	2) ????????4000??????????85??>85??????????
	//??80??>80????????? 
   	if (s->qimo >85&&s->banji >80) mon+=4000;
//	3) ????????2000??????????90??>90????????? 
	if (s->qimo >90) mon+=2000;
	//4) ????????1000??????????85??>85????????????? 
	if (s->qimo >85&&s->xibu =='Y') mon+=1000;

//5) ????????850??????????80??>80??????????? 
	if (s->banji >80&&s->ganbu =='Y') mon+=850;
return mon;
}

int main()
{
	
	long int n,sum=0;
	int i;
	char tmp;
	struct student *stu,*max;
	scanf("%d",&n);
	stu=(struct student *)malloc(sizeof(struct student)*n);

	for (i=0;i<n;i++){ //ChenRuiyi 88 78 N Y 1

		scanf("%s%d%d%c%c%c%c%d",stu[i].name,&(stu[i].qimo),&(stu[i].banji),&tmp,&(stu[i].ganbu),&tmp,&(stu[i].xibu),&(stu[i].lunwen));
		stu[i].money=suan(stu+i);
		sum+=stu[i].money;
	}
	max=stu+n-1;
	for (i=n-1;i>0;i--)
		if (max->money<=stu[i].money) max=stu+i;

	printf("%s\n%d\n%d\n",max->name,max->money,sum);




}
struct student
{
	char name[20];
	int score1;
	int score2;
	char lead;
	char west;
	int paper;
	int sum;
	struct student *next;
};
int money(struct student *p)
{
	int z=0;
	if((p->score1>80)&&(p->paper>=1))
	   z+=8000;
    if((p->score1>85)&&(p->score2>80))
       z+=4000;
    if(p->score1>90)
       z+=2000;
    if((p->score1>85)&&(p->west=='Y'))
       z+=1000;
    if((p->score2>80)&&(p->lead=='Y'))
       z+=850;
    return(z);
}
void main()
{
	long total=0;
	struct student *p1,*p2,*p0,*head;
	int n,i;
	scanf("%d",&n);
	p1=p2=(struct student*)malloc(LEN);
	head=NULL;
	scanf("%s %d %d %c %c %d\n",p1->name,&p1->score1,&p1->score2,&p1->lead,&p1->west,&p1->paper);
	p0=p1;
	p1->sum=money(p1);
	total+=p1->sum;
	for(i=1;i<n;i++)
	{
	 	if(i==1)head=p1;
	 	else p2->next=p1;
	 	p2=p1;
	 	p1=(struct student*)malloc(LEN);
	 	scanf("%s %d %d %c %c %d\n",p1->name,&p1->score1,&p1->score2,&p1->lead,&p1->west,&p1->paper);
	 	p1->sum=money(p1);
	 	if(p0->sum<p1->sum)p0=p1;
	 	total+=p1->sum;
	}
	printf("%s\n%d\n%ld\n",p0->name,p0->sum,total);
}
struct student
{ int a,b,paper,total;
  char leader,west,name[32];
  struct student *next;
};

main()
{
   int n,i,sum=0;
   struct student *p1,*p2,*head,*max;
   scanf("%d",&n);
   
   
   
   
   p2=p1;
   for(i=0;i<n;i++)
   { p1=(struct student *)malloc(L);
     scanf("%s %d %d %c %c %d",p1->name,&p1->a,&p1->b,&p1->leader,&p1->west,&p1->paper);
     p1->total=0;
     if(p1->a>80&&p1->paper>=1) p1->total=p1->total+8000;
     if(p1->a>85&&p1->b>80) p1->total=p1->total+4000;
     if(p1->a>90) p1->total=p1->total+2000;
     if(p1->a>85&&p1->west=='Y') p1->total=p1->total+1000;
     if(p1->b>80&&p1->leader=='Y') p1->total=p1->total+850;
     sum=sum+p1->total;
     if(i==0){ max=p1;p2=head=p1;head->next=NULL;}
     else{ if(p1->total>max->total) max=p1;
     p2->next=p1;
     p2=p1;p2->next=NULL;}
   }
   printf("%s\n%d\n%d\n",max->name,max->total,sum);
}
int main()
{
	int n,i,e=0;
	struct student
  {char name[20];
   int scorea;
   int scoreb;
   char a;
   char f;
   int b;
   int c;
	}d[100],s;
 s.c=0;
 scanf("%d",&n);
 for(i=0;i<n;i++)
 {scanf("%s%d%d %c %c %d",d[i].name,&d[i].scorea,&d[i].scoreb,&d[i].a,&d[i].f,&d[i].b);
  d[i].c=0;
  if(d[i].scorea>80&&d[i].b>0)
  d[i].c=d[i].c+8000;
  if(d[i].scorea>85&&d[i].scoreb>80)
  d[i].c=d[i].c+4000;
  if(d[i].scorea>90)
  d[i].c=d[i].c+2000;
  if(d[i].scorea>85&&d[i].f=='Y')
  d[i].c=d[i].c+1000;
  if(d[i].scoreb>80&&d[i].a=='Y')
  d[i].c=d[i].c+850;
  e=e+d[i].c;
 }
  for(i=0;i<n;i++)
  {if(d[i].c>s.c)
  s=d[i];}
  printf("%s\n%d\n%d",s.name,s.c,e);
 return 0;
}
void main()
{
	struct stu
	{
		char name[21];
	    int qimo;
	    int banji;
	    char ganbu;
	    char xibu;
	    int lunwen;
		int zongjiangjin;
	}stu[100];
	struct stu temp;
	int n,i,j;
	int sum;
	int total=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);
		sum=0;
		if(stu[i].qimo>80&&stu[i].lunwen>=1)
			sum=sum+8000;
		if(stu[i].qimo>85&&stu[i].banji>80)
			sum=sum+4000;
		if(stu[i].qimo>90)
			sum=sum+2000;
		if(stu[i].qimo>85&&stu[i].xibu=='Y')
			sum=sum+1000;
		if(stu[i].banji>80&&stu[i].ganbu=='Y')
			sum=sum+850;
		stu[i].zongjiangjin=sum;
		total=total+sum;
	}
	for(j=1;j<n;j++)
		for(i=0;i<n-j;i++)
			if(stu[i].zongjiangjin<stu[i+1].zongjiangjin)
			{
				temp=stu[i];
				stu[i]=stu[i+1];
				stu[i+1]=temp;
			}
	printf("%s\n",stu[0].name);
	printf("%d\n",stu[0].zongjiangjin);
	printf("%d\n",total);
}
int main()
{
 int n, i;
 scanf("%d", &n);
 int sum[100]={0}, total=0;
 char name[100][20];
 for(i=0;i<n;i++)
 {
  int a, b;
  char p[2], q[2];
  int l;
  scanf("%s%d%d%s%s%d", &name[i], &a, &b, &p, &q, &l);
  if(a>80&&l!=0)
  {
   sum[i]+=8000;
  }
  if(a>85&&b>80)
  {
   sum[i]+=4000;
  }
  if(a>90)
  {
   sum[i]+=2000;
  }
  if(a>85&&strcmp(q,"Y")==0)
  {
   sum[i]+=1000;
  }
  if(b>80&&strcmp(p,"Y")==0)
  {
   sum[i]+=850;
  }
  total+=sum[i];
 }
 int max=0, k;
 for(i=0;i<n;i++)
 {
  if(sum[i]>max)
  {
   max=sum[i];
   k=i;
  }
 }
 printf("%s\n%d\n%d\n", name[k], sum[k], total);
 return 0;
}
struct stu{
	char name[20];
	int s1;
	int s2;
	char gb;
	char we;
	int lw;
	int jj;
}stu[100];
int main()
{
	int n,i,s=0,max=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
		scanf("%s%d%d %c %c%d",stu[i].name,&stu[i].s1,&stu[i].s2,&stu[i].gb,&stu[i].we,&stu[i].lw);
	for(i=0;i<n;i++){stu[i].jj=0;
		if(stu[i].s1>80&&stu[i].lw>=1)
			stu[i].jj+=8000;
		if(stu[i].s1>85&&stu[i].s2>80)
			stu[i].jj+=4000;
		if(stu[i].s1>90)
			stu[i].jj+=2000;
		if(stu[i].s1>85&&stu[i].we=='Y')
			stu[i].jj+=1000;
		if(stu[i].s2>80&&stu[i].gb=='Y')
			stu[i].jj+=850;
		s+=stu[i].jj;
		if(stu[i].jj>max) max=stu[i].jj;
	}
	for(i=0;i<n;i++)
		if(stu[i].jj==max){
			printf("%s\n%d\n",stu[i].name,stu[i].jj);
			break;
		}
	printf("%d",s);
    return 0;
}
void main()
{
	int sum[100]={0},i,n,p=0;
	struct student
	{
		char name[21];
		int a;
		int b;
		char c;
		char d;
		int e;
	}stu[100];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s %d %d %c %c %d",stu[i].name,&stu[i].a,&stu[i].b,
			&stu[i].c,&stu[i].d,&stu[i].e);
	}
	for(i=0;i<n;i++)
	{
		if(stu[i].a>80&&stu[i].e>=1)
			sum[i]+=8000;
		if(stu[i].a>85&&stu[i].b>80)
			sum[i]+=4000;
		if(stu[i].a>90) 
			sum[i]+=2000;
		if(stu[i].a>85&&stu[i].d=='Y')
			sum[i]+=1000;
		if(stu[i].b>80&&stu[i].c=='Y')
			sum[i]+=850;
	}
	for(i=0;i<n;i++)
	{p+=sum[i];}
	for(i=1;i<n;i++)
	{
		if(sum[0]<sum[i])
		{stu[0]=stu[i];
		sum[0]=sum[i];}
	}
	printf("%s\n",stu[0].name);
	printf("%d\n",sum[0]);
	printf("%d",p);
}
int main()
{
	struct stu {
		char name[100];
		int score,cscore,p;
		char w,l;
	};
	int n,tot=0,i,j,swap;
	struct stu a[102];
	struct stu aswap;
	int b[102];
	char rr,tt;
	scanf("%d",&n);
	for (i=1;i<=n;i++){
		scanf("%s",a[i].name);
		scanf("%d%d%c%c%c%c%d",&a[i].score,&a[i].cscore,&rr,&a[i].l,&tt,&a[i].w,&a[i].p);
	}
	
	for (i=1;i<=n;i++){
		b[i]=0;
		if ((a[i].score>80)&&(a[i].p>=1)) b[i]=b[i]+8000;
		if ((a[i].score>85)&&(a[i].cscore>80)) b[i]=b[i]+4000;
		if (a[i].score>90) b[i]=b[i]+2000;
		if ((a[i].score>85)&&(a[i].w=='Y')) b[i]=b[i]+1000;
		if ((a[i].cscore>80)&&(a[i].l=='Y')) b[i]=b[i]+850;
		tot=tot+b[i];
	}
	for (i=1;i<=n;i++){
		for (j=i+1;j<=n;j++){
			if (b[i]<b[j]) {
				swap=b[i];b[i]=b[j];b[j]=swap;
				aswap=a[i];a[i]=a[j];a[j]=aswap;
			}
		}
	}
    printf("%s\n",a[1].name);
	printf("%d\n",b[1]);
	printf("%d\n",tot);
	return 0;
}
void main()
{
	struct student
	{
		char name[100];
		int num1,num2;
		char c1,c2;
		int paper;
	}stu[100];
	int N,sum=0,i,m,b[100],max=0;
	scanf("%d",&N);
	for(i=0;i<N;i++)
	{
		scanf("%s %d %d %c %c %d",stu[i].name,&stu[i].num1,&stu[i].num2,&stu[i].c1,&stu[i].c2,&stu[i].paper);
		b[i]=0;
		if(stu[i].num1>80&&stu[i].paper>0)b[i]+=8000;
		if(stu[i].num1>85&&stu[i].num2>80)b[i]+=4000;
		if(stu[i].num1>90)b[i]+=2000;
		if(stu[i].num1>85&&stu[i].c2=='Y')b[i]+=1000;
		if(stu[i].num2>80&&stu[i].c1=='Y')b[i]+=850;
		sum+=b[i];
		if(b[i]>max)
		{
			max=b[i];
			m=i;
		}
	}
	printf("%s\n%d\n%d",stu[m].name,b[m],sum);
}
struct stu
{
	char name[20];
	int aver;
	int sugg;
	char ganbu;
	char xibu;
	int amount;
	int money;
}stu[100];
main()
{
	int k=0,j,N,M=0;
	scanf("%d",&N);
	for(k=0;k<N;k++)
	  scanf("%s %d %d %c %c %d",stu[k].name,&stu[k].aver,&stu[k].sugg,&stu[k].ganbu,&stu[k].xibu,&stu[k].amount);
	for(k=0;k<N;k++)
	{stu[k].money=0;
		if(stu[k].aver>80&&stu[k].amount>=1)stu[k].money+=8000;
		if(stu[k].aver>85&&stu[k].sugg>80)stu[k].money+=4000;
		if(stu[k].aver>90)stu[k].money+=2000;
		if(stu[k].aver>85&&stu[k].xibu=='Y')stu[k].money+=1000;
		if(stu[k].sugg>80&&stu[k].ganbu=='Y')stu[k].money+=850;}
	for(j=1;j<N;j++)
		if(stu[j].money>stu[k].money)k=j;
		printf("%s\n",stu[k].name);
		printf("%d\n",stu[k].money);
		for(j=0;j<N;j++)
			M+=stu[j].money;
		printf("%d\n",M);
}
struct stu
{
 char name[20];
 int qm;
 int bj;
 char bgb;
 char xb;
 int lw;
 int sum;
};
int main()
{
	 int n,i,max=0,SUM=0;
           struct stu xs[100],b;
           scanf("%d",&n);
           for(i=0;i<n;i++)
           {
             scanf("%s",xs[i].name);    
             getchar();
             scanf("%d %d %c %c %d",&xs[i].qm,&xs[i].bj,&xs[i].bgb,&xs[i].xb,&xs[i].lw);     
             xs[i].sum=0;
             if(xs[i].qm>80&&xs[i].lw>0) xs[i].sum=xs[i].sum+8000;
             if(xs[i].qm>85&&xs[i].bj>80)  xs[i].sum+=4000;
		if(xs[i].qm>90)
		xs[i].sum+=2000;
		if(xs[i].qm>85&&xs[i].xb=='Y')
		xs[i].sum+=1000;
		if(xs[i].bj>80&&xs[i].bgb=='Y')
		xs[i].sum+=850;
		SUM+=xs[i].sum;
		if(xs[i].sum>max)
		{
			max=xs[i].sum;
			b=xs[i];
		}
	}
	printf("%s\n%d\n%d",b.name,max,SUM);
	return 0;
}
int main(){
	int i,n,m,a,b,k,max;
	char c1,c2;
	char na[100][100];
	long sum,s[1000]={0};
	scanf("%d",&n);
	sum=0;max=0;
	for (i=0;i<n;i++){
		s[i]=0;
		scanf("%s %d %d %c %c %d",na[i],&a,&b,&c1,&c2,&k);
		if (a>80&&k>=1) s[i]+=8000;
		if (a>85&&b>80) s[i]+=4000;
		if (a>90) s[i]+=2000;
		if (a>85&&c2=='Y') s[i]+=1000;
		if (b>80&&c1=='Y') s[i]+=850;
	    sum+=s[i];
		if (max<s[i]) {max=s[i];m=i;}
	}
    printf("%s\n",na[m]);
	printf("%d\n",s[m]);
	printf("%d\n",sum);
	return 0;
}
int main()
{
	struct stu
	{
		char name[20];
        int a;
        int b;
        char c[2];
        char d[2];
        int e;
        int m;
	};
	struct stu *p;
    int n,i,max=0,t,sum=0;
    scanf("%d",&n);
    p=(struct stu *)malloc(n*sizeof(struct stu));
    for(i=0;i<n;i++)
    scanf("%s%d%d%s%s%d",(p+i)->name,&(p+i)->a,&(p+i)->b,(p+i)->c,(p+i)->d,&(p+i)->e);
    for(i=0;i<n;i++)
    (p+i)->m=0;
    for(i=0;i<n;i++)
	{
      if((((p+i)->a)>80)&&(((p+i)->e)>0))
        (p+i)->m+=8000;
      if((((p+i)->a)>85)&&(((p+i)->b)>80))
        (p+i)->m+=4000;
      if(((p+i)->a)>90)
         (p+i)->m+=2000;
      if((((p+i)->a)>85)&&(((p+i)->d[0])=='A'+24))
        (p+i)->m+=1000;
      if((((p+i)->b)>80)&&(((p+i)->c[0])=='A'+24))
        (p+i)->m+=850;
	}
	
  for(i=0;i<n;i++)

   if(((p+i)->m)>max)
    {
      max=(p+i)->m;
      t=i;
    }
    
  for(i=0;i<n;i++)
       sum+=(p+i)->m;
  printf("%s\n",(p+t)->name);
  printf("%d\n",max);
  printf("%d\n",sum);
  return 0;

}
int main(int argc, char* argv[])
{
	int n,s1,s2,paper,i,money[100],m=0,sum=0,a;
	char name[100][20],c1=0,c2=0;
     scanf("%d",&n);
	 for(i=0;i<n;i++)
	 {  
		money[i]=0;
	    scanf("%s %d %d %c %c %d\n",name[i],&s1,&s2,&c1,&c2,&paper);
	    if(s1>80&&paper>=1)
		{
			money[i]=money[i]+8000;
		}
		if(s1>85&&s2>80)
		{
			money[i]=money[i]+4000;
		}
		if(s1>90)
		{
			money[i]=money[i]+2000;
		}
		if(s1>85&&c2=='Y')
		{
			money[i]=money[i]+1000;
		}
		if(s2>80&&c1=='Y')
		{
			money[i]=money[i]+850;
		}
        if(money[i]>m)
		{
			m=money[i];
			a=i;
		}
         sum=sum+money[i];
	 
	 }
      printf("%s\n%d\n%d",name[a],m,sum);

	return 0;
}
struct student
{
	char name[20];
	int a;
	int b;
	char cla;
	char west;
	int paper;
	int total;
}s[100];
int main()
{
	int n,i,sum=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s",s[i].name);
		scanf("%d%d %c %c%d",&s[i].a,&s[i].b,&s[i].cla,&s[i].west,&s[i].paper);
		s[i].total=0;
		if(s[i].a>80&&s[i].paper>=1)
			s[i].total+=8000;
		if(s[i].a>85&&s[i].b>80)
			s[i].total+=4000;
		if(s[i].a>90)
			s[i].total+=2000;
		if(s[i].a>85&&s[i].west=='Y')
			s[i].total+=1000;
		if(s[i].b>80&&s[i].cla=='Y')
			s[i].total+=850;
		sum+=s[i].total;
	}
	for(i=1;i<n;i++)
	{
		if(s[i].total>s[0].total)
			s[0]=s[i];
	}
	printf("%s\n",s[0].name);
	printf("%d\n",s[0].total);
	printf("%d",sum);
	
	return 0;
}
struct stu
{char num[200];
int qimo;
int banji;
char gan;
char sheng;
int lun;
int qian;
struct stu * next;
};
void sort(struct stu * head,struct stu * q)
{
	struct stu *pre=head,*p=pre->next,*s;
	s=(struct stu *)malloc(sizeof(struct stu));
	s->banji=q->banji;strcpy(s->num,q->num);s->qimo=q->qimo;s->qian=q->qian;s->sheng=q->sheng;s->gan=q->gan;
	s->next=NULL;
	while((p!=NULL)&&(s->qian<=p->qian))
	{
		pre=p;
		p=p->next;
	}
	pre->next=s;
	s->next=p;
}
void main()
{
	int n,k,i,all,tol=0;
	float m;
	char num[20];
	struct stu *head;
	struct stu *p,*q;
	head=(struct stu *)malloc(sizeof(struct stu));
	head->next=NULL;
	scanf("%d",&n);
	for (i=1;i<=n;i++)
	{	 all=0;
		 p=(struct stu *)malloc(sizeof(struct stu));
		 scanf("%s %d %d %c %c %d",p->num,&p->qimo,&p->banji,&p->gan,&p->sheng,&p->lun);
         if((p->qimo>80)&&(p->lun>0)) all=all+8000;
		 if((p->qimo>85)&&(p->banji>80)) all=all+4000;
		 if(p->qimo>90) all=all+2000;
		 if((p->qimo>85)&&(p->sheng=='Y')) all=all+1000;
		 if((p->banji>80)&&(p->gan=='Y')) all=all+850;
		 p->qian=all;
		 tol=tol+all;
         sort(head,p);
	}
	p=head->next;
	printf("%s\n",p->num);
	printf("%d\n",p->qian);
	printf("%d\n",tol);
}
void main()
{
	typedef struct stu
	{
		char name[22];
		int qm;
		int bj;
		char gb;
		char xb;
		int lw;
		int jxj;
	}stu;
	stu s[100];
	int i,n,max,total;
	memset(s,0,sizeof(s));
	max = 0; total = 0;
	scanf("%d",&n);
	for (i = 0;i < n;i++)
	{
		scanf("%s %d %d %c %c %d",(s+i)->name,&(s+i)->qm,&(s+i)->bj,&(s+i)->gb,&(s+i)->xb,&(s+i)->lw);
		if ((s+i)->qm > 80 && (s+i)->lw) (s+i)->jxj += 8000;
		if ((s+i)->qm > 85 && (s+i)->bj > 80) (s+i)->jxj += 4000;
		if ((s+i)->qm > 90) (s+i)->jxj += 2000;
		if ((s+i)->qm > 85 && (s+i)->xb == 'Y') (s+i)->jxj += 1000;
		if ((s+i)->bj > 80 && (s+i)->gb == 'Y') (s+i)->jxj += 850;
	}
	for (i = 0;i < n;i++)
	{
		if (max < (s+i)->jxj) max = (s+i)->jxj;
		total += (s+i)->jxj;
	}
	for (i = 0;i < n;i++)
		if (max == (s+i)->jxj)
		{
			printf("%s\n",(s+i)->name);
			break;
		}
	printf("%d\n%d\n",max,total);
}
int main(){
	int n;
	scanf("%d",&n);
	int pingjun[100];
	int pingyi[100];
	int jiangjin[100];
	int lunwen;
	char xingming[100][21];
	char ganbu;
	char xibu;
	int jiangjinzongshu=0;
	for(int i=0;i<n;i++){
		jiangjin[i]=0;
		scanf("%s %d %d %c %c %d\n",xingming[i],&pingjun[i],&pingyi[i],&ganbu,&xibu,&lunwen);
		if(pingjun[i]>80&&lunwen>=1){
			jiangjin[i]+=8000;
		}
		if(pingjun[i]>85&&pingyi[i]>80){
			jiangjin[i]+=4000;
		}
		if(pingjun[i]>90){
			jiangjin[i]+=2000;
		}
		if(pingjun[i]>85&&xibu=='Y'){
			jiangjin[i]+=1000;
		}
		if(pingyi[i]>80&&ganbu=='Y'){
			jiangjin[i]+=850;
		}
		jiangjinzongshu+=jiangjin[i];
	}
	int m=0;
	for(int r=0;r<n;r++){
		if(jiangjin[r]>jiangjin[m]){
			m=r;
		}
	}
	printf("%s\n%d\n%d\n",xingming[m],jiangjin[m],jiangjinzongshu);
    return 0;
}
struct student
{char name[20];
int score1;
int score2;
char ganbu;
char west;
int paper;
int scolarship;
};

void main()
{
  int n,i,total=0,max=0;
  char name2[20];
  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].score1,&stu[i].score2,&stu[i].ganbu,&stu[i].west,&stu[i].paper);
  stu[i].scolarship=0;
  if(stu[i].score1>80&&stu[i].paper>=1) stu[i].scolarship=8000;
  if(stu[i].score1>85&&stu[i].score2>80) stu[i].scolarship=stu[i].scolarship+4000;
  if(stu[i].score1>90) stu[i].scolarship=stu[i].scolarship+2000;
  if(stu[i].score1>85&&stu[i].west=='Y') stu[i].scolarship=stu[i].scolarship+1000;
  if(stu[i].score2>80&&stu[i].ganbu=='Y') stu[i].scolarship=stu[i].scolarship+850;
  total=total+stu[i].scolarship;
  if(stu[i].scolarship>max) 
  {max=stu[i].scolarship;
  strcpy(name2,stu[i].name);}
  }

  printf("%s\n%d\n%d",name2,max,total);
}
int main()
{
    int n,i,a[200],b[200],c[200],m[200],s=0,max,maxj;
    char d[200][40],e[200],f[200];
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%s%d%d %c %c %d",d[i],&a[i],&b[i],&e[i],&f[i],&c[i]);
    }
    for(i=0;i<n;i++){
        m[i]=0;
        if(a[i]>80 && c[i]>0){
            m[i]+=8000;
        }
        if(a[i]>85 && b[i]>80){
            m[i]+=4000;
        }
        if(a[i]>90){
            m[i]+=2000;
        }
        if(a[i]>85 && f[i]=='Y'){
            m[i]+=1000;
        }
        if(b[i]>80 && e[i]=='Y'){
            m[i]+=850;
        }
    }
    for(i=0;i<n;i++){
        s+=m[i];
    }
    max=m[0];
    maxj=0;
    for(i=1;i<n;i++){
        if(m[i]>max){
            max=m[i];
            maxj=i;
        }
    }
    printf("%s\n%d\n%d",d[maxj],max,s);
    return 0;
}
struct data
{
	char name[21];
	int final;
	int assess;
	char servant;
	char west;
	int pub;
	int bonus;
}student[100], *medium;

void yuanshi(struct data *student)
{
	if(student->final>80&&student->pub>0)
		student->bonus=student->bonus+8000;
}

void wusi(struct data *student)
{
	if(student->final>85&&student->assess>80)
		student->bonus=student->bonus+4000;
}

void chengji(struct data *student)
{
	if(student->final>90)
		student->bonus=student->bonus+2000;
}

void xibu(struct data *student)
{
	if(student->final>85&&student->west=='Y')
		student->bonus=student->bonus+1000;
}

void banji(struct data *student)
{
	if(student->assess>80&&student->servant=='Y')
		student->bonus=student->bonus+850;
}

int main()
{
    int n;
	int i, j, index;
	int max=0, sum=0;
	scanf("%d", &n);
	for(i=0; i<n; i++)
	{
		scanf("%s %d %d %c %c %d", student[i].name, &student[i].final, &student[i].assess, &student[i].servant, &student[i].west, &student[i].pub);
		student[i].bonus=0;
	}
	medium=student;
	for(i=0; i<n; i++)
	{
		banji(medium+i);
		xibu(medium+i);
		chengji(medium+i);
		yuanshi(medium+i);
		wusi(medium+i);
	}
	for(i=0; i<n; i++)
	{
		if(max<student[i].bonus)
		{
			max=student[i].bonus;
			index=i;
		}
		sum=sum+student[i].bonus;
	}
	printf("%s\n%d\n%d", student[index].name, max, sum);
	return 0;
}
struct student
{
	char name[21];
	int score;
	int point;
	char s1[2];
	char s2[2];
	int paper;
}stu[100];
void main()
{
	int n,i,total=0,t[100]={0},max=0;
	scanf("%d\n",&n);
	for(i=0;i<n;i++)
	{scanf("%s%d%d%s%s%d",stu[i].name,&stu[i].score,&stu[i].point,stu[i].s1,stu[i].s2,&stu[i].paper);}		
	for(i=0;i<n;i++)
	{   
		if(stu[i].score>80)
		{
			if(stu[i].paper!=0)
				t[i]+=8000;
			if(stu[i].score>85&&stu[i].point>80)
				t[i]+=4000;		
			if(stu[i].score>85&&stu[i].s2[0]=='Y')
				t[i]+=1000;
			if(stu[i].score>90)
				t[i]+=2000;
		}
		if(stu[i].point>80&&stu[i].s1[0]=='Y')
				t[i]+=850;
	}
	for(i=0;i<n;i++)
	{	max=max>t[i]?max:t[i];}
	for(i=0;i<n;i++)
	{
		if(max==t[i])
		{
			printf("%s\n%d\n",stu[i].name,max);break;
		}
	}
	for(i=0;i<n;i++)	
	{	total+=t[i];
	}
		printf("%d\n",total);
}