semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
struct student{
       char name[21];
       int qimo;
       int maji;
       char ganbu;
       char xibu;
       int lun;
       int money;}st[101];
int main()
{
    int n,i,j,ans=0;
    memset(st,0,sizeof(struct student));
    scanf("%d",&n);
    for(i=1;i<=n;i++)
    scanf("%s %d %d %c %c %d",st[i].name,&st[i].qimo,&st[i].maji,&st[i].ganbu,&st[i].xibu,&st[i].lun);
    for(i=1;i<=n;i++)
    {if(st[i].qimo>80&&st[i].lun>=1)st[i].money+=8000;
     if(st[i].qimo>85&&st[i].maji>80)st[i].money+=4000;
     if(st[i].qimo>90)st[i].money+=2000;
     if(st[i].qimo>85&&st[i].xibu=='Y')st[i].money+=1000;
     if(st[i].maji>80&&st[i].ganbu=='Y')st[i].money+=850;
     }
     j=1;
     for(i=1;i<=n;i++)
     {if(st[j].money<st[i].money)j=i;
     ans+=st[i].money;
     }
     printf("%s\n%d\n%d",st[j].name,st[j].money,ans);
     return 0;
     }
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, q;
		int l;
		scanf("%s%d%d %c %c%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&&q=='Y')
		{
			sum[i]+=1000;
		}
		if(b>80&&p=='Y')
		{
			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", name[k]);
	printf("%d\n", sum[k]);
	printf("%d\n", total);
	return 0;
}
void main()
{
	int n, i, sum, z;

	struct student
	{
		char name[20];
		int exam;
		int cla;
		char lead;
		char west;
		int theo;
		int sch;
	};
	struct student stu[100];

	scanf("%d", &n);
	for(i=0; i<n; i++)
	{
		scanf("%s", stu[i].name);
		scanf("%d", &stu[i].exam);
		scanf("%d %c %c %d", &stu[i].cla, &stu[i].lead, &stu[i].west, &stu[i].theo);
	}

	for(i=0; i<n; i++)
	{
		stu[i].sch = 0;
		if(stu[i].exam>80 && stu[i].theo>0)
			stu[i].sch = stu[i].sch + 8000;
		if(stu[i].exam>85 && stu[i].cla>80)
			stu[i].sch = stu[i].sch + 4000;
		if(stu[i].exam>90)
			stu[i].sch = stu[i].sch + 2000;
		if(stu[i].exam>85 && stu[i].west=='Y')
			stu[i].sch = stu[i].sch + 1000;
		if(stu[i].cla>80 && stu[i].lead=='Y')
			stu[i].sch = stu[i].sch + 850;
	}

	z = 0;
	for(i=0; i<n; i++)
	{
		if(stu[i].sch>stu[z].sch)
			z = i;
	}

	sum = 0;
	for(i=0; i<n; i++)
		sum = sum + stu[i].sch;

	printf("%s\n", stu[z].name);
	printf("%d\n", stu[z].sch);
	printf("%d\n", sum);
}
struct student{
char name[21];
int pingjun;
int banyi;
char ganbu;
char west;
int paper;
}stu[120];
void scholar(struct student *p,int a); 

int main(){
	int n,i;
	struct student *pointer1;
	pointer1=stu;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s %d %d %c %c %d",&stu[i].name,&stu[i].pingjun,&stu[i].banyi,&stu[i].ganbu,&stu[i].west,&stu[i].paper);
	}
	scholar(pointer1,n);
	return 0;
}
void scholar(struct student *p,int a){
	int sums,sum=0,max=0;
	int j,jishu=0;
	for(j=0;j<a;j++){
		sums=0;
		if(((p+j)->pingjun>80)&&((p+j)->paper>0)){
			sums+=8000;
		}
		if(((p+j)->pingjun>85)&&((p+j)->banyi>80)){
			sums+=4000;
		}
		if((p+j)->pingjun>90){
			sums+=2000;		
		}
		if(((p+j)->pingjun>85)&&((p+j)->west=='Y')){
			sums+=1000;		
		}
		if(((p+j)->banyi>80)&&((p+j)->ganbu=='Y')){
			sums+=850;		
		}
		sum+=sums;
		if(sums>max){
			max=sums;
			jishu=j;
		}
	}
	printf("%s\n%d\n%d",(p+jishu)->name,max,sum);

}
struct student{
	char name[20];
	int gra1;
	int gra2;
	char ganbu;
	char west;
	int paper;
	int award;
}stu[100];
void main()
{
 int n,i,sum=0;
 scanf("%d",&n);

 for(i=0;i<n;i++){
  scanf("%s",stu[i].name);
  scanf("%d%d%s%s%d",&stu[i].gra1,&stu[i].gra2,&stu[i].ganbu,&stu[i].west,&stu[i].paper);
 }
 for(i=0;i<n;i++){
  if(stu[i].gra1>80&&stu[i].paper>=1){
	  stu[i].award+=8000;
  }
  if(stu[i].gra1>85&&stu[i].gra2>80){
	  stu[i].award+=4000;
  }
  if(stu[i].gra1>90){
	  stu[i].award+=2000;
  }
  if(stu[i].gra1>85&&stu[i].west=='Y'){
	  stu[i].award+=1000;
  }
  if(stu[i].ganbu=='Y'&&stu[i].gra2>80){
	  stu[i].award+=850;
 }
  sum+=stu[i].award ;
 }


  int max=stu[0].award;
  char best[20];
  for(i=0;i<n;i++){
	  if(stu[i].award>max){
		  max=stu[i].award;
		  strcpy(best,stu[i].name);
	  }
  }
  printf("%s\n%d\n%d",best,max,sum);
 }
