semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
void main()
{
	int n;
	scanf("%d",&n);
	struct student
	{
		char name[20];
		int score;
		int judge;
		char work;
		char west;
        int paper;
		int money;
	}stu[100];
	int i;
	for(i=0;i<n;i++)
	{
		stu[i].money=0;
		scanf("%s%d%d %c %c%d",stu[i].name,&stu[i].score,&stu[i].judge,&stu[i].work,&stu[i].west,&stu[i].paper);
		if(stu[i].score>80&&stu[i].paper>=1)
			stu[i].money=stu[i].money+8000;
		if(stu[i].score>85&&stu[i].judge>80)
			stu[i].money=stu[i].money+4000;
		if(stu[i].score>90)
			stu[i].money=stu[i].money+2000;
		if(stu[i].score>85&&stu[i].west=='Y')
			stu[i].money=stu[i].money+1000;
		if(stu[i].judge>80&&stu[i].work=='Y')
			stu[i].money=stu[i].money+850;
	}
	int max=0,sum=0;
	for(i=0;i<n;i++)
	{
		sum=sum+stu[i].money;
		if(stu[i].money>max)
			max=stu[i].money;
	}
	for(i=0;i<n;i++)
	{
		if(stu[i].money==max)
		{	
			printf("%s\n%d\n",stu[i].name,max);
		break;
		}
	}
	printf("%d\n",sum);
}
struct student
{
	char name[20];
	int qimo;
	int banji;
	char ganbu;
	char xibu;
	int paper;
}stu[100];

int main()
{    int f(struct student s);
	int n,i,a[100],max,count=0,m=0,k=0,sum=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].paper);
	for(i=0;i<n;i++)
		a[i]=f(stu[i]);
	for(i=0;i<n;i++)
  sum=sum+a[i];
	max=a[0];
	for(i=0;i<n;i++)
      if(a[i]>max)
	  {max=a[i];
	  m=i;}
	  for(i=0;i<n;i++)
		  if(a[i]==max)
		  count++;
		  if(count==1)
			  printf("%s\n%d\n%d",stu[m].name,max,sum);
     else for(i=0;i<n;i++)
		 if(a[i]==max)
		 {printf("%s\n%d\n%d",stu[i].name,max,sum);
		 break;}
		 return 0;

}
    int f(struct student s)
	{int sum=0;
	if(s.qimo>80&&s.paper>=1)
		sum=sum+8000;
	if(s.qimo>85&&s.banji>80)
		sum=sum+4000;
	if(s.qimo>90) 
		sum=sum+2000;
	if(s.qimo>85&&s.xibu=='Y')
		sum=sum+1000;
	if(s.banji>80&&s.ganbu=='Y')
		sum=sum+850;
	return sum;
	}
void main()
{
	struct student
	{
		char name[30],gb,west;
		int sco1,sco2,paper,money;
	} stu[100];
	int n,i;
	long sum=0,max=0;
	char maxs[30];
	scanf("%d",&n);
	for (i=0;i<n;i++)
	{
		scanf("%s %d %d %c %c %d",stu[i].name,&stu[i].sco1,&stu[i].sco2,&stu[i].gb,&stu[i].west,&stu[i].paper);
		stu[i].money=0;
		if (stu[i].sco1>80&&stu[i].paper>=1) stu[i].money+=8000;
		if (stu[i].sco1>85&&stu[i].sco2>80) stu[i].money+=4000;
		if (stu[i].sco1>90) stu[i].money+=2000;
		if (stu[i].sco1>85&&stu[i].west=='Y') stu[i].money+=1000;
		if (stu[i].sco2>80&&stu[i].gb=='Y') stu[i].money+=850;
	}
	for (i=0;i<n;i++)
	{
		sum+=stu[i].money;
		if (stu[i].money>max) {max=stu[i].money;strcpy(maxs,stu[i].name);}
	}
	printf("%s\n%ld\n%ld",maxs,max,sum);
}
int main()
{
    int N,i,price,total=0,max=0,t;
    scanf("%d",&N);
    struct student
    {
           char name[21];
           int ave;
           int comment;
           char officer;
           char province;
           int paper;
           }stu[100];
    for(i=0;i<N;i++){
                     scanf("%s %d %d %c %c %d",stu[i].name,&stu[i].ave,&stu[i].comment,&stu[i].officer,&stu[i].province,&stu[i].paper);
                     }    
    for(i=0;i<N;i++){
                     price=0;
                     if(stu[i].ave>80&&stu[i].paper>0){price=price+8000;}
                     if(stu[i].ave>85&&stu[i].comment>80){price=price+4000;}
                     if(stu[i].ave>90){price=price+2000;}
                     if(stu[i].ave>85&&stu[i].province=='Y'){price=price+1000;}
                     if(stu[i].comment>80&&stu[i].officer=='Y'){price=price+850;}
                     total=total+price;
                     if(price>max){
                                   max=price;
                                   t=i;
                                   }
                     }
    printf("%s\n%d\n%d\n",stu[t].name,max,total);
    
    return 0;
    }
