semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
struct student
{
	char name[21];
	short finalscore;
	short clascore;
	char position;
	char westen;
	short essaynum;
	int reward;

}
;
int main()
{
	int nstu=4;
	int total=0;
	scanf("%d",&nstu);
	struct student *p=(struct student*)malloc(nstu*sizeof(struct student));
	int i;
	for(i=0;i<nstu;i++)
	{
		scanf("%s",p[i].name);
		scanf("%d",&(p[i].finalscore));
		scanf("%d ",&(p[i].clascore));
		scanf("%c ",&p[i].position);
		scanf("%c",&p[i].westen);
		scanf("%d",&(p[i].essaynum));
		p[i].reward=0;
	}
	for(i=0;i<nstu;i++)
	{
		if(p[i].finalscore>80&&p[i].essaynum>0)
			(p[i].reward)+=8000;
		if(p[i].finalscore>85&&p[i].clascore>80)
			(p[i].reward)+=4000;
		if(p[i].finalscore>90)
			(p[i].reward)+=2000;
		if(p[i].westen=='Y'&&p[i].finalscore>85)
			(p[i].reward)+=1000;
		if(p[i].position=='Y'&&p[i].clascore>80)
			(p[i].reward)+=850;
	}
	int money=p[0].reward;
	for(i=0;i<nstu-1;i++)
	{                  
		if(money<p[i+1].reward)
			money=(p[i+1].reward);
		total+=(p[i].reward);
	}
	total+=(p[nstu-1].reward);
	int j;
	for(j=0;j<nstu;j++)
	{
		if(p[j].reward==money)
			break;
	}
	printf("%s\n",p[j].name);
	printf("%d\n",p[j].reward);
	printf("%d\n",total);
	return 0;
}
struct student
{
 char name[20];
 int score;
 int ping;
 char gan;
 char xi;
 int lun;
 int jiang;
 }stu[100];

int main()
{
 int n,i,t,h=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].ping,&stu[i].gan,&stu[i].xi,&stu[i].lun);
	stu[i].jiang=0;
