semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
struct student
{
       char name[20];
       int scorefinal;
       int scoreclass;
       char gan;
       char xi;
       int lun;
       int money;
       struct student *next; 
};
main()
{
      int n,j,sum=0,flag=0;
      struct student *head;
      struct student *p1,*p2,*p5,*p4,*p;
      scanf("%d",&n);
      p1=p2=(struct student*)malloc(LEN);
      p1->money=0;
      scanf("%s %d %d %c %c %d",p1->name,&p1->scorefinal,&p1->scoreclass,&p1->gan,&p1->xi,&p1->lun);
      head=p1;
      for(j=0;j<n-1;j++)
      {
          p1=(struct student*)malloc(LEN);
          p1->money=0;
          p2->next=p1;
          p2=p1;
          scanf("%s %d %d %c %c %d",p1->name,&p1->scorefinal,&p1->scoreclass,&p1->gan,&p1->xi,&p1->lun);
      }
      p2->next=NULL;
      p5=head;
      for(;p5!=NULL;p5=p5->next)
      {   if(p5->scorefinal>80&&p5->lun>=1) p5->money=p5->money+8000;
          if(p5->scorefinal>85&&p5->scoreclass>80) p5->money=p5->money+4000;
          if(p5->scorefinal>90) p5->money=p5->money+2000;
          if(p5->scorefinal>85&&p5->xi=='Y') p5->money=p5->money+1000;
          if(p5->scoreclass>80&&p5->gan=='Y') p5->money=p5->money+850;
          sum=sum+p5->money;
      }
      for(p4=head;p4!=NULL;p4=p4->next)
      {   
          if(p4->money>flag)
          {flag=p4->money;p=p4;}
      }
      printf("%s\n%d\n%d",p->name,flag,sum);
   
}
int main ()
{
	int n,sum=0,max,i;
	struct stus {
		char as[21],e,f;
		int a,b,c,mon;
	}stus[100];
	scanf("%d\n",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s %d %d %c %c %d",stus[i].as,&stus[i].a,&stus[i].b,&stus[i].e,&stus[i].f,&stus[i].c);
	}
	for(i=0;i<n;i++)
	{
		stus[i].mon=0;
	}
	for(i=0;i<n;i++)
	{
		if(stus[i].a>80 && stus[i].c>=1)
		{
			stus[i].mon+=8000;
		}
		if(stus[i].a>85 && stus[i].b>80)
		{
			stus[i].mon+=4000;
		}
		if(stus[i].a>90)
		{
			stus[i].mon+=2000;
		}
		if(stus[i].a>85 && stus[i].f=='Y')
		{
			stus[i].mon+=1000;
		}
		if(stus[i].b>80 && stus[i].e=='Y')
		{
			stus[i].mon+=850;
		}
	}
	max=0;
	for(i=0;i<n;i++)
	{
		if(max<stus[i].mon)
		{
			max=stus[i].mon;
		}
		sum+=stus[i].mon;
	}
	for(i=0;i<n;i++)
	{
		if(max==stus[i].mon)
		{
			printf("%s\n",stus[i].as);
			printf("%d\n",max);
			printf("%d\n",sum);
			break;
		}
	}
	return 0;
}
struct student
{
  char name[20];
  int qimo;
  int banji;
  char ganbu;
  char xisheng;
  int lunwen;
 }stu[300];
int main(){
int n,m,i,sum=0;
int money[300];
char a[20];
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].xisheng,&stu[i].lunwen);
}
for(i=0;i<n;i++){
		money[i]=0;
	if(stu[i].qimo>80&&stu[i].lunwen>0){
		money[i]=money[i]+8000;
	}
	if(stu[i].qimo>85&&stu[i].banji>80){
		money[i]=money[i]+4000;
	}
	if(stu[i].qimo>90){
		money[i]=money[i]+2000;
	}
	if(stu[i].qimo>85&&stu[i].xisheng=='Y'){
		money[i]=money[i]+1000;
	}
	if(stu[i].banji>80&&stu[i].ganbu=='Y'){
		money[i]=money[i]+850;
	}
		sum=sum+money[i];
}

strcpy(a,stu[0].name);
m=money[0];
for(i=1;i<n;i++){
	if(money[i]>m){
		m=money[i];
		strcpy(a,stu[i].name);
	}
}
printf("%s\n%d\n%d\n",a,m,sum);

return 0;
}
struct stu
{
	char name[25];
	int s1;
	int s2;
	char y1;
	char y2;
	int t;
	int sum;
	struct stu *next;
};