struct data
{
	char name[200];
	int score;
	int classscore;
	char leader;
	char west;
	int paper;
	int scholarship;
	struct data *next;
};
int main()
{
	int N;
	scanf("%d",&N);

	int i,sum=0,max=0;
	struct data *head,*p1,*p2,*recorder;
	p1=(struct data *)malloc(Len);
	scanf("%s %d %d %c %c %d",p1->name,&p1->score,&p1->classscore,&p1->leader,&p1->west,&p1->paper);
	p1->next=NULL;
	p1->scholarship=0;
	head=p1;
	p2=p1;

	for (i=1;i<N;i++)
	{
		p1=(struct data *)malloc(Len);
	    scanf("%s %d %d %c %c %d",p1->name,&p1->score,&p1->classscore,&p1->leader,&p1->west,&p1->paper);
	    p1->next=NULL;
	    p1->scholarship=0;
	    p2->next=p1;
		p2=p1;
	}

	for (p1=head;p1!=NULL;p1=p1->next)
	{

		if (p1->paper>0&&p1->score>80) p1->scholarship+=8000;
		if (p1->score>85&&p1->classscore>80) p1->scholarship+=4000;
		if (p1->score>90) p1->scholarship+=2000;
		if (p1->score>85&& p1->west=='Y') p1->scholarship+=1000;
		if (p1->classscore>80 && p1->leader=='Y') p1->scholarship+=850;

		if (p1->scholarship>max) 
		{
			max=p1->scholarship;
			recorder=p1;
		}
		sum=sum+p1->scholarship;
	}
	printf("%s\n%d\n%d\n",recorder->name,recorder->scholarship,sum);
	return 0;
}
struct Student
{
    char name[20];
    int a;
	int b;
    char g;
	char x;
    int l;
	int sum;
}stu[100];
int n;
int main()
{
   scanf("%d",&n);
   int i;
   int all=0;
   for(i=0;i<n;i++)
   {
	   scanf("%s %d %d %c %c %d",stu[i].name,&stu[i].a,&stu[i].b,&stu[i].g,&stu[i].x,&stu[i].l);
       stu[i].sum=0;
	   if(stu[i].a>80&&stu[i].l>=1)
		   stu[i].sum+=8000;
	   if(stu[i].a>85&&stu[i].b>80)
		   stu[i].sum+=4000;
       if(stu[i].a>90)
		   stu[i].sum+=2000;
	   if(stu[i].a>85&&stu[i].x=='Y')
		   stu[i].sum+=1000;
	   if(stu[i].b>80&&stu[i].g=='Y')
		   stu[i].sum+=850;
	   all+=stu[i].sum;
   }
   int max=0;
   for(i=0;i<n;i++)
   {
	   if(max<stu[i].sum)
		   max=stu[i].sum;
   }
   for(i=0;i<n;i++)
   {
	   if(stu[i].sum==max)
	   {
		   printf("%s\n",stu[i].name);
		   printf("%d\n",stu[i].sum);
		   break;
	   }
   }
   printf("%d\n",all);
   return 0;
}
void main()
{
	struct student
	{
		char name[20];
		int score;
		int grade;
		char ganbu;
		char west;
		int paper;
		long money;
	};
	int a,i,j,n,sum;
	char c;
	struct student stu[100];
	scanf("%d",&n);
	for(i=0;i<=n-1;i++)
	{
		scanf("%s%d%d%c%c%c%c%c%d",stu[i].name,&stu[i].score,&stu[i].grade,&c,&stu[i].ganbu,&c,&stu[i].west,&c,&stu[i].paper);
		stu[i].money=0;
	}
	for(i=0;i<=n-1;i++)
	{
		if (stu[i].score>80&&stu[i].paper>=1)
			stu[i].money=stu[i].money+8000;
		if (stu[i].score>85&&stu[i].grade>80)
			stu[i].money=stu[i].money+4000;
		if (stu[i].score>90)
			stu[i].money=stu[i].money+2000;
		if (stu[i].score>85&&stu[i].west=='Y')
			stu[i].money=stu[i].money+1000;
		if (stu[i].grade>80&&stu[i].ganbu=='Y')
			stu[i].money=stu[i].money+850;
	}
	j=0;
	a=stu[0].money;
	sum=stu[0].money;
	for(i=1;i<=n-1;i++)
	{
		if (stu[i].money>a)
		{
			j=i;
			a=stu[i].money;
		}
		sum=sum+stu[i].money;
	}
	printf("%s\n%d\n%d\n",stu[j].name,a,sum);
}
struct student{
	char mz[20];
	int cj;
	int py;
	char gb;
	char xb;
	int lw;
	int money;
};