if(stu[i].score>80&&stu[i].lun>0)stu[i].jiang=stu[i].jiang+8000;
if(stu[i].score>85&&stu[i].ping>80)stu[i].jiang=stu[i].jiang+4000;
if(stu[i].score>90)stu[i].jiang=stu[i].jiang+2000;
if(stu[i].score>85&&stu[i].xi=='Y')stu[i].jiang=stu[i].jiang+1000;
if(stu[i].ping>80&&stu[i].gan=='Y')stu[i].jiang=stu[i].jiang+850;
}for(i=0,t=stu[0].jiang;i<n-1;i++)
{h=h+stu[i].jiang;if(stu[i+1].jiang>t)t=stu[i+1].jiang;}
for(i=0;i<n;i++)
if(stu[i].jiang==t){printf("%s\n%d\n%d",stu[i].name,t,h+stu[n-1].jiang);break;}
return 0;

}
struct Student
{char name[20];
 int a;
 int b;
 char c;
 char d;
 int e;
 int f;
};
int main()
{
	int n,i,k,m,t;
	scanf ("%d",&n);
	struct Student stu[200];
	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);
	    stu[i].f=0;
	}
	for (i=0,m=0;i<n;i++)
	{
		if (stu[i].a>80&&stu[i].e>0)
			stu[i].f=stu[i].f+8000;
		if (stu[i].a>85&&stu[i].b>80)
			stu[i].f=stu[i].f+4000;
		if (stu[i].a>90)
			stu[i].f=stu[i].f+2000;
		if (stu[i].a>85&&stu[i].d=='Y')
			stu[i].f=stu[i].f+1000;
		if (stu[i].b>80&&stu[i].c=='Y')
			stu[i].f=stu[i].f+850;
		if (stu[i].f>m)
		{
			m=stu[i].f;
		    t=i;
		}
	}
	for (i=0,k=0;i<n;i++)
		k=k+stu[i].f;
	printf ("%s\n%d\n%d\n",stu[t].name,m,k);
	return 0;
}
int main ()
{
	int N,i,m,s1,s2,max=0,sum=0,t;
	char name[20],maxname[20],t1,t2;
	scanf ("%d",&N);
	for(i=0;i<N;i++)
	{
		t=0;
		scanf("%s %d %d %c %c %d",name,&s1,&s2,&t1,&t2,&m);
		if(s1>80 && m>=1)
			t+=8000;
		if(s1>85 && s2>80)
			t+=4000;
		if(s1>90)
			t+=2000;
		if(s1>85 && t2=='Y')
			t+=1000;
		if(s2>80 && t1=='Y')
			t+=850;
		sum+=t;
		if(t>max)
		{
			strcpy(maxname,name);
			max=t;
		}
	}
	printf("%s\n%d\n%d\n",maxname,max,sum);
	return 0 ;
}
int main()
{
    int n;
    int i;
    scanf("%d", &n);
    struct student
    {
           char name[1000];
           int final;
           int clas;
           char ganbu;
           char west;
           int paper;
    }stu[1000];
    
    for(i=1;i<=n;i++)
    {
                    scanf("%s %d %d %c %c %d", stu[i].name, &stu[i].final, &stu[i].clas, &stu[i].ganbu, &stu[i].west, &stu[i].paper);
    }
    int total[1000]={0};
    for(i=1;i<=n;i++)
    {
                     if(stu[i].final>80&&stu[i].paper>=1)
                     {
                                                         total[i]=total[i]+8000;
                     }
                     if(stu[i].final>85&&stu[i].clas>80)
                     {
                                                        total[i]=total[i]+4000;
                     }
                     if(stu[i].final>90)
                     {
                                                         total[i]=total[i]+2000;
                     }
                     if(stu[i].final>85&&stu[i].west=='Y')
                     {
                                                          total[i]=total[i]+1000;
                     }
                     if(stu[i].clas>80&&stu[i].ganbu=='Y')
                     {
                                                          total[i]=total[i]+850;
                     }
                 
    }
    
    int max=total[1];
    int sum=total[1];
    int k;
    for(i=2;i<=n;i++)
    {
                     sum=sum+total[i];
                     if(total[i]>max)
                     {
                                     max=total[i];
                     }
    }
    for(i=1;i<=n;i++)
    {
                     if(total[i]==max)
                     {
                                      printf("%s\n", stu[i].name);
                                      break;
                     }
    }
    printf("%d\n", max);
    printf("%d", sum);
    
    
   
    return 0;
}
void main()
{
	struct student
	{
		char num[21];
		int scor1;
		int scor2;
		char g;
		char x;
		int lun;
		int ss;
	}stu[100];
	int i,n,sum=0;
	struct student max;

	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s %d %d %c %c %d",stu[i].num,&stu[i].scor1,&stu[i].scor2,&stu[i].g,&stu[i].x,&stu[i].lun);
		stu[i].ss=0;
	}

	for(i=0;i<n;i++)
	{
		if(stu[i].scor1>80&&stu[i].lun>0)
			stu[i].ss+=8000;

		if(stu[i].scor1>85&&stu[i].scor2>80)
			stu[i].ss+=4000;

		if(stu[i].scor1>90)
			stu[i].ss+=2000;

		if(stu[i].scor1>85&&stu[i].x=='Y')
			stu[i].ss+=1000;

		if(stu[i].scor2>80&&stu[i].g=='Y')
			stu[i].ss+=850;
	}

	max=stu[0];
	for(i=0;i<n;i++)
	{
		if(stu[i].ss>max.ss)
			max=stu[i];
		sum+=stu[i].ss;
	}
	printf("%s\n",max.num);
	printf("%d\n",max.ss);
	printf("%d\n",sum);
}
struct person{
	char pname[30];
	int s1,s2,s3;
	char c1,c2;
	int money;
};
int main(){
	struct person p[100];
	int n,m,i,j,k;
	long tot;
	for(i=0;i<100;i++){
		p[i].s1=0;
		p[i].s2=0;
		p[i].s3=0;
		p[i].money=0;
	}
	scanf("%d",&n);
	k=0;
	tot=0;
	for(i=0;i<n;i++){
		scanf("%s%d%d %c %c %d",p[i].pname,&p[i].s1,&p[i].s2,&p[i].c1,&p[i].c2,&p[i].s3);
		if(p[i].s1>80&&p[i].s3>=1)
			p[i].money+=8000;
		if(p[i].s1>85&&p[i].s2>80)
			p[i].money+=4000;
		if(p[i].s1>90)
			p[i].money+=2000;
		if(p[i].s1>85&&p[i].c2=='Y')
			p[i].money+=1000;
		if(p[i].s2>80&&p[i].c1=='Y')
			p[i].money+=850;
		tot+=p[i].money;
		if(p[i].money>p[k].money)
			k=i;
	}
	printf("%s\n%d\n%d\n",p[k].pname,p[k].money,tot);
	return 0;
}
int main(){
    int n , i , p = 0 , sum = 0 , q;
	struct student{
		char name[200];
		int c1 , c2 , wx , wa;
		char bg , xb ;	
	}stu[101];
	scanf("%d" , &n);
	for( i = 0 ; i <= n - 1; i++){
		stu[i].wa = 0 ;
		scanf("%s %d %d %c %c %d", stu[i].name , &stu[i].c1 , &stu[i].c2 ,  &stu[i].bg , &stu[i].xb , &stu[i].wx);
//			printf("%s %d %d %c %c %d\n", stu[i].name , stu[i].c1 , stu[i].c2 ,  stu[i].bg , stu[i].xb , stu[i].wx);
		if( stu[i].c1 > 80 && stu[i].wx != 0 ) stu[i].wa = stu[i].wa + 8000 ;
		if( stu[i].c1 > 85 && stu[i].c2 > 80 ) stu[i].wa = stu[i].wa + 4000 ;
		if( stu[i].c1 > 90 ) stu[i].wa = stu[i].wa + 2000;
		if( stu[i].c1 > 85 && stu[i].xb == 'Y' ) stu[i].wa = stu[i].wa + 1000;
		if( stu[i].c2 > 80 && stu[i].bg == 'Y' ) stu[i].wa = stu[i].wa + 850 ;
		if( stu[i].wa > p ) {p = stu[i].wa ;q = i ;}
		sum = sum + stu[i].wa ;
//			printf("wa%d\n %d\n" , stu[i].wa , q);
	}
	printf("%s\n%d\n%d\n" , stu[q].name , stu[q].wa , sum);

    return(0);

}
struct Student{
	char name[20];
	int mark;
	int classpoint;
	char leader;
	char west;
	int paper;
	int money;
};
void main(){
	int i,n,maxnum,tot=0;
	struct Student stu[100]={0};
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{scanf("%s %d %d %c %c %d",stu[i].name,&stu[i].mark,&stu[i].classpoint,&stu[i].leader,&stu[i].west,&stu[i].paper);
	}
	for(i=0;i<n;i++)
	{if(stu[i].mark>80&&stu[i].paper>0) stu[i].money=stu[i].money+8000;
	if(stu[i].mark>85&&stu[i].classpoint>80) stu[i].money=stu[i].money+4000;
	if(stu[i].mark>90) stu[i].money=stu[i].money+2000;
	if(stu[i].mark>85&&(stu[i].west=='Y')) stu[i].money=stu[i].money+1000;
	if(   stu[i].leader=='Y'&&(stu[i].classpoint>80) )stu[i].money=stu[i].money+850;
	}
	maxnum=0;
    for(i=1;i<n;i++)
		if(stu[maxnum].money<stu[i].money) maxnum=i;
	for(i=0;i<n;i++)
		tot=tot+stu[i].money;
	printf("%s\n%d\n%d",stu[maxnum].name,stu[maxnum].money,tot);
}
struct student{
	char name[21];
	int qimo;
	int banji;
	char ganbu;
	char west;
	int article;
	int total;
};