struct stu *creat(int n)
{
	int i;
	struct stu *head;
	struct stu *p1,*p2;
	p1=p2=(struct stu *)malloc(LEN);
	scanf("%s %d %d %c %c %d",p1->name,&p1->s1,&p1->s2,&p1->y1,&p1->y2,&p1->t);
	head=NULL;
	
	for(i=0;i<n-1;i++)
	{
	
		if(i==0)head=p1;
		p1=(struct stu*)malloc(sizeof(struct stu));
		scanf("%s %d %d %c %c %d",p1->name,&p1->s1,&p1->s2,&p1->y1,&p1->y2,&p1->t);
		p2->next=p1;
		p2=p1;
	}
	p2->next=NULL;
	return (head);
}
void print(struct stu*head)
{
	struct stu*p;
	p=head;
	if(head!=NULL)
		do
		{
			printf("%s %d %d %c %c %d\n",p->name,p->s1,p->s2,p->y1,p->y2,p->t);
			p=p->next;
		}while(p!=NULL);
}

main()
{
	int n,i,s,max;
	struct stu *head,*p1,*p2,*p3,*p;
	scanf("%d",&n);
	head=creat(n);
	p3=p2=p1=head;
	for(i=0;i<n;i++)
	{
		p1->sum=0;
		if((p1->t>0)&&(p1->s1>80))p1->sum=p1->sum+8000;
		if((p1->s2>80)&&(p1->s1>85))p1->sum=p1->sum+4000;
		if(p1->s1>90)p1->sum=p1->sum+2000;
		if((p1->y2=='Y')&&(p1->s1>85))p1->sum=p1->sum+1000;
		if((p1->y1=='Y')&&(p1->s2>80))p1->sum=p1->sum+850;
		p1=p1->next;
	}
	max=0;
	p1=head;
	for(i=0;i<n;i++)
	{
		if(p1->sum>max)
		{
			max=p1->sum;
			p2=p1;
		}
		p1=p1->next;
	}

	s=0;
	p1=head;
	for(i=0;i<n;i++)
	{
		s=s+p1->sum;
		p1=p1->next;
	}
	printf("%s\n%d\n%d\n",p2->name,p2->sum,s);
}
main()
{
	int n,i,j,m=0,t,s=0,a[100][5]={0},b[100],c[100];
	struct student
	{
		char name[20];
		int qimo;
		int pingyi;
		char ganbu;
		char xibu;
		int lunwen;
	};
	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].qimo,&stu[i].pingyi,&stu[i].ganbu,&stu[i].xibu,&stu[i].lunwen);
	for(i=0;i<n;i++)
	{
		if(stu[i].qimo>80&&stu[i].lunwen>=1) a[i][0]=8000;
		if(stu[i].qimo>85&&stu[i].pingyi>80) a[i][1]=4000;
		if(stu[i].qimo>90) a[i][2]=2000;
		if(stu[i].qimo>85&&stu[i].xibu=='Y') a[i][3]=1000;
		if(stu[i].pingyi>80&&stu[i].ganbu=='Y') a[i][4]=850;
		b[i]=a[i][0]+a[i][1]+a[i][2]+a[i][3]+a[i][4];
	}
	for(i=0;i<n;i++)
		c[i]=b[i];
	for(i=0;i<n-1;i++)
	{
		for(j=0;j<n-1-i;j++)
			if(c[j]>c[j+1])
			{
				t=c[j];
				c[j]=c[j+1];
				c[j+1]=t;
			}
	}
	for(i=0;i<n;i++)
	{
		if(b[i]==c[n-1])
		{
			m=i;
			break;
		}
	}
	for(i=0;i<n;i++)
		s=s+b[i];
	printf("%s\n",stu[m].name);
	printf("%d\n",c[n-1]);
	printf("%d\n",s);
	return 0;
}
struct jiangli
{
	char name[20];
	int	study;
	int cla;
	char gugan;
	char xibu;
	int paper;
	int money;
}stu[100];
void main()
{
	int n,i,max,sum=0,k;
	scanf ("%d",&n);
	for (i=0;i<n;i++)
		scanf("%s %d %d %c %c %d",stu[i].name,&stu[i].study,&stu[i].cla,&stu[i].gugan,&stu[i].xibu,&stu[i].paper);
	for (i=0;i<n;i++)
	{
		stu[i].money=0;
		if (stu[i].study>80&&stu[i].paper>=1)
			stu[i].money+=8000;
		if (stu[i].study>85&&stu[i].cla>80)
			stu[i].money+=4000;
		if (stu[i].study>90)
			stu[i].money+=2000;
		if (stu[i].study>85&&stu[i].xibu=='Y')
			stu[i].money+=1000;
		if (stu[i].cla>80&&stu[i].gugan=='Y')
        	stu[i].money+=850;
	}
	max=stu[0].money;
	for (i=0;i<n;i++)
	{
		sum=sum+stu[i].money;
		if (max<stu[i].money)
		{
			max=stu[i].money;
		    k=i;
		}
	}
		printf("%s\n%d\n%d",stu[k].name,stu[k].money,sum);
}
struct people
{
       char name[30];
       int qimo;
       int pingyi;
       char gan;
       char xi;
       int lunwen;
       int jiang;
}line[100], temp;
int main()
{
    int n, i, j;
    scanf("%d\n", &n);
    int sum=0;
    for(i=1;i<=n;i++)
    {
        scanf("%s %d %d %c %c %d", &line[i].name, &line[i].qimo, &line[i].pingyi, &line[i].gan, &line[i].xi, &line[i].lunwen);
        line[i].jiang=0;
        if(line[i].qimo>80&&line[i].lunwen!=0)
        {
            line[i].jiang+=8000;
        }
        if(line[i].qimo>85&&line[i].pingyi>80)
        {
            line[i].jiang+=4000;
        }
        if(line[i].qimo>90)
        {
            line[i].jiang+=2000;
        }
        if(line[i].qimo>85&&(int)line[i].xi==(int)'Y')
        {
            line[i].jiang+=1000;
        }
        if(line[i].pingyi>80&&(int)line[i].gan==(int)'Y')
        {
            line[i].jiang+=850;
        }
        sum+=line[i].jiang;
    }
    for(i=1;i<n;i++)
    {
        for(j=1;j<=n-i;j++)
        {
            if(line[j].jiang<line[j+1].jiang)
            {
                temp=line[j];
                line[j]=line[j+1];
                line[j+1]=temp;
            }
        }
    }
    printf("%s\n%d\n%d", line[1].name, line[1].jiang, sum);
    return 0;
}
int main(int argc, char* argv[])
{
    int N,i,sch,msch=0,ssch=0;
	char mname[21];
		char name[21];
		int aver;
		int ping;
        char lead;
		char west;
		int essay;
	scanf("%d",&N);
	for(i=1;i<=N;i++)
	{
        sch=0;
		scanf("%s%d%d %c %c%d",name,&aver,&ping,&lead,&west,&essay);
        if((aver>80)&&(essay>=1))sch=sch+8000;
        if((aver>85)&&(ping>80))sch=sch+4000;
		if(aver>90)sch=sch+2000;
		if((aver>85)&&(west=='Y'))sch=sch+1000;
		if((ping>80)&&(lead=='Y'))sch=sch+850;
		ssch=ssch+sch;
		if(sch>msch)
		{
			msch=sch;
			strcpy(mname,name);
		}
	}
    printf("%s\n%d\n%d\n",mname,msch,ssch);
	return 0;
}
struct student
{
	char name[20];
	int final;
	int pingyi;
	char leader;
	char wester;
	int essay;
}stu[200];
void main()
{
	int n,i,sum=0,prize,max=0,k=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].pingyi,&stu[i].leader,&stu[i].wester,&stu[i].essay);
	for(i=0;i<n;i++)
	{
		prize=0;
		if(stu[i].final>80&&stu[i].essay>=1)
		{prize+=8000;sum+=8000;}
	    if(stu[i].final>85&&stu[i].pingyi>80)
		{prize+=4000;sum+=4000;}
		if(stu[i].final>90)
		{prize+=2000;sum+=2000;}
        if(stu[i].final>85 && stu[i].wester=='Y') 
		{prize+=1000;sum+=1000;}
		if(stu[i].pingyi>80&&stu[i].leader=='Y')
		{prize+=850;sum+=850;}
		if(prize>max) 
		{max=prize;k=i;}
	}
    printf("%s\n",stu[k].name);
    printf("%d\n%d\n",max,sum);
}
main()
{
	struct{
		char name[20];
		int qimo,pingyi;
		char ban,xi;
		int lun,sum;
	}num[100];
	int n,i;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s %d %d %c %c %d",num[i].name,&num[i].qimo,&num[i].pingyi,&num[i].ban,&num[i].xi,&num[i].lun);
	
	}
	int zong=0;
	for(i=0;i<n;i++){
		num[i].sum=0;
		if(num[i].qimo>80&&num[i].lun>=1)
			num[i].sum+=8000;
		if(num[i].qimo>85&&num[i].pingyi>80)
			num[i].sum+=4000;
		if(num[i].qimo>90)
			num[i].sum+=2000;
		if(num[i].qimo>85&&num[i].xi=='Y')
			num[i].sum+=1000;
		if(num[i].pingyi>80&&num[i].ban=='Y')
			num[i].sum+=850;
		zong+=num[i].sum;
	

	}
	int w=0,e;

	for(i=0;i<n;i++){
		if(num[i].sum>w){
			w=num[i].sum;
			e=i;
			
		}
	
	}
	printf("%s\n",num[e].name);
	printf("%d\n",w);
	printf("%d",zong);
	return 0;
}
void main()
{
	struct student
	{char name[20];
	 int score;
     int fame;
  	 char leader;
	 char west;
	 int paper;
	}stu[100];
	
	int i,n,max=0,k,t;
	int Price[5]={8000,4000,2000,1000,850};
	long int sum=0;

	scanf("%d\n",&n);
	for(i=0;i<n;i++)
		scanf("%s %d %d %c %c %d",&stu[i].name,&stu[i].score,&stu[i].fame,&stu[i].leader,&stu[i].west,&stu[i].paper);

	for(i=0;i<n;i++)
	{
		t=0;
		if(stu[i].score>80&&stu[i].paper>0) t+=Price[0];
		if(stu[i].score>85&&stu[i].fame>80) t+=Price[1];
		if(stu[i].score>90) t+=Price[2];
		if(stu[i].score>85&&stu[i].west=='Y') t+=Price[3];
		if(stu[i].fame>80&&stu[i].leader=='Y') t+=Price[4];

		sum+=t;
		if(t>max)
		{
			max=t;
			k=i;
		}
	}


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

}
struct student
{
	char name[30];
	int aver;
	int judge;
	char cadre;
	char west;
	int amount;
	long prize;
	struct student *next;
};
int n;
  struct student *creat(int m)
  {
	  struct student *head;
	  struct student *p1,*p2;
	  n=0;
	  p1=p2=(struct student*)malloc(LEN);
	  scanf("%s %d %d %c %c %ld",p1->name,&p1->aver,&p1->judge,&p1->cadre,&p1->west,&p1->amount);
	  p1->prize=0;
	  head=NULL;
	  while(m--)
	  {
		  n=n+1;
		  if(n==1)head=p1;
		  else p2->next=p1;
		  p2=p1;
		  p1=(struct student *)malloc(LEN);
		  scanf("%s %d %d %c %c %ld",p1->name,&p1->aver,&p1->judge,&p1->cadre,&p1->west,&p1->amount);
		  p1->prize=0;
		  
	  }
	  p2->next=NULL;
	  return(head);
  }
  void main()
  {
	  struct student *head,*p1,*p2;
	  int m,max=0,sum=0;
	  scanf("%d",&m);
	  head=creat(m);
	       p1=p2=head;
		  while(p1)
		  {
			  if(p1->aver>80&&p1->amount>0)p1->prize+=8000;
			  if(p1->aver>85&&p1->judge>80)p1->prize+=4000;
			  if(p1->aver>90)p1->prize+=2000;
			  if(p1->aver>85&&p1->west=='Y')p1->prize+=1000;
			  if(p1->judge>80&&p1->cadre=='Y')p1->prize+=850;
			  p1=p1->next;
		  }
		  p1=head;
		  while(p1)
		  {
			  sum+=p1->prize;
			  if(p1->prize>max)max=p1->prize,p2=p1;
			  p1=p1->next;
		  }
		  printf("%s\n%d\n%d\n",p2->name,p2->prize,sum);

		   
  }