void main()
{
	int n,w,c[2],i,j,max,total,no;
	char a1,a2,s[20],t[20];
	scanf("%d",&n);
	total=0;
	max=0;
	for(i=0;i<n;i++)
	{
		w=0;
		scanf("%s %d %d %c %c %d",s,&c[0],&c[1],&a1,&a2,&no);
		if(c[0]>80&&no>0) w=w+8000;
		if(c[0]>85&&c[1]>80) w=w+4000;
		if(c[0]>90) w=w+2000;
		if(c[0]>85&&a2=='Y') w=w+1000;
		if(c[1]>80&&a1=='Y') w=w+850;
		total=total+w;
		if(w>max) 
		{
			max=w;
			strcpy(t,s);
		}
	}
	printf("%s\n%d\n%d\n",t,max,total);
}
struct award
{
	char name[20];
	int score1;
	int score2;
	char leader;
	char west;
	int paper;
	int money;
};
int main()
{
	struct award stu[100];
	struct award max;
	int n,i,sum=0;
	scanf("%d\n",&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].leader,&stu[i].west,&stu[i].paper);
	}
	for (i=0;i<n;i++)
	{
		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].west=='Y')
		{
			stu[i].money+=1000;
		}
		if (stu[i].score2>80 && stu[i].leader=='Y')
		{
			stu[i].money+=850;
		}
		sum+=stu[i].money;
	}
	max=stu[0];
	for (i=1;i<n;i++)
	{
		if (stu[i].money>max.money)
		{
			max=stu[i];
		}
	}
	puts(max.name);
	printf("%d\n",max.money);
	printf("%d\n",sum);
	return 0;
}
int main()
{
	int n,i,j,a1=8000,a2=4000,a3=2000,a4=1000,a5=850;
	int max=0,top=0,sum=0;
	int grade[100],assess[100],article[100],award[100];
	char west[100],official[100];
	char name[100][20];
	scanf("%d",&n);

	for(i=0;i<n;i++)
	{	
		getchar();
		for (j=0;j<20;j++)
		{
			scanf("%c",&name[i][j]);
			if (name[i][j]==' ') 
				break;
		}
		award[i]=0;
		scanf("%d %d %c %c %d",&grade[i],&assess[i],&official[i],&west[i],&article[i]);
		if (grade[i]>80 && article[i]>0)
			award[i]+=a1;
		if (grade[i]>85 && assess[i]>80)
			award[i]+=a2;
		if (grade[i]>90)
			award[i]+=a3;
		if (grade[i]>85 && west[i]=='Y')
			award[i]+=a4;
		if (assess[i]>80 && official[i]=='Y')
			award[i]+=a5;
		sum+=award[i];
		if (award[i]>max)
		{
			max=award[i];
			top=i;
		}
	}
	for(i=0;i<20;i++)
	{
		if(name[top][i]!=' ')
			printf("%c",name[top][i]);
		else
			break;
	}
	printf("\n%d\n%d\n",max,sum);
	return 0;
}
int main()
{
	int n,count[100]={0},score1[100],score2[100],num[100],i;
	char name[100][30],a[100][2],b[100][2];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s%d%d%s%s%d",name[i],&score1[i],&score2[i],a[i],b[i],&num[i]);
        if(score1[i]>80&&num[i]>=1)
			count[i]+=8000;
		if(score1[i]>85&&score2[i]>80)
			count[i]+=4000;
		if(score1[i]>90)
			count[i]+=2000;
		if(score1[i]>85&&strcmp(b[i],"Y")==0)
			count[i]+=1000;
		if(score2[i]>80&&strcmp(a[i],"Y")==0)
			count[i]+=850;
	}
    int max=count[0],m=0,sum=count[0];
	for(i=1;i<n;i++)
	{
		sum+=count[i];
		if(count[i]>max)
		{
			max=count[i];
			m=i;
		}
	}
	printf("%s\n%d\n%d",name[m],count[m],sum);
	return 0;
}
struct student
{
	char name[20];
	int s1,s2;
	char x,y;
	int l;
}stu[100];
int jiangjin(int i)
{
	int jiang=0;
	if(stu[i].s1>80&&stu[i].l>=1)
		jiang+=8000;
	if(stu[i].s1>85&&stu[i].s2>80)
		jiang+=4000;
	if(stu[i].s1>90)
		jiang+=2000;
	if(stu[i].s2>80&&stu[i].x=='Y')
		jiang+=850;
	if(stu[i].s1>85&&stu[i].y=='Y')
		jiang+=1000;
	return(jiang);
}
	