int main(){
	int n,i,max,sum;

	scanf("%d",&n);

	struct student *stu=(struct student *)malloc(sizeof(int)*4*n+sizeof(char)*23*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].west,&stu[i].article);
		stu[i].total =0;
	}


	for(i=0;i<n;i++){
		if(stu[i].qimo>80&&stu[i].article>0){
			stu[i].total +=8000;
		}
		if(stu[i].qimo>85&&stu[i].banji>80){
			stu[i].total +=4000;
		}
		if(stu[i].qimo>90){
			stu[i].total+=2000;
		}
		if(stu[i].qimo >85&&stu[i].west=='Y'){
			stu[i].total +=1000;
		}
		if(stu[i].banji >80&&stu[i].ganbu =='Y'){
			stu[i].total +=850;
		}
	}
	max=stu[0].total ;
	sum=0;
	for(i=0;i<n;i++){
		if(stu[i].total>max){
			max=stu[i].total ;
		}
		sum+=stu[i].total ;
	}
	for(i=0;i<n;i++){
		if(max==stu[i].total){
			printf("%s\n%d\n%d\n",stu[i].name,max,sum);
			break;
		}
	}

	return 0;
	
}
struct stu
{
   char x[20];
   int a;
   int b;
   char c[2];
   char d[2];
   int e;
   int t;
};
int main()
{
	int n,i,m;
	struct stu h[100]={0};
    scanf("%d",&n);
	for(i=0,m=0;i<=(n-1);i++)
	{
		scanf("%s%d%d%s%s%d",&h[i].x,&h[i].a,&h[i].b,&h[i].c,&h[i].d,&h[i].e);
		if(h[i].a>80&&h[i].e>=1)
			h[i].t+=8000;
		if(h[i].a>85&&h[i].b>80)
			h[i].t+=4000;
		if(h[i].a>90)
			h[i].t+=2000;
		if(h[i].a>85&&strcmp(h[i].d,"Y")==0)
			h[i].t+=1000;
		if(h[i].b>80&&strcmp(h[i].c,"Y")==0)
			h[i].t+=850;
		m+=h[i].t;
	}
	for(i=0;i<=(n-1);i++)
	{
		if(h[i].t>=h[i+1].t)
			h[i+1]=h[i];
	}
	printf("%s\n%d\n%d",h[n-1].x,h[n-1].t,m);
}
struct scholarship
{
	char name[20];
	int avscore;
	int clscore;
	char ganbu;
	char xibu;
	int paper;
}stu[100];
void main()
{
int n,i,b[100]={0},c=0,d=0,all=0;
scanf("%d",&n);
for(i=0;i<n;i++)
{
	scanf("%s %d %d %c %c %d",stu[i].name,&stu[i].avscore,&stu[i].clscore,&stu[i].ganbu,&stu[i].xibu,&stu[i].paper);
	if(stu[i].avscore>80&&stu[i].paper>0)
		b[i]=b[i]+8000;
	if(stu[i].avscore>85&&stu[i].clscore>80)
		b[i]=b[i]+4000;
	if(stu[i].avscore>90)
		b[i]=b[i]+2000;
	if(stu[i].avscore>85&&stu[i].xibu=='Y')
		b[i]=b[i]+1000;
	if(stu[i].ganbu=='Y'&&stu[i].clscore>80)
		b[i]=b[i]+850;
	if(i>0&&b[i]>c)
	{
		c=b[i];
		d=i;
	}
	else if(i==0) 
		c=b[0];
}
for(i=0;i<n;i++)
all=all+b[i];

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


}
struct student
{
       char name[20];
       int a;
       int b;
       char c1;
       char c2;
       int d;
}stu[100];
int main()
{
    int n,i,p[100]={0},sum=0,max;
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
    scanf("%s",stu[i].name);
    scanf("%d %d %c %c %d",&stu[i].a,&stu[i].b,&stu[i].c1,&stu[i].c2,&stu[i].d);
    }
    for(i=0;i<n;i++)
    {
                          if((stu[i].a>80)&&(stu[i].d>0))
                          p[i]=p[i]+8000;
                          if((stu[i].a>85)&&(stu[i].b>80))
                          p[i]=p[i]+4000;
                          if(stu[i].a>90)
                          p[i]=p[i]+2000;
                          if((stu[i].a>85)&&(stu[i].c2=='Y'))
                          p[i]=p[i]+1000;
                          if((stu[i].b>80)&&(stu[i].c1=='Y'))
                          p[i]=p[i]+850;
                          sum=sum+p[i];
    }
    max=p[0];
 for(i=0;i<n;i++)
 {
                   if(p[i]>max)
                   max=p[i];
 }
 for(i=0;i<n;i++)
 {
                   if(p[i]==max)
                   {
                               printf("%s\n",stu[i].name);
                               printf("%d\n",p[i]);
                               break;
                   }
                   }
                   printf("%d\n",sum);
                   return 0;
 }