struct student{
char name[20];
int a1;
int a2;
char b1;
char b2;
int c;
int money;
}stu[100];
void main()
{
	int n,i,max=0,m=0;
	struct student *p;
	scanf("%d",&n);
	for(p=stu;p<stu+n;p++)
	{
		scanf("%s %d %d %c %c %d",p->name,&p->a1,&p->a2,&p->b1,&p->b2,&p->c);
		 p->money=0;
		if(p->a1>80&&p->c>=1) p->money=p->money+8000;
        if(p->a1>85&&p->a2>80) p->money=p->money+4000;
		if(p->a1>90) p->money=p->money+2000;
		if(p->a1>85&&p->b2=='Y') p->money=p->money+1000;
		if(p->a2>80&&p->b1=='Y') p->money=p->money+850;
	}
	for(p=stu;p<stu+n;p++)
    if(p->money>max) max=p->money;
	for(p=stu;p<stu+n;p++)
	if (p->money==max) 
	{printf("%s\n%d\n",p->name,p->money);
	break;}
	for(p=stu;p<stu+n;p++)
		m=m+p->money;
	printf("%d",m);
}
int main(int argc, char *argv[])
{
  struct stu
  {
    char name[25];
    int score;
    int pinyi;
    char ganbu;
    char xibu;
    int lunwen;      
  }stu[110];
  int n,i,m;
  char str[25];
  m=0;
  int a[110];
  int total;
  scanf("%d",&n);
  for(i=0;i<n;i++)
  {
   scanf("%s %d %d %c %c %d",&stu[i].name,&stu[i].score,&stu[i].pinyi,&stu[i].ganbu,&stu[i].xibu,&stu[i].lunwen);                
  }
  for(i=0;i<n;i++)
  {a[i]=0;
    if(stu[i].score>80&&stu[i].lunwen>=1){a[i]+=8000;}
     
    if(stu[i].score>85&&stu[i].pinyi>80){a[i]+=4000;}
   
    if(stu[i].score>90){a[i]+=2000;}
    
    if(stu[i].score>85&&stu[i].xibu=='Y'){a[i]+=1000;}
    
    if(stu[i].pinyi>80&&stu[i].ganbu=='Y'){a[i]+=850;}
                  
                  }
    for(i=0;i<n;i++)
    {
       if(a[i]>m){strcpy(str,stu[i].name);m=a[i];}              
    }
    printf("%s\n%d\n",str,m);
    total=0;
    for(i=0;i<n;i++)
    {total+=a[i];}
    printf("%d\n",total);
  	
  return 0;
}
struct student
{
	char name[20];
	int mark1;
	int mark2;
	char judge1;
	char judge2;
	int paper;
	double total;
}stu;
double max=0;