void main()
{
	int n,i,a[100],h,sum=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].x,&stu[i].y,&stu[i].l);
	a[i]=jiangjin(i);
	}
	h=0;
	for(i=0;i<n;i++)
	{
		sum+=a[i];
		if(a[i]>a[h]){
			h=i;}
	}
	printf("%s\n%d\n%d",stu[h].name,a[h],sum);
}
int main()
{
	int n,i=1,a,b,c,x,y=-1,sum=0;
	char N[21],A[21],d,e;
	scanf("%d",&n);
	do 
	{
		scanf("%s %d %d %c %c %d",N,&a,&b,&d,&e,&c);
                  x=0;
		if(a>80&&c>=1)
			x=x+8000;
		if(a>85&&b>80)
			x=x+4000;
		if(a>90)
			x=x+2000;
		if(a>85&&e=='Y')
			x=x+1000;
		if(b>80&&d=='Y')
			x=x+850;
		    sum=sum+x;
		if(x>y)
		{
			y=x;
			strcpy(A,N);
		}
		i++;
	}
	while(i<=n);
    printf("%s\n",A);
    printf("%d\n",y);
	printf("%d\n",sum);
	return 0;
}
void main()
{
	int i,n,max=0;
	unsigned long sum=0;
	struct student
	{
		char name[21];			//??
		int mark;				//??????
		int evaluation;			//??????
		char cadre;				//????
		char west;				//??????
		int thesis;				//???
		int scholarship;		//???
	};
	scanf("%d",&n);
	struct student *p = (struct student*)malloc(n * sizeof(struct student));
	for(i=0; i<n; i++)
	{
		struct student *q;
		q = p + i;
		q->scholarship = 0;
		scanf("%s %d %d %c %c %d",&(q->name),&(q->mark),&(q->evaluation),&(q->cadre),&(q->west),&(q->thesis));
		if(q->mark>80 && q->thesis>0)
			q->scholarship += 8000;			//?????
		if(q->mark>85 && q->evaluation>80)
			q->scholarship += 4000;			//?????
		if(q->mark>90)
			q->scholarship += 2000;			//?????
		if(q->mark>85 && q->west=='Y')
			q->scholarship += 1000;			//?????
		if(q->evaluation>80 && q->cadre=='Y')
			q->scholarship += 850;			//?????
		sum += q->scholarship;
	}
	for(i=1; i<n; i++)
	{
		if((p+i)->scholarship > (p+max)->scholarship)
			max = i;
	}
	printf("%s\n%d\n%d",(p+max)->name,(p+max)->scholarship,sum);
}
struct student
	{
		char name [20];
		int score1;
		int score2;
		char moni;
		char west;
		int comp;
	}stu[100];
