semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
struct student{
	char name[20];
	int pjcj,pycj;
	char ganbu,xibu;
	int article;
};

void main()
{
	struct student *p;
	int n,i;
	int sum=0,max=0,maxnum,single=0;
	scanf("%d",&n);
	p= (struct student *)malloc( n*sizeof(struct student) );

	for(i=0 ; i<n ; i++,single=0 ){
		scanf("%s", &p[i].name);
		scanf("%d%d", &p[i].pjcj, &p[i].pycj);
		scanf(" %c %c", &p[i].ganbu, &p[i].xibu);
		scanf("%d", &p[i].article);

		if( p[i].pjcj>80 && p[i].article )
			single+=8000;
		if( p[i].pjcj>85 && p[i].pycj>80 )
			single+=4000;
		if( p[i].pjcj>90 )
			single+=2000;
		if( p[i].pjcj>85 && p[i].xibu=='Y')
			single+=1000;
		if( p[i].pycj>80 && p[i].ganbu=='Y')
			single+=850;

		if( single>max ){
			max=single;
			maxnum=i;
		}
		sum+=single;
	}

	printf("%s\n",p[maxnum].name);
	printf("%d\n",max);
	printf("%d\n",sum);
}
struct student{
	char name[20];
	int qimo;
	int ping;
	char gan;
	char xi;
	int lun;
}stu[101];

int main(int argc, char* argv[])
{	int n,i;
	int jiang[101];
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s %d %d %c %c %d",stu[i].name,&stu[i].qimo,&stu[i].ping,&stu[i].gan,&stu[i].xi,&stu[i].lun);
		jiang[i]=0;
	}
	int max=0,zong=0;
	for(i=0;i<n;i++){
		if(stu[i].qimo>80&&stu[i].lun>0)jiang[i]+=8000;
		if(stu[i].qimo>85&&stu[i].ping>80)jiang[i]+=4000;
		if(stu[i].qimo>90)jiang[i]+=2000;
		if(stu[i].qimo>85&&stu[i].xi=='Y')jiang[i]+=1000;
		if(stu[i].ping>80&&stu[i].gan=='Y')jiang[i]+=850;
		if(max<jiang[i])max=jiang[i];
		zong+=jiang[i];
	}
	for(i=0;i<n;i++){
		if(max==jiang[i]){
			printf("%s\n%d\n",stu[i].name,jiang[i]);break;

		}
	}
	
printf("%d\n",zong);
		
	return 0;
}
int main()
{
 struct student
{char name[20];
 int  g1;
 int  g2;
 char c;
 char w;
 int  p;}stu[100];
 int n,s[100],total=0,max=0,i;
 scanf("%d\n",&n);
 for(i=0;i<n;i++)
 scanf("%s %d %d %c %c %d\n",&stu[i].name,&stu[i].g1,&stu[i].g2,&stu[i].c,&stu[i].w,&stu[i].p);
 for(i=0;i<n;i++)
{ if(stu[i].g1>80&&stu[i].p>=1)s[i]=s[i]+8000;
 if(stu[i].g1>85&&stu[i].g2>80)s[i]=s[i]+4000;
 if(stu[i].g1>90)s[i]=s[i]+2000;
 if(stu[i].g1>85&&stu[i].w=='Y')s[i]=s[i]+1000;
 if(stu[i].g2>80&&stu[i].c=='Y')s[i]=s[i]+850;
 total=total+s[i];}
 for(i=1;i<n;i++)
 if(s[i]>s[max])max=i;
 printf("%s\n",stu[max].name);
 printf("%d\n",s[max]);
 printf("%d\n",total);
 return 0;
}
void main()
{
	int N,x[100][3],i,total[100]={0};
	int T[100],s=0,k;
	char y[100][2],z[100][20];
	scanf("%d",&N);
	for(i=0;i<N;i++)
		scanf("%s %d %d %c %c %d",z[i],&x[i][0],&x[i][1],&y[i][0],&y[i][1],&x[i][2]);
    for(i=0;i<N;i++)
	{
		if(x[i][0]>80 && x[i][2]>0) total[i]=total[i]+8000;
		if(x[i][0]>85 && x[i][1]>80) total[i]=total[i]+4000;
		if(x[i][0]>90) total[i]=total[i]+2000;
        if(x[i][0]>85 && y[i][1]=='Y') total[i]=total[i]+1000;
		if(x[i][1]>80 && y[i][0]=='Y') total[i]=total[i]+850;
		s=s+total[i];
	}
	for(i=0;i<N;i++)
		T[i]=total[i];
	for(i=0;i<N-1;i++)
	{
		if(T[i]>T[i+1])
		{
            k=T[i];
			T[i]=T[i+1];
			T[i+1]=k;
		}
	}
	for(i=0;i<N;i++)
		if(total[i]==T[N-1])
		{
			printf("%s\n",z[i]);
			printf("%d\n",total[i]);
			printf("%d",s);
			break;
		}
}
struct student
{
	char name[20];
	int qimo;
	int banpin;
	char ganbu;
	char xibu;
	int lunwen;
	double sum;
	struct student *next;
};
int n;
double total=0;
struct student *create()
{
	struct student *p1,*p2,*head;
	p1=(struct student*)malloc(LEN);
	scanf("%s %d %d %c %c %d",p1->name,&p1->qimo,&p1->banpin,&p1->ganbu,&p1->xibu,&p1->lunwen);
	p1->sum=0;
    if(p1->qimo>80&&p1->lunwen>0)p1->sum=p1->sum+8000;
	if(p1->qimo>85&&p1->banpin>80)p1->sum=p1->sum+4000;
	if(p1->qimo>90)p1->sum=p1->sum+2000;
	if(p1->xibu=='Y'&&p1->qimo>85)p1->sum=p1->sum+1000;
    if(p1->ganbu=='Y'&&p1->banpin>80)p1->sum=p1->sum+850;
	total=total+p1->sum;