void main()
{
	void compare(struct student temp);
	struct student stu1;
	int n,i;
	stu1.total=0;
	stu.total=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s%d%d %c %c%d",stu1.name,&stu1.mark1,&stu1.mark2,&stu1.judge1,&stu1.judge2,&stu1.paper);
		compare(stu1);
		//printf("%s\n%d\n%d\n%c\n%c\n%d\n",stu1.name,stu1.mark1,stu1.mark2,stu1.judge1,stu1.judge2,stu1.paper);
	}
	printf("%s\n%.0lf\n%.0lf\n",stu.name,stu.total,max);
}
void compare(struct student temp)
{
	if(temp.mark1>80&&temp.paper>0)temp.total+=8000;	//????????8000?
	if(temp.mark1>85&&temp.mark2>80)temp.total+=4000;	//????????4000?
	if(temp.mark1>90)temp.total+=2000;					//????????2000?
	if(temp.mark1>85&&temp.judge2=='Y')temp.total+=1000;//????????1000?
	if(temp.mark2>80&&temp.judge1=='Y')temp.total+=850;	//????????850?
	max+=temp.total;
	if(temp.total>stu.total)stu=temp;
}
int main()
{
	char name[100][21];
	int n;//??
	int temp=0;//??????????
	int temp_money=0;//?????????????
	int temp_name;//??????????????
	int all_money=0;//??????????????
	int i;
	scanf("%d", &n);
//	printf("n             =         %d\n",n);
	for(i=0;i<n;i++)
	{
		int qi_mo;
		int ping_yi;
		char gan_bu;
		char xi_bu;
		int lun_wen;
//		printf("%d\n", i);
		scanf("%s", name[i]);
//		printf("%s\n",name[i]);
		scanf("%d", &qi_mo);
		scanf("%d", &ping_yi);
		scanf(" %c %c", &gan_bu, &xi_bu);
		scanf("%d", &lun_wen);
		if((qi_mo>80)&&(lun_wen>=1))
			temp += 8000;
		if((qi_mo>85)&&(ping_yi>80))
			temp += 4000;
		if(qi_mo>90)
			temp += 2000;
		if((qi_mo>85)&&(xi_bu=='Y'))
			temp += 1000;
		if((ping_yi>80)&&(gan_bu=='Y'))
			temp += 850;
		if(temp>temp_money)
		{
			temp_money=temp;
			temp_name=i;
		}
		all_money += temp;
		temp = 0;
	}
	printf("%s\n",name[temp_name]);
	printf("%d\n",temp_money);
	printf("%d\n",all_money);
}
struct stu
{char name[20];
int s1;
int s2;
char a1;
char a2;
int pa;

}stu[100];
void main()
{int n,i,sumt,j;
int sum[100];
scanf("%d\n",&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].a1,
&stu[i].a2,&stu[i].pa);
for(i=0;i<n;i++)
{sum[i]=0;
	if(stu[i].s1>80&&stu[i].pa>0)
		sum[i]=(sum[i]+8000);
	if(stu[i].s1>85&&stu[i].s2>80)
		sum[i]=(sum[i]+4000);
	if(stu[i].s1>90)
		sum[i]=(sum[i]+2000);
	if(stu[i].s1>85&&stu[i].a2=='Y')
		sum[i]=(sum[i]+1000);
	if(stu[i].s2>80&&stu[i].a1=='Y')
		sum[i]=(sum[i]+850);
}
sumt=sum[0];
for(i=1;i<n;i++)
sumt=sumt+sum[i];
for(i=0;i<n;i++)
{for(j=0;j<n;j++)
if(sum[i]<sum[j])
break;
if(j==n)
break;}
printf("%s\n%d\n%d",stu[i].name,sum[i],sumt);
}
struct person
{
	char name[30];
	int qimo;
	int banji;
	char ganbu[5];
	char xibu[5];
	int lunwen;
	int yuanshijiangxue;
	int wusijiangxue;
	int chengjiyouxiu;
	int xibujiangxue;
	int banjigongxian;
	int total;
}student[110];