void main()
{
	struct student *p;
	int n,sum=0,t,s=0,d,i;
	char nam[20];
	scanf("%d",&n);
	for (  p=stu;p<stu+ n;p++)
		scanf("%s %d %d %c %c %d", &p->name,&p->score1,&p->score2,&p->moni,&p->west,&p->comp);
	p=stu;
	for (p=stu;p<stu+n;p++)
	{
		t=0;
       if (p->score1>80&&p->comp>=1)
		   t=t+8000;
	   if (p->score1>85&&p->score2>80)
		   t=t+4000;
	   if (p->score1>90)
		   t=t+2000;
	   if (p->score1>85&&p->west=='Y')
		   t=t+1000;
	   if (p->score2>80&&p->moni=='Y')
		   t=t+850;
	   if (t>s)   
	   {
		   s=t;
		   d=strlen(p->name);
		   strcpy(nam,p->name);
		   for (i=d;i<20;i++)
			   nam[i]=0;
	   }
	   sum=sum+t;

	}
	puts(nam);
 
	printf("%d\n%d",s,sum); 

}
int main()
{
	int n,i;
	scanf("%d",&n);
	struct f
	{
		char str[21];
		int score1,score2,article;//score1???????? score2??????
		char a,b;
		int prize;
	}*p;
	p=(struct f*)malloc(n*sizeof(struct f));
	for(i=0;i<n;i++)
	{   (p+i)->prize=0;
		scanf("%s %d %d %c %c %d",(p+i)->str,&((p+i)->score1),&((p+i)->score2),&((p+i)->a),&((p+i)->b),&((p+i)->article));
	if((p+i)->score1>80&&(p+i)->article>0)  (p+i)->prize+=8000;
	if((p+i)->score1>85&&(p+i)->score2>80)  (p+i)->prize+=4000;
	if((p+i)->score1>90) (p+i)->prize+=2000;
	if((p+i)->score1>85&&(p+i)->b=='Y') (p+i)->prize+=1000;
	if((p+i)->score2>80&&(p+i)->a=='Y') (p+i)->prize+=850;
	}
	long int sum=0;
    for(i=0;i<n;i++)  
	{
		sum+=(p+i)->prize;
	}
	char *p1;
	int max=0;
	for(i=0;i<n;i++)//????????????max?
		if((p+i)->prize>max)
		{
			max=(p+i)->prize;
			p1=(p+i)->str;
		}
		printf("%s\n%d\n%ld",p1,max,sum);
}
struct student
{
	char name[20];
	int ave;
	int cla;
	char leader;
	char west;
	int paper;
};
void main()
{
	struct student stu[200];
	int n,i,count[200],count2[200],k,j,temp,l,all,max;
	all=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		count[i]=0;
		scanf("%s %d %d %c %c %d",&stu[i].name,&stu[i].ave,&stu[i].cla,&stu[i].leader,&stu[i].west,&stu[i].paper);
		if(stu[i].ave>80&&stu[i].paper>=1)
			count[i]=count[i]+8000;
		if(stu[i].ave>85&&stu[i].cla>80)
			count[i]=count[i]+4000;
		if(stu[i].ave>90)
			count[i]=count[i]+2000;
		if(stu[i].ave>85&&stu[i].west=='Y')
			count[i]=count[i]+1000;
		if(stu[i].cla>80&&stu[i].leader=='Y')
			count[i]=count[i]+850;
		all=all+count[i];

	}
	for(k=0;k<n;k++)
		count2[k]=count[k];
	max=count[0];
	for(j=0;j<n;j++)
		if(count[j]>max)
			max=count[j];
		for(l=0;l<n;l++)
			if(count2[l]==max)
				break;
		printf("%s\n%d\n%d\n",stu[l].name,max,all);
}
int main(int argc, char* argv[])
{
	int n,i,b=0,sum=0,max;
	struct student{
		char name[21];
		int mc;
		int bc;
		char bg;
		char xb;
		int lw;
		int sch;
	}stu[100];
	scanf("%d",&n);
	for(i=0;i<n;i++){
		stu[i].sch=0;
		scanf("%s%d%d %c %c%d",&stu[i].name,&stu[i].mc,&stu[i].bc,&stu[i].bg,&stu[i].xb,&stu[i].lw);
		if(stu[i].mc>80&&stu[i].lw>0){
			stu[i].sch=8000;
			sum+=8000;
		}
		if(stu[i].mc>85&&stu[i].bc>80){
			stu[i].sch+=4000;
			sum+=4000;
		}
		if(stu[i].mc>90){
			stu[i].sch+=2000;
			sum+=2000;
		}
		if(stu[i].mc>85&&stu[i].xb=='Y'){
			stu[i].sch+=1000;
			sum+=1000;
		}
		if(stu[i].bc>80&&stu[i].bg=='Y'){
			stu[i].sch+=850;
			sum+=850;
		}
	}
	max=stu[0].sch;
	for(i=0;i<n;i++){
		if(max<stu[i].sch){
			max=stu[i].sch;
			b=i;
		}
	}
	printf("%s\n%d\n%d\n",stu[b].name,stu[b].sch,sum);
	return 0;
}
int main(int argc, char* argv[])
{
	char a[20],g[20],d,e;
	int b,c,f,n,sum=0,max=0,i,j;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		int sum1=0;
		scanf("%s %d %d %c %c %d",a,&b,&c,&d,&e,&f);
        if(b>80&&f>=1) sum1+=8000;
		if(b>85&&c>80) sum1+=4000;
		if(b>90) sum1+=2000;
		if(b>85&&e=='Y') sum1+=1000;
		if(c>80&&d=='Y') sum1+=850;
		sum+=sum1;
		if(sum1>max) 
		{
			max=sum1;
			for(j=0;j<20;j++)
			{
				g[j]=a[j];
			}
		}
	}
	printf("%s\n%d\n%d\n",g,max,sum);
	return 0;
}
struct student 
{	char s[21];
	int a;
	int b;
	char m;
	char p;
	int c;
	int q;
};
void main()
{
	int n,i,j;
	int long sum=0;
	struct student stu[100]; 
	struct student  l;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s %d %d %c %c %d",stu[i].s,&stu[i].a,&stu[i].b,&stu[i].m,&stu[i].p,&stu[i].c);
	}
	for(i=0;i<n;i++)
	{       
		    stu[i].q=0;
			if((stu[i].a>80) &&( stu[i].c>0))   
				stu[i].q+=8000;
			if((stu[i].a>85 )&& (stu[i].b>80))   
				stu[i].q+=4000;
		    if(stu[i].a>90)                 
				stu[i].q+=2000;
            if((stu[i].a>85) && (stu[i].p=='Y'))  
				stu[i].q+=1000;
            if((stu[i].b>80 )&& (stu[i].m=='Y'))  
				stu[i].q+=850;
	}
	for(j=1;j<n;j++)
	{
		for(i=0;i<n-j;i++)
	 { 
		 if(stu[i+1].q>stu[i].q)
		 {
	     l=stu[i];
		 stu[i]=stu[i+1];
		 stu[i+1]=l;
		 }
	 }
	}
	 for(i=0;i<n;i++)
		 sum+=stu[i].q;