int main(){
	int N,i,max,sum;
	scanf("%d",&N);
	struct student *stu=(struct student*)malloc(sizeof(struct student)*N);/*??????*/
	struct student *p;
	p=stu;
	for(i=0;i<N;i++,p++){
		scanf("%s %d %d %c %c %d",p->mz,&(p->cj),&(p->py),&(p->gb),&(p->xb),&(p->lw));/*????*/
	}
	p=stu;
	for(i=0;i<N;i++,p++){
		(p->money)=0;
		if (p->cj>80 && p->lw>0)
		{
			(p->money)+=8000;
		}
		if (p->cj>85 && p->py>80)
		{
			(p->money)+=4000;
		}
		if (p->cj>90)
		{
			(p->money)+=2000;
		}
		if (p->cj>85 && p->xb=='Y')
		{
			(p->money)+=1000;
		}
		if (p->py>80 && p->gb=='Y')
		{
			(p->money)+=850;
		}
	}/*?????*/
	sum=0;
	p=stu;
	for(i=0;i<N;i++,p++){
		sum+=(p->money);
	}/*?????*/
	max=0;
	for (i=0;i<N;i++)
	{
		if (stu[i].money>stu[max].money)
		{
			max=i;
		}
	}/*?????*/
	printf("%s\n%d\n%d\n",stu[max].mz,stu[max].money,sum);
	free(stu);
	return 0;
}
void main()
{
	struct std
	{
		char name[21];
		int cj;
		int py;
		char gb;
		char xb;
		int lw;
		int sum;
	}std[100];

	int n,i,max,sum=0;

	scanf("%d",&n);

	for(i=0;i<n;i=i+1)
	{
		scanf("%s %d %d %c %c %d",&std[i].name,&std[i].cj,&std[i].py,&std[i].gb,&std[i].xb,&std[i].lw);

		std[i].sum=0;

		if(std[i].cj>80&&std[i].lw>=1) std[i].sum=std[i].sum+8000;
		else;

		if(std[i].cj>85&&std[i].py>80) std[i].sum=std[i].sum+4000;
		else;

		if(std[i].cj>90) std[i].sum=std[i].sum+2000;
		else;

		if(std[i].xb=='Y'&&std[i].cj>85) std[i].sum=std[i].sum+1000;
		else;

		if(std[i].gb=='Y'&&std[i].py>80) std[i].sum=std[i].sum+850;
		else;

		sum=sum+std[i].sum;
	}

	for(i=1,max=std[0].sum;i<n;i=i+1)
	{
		if(max<std[i].sum) max=std[i].sum;
		else;
	}

	for(i=0;i<n;i=i+1)
	{
		if(std[i].sum==max)
		{
			printf("%s\n",std[i].name);
			printf("%d\n",std[i].sum);
			printf("%d\n",sum);
			break;
		}
	}
}
struct stus
{
    char name[25];
	int qimo;
	int banji;
	char ganbu;
    char xibu;
	int lunwen;
	int p;
};