int main()
{
	int n, i, all=0, max=0, whom=-1;
	scanf("%d", &n);
	for(i=0; i<n; i++)
	{
		scanf("%s", student[i].name);
		scanf("%d", &student[i].qimo);
		scanf("%d", &student[i].banji);
		scanf("%s", student[i].ganbu);
		scanf("%s", student[i].xibu);
		scanf("%d", &student[i].lunwen);
	}

	for(i=0; i<n; i++)
	{
		if(student[i].lunwen>0 && student[i].qimo>80)
		{
			student[i].yuanshijiangxue=8000;
		}
		else
		{
			student[i].yuanshijiangxue=0;
        }
	}

	for(i=0; i<n; i++)
	{
		if(student[i].qimo>85 && student[i].banji>80)
		{
			student[i].wusijiangxue=4000;
		}
		else
		{
			student[i].wusijiangxue=0;
		}
	}

	for(i=0; i<n; i++)
	{
		if(student[i].qimo>90)
		{
			student[i].chengjiyouxiu=2000;
		}
		else
		{
			student[i].chengjiyouxiu=0;
		}
	}

	for(i=0; i<n; i++)
	{
		if(student[i].xibu[0]=='Y' && student[i].qimo>85)
		{
			student[i].xibujiangxue=1000;
		}
		else
		{
			student[i].xibujiangxue=0;
		}
	}

	for(i=0; i<n; i++)
	{
		if(student[i].banji>80 && student[i].ganbu[0]=='Y')
		{
			student[i].banjigongxian=850;
		}
		else
		{
			student[i].banjigongxian=0;
		}
	}

	for(i=0; i<n; i++)
	{
		student[i].total=student[i].yuanshijiangxue+student[i].wusijiangxue+student[i].chengjiyouxiu+student[i].xibujiangxue+student[i].banjigongxian;
	}

	for(i=0; i<n; i++)
	{
		all=all+student[i].total;
	}

	for(i=n-1; i>=0; i--)
	{
		if(student[i].total>=max)
		{
			max=student[i].total;
			whom=i;
        }
	}

	printf("%s\n", student[whom].name);
	printf("%d\n", student[whom].total);
	printf("%d", all);

	
	return 0;
}
struct student
{
 char name[20];
 int score;
 int clas;
 char g;
 char x;
 int paper;
 int total; 
}stu[100];
void main()
{
 int i,k,max,n,zong;
 scanf("%d\n",&n);
 for(i=0;i<n;i++)
     {
      scanf("%s %d %d %c %c %d\n",stu[i].name,&stu[i].score,&stu[i].clas,&stu[i].g,&stu[i].x,&stu[i].paper);
      stu[i].total=0;
      if(stu[i].score>80&&stu[i].paper>=1)
        stu[i].total=stu[i].total+8000;
      if(stu[i].score>85&&stu[i].clas>80)
        stu[i].total=stu[i].total+4000;
      if(stu[i].score>90)
        stu[i].total=stu[i].total+2000;
      if(stu[i].score>85&&stu[i].x=='Y')
        stu[i].total=stu[i].total+1000;
      if(stu[i].clas>80&&stu[i].g=='Y')
        stu[i].total=stu[i].total+850;
}
 zong=0;
 max=0;
 for(i=0;i<n;i++)
     {
      zong=zong+stu[i].total;
      if(stu[i].total>max)
         {
          max=stu[i].total;
          k=i;}
      }
 printf("%s\n%d\n%d",stu[k].name,max,zong);
}
int main(){
	int n,k,t,i,q,s[100],cm[100],atl[100],a[100],b,m;
	char name[100][20],e[100][2],f[100][2],final[20];
	scanf("%d",&n);
	for(k=0;k<n;k++){
		scanf("%s %d %d %s %s %d",&name[k],&s[k],&cm[k],&e[k],&f[k],&atl[k]);
	}
	b=0;
	for(t=0;t<n;t++){
		a[t]=0;
		if(s[t]>80&&atl[t]>=1){
			a[t]=a[t]+8000;
		}
		if(s[t]>85&&cm[t]>80){
			a[t]=a[t]+4000;
		}
		if(s[t]>90){
			a[t]=a[t]+2000;
		}
		if(s[t]>85&&strcmp(f[t],"Y")==0){
			a[t]=a[t]+1000;
		}
		if(cm[t]>80&&strcmp(e[t],"Y")==0){
			a[t]=a[t]+850;
		}
	}
	b=0;
	for(q=0;q<n;q++){
		b=b+a[q];
	}
	m=0;
	for(i=0;i<n;i++){
		if(a[i]>m){
			m=a[i];
			strcpy(final,name[i]);
		}
	}
	printf("%s\n%d\n%d",final,m,b);
	return 0;
}
void main()
{
	struct
	{
		char name[20];
		int f;
		int ping;
		char gan;
		char xi;
		int lun;
		int jiang;
	}stu[100];
	{
		int n,i,t,s=0;
		scanf("%d",&n);

		for(i=0;i<n;i++)
		{
			scanf("%s %d %d %c %c %d",&stu[i].name,&stu[i].f,&stu[i].ping,&stu[i].gan,&stu[i].xi,&stu[i].lun);
			stu[i].jiang=0;
			if(stu[i].f>80&&stu[i].lun>0)
				stu[i].jiang=stu[i].jiang+8000;
			if(stu[i].f>85&&stu[i].ping>80)
				stu[i].jiang=stu[i].jiang+4000;
			if(stu[i].f>90)
				stu[i].jiang=stu[i].jiang+2000;
			if(stu[i].f>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++)
		{
			s=s+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\n",stu[i].name,t,s+stu[n-1].jiang);
				break;
			}
	}
}
struct student
	{char name[20];
	 int score1;
	 int score2;
	 char a;
	 char b;
	 int num;
	};
	struct student stu[100];
int main()
{
	int N,i,num;
	int a[100]={0};
	int sumall=0,summax=0;
	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].a,&stu[i].b,&stu[i].num);
	

	for(i=0;i<N;i++)
	{if(stu[i].score1>80&&stu[i].num>=1)
			a[i]+=8000;
	if(stu[i].score1>85&&stu[i].score2>80)
		a[i]+=4000;
	if(stu[i].score1>90)
		a[i]+=2000;
	if(stu[i].score1>85&&stu[i].b=='Y')
		a[i]+=1000;
	if(stu[i].score2>80&&stu[i].a=='Y')
		a[i]+=850;
	if(summax<a[i])
		summax=a[i];
	sumall+=a[i];
	}
	for(i=0;i<N;i++)
	{if(a[i]==summax)
			{num=i;
	break;}
	}

	printf("%s\n%d\n%d\n",stu[num].name,a[num],sumall);
}
struct inform
{
	char name[20];
	int test1;
	int test2;
	char c;                                                                           
	char w;
	int a;
}stu[100],temp1;
void main()
{
	int n,i,j,temp2;
    int sum[100]={0},sum1=0;
	scanf("%d",&n);
	for(i=0;i<=n-1;i++)
	{    
		scanf("%s %d %d %c %c %d",stu[i].name,&stu[i].test1,&stu[i].test2,&stu[i].c,&stu[i].w,&stu[i].a);
	}
	for(i=0;i<=n-1;i++)
	{
		if(stu[i].test1>80 && stu[i].a>=1) sum[i]=8000;
	    if(stu[i].test1>85 && stu[i].test2>80) sum[i]=sum[i]+4000;
		if(stu[i].test1>90) sum[i]=sum[i]+2000;
		if(stu[i].test1>85 && stu[i].w=='Y') sum[i]=sum[i]+1000;
		if(stu[i].test2>80 && stu[i].c=='Y')sum[i]=sum[i]+850;
	}
	for(i=0;i<=n-1;i++)
	{
         for(j=0;j<=n-2-i;j++)
		 {
			 if(sum[j]<sum[j+1])
			 {
				 temp2=sum[j];
				 sum[j]=sum[j+1];
				 sum[j+1]=temp2;
				 temp1=stu[j];
				 stu[j]=stu[j+1];
				 stu[j+1]=temp1;
			 }
		 }
	}
	for(i=0;i<=n-1;i++)
	{
		sum1=sum1+sum[i];
	}
	printf("%s\n",stu[0].name);
	printf("%d\n",sum[0]);
	printf("%d\n",sum1);
}
int main()
{
    struct student
    {
        char name[20];
        int a;
        int b;
        char c;
        char d;
        int e;
        int sum;
    };
    struct student st[100];
    int n,i,am=0,max;
    char f[20];
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
        scanf("%s %d %d %c %c %d",st[i].name,&st[i].a,&st[i].b,&st[i].c,&st[i].d,&st[i].e);
        st[i].sum=0;
    }
    for(i=0;i<n;i++)
    {
        if(st[i].a>80 && st[i].e>0)
        st[i].sum=st[i].sum+8000;
        if(st[i].a>85 && st[i].b>80)
        st[i].sum=st[i].sum+4000;
        if(st[i].a>90)
        st[i].sum=st[i].sum+2000;
        if(st[i].a>85 && st[i].d=='Y')
        st[i].sum=st[i].sum+1000;
        if(st[i].b>80 && st[i].c=='Y')
        st[i].sum=st[i].sum+850;
        am=am+st[i].sum;
    }
    max=st[0].sum;
    for(i=0;i<n;i++)
    {
       if(max<st[i].sum)
       {
           max=st[i].sum;
           strcpy(f,st[i].name);
       }
    }
    printf("%s\n%d\n%d",f,max,am);
    return 0;
}
int main()
{int i,n,grade1[100],grade2[100],lunwen[100],money[100]={0},moneyall=0,max=0,p;
char name[100][100],ganbu[100],xibu[100];
scanf("%d",&n);
for(i=0;i<n;i++){

scanf("%s%d%d%s%s%d",name[i],&grade1[i],&grade2[i],&ganbu[i],&xibu[i],&lunwen[i]);
if(grade1[i]>80&&lunwen[i]>=1)
money[i]=money[i]+8000;
if(grade1[i]>85&&grade2[i]>80)
money[i]=money[i]+4000;
if(grade1[i]>90)
money[i]=money[i]+2000;
if(grade1[i]>85&&xibu[i]=='Y')
money[i]=money[i]+1000;
if(grade2[i]>80&&ganbu[i]=='Y')
money[i]=money[i]+850;}

for(i=0;i<n;i++)
{if(money[i]>max){
max=money[i];
p=i;
}
moneyall=moneyall+money[i];}
printf("%s",name[p]);
printf("\n");
printf("%d",max);
printf("\n");
printf("%d",moneyall);
return 0;
}
int main()
{
	int N,i,g=0,n[100]={0},h,sum=0;
	scanf("%d",&N);
	struct student{
		char name[20];
		int x,y;
		char p,q;
		int z;
	}s[100];
	for(i=0;i<N;i++){
		scanf("%s %d %d %c %c %d",s[i].name,&s[i].x,&s[i].y,&s[i].p,&s[i].q,&s[i].z);
		if((s[i].x>80)&&(s[i].z>0))
			n[i]+=8000;
		if((s[i].x>85)&&(s[i].y>80))
			n[i]+=4000;
		if(s[i].x>90)
			n[i]+=2000;
		if((s[i].x>85)&&(s[i].q=='Y'))
			n[i]+=1000;
		if((s[i].y>80)&&(s[i].p=='Y'))
			n[i]+=850;
	}
	for(i=0;i<N;i++){
		if(n[i]>g){
			g=n[i];
			h=i;
		}
		sum += n[i];
	}
	printf("%s\n",s[h].name);
	printf("%d\n",g);
	printf("%d",sum);
}