printf("%s",stu[0].s);
printf("\n%d\n",stu[0].q);
printf("%d",sum);
}
struct stu
{ 
     char a[21];
     int b[2];
     char c;
     char d;
     int e;
     int sum;
   };
   int main()
   {
       struct stu h[100];
       int n,i,j,k,sum1;
       scanf("%d",&n);
       for(i=0;i<n;i++)
       {
         scanf("%s %d%d %c %c%d",h[i].a,&h[i].b[0],&h[i].b[1],&h[i].c,&h[i].d,&h[i].e);
         h[i].sum=0;
        if(h[i].b[0]>80&&h[i].e>=1)
         h[i].sum=h[i].sum+8000;
         if(h[i].b[0]>85&&h[i].b[1]>80)
         h[i].sum=h[i].sum+4000;
         if(h[i].b[0]>90)
         h[i].sum=h[i].sum+2000;
         if(h[i].b[0]>85&&h[i].d=='Y')
         h[i].sum=h[i].sum+1000;
         if(h[i].b[1]>80&&h[i].c=='Y')
         h[i].sum=h[i].sum+850;
         }
    //     for(i=0;i<n;i++)
    //      printf("%d\n",h[i].sum);
         k=0;
         sum1=h[0].sum;
         for(i=1;i<n;i++)
         {
           if(h[k].sum<h[i].sum)
           k=i;
           sum1=sum1+h[i].sum;
         }
         printf("%s\n%d\n%d\n",h[k].a,h[k].sum,sum1);
         return 0;
   }