	head=p1;
	p2=p1;
	p1->next=NULL;
	int i=1;
	do
	{
		if(i==n)break;
			p1=(struct student*)malloc(LEN);
			scanf("%s %d %d %c %c %d",p1->name,&p1->qimo,&p1->banpin,&p1->ganbu,&p1->xibu,&p1->lunwen);
	        p1->sum=0;
            if(p1->qimo>80&&p1->lunwen>0)p1->sum=p1->sum+8000;
	        if(p1->qimo>85&&p1->banpin>80)p1->sum=p1->sum+4000;
	        if(p1->qimo>90)p1->sum=p1->sum+2000;
	        if(p1->xibu=='Y'&&p1->qimo>85)p1->sum=p1->sum+1000;
            if(p1->ganbu=='Y'&&p1->banpin>80)p1->sum=p1->sum+850;
	        total=total+p1->sum;

			p2->next=p1;
			p2=p1;
			p1->next=NULL;
			i++;
			
		}while(1);
	    return(head);
}
struct student *findmax(struct student *head)
{
	struct student *p,*max;
	p=head->next;
	max=head;
	while(p!=NULL)
	{
		if(p->sum>max->sum)max=p;
		p=p->next;
	}
	return(max);
}



int main()
{
	scanf("%d",&n);
	struct student *head,*max;
	head=create();
	max=findmax(head);
	printf("%s\n%g\n%g",max->name,max->sum,total);
}
int sch(int,int,char[],char[],int);
void main()
{  struct student
{char name[20];
int ave;
int jud;
char gan[2];
char xib[2];
int pap;
struct student *next;
} *p1,*p2,*head,*p;
int n,i,max,t;
scanf("%d",&n);

p=head=p1=p2=(struct student *)malloc(sizeof(struct student));
scanf("%s",p1->name);
scanf("%d%d",&p1->ave,&p1->jud);
scanf("%s",p1->gan);
scanf("%s",p1->xib);
scanf("%d",&p1->pap);
max=t=sch(p1->ave,p1->jud,p1->gan,p1->xib,p1->pap); 

for(i=2;i<=n;i++)
{p1=(struct student *)malloc(sizeof(struct student));

scanf("%s",p1->name);
scanf("%d%d",&p1->ave,&p1->jud);
scanf("%s",p1->gan);
scanf("%s",p1->xib);
scanf("%d",&p1->pap); 

t=t+sch(p1->ave,p1->jud,p1->gan,p1->xib,p1->pap);
if(sch(p1->ave,p1->jud,p1->gan,p1->xib,p1->pap)>max)
{max=sch(p1->ave,p1->jud,p1->gan,p1->xib,p1->pap);
p=p1;
}
p2->next=p1;
p2=p1;
}
p2->next=NULL;
printf("%s\n%d\n%d\n",p->name,max,t);
 
}
int sch(int ave,int jud,char gan[],char xib[],int pap)
{int t=0;
if(ave>80&&pap>=1)
t=t+8000;
if(ave>85&&jud>80)
t=t+4000;
if(ave>90)
t=t+2000;
if(ave>85&&strcmp(xib,"Y")==0)
t=t+1000;
if(jud>80&&strcmp(gan,"Y")==0)
t=t+850;
return(t);
}
struct Student
	{char name[30];
	 int q;
	 int b;
	 char s;
	 char x;
	 int w;
	 int money;
	};