struct 
{
	char name[20];
	int qimo;
	int banji;
	char gb;
	char xb;
	int paper;
}stu[101];

void main()
{
	int N, i, max=0, p=0, total=0, sch[101]={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].gb,&stu[i].xb,&stu[i].paper);
	for(i=0;i<N;i++)
	{  
		if(stu[i].qimo>80&&stu[i].paper>0)
			sch[i]+=8000;
		if(stu[i].qimo>85&&stu[i].banji>80)
			sch[i]+=4000;
		if(stu[i].qimo>90)
			sch[i]+=2000;
		if(stu[i].qimo>85&&stu[i].xb=='Y')
			sch[i]+=1000;
		if(stu[i].banji>80&&stu[i].gb=='Y')
			sch[i]+=850;
	}
	max=0;
	for(i=0;i<N;i++)
	{
		if(sch[i]>max)
		{
			max=sch[i];
			p=i;
		}
		total=total+sch[i];
	}
	printf("%s\n%d\n%d\n",stu[p].name,sch[p],total);
}
struct student
{
	char name[20];
	int score;
	int value;
	char cadre;
	char west;
	int paper;
	int sum;
};
int deal(struct student stu)
{
	stu.sum=0;
	if(stu.score>80&&stu.paper>0)
		stu.sum+=8000;
	if(stu.score>85&&stu.value>80)
		stu.sum+=4000;
	if(stu.score>90)
		stu.sum+=2000;
	if(stu.score>85&&stu.west=='Y')
		stu.sum+=1000;
	if(stu.value>80&&stu.cadre=='Y')
		stu.sum+=850;
	return(stu.sum);
}
void main()
{
	int n,i,total=0,top=0,t=0;
	scanf("%d",&n);
	struct student stu[100];
	for(i=0;i<n;i++)
	{scanf("%s %d %d %c %c %d",stu[i].name,&stu[i].score,&stu[i].value,&stu[i].cadre,&stu[i].west,&stu[i].paper);
	stu[i].sum=deal(stu[i]);total+=stu[i].sum;
	if(stu[i].sum>top)
	{top=stu[i].sum;t=i;}
	}
	printf("%s\n%d\n%d",stu[t].name,top,total);
}
int main (){
int n;
	scanf("%d",&n);
	int i;
	int sum=0,max=0;
	char t[30];
	for(i=0;i<n;i++){
		char p[30],c,v;
		int m,k,b,g=0,z=0;
		scanf("%s %d %d %c %c %d",p,&m,&k,&c,&v,&b);
		if(m>80&&b>=1) g=g+8000;
		if(m>85&&k>80) g=g+4000;
		if(m>90) g=g+2000;
		if(m>85&&v=='Y') g=g+1000;
		if(k>80&&c=='Y') g=g+850;
		if(g>max){
			max=g;
			z=strlen(p);
			for(int h=0;h<z;h++){
				t[h]=p[h];
			}
			t[z]='\0';
		}
		else max=max;
		sum=sum+g;
	}
	printf("%s\n%d\n%d",t,max,sum);
	return 0;
}
struct student
{
char name[35];
int final;
int score;
char leader;
char west;
int paper;
int money;
struct student *next;
};