void main()
{
	int m,n,i,j,k,s=0;
	char c[25]={0};
	struct stus stu[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].ganbu,&stu[i].xibu,&stu[i].lunwen);
        if(stu[i].qimo>80&&stu[i].lunwen>=1)
			stu[i].p+=8000;
		if(stu[i].qimo>85&&stu[i].banji>80)
			stu[i].p+=4000;
		if(stu[i].qimo>90)
			stu[i].p+=2000;
		if(stu[i].xibu=='Y'&&stu[i].qimo>85)
			stu[i].p+=1000;
		if(stu[i].banji>80&&stu[i].ganbu=='Y')
			stu[i].p+=850;
        s+=stu[i].p;
	}
	m=stu[0].p;
	strcpy(c,stu[0].name);
    for(i=1;i<n;i++)
		if(stu[i].p>m)
		{
            strcpy(c,stu[i].name);
            m=stu[i].p;
		}
	printf("%s\n",c);
	printf("%d\n%d",m,s);
}
int main()
{
 int n,p,i,j,end[100],class[100],issue[100],k[100],sum=0;
 char monitor[100],province[100],name[100][20];
 int max;
 scanf("%d\n",&n); 
 
 for(i=0;i<n;i++)
  scanf("%s %d %d %c %c %d",&name[i],&end[i],&class[i],&monitor[i],&province[i],&issue[i]);
 
 for(i=0;i<n;i++)
  k[i]=0;
 for(i=0;i<n;i++)
 {
 if(end[i]>80&&issue[i]>=1) k[i]=k[i]+8000;
 if(end[i]>85&&class[i]>80) k[i]=k[i]+4000;
 if(end[i]>90) k[i]=k[i]+2000;
 if(end[i]>85&&province[i]=='Y')  k[i]=k[i]+1000;
 if(class[i]>80&&monitor[i]=='Y') k[i]=k[i]+850;
 }

 max=k[0];

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

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

return 0;
}
int main()
{
    int n,i,sum=0,max=0;
    int stu[100],com[100],paper[100],money[100]={0};
    char name[100][20];
    char cadre[100],west[100];
    char best[20];
    scanf("%d",&n);
    for (i=0;i<n;i++)
    {
        scanf("%s %d %d %c %c %d\n",name[i],&stu[i],&com[i],&cadre[i],&west[i],&paper[i]);
        if (stu[i]>80&&paper[i]>0)
            money[i]+=8000;    
        if (stu[i]>85&&com[i]>80)
            money[i]+=4000;
        if (stu[i]>90)
            money[i]+=2000;
        if (stu[i]>85&&west[i]=='Y')
            money[i]+=1000;
        if (com[i]>80&&cadre[i]=='Y')
            money[i]+=850;
        if (money[i]>max)
        {
            max=money[i];
            strcpy(best,name[i]);
        }
        sum+=money[i];
    }
    printf("%s\n%d\n%d",best,max,sum);
}
struct student
{
	char name[20];
	int GPA;
	int val;
	char moni;
	char west;
	int paper;
	int scholar;

}stu[100];
void main()
{
	int n,i,max=0,sum,k;
	scanf("%d",&n);
	for(i=0;i<=n-1;i++)
	{
		scanf("%s %d %d %c %c %d",&stu[i].name,&stu[i].GPA,&stu[i].val,&stu[i].moni,&stu[i].west,&stu[i].paper);
	}
	for(i=0;i<=n-1;i++)
	{
		stu[i].scholar=0;
		if(stu[i].GPA>80&&stu[i].paper>=1)
			stu[i].scholar=stu[i].scholar+8000;
		if(stu[i].GPA>85&&stu[i].val>80)
			stu[i].scholar=stu[i].scholar+4000;
		if(stu[i].GPA>90)
			stu[i].scholar=stu[i].scholar+2000;
		if(stu[i].GPA>85&&stu[i].west=='Y')
			stu[i].scholar=stu[i].scholar+1000;
		if(stu[i].val>80&&stu[i].moni=='Y')
			stu[i].scholar=stu[i].scholar+850;

	}
	for(i=0,max=stu[0].scholar,sum=0;i<=n-1;i++)
	{
		if(stu[i].scholar>max)
		{
			k=i;
			max=stu[i].scholar;
		}
		sum=sum+stu[i].scholar;
	}
	
	printf("%s\n%d\n%d",stu[k].name,stu[k].scholar,sum);

}
struct scholarship
{
	char name[21];
	short mark;
	short judge;
	char cadre;
	char west;
	short paper;
	int ss;
}stu[100];
int main(int argc, char* argv[])
{
	int n;
	scanf("%d",&n);
	int i;
	for(i=0;i<n;i++){
		scanf("%s %d %d %c %c %d",&stu[i].name,&stu[i].mark,&stu[i].judge,&stu[i].cadre,&stu[i].west,&stu[i].paper);
		stu[i].ss=0;
		if(stu[i].mark>80&&stu[i].paper>=1){
			stu[i].ss=stu[i].ss+8000;
		}
		if(stu[i].mark>85&&stu[i].judge>80){
			stu[i].ss=stu[i].ss+4000;
		}
		if(stu[i].mark>90){
			stu[i].ss=stu[i].ss+2000;
		}
		if(stu[i].mark>85&&stu[i].west=='Y'){
			stu[i].ss=stu[i].ss+1000;
		}
		if(stu[i].judge>80&&stu[i].cadre=='Y'){
			stu[i].ss=stu[i].ss+850;
		}
	}
	int max=stu[0].ss;
	int a=0;
	int total=0;
	for(i=0;i<n;i++){
		if(stu[i].ss>max){
			max=stu[i].ss;
			a=i;
		}
		total=total+stu[i].ss;
	}
	printf("%s\n%d\n%d\n",stu[a].name,stu[a].ss,total);
	return 0;
}
struct money
{
	char name[20];
	int qm;
	int bj;
	char gb;
	char xb;
	int lw;
}
main()
{
	struct money stu[100];
	int n,i,p;
	long a[100]={0},max=0,sum=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s %d %d %c %c %d",stu[i].name,&stu[i].qm,&stu[i].bj,&stu[i].gb,&stu[i].xb,&stu[i].lw);
		if(stu[i].qm>80&&stu[i].lw>=1)
			a[i]=a[i]+8000;
		if(stu[i].qm>85&&stu[i].bj>80)
			a[i]=a[i]+4000;
		if(stu[i].qm>90)
			a[i]=a[i]+2000;
		if(stu[i].qm>85&&stu[i].xb=='Y')
			a[i]=a[i]+1000;
		if(stu[i].bj>80&&stu[i].gb=='Y')
			a[i]=a[i]+850;
	}
	for(i=0;i<n;i++)
	{
		sum=sum+a[i];
		if(max<a[i])
			max=a[i];
	}
	for(i=0;i<n;i++)
		if(max==a[i])
		{
			p=i;
			break;
		}
	printf("%s\n%ld\n%ld",stu[p].name,a[p],sum);
}
struct student
{
	char name[100];
	short int score1;
	short int score2;
	char x;
	char y;
	short int num;
	int sum;
	struct student *next;
};
void main()
{
	struct student *p1,*p2,*head;
	char name2[100];
	int max=0,s=0,i,n;
	p1=p2=head=NULL;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		p1=(struct student *)malloc(sizeof(struct student));
		scanf("%s %d %d %c %c %d",p1->name,&p1->score1,&p1->score2,&p1->x,&p1->y,&p1->num);
		p1->sum=0;
        
		if(p1->score1>90)
		{
			p1->sum=2000;
			if(p1->score2>80)
			{
				p1->sum=p1->sum+4000;
				if(p1->x=='Y')p1->sum=p1->sum+850;
				if(p1->y=='Y')p1->sum=p1->sum+1000;
				if(p1->num>=1)p1->sum=p1->sum+8000;
			}
			else
			{
				if(p1->num>=1)p1->sum=p1->sum+8000;
				if(p1->y=='Y')p1->sum=p1->sum+1000;
			}
		}
		else if(p1->score1>85)
		{
			if(p1->score2>80)
			{
				p1->sum=p1->sum+4000;
				if(p1->x=='Y')p1->sum=p1->sum+850;
				if(p1->y=='Y')p1->sum=p1->sum+1000;
				if(p1->num>=1)p1->sum=p1->sum+8000;
			}
			else 
			{
				if(p1->y=='Y')p1->sum=p1->sum+1000;
				if(p1->num>=1)p1->sum=p1->sum+8000;
			}
		}
		else if(p1->score1>80)
		{
			if(p1->num>=1)p1->sum=p1->sum+8000;
			if(p1->score2>80&&p1->x=='Y')p1->sum=p1->sum+850;
		}
		else if(p1->score2>80&&p1->x=='Y')p1->sum=p1->sum+850;

		if(i==0)head=p1;
		else p2->next=p1;
		p2=p1;
	}
	p2->next=NULL;

	max=head->sum;
	p1=head;
	while(p1!=NULL)
	{
		if(p1->sum>max){max=p1->sum;strcpy(name2,p1->name);}
		s=s+p1->sum;
		p1=p1->next;
		
	}
	printf("%s\n%d\n%d\n",name2,max,s);
}
struct stu
{
	char n[30];
	int a;
	int b;
	char c;
	char d;
	int e;
	int sum;
	struct stu *next;
};
void main()
{
	int i,n,max=0,sum;
	struct stu *head,*p1,*p2;
	scanf("%d",&n);
	head=p1=p2=(struct stu*)malloc(LEN);
	scanf("%s %d %d %c %c %d",p1->n,&p1->a,&p1->b,&p1->c,&p1->d,&p1->e);
	p1->sum=0;
	for(i=0;i<n-1;i++)
	{
		p1=(struct stu*)malloc(LEN);
		scanf("%s %d %d %c %c %d",p1->n,&p1->a,&p1->b,&p1->c,&p1->d,&p1->e);
		p1->sum=0;
		p2->next=p1;
		p2=p1;
	}
	p1->next=NULL;
	p1=p2=head;
	for(i=0;i<n;i++,p1=p1->next)
	{
		if(p1->a>80&&p1->e>0)
			p1->sum+=8000;
		if(p1->a>85&&p1->b>80)
			p1->sum+=4000;
		if(p1->a>90)
			p1->sum+=2000;
		if(p1->a>85&&p1->d=='Y')
			p1->sum+=1000;
		if(p1->b>80&&p1->c=='Y')
			p1->sum+=850;
	}
	p1=head;
	for(i=0;i<n;i++,p1=p1->next)
	{
		if(max<p1->sum)
			max=p1->sum;
	}
	p1=head;
	sum=0;
	for(i=0;i<n;i++,p1=p1->next)
	{
		sum+=p1->sum;
	}
	p1=head;
	for(i=0;i<n;i++,p1=p1->next)
	{
		if(p1->sum==max)
		{
			printf("%s\n%d\n",p1->n,p1->sum);
			break;
		}
	}
		printf("%d",sum);
}
struct studen{char name[100];int score1;int score2; char H;char W;int paper;int money;}stu[200];
int main()
{
	int n,i,j,money=0,student,scholar=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].H,&stu[i].W,&stu[i].paper);
		stu[i].money=0;
		if(stu[i].score1>80&&stu[i].paper>0)
			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].W=='Y')
			stu[i].money+=1000;
		if(stu[i].score2>80&&stu[i].H=='Y')
			stu[i].money+=850;
	}
	for(i=0;i<n;i++)
	{
		if(stu[i].money>money)
		{
			student=i;
			money=stu[i].money;
		}
		scholar=scholar+stu[i].money;
	}
		printf("%s\n%d\n%d\n",stu[student].name,stu[student].money,scholar);
	return 0;
}
struct student
{
	char name[1000];
	int final;
	int aver;
	char xshe;
	char xb;
	int paper;
	int score;
	struct student *next;
};
int num;
struct student *creat(void)
{
	struct student *head,*p1,*p2;
	int i,n;
	n=0;
	p1=p2=(struct student*)malloc(LEN);
	