int main()
{
	struct Student stu[100];
	struct Student temp;
	int n,sum=0,i,j,k;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s%d%d %c %c%d",&stu[i].name,&stu[i].q,&stu[i].b,&stu[i].s,&stu[i].x,&stu[i].w);
		stu[i].money=0;
		if(stu[i].q>80&&stu[i].w>0)
			stu[i].money=stu[i].money+8000;
		if(stu[i].q>85&&stu[i].b>80)
			stu[i].money=stu[i].money+4000;
		if(stu[i].q>90)
			stu[i].money=stu[i].money+2000;
		if(stu[i].q>85&&stu[i].x=='Y')
			stu[i].money=stu[i].money+1000;
		if(stu[i].b>80&&stu[i].s=='Y')
			stu[i].money=stu[i].money+850;
	}
	for(i=0;i<n;i++){
		sum=sum+stu[i].money;
	}
	for(i=0;i<n;i++){
		k=i;
		for(j=i+1;j<n;j++)
		if(stu[j].money>stu[k].money)
			k=j;
		temp=stu[k];stu[k]=stu[i];stu[i]=temp;
	}
	printf("%s\n%d\n%d\n",stu[0].name,stu[0].money,sum);
	return 0;
}
void main()
{
   struct student
   {char name[20];
 int grade;
 int eva;
 char pres;
 char west;
 int paper;
 int money;
   }stu[100];

	int n,i,sum,j;
	struct student *p;
	scanf("%d",&n);
	for(i=0;i<n;i++)
		scanf("%s %d %d %c %c %d",&stu[i].name,&stu[i].grade,&stu[i].eva,&stu[i].pres,&stu[i].west,&stu[i].paper);

	for(i=0;i<n;i++)
	{
		stu[i].money=0;
		if(stu[i].grade>80 && stu[i].paper>=1)
			stu[i].money=stu[i].money+8000;
		if(stu[i].grade>85 && stu[i].eva>80)
			stu[i].money=stu[i].money+4000;
		if(stu[i].grade>90)
			stu[i].money=stu[i].money+2000;
		if(stu[i].grade>85 && stu[i].west=='Y')
			stu[i].money=stu[i].money+1000;
		if(stu[i].eva>80 && stu[i].pres=='Y')
			stu[i].money=stu[i].money+850;
	}
	for(i=0,sum=0;i<n;i++)
		sum=sum+stu[i].money;
	for(i=1,p=&stu[0];i<n;i++)
		{	if(stu[i].money>p->money)
				p=stu+i;
		}

   printf("%s\n%d\n%d\n",p->name,p->money,sum);
}
struct Student
{
	char name[20];
	int final;
	int evaluate;
	char office;
	char west;
	int paper;
	int money;
	struct Student *next;
};
int main()
{
	struct Student *head,*p,*best;
	head=(struct Student *)malloc(sizeof(struct Student));
	p=head;
	int N,i;
	scanf("%d",&N);
	for(i=0;i<N;i++)
	{
		scanf("%s %d %d %c %c %d",p->name,&p->final,&p->evaluate,&p->office,&p->west,&p->paper);
		p->money=0;
		if(p->final>80&&p->paper>0)
			p->money+=8000;
		if(p->final>85&&p->evaluate>80)
			p->money+=4000;
		if(p->final>90)
			p->money+=2000;
		if(p->final>85&&p->west=='Y')
			p->money+=1000;
		if(p->evaluate>80&&p->office=='Y')
			p->money+=850;
		p->next=(struct Student *)malloc(sizeof(struct Student));
		p=p->next;
	}
	int all=0;
	p=head;
	best=head;
	for(i=0;i<N;i++)
	{
		all+=p->money;
		if(p->money>best->money)
		{
			best=p;
		}
		p=p->next;
	}
	printf("%s\n%d\n%d",best->name,best->money,all);
	return 0;
}
struct student
{
	int avescore,classscore,paper,money;
	char name[21],lead[2],west[2];
}stu[100];