struct student *creat(void)
{
struct student *p,*q,*head;
int n,i=0;
scanf("%d",&n);

head=(struct student*)malloc(sizeof (struct student));
scanf("%s %d %d %c %c %d",&head->name,&head->final,&head->score,&head->leader,&head->west,&head->paper);
q=head;
p=head;

for(i=0;i<n;i++)
{
q=p;
q->money=0;
if ((q->final>80)&&(q->paper>0)) q->money=q->money+8000;
if ((q->final>85)&&(q->score>80)) q->money=q->money+4000;
if (q->final>90) q->money=q->money+2000;
if ((q->final>85)&&(q->west=='Y')) q->money=q->money+1000;
if ((q->score>80)&&(q->leader=='Y')) q->money=q->money+850;

if(i<n-1) 
{p=(struct student*)malloc(sizeof (struct student));
scanf("%s %d %d %c %c %d",&p->name,&p->final,&p->score,&p->leader,&p->west,&p->paper);
q->next=p;}
}

q->next=NULL;
return(head);
}

void main()
{
struct student *p,*q,*r;
int sum=0,max=0;
p=creat();

for(q=p;q!=NULL;)
{if (q->money>max) {max=q->money; r=q;}
sum=sum+q->money;
q=q->next;
}

printf("%s\n%d\n",r->name,r->money);
printf("%d",sum);
}
int main()
{
	int N,fgrade[101],cgrade[101],lunwen[101],jiang[101],max=0,x,sum=0;
	cin>>N;
	cin.get();
	char name[101][20],ganbu[101],xibu[101];
	for(int i=1;i<=N;i++)
	{
		cin>>name[i]>>fgrade[i]>>cgrade[i]>>ganbu[i]>>xibu[i]>>lunwen[i];
        
	}
	for(int i=1;i<=N;i++)
	{
		jiang[i]=(fgrade[i]>80&&lunwen[i]>=1)*8000+(fgrade[i]>85&&cgrade[i]>80)*4000+(fgrade[i]>90)*2000+
			     (fgrade[i]>85&&xibu[i]=='Y')*1000+(cgrade[i]>80&&ganbu[i]=='Y')*850;
		sum=sum+jiang[i];
		if(max<jiang[i])
		{
			max=jiang[i];
		    x=i;
		}
	}
cout<<name[x]<<endl<<jiang[x]<<endl<<sum<<endl;
return 0;
}
struct student
{
	char name[20];
	int score1;
	int score2;
	char lead;
	char west;
	int paper;
	int sch;
	struct student *next;
};
void main()
{
	struct student *p0,*p1,*p2,*head;
	int n,k,i;
	scanf("%d",&n);
	p1=(struct student *)malloc(sizeof(struct student));
	p1->sch=0;
	scanf("%s %d %d %c %c %d",p1->name,&p1->score1,&p1->score2,&p1->lead,&p1->west,&p1->paper);
	if((p1->score1>80)&&(p1->paper>0))
		p1->sch=p1->sch+8000;
	if((p1->score1>85)&&(p1->score2>80))
		p1->sch=p1->sch+4000;
	if(p1->score1>90)
		p1->sch=p1->sch+2000;
	if((p1->score1>85)&&(p1->west=='Y'))
		p1->sch=p1->sch+1000;
	if((p1->score2>80)&&(p1->lead=='Y'))
		p1->sch=p1->sch+850;
	head=p1;
	p1->next=NULL;
	for(i=1;i<n;i++)
	{
		p1=head;
		p0=(struct student *)malloc(sizeof(struct student));
		scanf("%s %d %d %c %c %d",p0->name,&p0->score1,&p0->score2,&p0->lead,&p0->west,&p0->paper);
		p0->sch=0;
		if((p0->score1>80)&&(p0->paper>0))
			p0->sch=p0->sch+8000;
		if((p0->score1>85)&&(p0->score2>80))
			p0->sch=p0->sch+4000;
		if(p0->score1>90)
			p0->sch=p0->sch+2000;
		if((p0->score1>85)&&(p0->west=='Y'))
			p0->sch=p0->sch+1000;
		if((p0->score2>80)&&(p0->lead=='Y'))
			p0->sch=p0->sch+850;
		while((p0->sch<=p1->sch)&&(p1->next!=NULL))
		{
			p2=p1;
			p1=p1->next;
		}
		if(p0->sch>p1->sch)
		{
			if(head==p1)
				head=p0;
			else p2->next=p0;
			p0->next=p1;
		}
		else 
		{
			p1->next=p0;
			p0->next=NULL;
		}
	}
	k=0;
	p1=head;
	while(p1!=NULL)
	{
		k=k+p1->sch;
		p1=p1->next;
	}
	printf("%s\n%d\n%d",head->name,head->sch,k);
}
struct stu
{ char name[100];
  int qm;
  int py;
  char gb;
  char xb;
  int lw;
  int jj;
};
int a[101]={0};
int main()
{ void pai(struct stu s[],int n,int a[]);
  struct stu s[101];
  int i=0,n=0,sum=0;
  char m[100]={'\0'};
  for(i=0;i<101;i++)
  { strcpy(s[i].name,m);
    s[i].qm=0;
    s[i].py=0;
    s[i].gb='\0';
    s[i].xb='\0';
    s[i].lw=0;
    s[i].jj=0;
		}
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{ scanf("%s",s[i].name);
	  scanf("%d %d %c %c %d",&s[i].qm,&s[i].py,&s[i].gb,&s[i].xb,&s[i].lw);
	  if(s[i].qm>80&&s[i].lw>=1) s[i].jj=s[i].jj+8000;
	  if(s[i].qm>85&&s[i].py>80) s[i].jj=s[i].jj+4000;
	  if(s[i].qm>90) s[i].jj=s[i].jj+2000;
	  if(s[i].xb=='Y'&&s[i].qm>85) s[i].jj=s[i].jj+1000;
	  if(s[i].py>80&&s[i].gb=='Y') s[i].jj=s[i].jj+850;
		sum=sum+s[i].jj;
		a[i]=i;
		}
	pai(s,n,a);
	printf("%s\n",s[a[0]].name);
	printf("%d\n",s[a[0]].jj);
	printf("%d",sum);	
	
	
	return(0);
}
void pai(struct stu s[],int n,int a[])
{ int t=0;
  int i=0,j=0;
  for(i=0;i<n;i++)
   {for(j=0;j<n-i-1;j++)
      { if(s[a[j]].jj<s[a[j+1]].jj)
         { t=a[j];
           a[j]=a[j+1];
           a[j+1]=t;
				}
			}
		}
}
struct student
{
	char name[20];
	int end;
	int clas;
	char leader;
	char west;
	int paper;
	struct student *next;
};
int main()
{
	struct student *p,*q,*head;
	char *a;
	int *b,*c;
	int n,i,max=0;
	long int sum=0;
	scanf("%d\n",&n);
	head=p=q=(struct student *)malloc(LEN);
	a=(char*)malloc(20*sizeof(char));
	b=c=(int *)malloc(n*sizeof(int));
	for(i=0;i<n;i++)
	{
		scanf("%s %d %d %c %c %d\n",p->name,&p->end,&p->clas,&p->leader,&p->west,&p->paper);
		p=(struct student *)malloc(LEN);
		q->next=p;
		q=p;
	}
	q->next=NULL;
	q=p=head;
	for(i=0;i<n;i++)
	{
		if(((p->end)>80)&&((p->paper)>0))*b+=8000;
		if(((p->end)>85)&&((p->clas)>80))*b+=4000;
		if((p->end)>90)*b+=2000;
		if(((p->end)>85)&&((p->west)=='Y'))*b+=1000;
		if(((p->clas)>80)&&((p->leader)=='Y'))*b+=850;
		b++;
		p=q->next;
		q=p;
	}
	q=p=head;
	b=c;
	for(i=0;i<n;i++)
	{
		if(*b>max)
		{
			max=*b;
			strcpy(a,p->name);
		}
		sum+=*b;
		b++;
		p=q->next;
		q=p;
	}
	printf("%s\n%d\n%ld\n",a,max,sum);
}
struct student
	{
		char name[21];
		int gpa;
		int c_gpa;
		char official;
		char west;
		int paper;
	};