void main()
{
	int n,i,a[100],e[100],f[100],g[100]={0},m=0,k;
	char b[100][20],c[100][1],d[100][1],x[100];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s%d%d%s%s%d",b[i],&a[i],&e[i],c[i],d[i],&f[i]);
		if(a[i]>80&&f[i]>0)
			g[i]=g[i]+8000;
		if(a[i]>85&&e[i]>80)
			g[i]=g[i]+4000;
		if(a[i]>90)
			g[i]=g[i]+2000;
		if(a[i]>85&&strcmp(d[i],"Y")==0)
			g[i]=g[i]+1000;
		if(e[i]>80&&strcmp(c[i],"Y")==0)
			g[i]=g[i]+850;
	}
	for(i=n-2;i>=0;i--)
		if(g[i]<g[i+1])
		{
			k=g[i];
			g[i]=g[i+1];
			g[i+1]=k;
			strcpy(x,b[i]);
			strcpy(b[i],b[i+1]);
			strcpy(b[i+1],x);
		}
	for(i=0;i<n;i++)
		m=m+g[i];
	printf("%s\n%d\n%d\n",b[0],g[0],m);
}
struct student
{
	char name[20];
	int qm;
	int bj;
	char x;
	char xi;
	int lun;
	int award;
};
void main()
{
	struct student s[100];
	int i,N,k=0,p,q=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].x,&s[i].xi,&s[i].lun);
		s[i].award=0;
	//	printf("%s %d %d %c %c %d\n",s[i].name,s[i].qm,s[i].bj,s[i].x,s[i].xi,s[i].lun);
	}
	for(i=0;i<N;i++)
	{
		if(s[i].qm>80&&s[i].lun>0)
			s[i].award=s[i].award+8000;
		if(s[i].qm>85&&s[i].bj>80)
			s[i].award=s[i].award+4000;
		if(s[i].qm>90)
			s[i].award=s[i].award+2000;
		if(s[i].qm>85&&s[i].xi=='Y')
			s[i].award=s[i].award+1000;
		if(s[i].bj>80&&s[i].x=='Y')
			s[i].award=s[i].award+850;
	}
	p=s[0].award;
	for(i=0;i<N;i++)
	{
		if(s[i].award>p)
			p=s[i].award;
	}
	q=0;
	for(i=0;i<N;i++)
	{
		if(s[i].award==p)
		{
			if(k==0)
			{
				k=k+1;
				printf("%s\n",s[i].name);
				printf("%d\n",p);
			}
		}
		q=q+s[i].award;
	}
	printf("%d",q);
}
void main()
{
	char name[100][100],student[100][5],west[100][5];
	int final[100], clas[100], essay[100],scholarship[100]={0};
	int n,total=0;
	scanf("%d",&n);
	int i;
	for(i=0;i<n;i++)
	{
		scanf("%s%d%d%s%s%d",&name[i],&final[i],&clas[i],&student[i],&west[i],&essay[i]);
	}
	for(i=0;i<n;i++)
	{
		if(final[i]>80&&essay[i]>=1)
			scholarship[i]=scholarship[i]+8000;
		if(final[i]>85&&clas[i]>80)
			scholarship[i]=scholarship[i]+4000;
		if(final[i]>90)
			scholarship[i]=scholarship[i]+2000;
		if(west[i][0]=='Y'&&final[i]>85)
			scholarship[i]=scholarship[i]+1000;
		if(student[i][0]=='Y'&&clas[i]>80)
			scholarship[i]=scholarship[i]+850;
		total=total+scholarship[i];
	}
	int max=0,k;
	for(i=0;i<n;i++)
	{
		if(scholarship[i]>max)
		{
			max=scholarship[i];
			k=i;
		}
	}
	printf("%s\n",name[k]);
	printf("%d\n%d\n",scholarship[k],total);
}
struct stu
{
	char name[21];
	int s1;
	int s2;
	char g;
	char x;
	int l;
	int m;
}stu[101];