main()
{
	int n,i,max=0,money=0;
	char output[21];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		stu[i].money=0;
		scanf("%s%d%d%s%s%d",&stu[i].name,&stu[i].avescore,&stu[i].classscore,&stu[i].lead,&stu[i].west,&stu[i].paper);
		if(stu[i].avescore>80&&stu[i].paper>=1)
		{
			stu[i].money+=8000;
		}
		if(stu[i].avescore>85&&stu[i].classscore>80)
		{
			stu[i].money+=4000;
		}
		if(stu[i].avescore>90)
		{
			stu[i].money+=2000;
		}
		if(stu[i].avescore>85&&stu[i].west[0]=='Y')
		{
			stu[i].money+=1000;
		}
		if(stu[i].classscore>80&&stu[i].lead[0]=='Y')
		{
			stu[i].money+=850;
		}
		money+=stu[i].money;
		if(max<stu[i].money)
		{
			max=stu[i].money;
			strcpy(output,stu[i].name);
		}
	}
	printf("%s\n%d\n%d\n",output,max,money);
	return 0;
}
struct node
{
	char name[20];
	int fin;
	int bj;
	char gb;
	char west;
	int essay;
}stu[100];
void main(){
	int n,sum=0,max=0;
	scanf("%d",&n);
	int i;
	for(i=0;i<n;i++)
	{
		scanf("%s %d %d %c %c %d",stu[i].name,&stu[i].fin,&stu[i].bj,&stu[i].gb,&stu[i].west,&stu[i].essay);
	}
	int a[100];
	for(i=0;i<n;i++)
	{
		a[i]=0;
		if((stu[i].fin>80)&&(stu[i].essay>=1)) a[i]=a[i]+8000;
		if((stu[i].fin>85)&&(stu[i].bj>80)) a[i]=a[i]+4000;
		if(stu[i].fin>90) a[i]=a[i]+2000;
		if((stu[i].fin>85)&&(stu[i].west=='Y')) a[i]=a[i]+1000;
		if((stu[i].gb=='Y')&&(stu[i].bj>80)) a[i]=a[i]+850;
	}
	for(i=0;i<n;i++)
	{
		sum=sum+a[i];
	}
	for(i=0;i<n;i++)
	{
		if(a[i]>max) max=a[i];
	}
	for(i=0;i<n;i++)
	{
		if(a[i]==max)
		{
			printf("%s\n%d\n",stu[i].name,a[i]);
			break;
		}
	}
	printf("%d",sum);
}
struct student
{
	char name[30];
	int exam;
	int result;
	char gan[2];
	char xibu[2];
	int lecture;
	int bonus;
};