	scanf("%s %d %d %c %c %d",p1->name,&p1->final,&p1->aver,&p1->xshe,&p1->xb,&p1->paper);
	p1->score=0;
	head=NULL;
	while(n<num-1)
	{
		n++;
		if(n==1) head=p1;
		else p2->next=p1;
		p2=p1;
		p1=(struct student*)malloc(LEN);
		scanf("%s %d %d %c %c %d",p1->name,&p1->final,&p1->aver,&p1->xshe,&p1->xb,&p1->paper);
        p1->score=0;
	}
	p2->next=p1;
	p1->next=NULL;
	return (head);
}
void main()
{
		struct student *head,*p1,*p2,*p,*max;
		int sum=0;
		scanf("%d",&num);
		head=creat();
		p=p1=p2=head;
		for(;p!=NULL;p=p->next)
		{
			if((p->aver)>80&&p->xshe=='Y')
				p->score=p->score+850;
			if((p->final)>80&&(p->paper)>=1)
				p->score=p->score+8000;
			if((p->final)>85&&(p->aver)>80)
				p->score=p->score+4000;
			if((p->final)>90)
				p->score=p->score+2000;
			if((p->final)>85&&(p->xb)=='Y')
				p->score=p->score+1000;
		}
		max=p=head;
		for(;p!=NULL;p=p->next)
		{
			if((p->score)>max->score)
			max=p;
			sum=sum+p->score;
		}
		printf("%s\n%d\n%d\n",max->name,max->score,sum);
}
typedef struct 
{
        char name[100];
        int qm,py;
        char gb,xb;
        int lw;
        int jxj;
} student;
student cl[200];
int sum,n;
void wsj(int k);
void yxj(int k);
void xbj(int k);
void gxj(int k);
void ysj(int k)
{
     if(cl[k].qm>80&&cl[k].lw>0)
     {
     cl[k].jxj+=8000;
     sum+=8000;
     }
     wsj(k);
}
void wsj(int k)
{
     if(cl[k].qm>85&&cl[k].py>80)
     {
     cl[k].jxj+=4000;
     sum+=4000;
     }
     yxj(k);
}
void yxj(int k)
{
     if(cl[k].qm>90)
     {
     cl[k].jxj+=2000;
     sum+=2000;
     }
     xbj(k);
}
void xbj(int k)
{
     if(cl[k].qm>85&&cl[k].xb=='Y')
     {
     cl[k].jxj+=1000;
     sum+=1000;
     }
     gxj(k);
}
void gxj(int k)
{
     if(cl[k].py>80&&cl[k].gb=='Y')
     {
     cl[k].jxj+=850;
     sum+=850;
     }
}
int main()
{
    int i,max=0,maxn;
    scanf("%d",&n);
    for(i=1;i<=n;i++)
    {
                     scanf("%s %d %d %c %c %d",cl[i].name,&cl[i].qm,&cl[i].py,&cl[i].gb,&cl[i].xb,&cl[i].lw);
        ysj(i);
        if(cl[i].jxj>max)
        {
                         max=cl[i].jxj;
                         maxn=i;
        }
    }
    printf("%s\n%d\n%d",cl[maxn].name,cl[maxn].jxj,sum);
   
    return 0;
}
int main() {
	struct stu1{
		char name[30];
		int scor;
		int grad;
		char as;
		char xi;
		int num;
		int reward;
	} stu[100], temp;
	int n, i, re=0;
		char hhh;
	scanf("%d" ,&n);
	for(i=0;i<n;i++) {
		scanf("%s%d%d%c%c%c%c%d", stu[i].name, &stu[i].scor, &stu[i].grad, &hhh,&stu[i].as,&stu[i].xi,&stu[i].xi, &stu[i].num);
		stu[i].reward=0;
		if(stu[i].scor>80&&stu[i].num>=1) {
			stu[i].reward+=8000;
		}
		if(stu[i].scor>85&&stu[i].grad>80) {
			stu[i].reward+=4000;
		}
		if(stu[i].scor>90) {
			stu[i].reward+=2000;
		}
		if(stu[i].scor>85&&stu[i].xi=='Y') {
			stu[i].reward+=1000;
		}
		if(stu[i].grad>80&&stu[i].as=='Y') {
			stu[i].reward+=850;
		}
	}
	temp=stu[0];
	for(i=0;i<n;i++) {
		if(stu[i].reward>temp.reward) {
			temp=stu[i];
		}
	}
	for(i=0;i<n;i++) {
			re+=stu[i].reward;
		}

	printf("%s\n%d\n%d", temp.name, temp.reward, re);
	return 0;
}
void main()
{
	struct student
	{
	char name[100];
	int marka;
	int markb;
	char ganbu;
	char xibu;
	int c;
	}stu[100];
	int n,i,j,max,sum=0;
	int money[100]={0};
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s %d %d %c %c %d",&stu[i].name,&stu[i].marka,&stu[i].markb,&stu[i].ganbu,&stu[i].xibu,&stu[i].c);
		
	}
    for(i=0;i<n;i++)
	{
		if(stu[i].marka>80&&stu[i].c>0)
		{
			money[i]=money[i]+8000;
		}
		if(stu[i].marka>85&&stu[i].markb>80)
		{
			money[i]=money[i]+4000;
		}
		if(stu[i].marka>90)
		{
			money[i]=money[i]+2000;
		}
		if(stu[i].marka>85&&stu[i].xibu=='Y')
		{
			money[i]=money[i]+1000;
		}
		if(stu[i].markb>80&&stu[i].ganbu=='Y')
		{
			money[i]=money[i]+850;
		}
	}
	max=0;
	for(i=1;i<n;i++)
	{
		if(money[i]>money[max])
			max=i;
	}
	for(i=0;i<n;i++)
		sum=sum+money[i];
	printf("%s\n",stu[max].name);
	printf("%d\n",money[max]);
	printf("%d\n",sum);

	
           
		



		
	
	
}
int main()
{
	char x[20],y[20],k,l;
    int n,a,b,c,sum,i,j,max=0,max2=0;
    scanf("%d",&n);
    for (i=0;i<n;i++)
	{
		scanf("%s %d %d %c %c %d",x,&a,&b,&k,&l,&c);
	    sum=0;
		if ((a>80) && (c!=0))
			sum=sum+8000;
		if ((a>85) && (b>80))
			sum=sum+4000;
		if (a>90)
			sum=sum+2000;
		if ((a>85) && (l=='Y'))
			sum=sum+1000;
		if ((b>80) && (k=='Y'))
			sum=sum+850;
		if (sum>max)
		{	
			max=sum;
			for(j=0;j<20;j++)
			y[j]=x[j];
		}        
		max2=max2+sum;

	}
	printf("%s\n%d\n%d\n",y,max,max2);
	return 0;
}
struct student
{
	char name[20];
	int score1;
	int score2;
	char leader[2];
	char west[2];
	int paper;
	int money;
	struct student *next;
};
struct student *creat(int n)
{
	struct student *head;
	struct student *p1,*p2;
	int i;
	p1=p2=(struct student *)malloc(LEN);
	head=p1;
	for(i=0;i<n;i++)
	{
		p2=p1;
		scanf("%s%d%d%s%s%d",p1->name,&p1->score1,&p1->score2,&p1->leader,&p1->west,&p1->paper);
		{
			p1->money=0;
			if(p1->score1>80&&p1->paper!=0)
				p1->money=p1->money+8000;
			if(p1->score1>85&&p1->score2>80)
				p1->money=p1->money+4000;
			if(p1->score1>90)	
				p1->money=p1->money+2000;
			if(p1->score1>85&&(strcmp(p1->west,"Y")==0))
				p1->money=p1->money+1000;
			if(p1->score2>80&&(strcmp(p1->leader,"Y")==0))
				p1->money=p1->money+850;
		}
		p1=(struct student *)malloc(LEN);
		p2->next=p1;
	}
	p2->next=NULL;
	return(head);
}
void print(struct student *head)
{
	struct student *p1;
	int max,all=0;
	p1=head;
	max=p1->money;
	do
	{
		if(p1->money>max)
			max=p1->money;
		all=all+p1->money;
		p1=p1->next;
	}
	while(p1->next!=NULL);
	if(p1->money>max)
		max=p1->money;
	all=all+p1->money;
	p1=head;
	for(;p1->next!=NULL;)
	{
		if(p1->money==max)
		{
			printf("%s\n%d\n",p1->name,p1->money);
			break;
		}
		p1=p1->next;
	}
	printf("%d",all);
}
void main()
{
	int n;
	struct student *head;
	scanf("%d",&n);	
	head=creat(n);
	print(head);
}
struct student
{char name[20];
int test;
int judge;
char leader;
char west;
int paper;
};struct student stu[100];