int main(int argc, char* argv[])
{
	int n,i,j,sum=0,len,max=0,num;
	scanf("%d",&n);
	for(i=1;i<=n;i++){
		scanf("%s %d %d %c %c %d",&stu[i].name,&stu[i].s1,&stu[i].s2,&stu[i].g,&stu[i].x,&stu[i].l);
		stu[i].m=0;
		if(stu[i].s1>80&&stu[i].l>=1){
			stu[i].m+=8000;
		}
		if(stu[i].s1>85&&stu[i].s2>80){
			stu[i].m+=4000;
		}
		if(stu[i].s1>90){
			stu[i].m+=2000;
		}
		if(stu[i].s1>85&&stu[i].x=='Y'){
			stu[i].m+=1000;
		}
		if(stu[i].s2>80&&stu[i].g=='Y'){
			stu[i].m+=850;
		}
		sum+=stu[i].m;
		if(stu[i].m>max){
			max=stu[i].m;
			num=i;
		}
	}
	printf("%s\n%d\n%d",stu[num].name,stu[num].m,sum);
	return 0;
}
void main()
{
	struct student
	{
		char name[20];
		int q;
		int b;
		char g;
		char x;
		int l;
	};
	struct student stu[100];
	int i,n;
    long sum[100]={0},sum2=0,sum1;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf(P,stu[i].name,&stu[i].q,&stu[i].b,&stu[i].g,&stu[i].x,&stu[i].l);
	}
	for(i=0;i<n;i++)
	{
		if(stu[i].q>80&&stu[i].l>=1)
			sum[i]=sum[i]+8000;
		if(stu[i].q>85&&stu[i].b>80)
			sum[i]=sum[i]+4000;
		if(stu[i].q>90)
			sum[i]=sum[i]+2000;
		if(stu[i].q>85&&stu[i].x=='Y')
			sum[i]=sum[i]+1000;
		if(stu[i].b>80&&stu[i].g=='Y')
			sum[i]=sum[i]+850;
	}
	sum1=sum[0];
	sum2=sum[0];
	for(i=1;i<n;i++)
	{
		if(sum[i]>sum1)
			sum1=sum[i];
		sum2=sum2+sum[i];
	}
	for(i=0;i<n;i++)
	{
		if(sum1==sum[i])
		{
			printf("%s\n",stu[i].name);
			break;
		}
	}
	printf("%ld\n",sum1);
	printf("%ld\n",sum2);


}
int qm[102],bp[102],lw[102];
char bg[102]={'\0'},xb[102]={'\0'};
int yuanshi(int i)
{
	if(qm[i]>80&&lw[i]>0) return 8000;
		else return 0;
}
int wusi(int i)
{
	if(qm[i]>85&&bp[i]>80) return 4000;
		else return 0;
}
int youxiu(int i)
{
	if (qm[i]>90 ) return 2000;
		else return 0;
}
int xibu(int i)
{
	if(qm[i]>85&&xb[i]=='Y') return 1000;
		else return 0;
}
int banji(int i)
{
	if( bp[i]>80 && bg[i]=='Y') return 850;
		else return 0;
}

int main()
{
	int i,n,max,num,jxj[102]={0},sum=0;
	char name[102][21]={'\0'};
	cin>>n;
	for(i=1;i<=n;i++)
	{
		cin>>name[i]>>qm[i]>>bp[i]>>bg[i]>>xb[i]>>lw[i];
		jxj[i]=yuanshi(i)+wusi(i)+youxiu(i)+xibu(i)+banji(i);
	}
	max=jxj[1]; num=1,sum=jxj[1];
	for(i=2;i<=n;i++)
	{
		sum=sum+jxj[i];
		if (jxj[i]>max)
		{
			max=jxj[i];
			num=i;
		}
	}
	cout<<name[num]<<endl<<jxj[num]<<endl<<sum<<endl;
	return 0;
}
int main()
{
	int n,i,maxmoney,sum=0;
	char name[21];char maxname[21];
	int qimo[100]={0};int banji[100]={0};char ganbu[100];char xibu[100];int lunwen[100]={0};int money[100]={0};
	scanf("%d",&n);
    

	for(i=1;i<=n;i++)
	{
		scanf("%s",name);

        
		scanf(" %d %d",&qimo[i-1],&banji[i-1]);
		scanf(" %c %c",&ganbu[i-1],&xibu[i-1]);
		scanf(" %d",&lunwen[i-1]);
		if(qimo[i-1]>80&&lunwen[i-1]>=1) money[i-1]=money[i-1]+8000;
		if(qimo[i-1]>85&&banji[i-1]>80) money[i-1]=money[i-1]+4000;
		if(qimo[i-1]>90) money[i-1]=money[i-1]+2000;
		if(qimo[i-1]>85&&xibu[i-1]=='Y') money[i-1]=money[i-1]+1000;
		if(banji[i-1]>80&&ganbu[i-1]=='Y') money[i-1]=money[i-1]+850;
		if(i==1) 
		{
			maxmoney=money[0];
		    strcpy(maxname,name);
		}
		sum=sum+money[i-1];
		if(i>=2)
		{
			
		if (money[i-1]>maxmoney)
		
		{
			maxmoney=money[i-1];
			strcpy(maxname,name);

		}
			
		}
	}


	printf("%s\n",maxname);
	printf("%d\n",maxmoney);
	printf("%d\n",sum);

	
	return 0;
}
int main()
{
	int N, i, final_g, class_g, nPapers;
	int scholarship, max_s, sum;
	char isCadre, isWest;
	char buffer[21];
	char name[21];

	scanf("%d", &N);
	sum = 0;
	max_s = 0;
	for (i=0; i<N; i++) {
		scanf("%s %d %d %c %c %d", buffer, &final_g, &class_g, &isCadre, &isWest, &nPapers);
		scholarship = 0;
				if (final_g>80 && nPapers>0)
			scholarship += 8000;
				if (final_g>85 && class_g>80)
			scholarship += 4000;
				if (final_g>90)
			scholarship += 2000;
				if (final_g>85 && isWest=='Y')
			scholarship += 1000;
				if (class_g>80 && isCadre=='Y')
			scholarship += 850;

		if (scholarship > max_s) {
			strcpy(name, buffer);
			max_s = scholarship;
		}
		sum += scholarship;
	}
	printf("%s\n%d\n%d\n", name, max_s, sum);

	return 0;
}
void main()
{
	int n,i,s1[100],s2[100],e[100],s[100]={0},all[100]={0},sum=0;
      char name[100][30],g[100],w[100];

	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		int R[5]={0};
		scanf("%s %d %d %c %c %d",name[i],&s1[i],&s2[i],&g[i],&w[i],&e[i]);
if ((s1[i]>80)&&(e[i]>=1)) 
R[0]= 8000;		
if ((s1[i]>85)&&(s2[i]>80)) 
R[1]= 4000;
	if (s1[i]>90)
R[2]= 2000;

if ((s1[i]>85)&&(w[i]=='Y'))
R[3]= 1000;

if ((s2[i]>80)&&(g[i]=='Y'))
R[4]= 850;

		all[i]=R[0]+R[1]+R[2]+R[3]+R[4];
	}
	int r=0,max=all[0];
	for(i=0;i<n;i++)
	{
		sum+=all[i];
		if(all[i]>max)
		{
			max=all[i];
			r=i;
		}
	}
	printf("%s\n%d\n%d\n",name[r],all[r],sum);
}
struct student
{
	char name[20];
	int score1;
	int score2;
	char mon;
	char west;
	int paper;
	int sum;
	struct student *next;
};