void main()
{
	int process( struct student *p);
	
	struct student stu[100],*p,*P=NULL;
	int i=0,n,TOTAL=0,max=0,MAX=0;


	p=stu;
	scanf("%d\n",&n);
	for(i;i<n;i++)
	{
		
		scanf("%s %d %d %c %c %d",p->name,&p->gpa,&p->c_gpa,&p->official,&p->west,&p->paper);
		max=process(p++);
		if(max>MAX) {MAX=max;P=p-1;}
		TOTAL += max;
	}

	printf("%s\n%d\n%d", P->name,MAX,TOTAL);

}

int process( struct student *p)
{
	int prize=0;
	if (p->gpa>80 && p->paper>=1) prize += 8000;
	if (p->gpa>85 && p->c_gpa>80) prize += 4000;
	if (p->gpa>90) prize += 2000;
	if (p->gpa>85 && p->west=='Y') prize += 1000;
	if (p->c_gpa>80 && p->official=='Y') prize +=850;
	return prize;
}
struct student
{
	char name[30];
	int sco;
	int pin;
	char gan;
	char xi;
	int lun;
};
struct student stu[100];
void main()
{
	int i,j,k,m,n,a[100],sum=0,t,add=0;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		scanf("%s %d %d %c %c %d",stu[i].name,&stu[i].sco,&stu[i].pin,&stu[i].gan,&stu[i].xi,&stu[i].lun);
		a[i]=0;
	}
	for(i=1;i<=n;i++)
	{
		if(stu[i].sco>80&&stu[i].lun>=1)
			a[i]=a[i]+8000;
		if(stu[i].sco>85&&stu[i].pin>80)
			a[i]=a[i]+4000;
		if(stu[i].sco>90)
			a[i]=a[i]+2000;
		if(stu[i].sco>85&&stu[i].xi=='Y')
			a[i]=a[i]+1000;
		if(stu[i].pin>80&&stu[i].gan=='Y')
			a[i]=a[i]+850;
	}
	for(i=1;i<=n;i++)
	{
		if(sum<a[i])
			sum=a[i];
	}
	for(i=1;i<=n;i++)
	{
		if(a[i]==sum)
		{
			t=i;break;
		}
			
	}
	for(i=1;i<=n;i++)
	{add=add+a[i];}

	printf("%s\n%d\n%d",stu[t].name,sum,add);
	
}
int main()
{
	struct std{
		char name[20];
		int qm,bp,lw,jj;
		char gb,xb;
	}stu[200];
	int n,i,s=0,max;
	char mn[20];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		stu[i].jj=0;
		scanf("%s %d %d %c %c %d",stu[i].name,&stu[i].qm,&stu[i].bp,&stu[i].gb,&stu[i].xb,&stu[i].lw);
		if(stu[i].qm>80&&stu[i].lw>0){stu[i].jj+=8000;}
		if(stu[i].qm>85&&stu[i].bp>80){stu[i].jj+=4000;}
		if(stu[i].qm>90){stu[i].jj+=2000;}
		if(stu[i].qm>85&&stu[i].xb=='Y'){stu[i].jj+=1000;}
		if(stu[i].bp>80&&stu[i].gb=='Y'){stu[i].jj+=850;}
		s=s+stu[i].jj;
	}
	max=stu[0].jj;
	strcpy(mn,stu[0].name);
	for(i=0;i<n;i++)
	{
		if(max<stu[i].jj)
		{
			max=stu[i].jj;
			strcpy(mn,stu[i].name);
		}
	}
	printf("%s\n%d\n%d",mn,max,s);
	return 0;
}
/*????????????????????????????????????????????
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?1 ? N ? 100??????????????N????????????????????????????
??????????????????????????????????????????????????????20???????????
???????????????0?100????????0?100?????????????????????????????Y????N?????
???????0?10??????0?10????????????????????
????
?????????????????????????????????????????????????????????????
????????????????????????????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*/
int main()
{
	int n,i,sum[100],b[100],c[100],f[100],total=0,max=0,x=0;
	char a[100][20],d[100],e[100];
	cin>>n;
	for(i=0;i<n;i++)
	{
		cin>>a[i]>>b[i]>>c[i]>>d[i]>>e[i]>>f[i];
	}
	for(i=0;i<n;i++)
	{
		sum[i]=0;
		if(b[i]>90)
		{
			sum[i]=sum[i]+2000;
		}
		if((c[i]>80)&&(d[i]=='Y'))
		{
			sum[i]=sum[i]+850;
		}
		if((b[i]>85)&&(e[i]=='Y'))
		{
			sum[i]=sum[i]+1000;
		}
		if((b[i]>85)&&(c[i]>80))
		{
			sum[i]=sum[i]+4000;
		}
		if((b[i]>80)&&(f[i]>=1))
		{
			sum[i]=sum[i]+8000;
		}
		total=total+sum[i];
		if(sum[i]>max)
		{
			max=sum[i];
			x=i;
		}
	}
	cout<<a[x]<<endl;
	cout<<max<<endl;
	cout<<total<<endl;
	return 0;
}