void main()
{int m=0,n,i;
long sum,t=0,a[100]={0};
scanf("%d",&n);
for(i=0;i<n;i++)
{scanf("%s %d %d %c %c %d",&stu[i].name,&stu[i].test,&stu[i].judge,&stu[i].leader,&stu[i].west,&stu[i].paper);
}
for(sum=0,i=0;i<n;i++)
 {if(stu[i].test>80&&stu[i].paper>0) {a[i]=a[i]+8000;}
  if(stu[i].test>85&&stu[i].judge>80) {a[i]=a[i]+4000;}
  if(stu[i].test>90) {a[i]=a[i]+2000;}
  if(stu[i].test>85&&(stu[i].west=='Y')) {a[i]=a[i]+1000;}
  if(stu[i].judge>80&&(stu[i].leader=='Y') ) {a[i]=a[i]+850;}
 sum=sum+a[i];
 if(a[i]>t) {t=a[i];m=i;}
 }
printf("%s\n",stu[m].name);
printf("%ld\n",t);
printf("%ld\n",sum); 
}
int main()
{
	int N,i;
	int Endmark[100],Classmark[100],Essay[100],award[100]={0},sum=0,BP,X;
    char Name[100][21],Zone[100],Leader[100];
	scanf("%d",&N);
	for(i=0;i<N;i++){
		scanf("%s %d %d %c %c %d",Name[i],&Endmark[i],&Classmark[i],&Leader[i],&Zone[i],&Essay[i]);
		if(Endmark[i]>80&&Essay[i]>0){
			award[i]+=8000;
		}
		if(Endmark[i]>85&&Classmark[i]>80){
			award[i]+=4000;
		}
		if(Endmark[i]>90){
			award[i]+=2000;
		}
		if(Endmark[i]>85&&Zone[i]=='Y'){
			award[i]+=1000;
		}
		if(Classmark[i]>80&&Leader[i]=='Y'){
			award[i]+=850;
		}
		sum+=award[i];
	}
	BP=award[0];
	X=0;
	for(i=0;i<N;i++){
		if(award[i]>BP){
            BP=award[i];
			X=i;
		}
	}
	printf("%s\n",Name[X]);
	printf("%d\n",award[X]);
	printf("%d\n",sum);

return 0;
}