void main()
{
	int n,i,sum=0;
	struct student Max;
	scanf("%d" ,&n);
	struct student *stu;
	stu = (struct student *)malloc(n*sizeof(struct student));
	for(i=0;i<n;i++)
	{
		scanf("%s %d %d %s %s %d" ,stu[i].name,&stu[i].exam,&stu[i].result,&stu[i].gan,&stu[i].xibu,&stu[i].lecture);

	}
	for(i=0;i<n;i++)
	{
		stu[i].bonus=0;
		if(((stu[i].exam)>80)&&((stu[i].lecture)>0))
		{
			stu[i].bonus+=8000;
		}
		if(((stu[i].exam)>85)&&((stu[i].result)>80))
		{
			stu[i].bonus+=4000;
		}
		if((stu[i].exam)>90)
		{
			stu[i].bonus+=2000;
		}
		if(((stu[i].exam)>85)&&((stu[i].xibu[0])=='Y'))
		{
			stu[i].bonus+=1000;
		}
		if(((stu[i].result)>80)&&((stu[i].gan[0])=='Y'))
		{
			stu[i].bonus+=850;
		}
	}
	Max=stu[0];
	for(i=1;i<n;i++)
	{
		if(stu[i].bonus>Max.bonus)
			Max=stu[i];
	}
	printf("%s\n" ,Max.name);
    printf("%d\n" ,Max.bonus);
	for(i=0;i<n;i++)
	{
		sum+=stu[i].bonus;
	}
	printf("%d\n" ,sum);
	free(stu);
}
int main()
{
	struct money
	{
		char name[20];
		int score1,score2;
		char a[2],b[2];
		int paper;
		int all;
	};
	struct money * p;
	int n,m;int * pp;
	scanf("%d",&n);
	p=(struct money *)malloc(n*sizeof(struct money));
	pp=(int *)malloc(n*sizeof(int));
	for(m=0;m<n;m++)
	{
		pp[m]=0;
		scanf("%s",p[m].name);
		scanf("%d %d",&p[m].score1,&p[m].score2);
		scanf("%s %s",&p[m].a,&p[m].b);
		scanf("%d",&p[m].paper);
		if(p[m].score1>80&&p[m].paper>0)
			pp[m]=pp[m]+8000;
		if(p[m].score1>85&&p[m].score2>80)
			pp[m]=pp[m]+4000;
		if(p[m].score1>90)
			pp[m]=pp[m]+2000;
		if(p[m].b[0]=='Y'&&p[m].score1>85)
			pp[m]=pp[m]+1000;
		if(p[m].a[0]=='Y'&&p[m].score2>80)
			pp[m]=pp[m]+850;
		p[m].all=pp[m];
	}
	int i,j,k,q=0;
	for(i=0;i<n-1;i++)
		for(j=0;j<n-1-i;j++)
			if(pp[j]>pp[j+1])
			{
				k=pp[j];
				pp[j]=pp[j+1];
				pp[j+1]=k;
			}
	for(i=0;i<n;i++)
		q=q+pp[i];
	for(i=0;i<n;i++)
		if(p[i].all==pp[n-1])
{
			printf("%s\n%d\n%d\n",p[i].name,p[i].all,q);break;
}

	free(p);
	free(pp);
}
struct student
{  char name[20];
   int s1;
   int s2;
   char a;
   char b;
   int num;
   int bonus;
} stu[100];
int main()
{
	int i,k=0,amount=0,n;
	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].a,&stu[i].b,&stu[i].num);
	
		
		if(stu[i].s1>80&&stu[i].num>=1) {
			stu[i].bonus+=8000;
		}
		if(stu[i].s1>85&&stu[i].s2>80) {
			stu[i].bonus+=4000;
		}
		if(stu[i].s1>90)
		{   stu[i].bonus+=2000;
		}
		if(stu[i].s1>85&&stu[i].b=='Y')
		{   stu[i].bonus+=1000;
		}
		if(stu[i].s2>80&&stu[i].a=='Y')
		{   stu[i].bonus+=850;
		}
		}
	for(i=0;i<n;i++){
	amount=amount+stu[i].bonus;
	}
	for(i=1;i<n;i++){
	   
	   if(stu[k].bonus<stu[i].bonus) 
	      k=i;
       }   
	   
    printf("%s\n",stu[k].name);
	printf("%d\n",stu[k].bonus);
	printf("%d",amount);
		return 0;
}
int main()
{
    struct jiangxuejin
    {
        char name[20],s1,s2;
        int qimo,banji,lunwen;
    }s[100];
    int n,i,b,jiangjin[100];
    scanf("%d",&n);
    for (i=0;i<n;i++)
    {
        scanf("%s %d %d %c %c %d\n",&s[i].name,&s[i].qimo,&s[i].banji,&s[i].s1,&s[i].s2,&s[i].lunwen);
    }
    for (i=0;i<n;i++)
    {
        b=0;
        if (s[i].qimo>80&&s[i].lunwen>=1)
        {
            b+=8000;
        }
        if (s[i].qimo>85&&s[i].banji>80)
        {
            b+=4000;
        }
        if (s[i].qimo>90)
        {
            b+=2000;
        }
        if (s[i].qimo>85&&s[i].s2=='Y')
        {
            b+=1000;
        }
        if (s[i].banji>80&&s[i].s1=='Y')
        {
            b+=850;
        }
        jiangjin[i]=b;
    }
    int largest=0,sum=0;
    for (i=0;i<n;i++)
    {
        if (jiangjin[i]>=largest)
        {
            largest=jiangjin[i];
        }
        sum+=jiangjin[i];
    }
    for (i=0;i<n;i++)

    {
        if (jiangjin[i]==largest)
        {
            printf("%s\n",s[i].name);
            printf("%d\n",largest);
            printf("%d",sum);
            break;
        }
    }
    return 0;
}
struct reward
{
   char name[20];
   int fgra;
   int tgra;
   char gb;
   char xb;
   int lw;
};
int main()
{
	int n,*pr,sum=0,max;
	struct reward *p,temp;
	scanf("%d",&n);
	struct reward *rew=(struct reward*)malloc(sizeof(struct reward)*n);
	int *trew=(int*)malloc(sizeof(int)*n);
	for(p=rew;p<rew+n;p++)
	{
		scanf("%s %d %d %c %c %d",p->name,&p->fgra,&p->tgra,&p->gb,&p->xb,&p->lw);
	}
	for(p=rew,pr=trew;p<rew+n;p++,pr++)
	{
		*pr=0;
		if(p->fgra>80&&p->lw>=1)
		{
			*pr+=8000;
			sum+=8000;
		}
		if(p->fgra>85&&p->tgra>80)
		{
			*pr+=4000;
			sum+=4000;
		}
		if(p->fgra>90)
		{
			*pr+=2000;
			sum+=2000;
		}
		if(p->fgra>85&&p->xb=='Y')
		{
			*pr+=1000;
			sum+=1000;
		}
		if(p->tgra>80&&p->gb=='Y')
		{
			*pr+=850;
			sum+=850;
		}
	}
	
	max=*trew;
	temp=*rew;
	for(p=rew,pr=trew;p<rew+n;p++,pr++)
	{
		if(*pr>max)
		{
			max=*pr;
			temp=*p;
		}
	}
	printf("%s\n%d\n%d\n",temp.name,max,sum);
	return 0;
}
void main()
{
int i,n,k;
long a[100]={0},ss,m;
struct student
{
char name[20];
int score1,score2;
char leader;
char western;
int essay;
}st[100];
scanf("%d",&n);
for(i=0;i<n;i++)
	scanf("%s %d %d %c %c %d",st[i].name,&st[i].score1,&st[i].score2,&st[i].leader,&st[i].western,&st[i].essay);
 for(i=0;i<n;i++)
{
	if(st[i].score1>80&&st[i].essay!=0) a[i]=a[i]+8000;
	if(st[i].score1>85&&st[i].score2>80) a[i]=a[i]+4000;
	if(st[i].score1>90) a[i]=a[i]+2000;
	if(st[i].score1>85&&st[i].western=='Y') a[i]=a[i]+1000;
	if(st[i].score2>80&&st[i].leader=='Y') a[i]=a[i]+850;
}
m=a[0]; k=0; ss=a[0];
for(i=1;i<n;i++)
{
	if(m<a[i])
	{
		m=a[i];
		k=i;
	}
	ss=ss+a[i];
}
printf("%s\n%ld\n%ld\n",st[k].name,a[k],ss);
}
struct stu
{
	char name[25];
	int sco;
	int scob;
	int gb;
	int xb;
	int lw;
	int mon;
};
int main()
{
	int n;
	int i;
	int max=0;
	int zh;
	long int all=0;
	char du1,du2;
	scanf("%d",&n);
	struct stu a[100];
	for(i=0;i<n;i++)
	{
		scanf("%s %d %d %c %c %d",a[i].name,&a[i].sco,&a[i].scob,&du1,&du2,&a[i].lw);
		if(du1=='Y')
			a[i].gb=1;
		else
			a[i].gb=0;
		if(du2=='Y')
			a[i].xb=1;
		else
			a[i].xb=0;
		a[i].mon=0;
	}
	for(i=0;i<n;i++)
	{
		if(a[i].sco>80&&a[i].lw>=1)
			a[i].mon+=8000;
		if(a[i].sco>85&&a[i].scob>80)
			a[i].mon+=4000;
		if(a[i].sco>90)
			a[i].mon+=2000;
		if(a[i].sco>85&&a[i].xb==1)
			a[i].mon+=1000;
		if(a[i].scob>80&&a[i].gb==1)
			a[i].mon+=850;
		if(a[i].mon>max)
		{
			max=a[i].mon;
			zh=i;
		}
		all+=a[i].mon;
	}
	printf("%s\n%d\n%lu",a[zh].name,a[zh].mon,all);
}
int main()
{
    int N,i,sum,max,k,total=0;
	int t[100];
	struct student
	{
		char name[40];
		int grade1;
		int grade2;
		char monitor;
		char western;
		int num;
	};
	struct student stu[100];
	scanf("%d",&N);
	for(i=0;i<N;i++)
		{
			scanf("%s%d%d%s%s%d",stu[i].name,&stu[i].grade1,&stu[i].grade2,&stu[i].monitor,&stu[i].western,&stu[i].num);
		}	

	for(i=0;i<N;i++)
	{
		sum=0;
		if(stu[i].grade1>80 && stu[i].num>=1)
			sum+=8000;
		if(stu[i].grade1>85 && stu[i].grade2>80)
			sum+=4000;
		if(stu[i].grade1>90)
			sum+=2000;
		if(stu[i].grade1>85 && stu[i].western=='Y')
			sum+=1000;
		if(stu[i].grade2>80 && stu[i].monitor=='Y')
			sum+=850;
		t[i]=sum;
	}
    max=0;
	for(i=0;i<N;i++)
	{
		if(t[i]>max)
		{
			max=t[i];
			k=i;
		}
	}
	for(i=0;i<N;i++)
		total+=t[i];
	printf("%s\n%d\n%d\n",stu[k].name,max,total);
    return 0;
}
struct st
{
	char nam[100];
	int scq;
	int scb;
	char gb;
	char xb;
	int lw;
};
void main()
{
	int n,i,a[1000]={0},b[1000],sum=0,j,t;
	struct st s[1000];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		getchar();
		scanf("%s%d%d %c %c%d",s[i].nam,&s[i].scq,&s[i].scb,&s[i].gb,&s[i].xb,&s[i].lw);
	}
	for(i=0;i<n;i++)
	{
		b[i]=i;
		if(s[i].scq>80&&s[i].lw>=1)
			a[i]=a[i]+8000;
		if(s[i].scq>85&&s[i].scb>80)
			a[i]=a[i]+4000;
		if(s[i].scq>90)
			a[i]=a[i]+2000;
		if(s[i].scq>85&&s[i].xb=='Y')
			a[i]=a[i]+1000;
		if(s[i].scb>80&&s[i].gb=='Y')
			a[i]=a[i]+850;
		sum=sum+a[i];
	}
	for(i=n-1;i>0;i--)
	{
		for(j=0;j<i;j++)
		{
			if(a[j]<a[j+1])
			{
				t=a[j+1];a[j+1]=a[j];a[j]=t;
				t=b[j+1];b[j+1]=b[j];b[j]=t;
			}
		}
	}
	printf("%s\n",s[b[0]].nam);
	printf("%d\n%d\n",a[0],sum);
}
void main()
{
	
	struct stud
	{
		char name[1000];
		int gra;
		int grcla;
		char of;
		char won;
		int essay;
		int sum;
	};
	struct stud a[1000];	
	
	
	int n,i,all=0,j=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s %d %d %c %c %d",&a[i].name,&a[i].gra,&a[i].grcla,&a[i].of,&a[i].won,&a[i].essay);
	}
	for(i=0;i<n;i++)
	{
		a[i].sum=0;
		if(a[i].gra>80&&a[i].essay>=1)a[i].sum=8000;
		if(a[i].gra>85&&a[i].grcla>80)a[i].sum=a[i].sum+4000;
	    if(a[i].gra>90)a[i].sum=a[i].sum+2000;
	    if(a[i].gra>85&&a[i].won=='Y')a[i].sum=a[i].sum+1000;
		if(a[i].grcla>80&&a[i].of=='Y')a[i].sum=a[i].sum+850;
	}

	for(i=0;i<n;i++)
		all=all+a[i].sum;
	
	
	
	for(i=0;i<=n-1;)
	{
		if(a[i].sum<a[j+1].sum)
			i=i+1;
		else if(a[i].sum>=a[j+1].sum)
			j++;
		if(j>=n)
			break;
	}


	printf("%s\n",a[i].name);
	printf("%d\n",a[i].sum);
	printf("%d\n",all);

}
struct student 
{char name[30];
 int score1;
 int score2;
 char ganbu[1];
 char xibu[1];
 int lunwen;
 int s;
}stu[100];
main()
{
	int N,i,max=0,j,sum=0;
	scanf("%d",&N);
	for(i=0;i<N;i++)
	{
		scanf("%s%d%d%s%s%d",stu[i].name,&stu[i].score1,&stu[i].score2,stu[i].ganbu,stu[i].xibu,&stu[i].lunwen);
	}
	for(i=0;i<N;i++)
	{
		stu[i].s=0;
	}
	for(i=0;i<N;i++)
	{
		if(stu[i].score1>80&&stu[i].lunwen>0)
			stu[i].s=stu[i].s+8000;
		if(stu[i].score1>85&&stu[i].score2>80)
			stu[i].s=stu[i].s+4000;
		if(stu[i].score1>90)
			stu[i].s=stu[i].s+2000;
		if(stu[i].score1>85&&stu[i].xibu[0]=='Y')
			stu[i].s=stu[i].s+1000;
		if(stu[i].score2>80&&stu[i].ganbu[0]=='Y')
			stu[i].s=stu[i].s+850;
	}
	for(i=0;i<N;i++)
	{
		if(stu[i].s>max) 
		{
			max=stu[i].s;
			j=i;
		}
		sum=sum+stu[i].s;
	}
	printf("%s\n",stu[j].name);
	printf("%d\n",max);
	printf("%d\n",sum);
    
	
}
int main()
{
	int n,i,total=0,max=0,maxi=0;
	struct list{
		char name[20];
		int score;
		int rate;
		char leader;
		char west;
		int pap;
		int schol;
	};
	struct list *start,*p1;
	scanf("%d",&n);
	getchar();
	start=(struct list*)calloc(n,sizeof(struct list));
	p1=start;
	for(i=0;i<n;i++){
		scanf("%s", &(p1->name) );
		scanf("%d %d %c %c %d", &(p1->score), &(p1->rate), &(p1->leader), &(p1->west), &(p1->pap));
		getchar();
		p1 -> schol=0;
		if( p1->score > 80 && p1->pap > 0 )
			p1->schol += 8000;
		if( p1->score > 85 && p1->rate > 80 )
			p1->schol += 4000;
		if( p1->score > 90 )
			p1->schol += 2000;
		if( p1->score > 85 && p1->west == 'Y' )
			p1->schol += 1000;
		if( p1->rate > 80 &&  p1->leader == 'Y' )
			p1->schol += 850;
		total += p1->schol;
		if( p1->schol > max ){
				max=p1->schol;
				maxi=i;
			}
		p1++;
	}
	printf("%s\n%d\n%d\n", (start+maxi) -> name, (start+maxi) -> schol, total);
	return 0;
}
struct student
{
	char name[20];
    int fin;
	int py;
	char o;
	char w;
	int num;
};
long f(struct student s)
{
	long scholarship=0;
	if(s.fin>80&&s.num>=1)
		scholarship+=8000;
	if(s.fin >85&&s.py>80)
		scholarship+=4000;
	if(s.fin>90)
		scholarship+=2000;
	if(s.fin>85&&s.w=='Y')
		scholarship+=1000;
	if(s.py>80&&s.o=='Y')
		scholarship+=850;
	return(scholarship);
}
void main()
{
	int i,N;
	long max,sum=0;
    struct student st[100];
	scanf("%d",&N);
	for(i=0;i<N;i++)
	{
		scanf("%s %d %d %c %c %d",&st[i].name,&st[i].fin,&st[i].py,&st[i].o,&st[i].w,
			&st[i].num);
	}
	max=f(st[0]);
	sum=0;
	for(i=0;i<N;i++)
	{
		
		if(max<f(st[i]))
			max=f(st[i]);
		sum+=f(st[i]);
	}
	for(i=0;i<N;i++)
	{
		if(f(st[i])==max)
		{
			printf("%s\n",st[i].name);
			printf("%ld\n",max);
			printf("%ld\n",sum);
			break;
		}
	}
	

}
void main()
{
int N;
scanf("%d",&N);

struct student
{
	char name[20];
	int qm;
	int py;
	char gb;
	char w;
	int lw;
	int jj;
}stu[100];
int i;
for(i=0;i<N;i++)
{

	scanf("%s %d %d %c %c %d",&stu[i].name,&stu[i].qm,&stu[i].py,&stu[i].gb,&stu[i].w,&stu[i].lw);
	stu[i].jj=0;
	if(stu[i].qm>90)stu[i].jj+=2000;
	if(stu[i].qm>80&&stu[i].lw>=1)stu[i].jj+=8000;
    if(stu[i].qm>85&&stu[i].w=='Y')stu[i].jj+=1000;
	if(stu[i].qm>85&&stu[i].py>80)stu[i].jj+=4000;
	if(stu[i].py>80&&stu[i].gb=='Y')stu[i].jj+=850;
}
int trans1;
char trans2[20];
int total=0;
for(i=0;i<N;i++)total+=stu[i].jj;
for(i=0;i<N-1;i++)
{
	if(stu[i].jj>=stu[i+1].jj)
	{
		trans1=stu[i].jj;
		strcpy(trans2,stu[i].name);
		strcpy(stu[i].name,stu[i+1].name);
		stu[i].jj=stu[i+1].jj;
		strcpy(stu[i+1].name,trans2);
		stu[i+1].jj=trans1;
	}
}

 printf("%s\n%d\n%d\n",stu[N-1].name,stu[N-1].jj,total);         
}
int main(int argc, char* argv[])
{   int n,c[100],d[100],e[100],i,j=0,z,jin[100],max=0;
    char s[100][50];
	char a[100],b[100];
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s%d%d %c %c%d",s[i],&c[i],&d[i],&a[i],&b[i],&e[i]);}
    for(i=0;i<n;i++){
    jin[i]=0;
		if(c[i]>80&&e[i]>=1){jin[i]=jin[i]+8000;}
        if(c[i]>85&&d[i]>80){jin[i]=jin[i]+4000;}
        if(c[i]>90){jin[i]=jin[i]+2000;}
        if(c[i]>85&&b[i]=='Y'){jin[i]=jin[i]+1000;}
	    if(d[i]>80&&a[i]=='Y'){jin[i]=jin[i]+850;}
	    
	}
	j=0;
	for(i=0;i<n;i++){
			j=j+jin[i];}
	
	for(i=0;i<n;i++){
		if(jin[i]>max){max=jin[i];z=i;}}
	

	printf("%s\n%d\n%d\n",s[z],max,j);
	return 0;
}
int main()
{
	struct{
		char t[20],a[2],b[2];
		int m,n,p,g;
	}k[100],q;
	int c,i,j,sum=0;
	scanf("%d",&c);
	for(i=0;i<c;i++)
	{
		k[i].g=0;
		scanf("%s%d%d%s%s%d",k[i].t,&k[i].m,&k[i].n,k[i].a,k[i].b,&k[i].p);
		if(k[i].m>80&&k[i].p>=1)
			k[i].g+=8000;
		if(k[i].m>85&&k[i].n>80)
			k[i].g+=4000;
        if(k[i].m>90)
			k[i].g+=2000;
        if(k[i].m>85&&k[i].b[0]=='Y')
			k[i].g+=1000;
        if(k[i].n>80&&k[i].a[0]=='Y')
			k[i].g+=850;
	}
	for(i=0;i<c;i++)
	{
		sum+=k[i].g;
	}
	for(i=0;i<c;i++)
	{
		for(j=c-1;j>i;j--)
		{
			if(k[j].g>k[j-1].g)
			{
				q=k[j];
				k[j]=k[j-1];
				k[j-1]=q;
			}
		}
	}
	printf("%s\n%d\n%d",k[0].t,k[0].g,sum);
	return 0;
}