struct student *creat(int n)
{
	struct student *p1,*p2,*head;
	int many;
	int n1;
	n1=n;
	p1=p2=(struct student*)malloc(LEN);
	head=NULL;
	many=0;
	while(many<n1)
	{
		scanf("%s %d %d %c %c %d",&p1->name,&p1->score1,&p1->score2,&p1->mon,&p1->west,&p1->paper);
		many++;
		if(many==1)head=p1;
		else p2->next=p1;
		p2=p1;
		p1=(struct student*)malloc(LEN);
	}
	p2->next=NULL;
	return(head);
}

void print(struct student *head)
{
	struct student *p,*pmax;
	p=head;
	int total=0,max=0;
	if(head!=NULL)
		do
		{
			p->sum=0;
			if(p->score1>80&&p->paper>=1)p->sum=p->sum+8000;
			if(p->score1>85&&p->score2>80)p->sum=p->sum+4000;
			if(p->score1>90)p->sum=p->sum+2000;
			if(p->score1>85&&p->west=='Y')p->sum=p->sum+1000;
            if(p->score2>80&&p->mon=='Y')p->sum=p->sum+850;
			total=total+p->sum;
			p=p->next;
		}while(p!=NULL);
		p=head;
		do
		{
			if(p->sum>max){max=p->sum;pmax=p;}
			p=p->next;
		}while(p!=NULL);
		printf("%s\n%d\n%d\n",pmax->name,max,total);
}

void main()
{
	int n;
	struct student *head;
	scanf("%d",&n);
	head=creat(n);
	print(head);
}
int main()
{
	int n;
	scanf("%d",&n);
	struct student
	{
		char name[100];
		int qi;
		int ping;
		char gan;
		char xi;
		int lun;
	}a[1000];
	int i;
	for(i=0;i<n;i++)
	{
		scanf("%s %d %d %c %c %d",a[i].name,&a[i].qi,&a[i].ping,&a[i].gan,&a[i].xi,&a[i].lun);
	}
	int d[1000]={0};
	for(i=0;i<n;i++)
	{
		if(a[i].qi>80&&a[i].lun!=0)
		{d[i]+=8000;}
		if(a[i].qi>85&&a[i].ping>80)
		{d[i]+=4000;}
		if(a[i].qi>90)
		{d[i]+=2000;}
		if(a[i].qi>85&&a[i].xi=='Y')
		{d[i]+=1000;}
		if(a[i].ping>80&&a[i].gan=='Y')
		{d[i]+=850;}
	}
	int sum=0;
	for(i=0;i<n;i++)
	{sum+=d[i];}
	int z=0;
	for(i=0;i<n;i++)
	{
		if(d[z]<d[i])
		{z=i;}
	}
	printf("%s\n%d\n%d",a[z].name,d[z],sum);
	return 0;
}