semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int main()
{
	int N,i,sum=0;
	int x[100]={0};
	int total=0;
	struct c{
		char p[20];
		int m1,m2;
		char a,b;
		int n;
	}q[100];
	scanf("%d",&N);
	for(i=0;i<N;i++)
	{
		char y[20];
		int m11,m22,n11;
		char a1,b1;
		scanf("%s %d %d %c %c %d",y,&m11,&m22,&a1,&b1,&n11);
		strcpy(q[i].p,y);
		q[i].m1=m11;
		q[i].m2=m22;
		q[i].a=a1;
		q[i].b=b1;
		q[i].n=n11;
	}
	for(i=0;i<N;i++)
	{
		if(q[i].m1>80&&q[i].n>0)
		{
			x[i]=x[i]+8000;
		}
		if(q[i].m1>85&&q[i].m2>80)
		{
			x[i]=x[i]+4000;
		}
		if(q[i].m1>90)
		{
			x[i]=x[i]+2000;
		}
		if(q[i].m1>85&&q[i].b=='Y')
		{
			x[i]=x[i]+1000;
		}
		if(q[i].m2>80&&q[i].a=='Y')
		{
			x[i]=x[i]+850;
		}
	}
	for(i=N-1;i>=0;i--)
	{
		if(x[i]>=sum)
		{
			sum=x[i];
		}
		total=total+x[i];
	}
	for(i=0;i<N;i++)
	{
		if(sum==x[i])
		{
			printf("%s\n",q[i].p);
			printf("%d\n",sum);
			printf("%d\n",total);
		    break;
		}
		
	}
	return 0;
}
int main ()
{
	char name[100][20]={0};
	char bgb,xb;
	int sc1,sc2,lw,sum[100]={0},s=0;
	int n,max=0;
	scanf("%d",&n);
	for(int i=0;i<n;i++)
	{
		scanf("%s",name[i]);			
		scanf("%d %d %c %c %d",&sc1,&sc2,&bgb,&xb,&lw);
		if(sc1>80 && lw>0){
			sum[i]+=8000;
		}
		if(sc1>85 && sc2>80){
			sum[i]+=4000;
		}
		if(sc1>90){
			sum[i]+=2000;
		}
		if(sc1>85 && xb=='Y'){
			sum[i]+=1000;
		}
		if(sc2>80 && bgb=='Y'){
			sum[i]+=850;
		}
		s+=sum[i];
	}
	for(int j=0;j<n;j++){
		if(max<sum[j]){
			max=sum[j];
		}
	}
	for(int k=0;k<n;k++){
		if(sum[k]==max){
			printf("%s\n%d\n%d\n",name[k],sum[k],s);
		    break;
		}
	}
	return 0;
}
struct student
{
	char name[20];
	int num1;
	int num2;
	char a;
	char b;
	int c;
	int sum;
	struct student *next;
};
struct student *creat(void)
{
	
	struct student *head;
	struct student *p1,*p2;
	int n;
	scanf("%d",&n);
	p1=p2=(struct student*)malloc(LEN);
	int i=0;
	scanf("%s %d %d %c %c %d",p1->name,&p1->num1,&p1->num2,&p1->a,&p1->b,&p1->c);
	i=i+1;
	head=NULL;
	while(i<n)
	{
		if(i==1) head=p1;
		else p2->next=p1;
		p2=p1;
		p1=(struct student*)malloc(LEN);
		scanf("%s %d %d %c %c %d",p1->name,&p1->num1,&p1->num2,&p1->a,&p1->b,&p1->c);
		i=i+1;
	}
	p2->next=p1;
	p1->next=NULL;

	return(head);
}



void print(struct student *head)
{
	struct student *p,*max;
	int d=0;
	p=head;
	
	if(head!=NULL)
       while(p!=NULL)
	    {
	    	(*p).sum=0;
		  if((*p).num1>80&&(*p).c!=0)
		  	(*p).sum+=8000;
		  else (*p).sum+=0;
		  if((*p).num1>85&&(*p).num2>80)
		    (*p).sum+=4000;
		  else (*p).sum+=0;
		  if((*p).num1>90)
		    (*p).sum+=2000;
		  else (*p).sum+=0;
		  if((*p).num1>85&&(*p).b=='Y')
		    (*p).sum+=1000;
		  else(*p).sum+=0;
		  if((*p).num2>80&&(*p).a=='Y')
		    (*p).sum+=850;
		  else (*p).sum+=0; 
		  
		
		  d+=(*p).sum;
		  p=p->next;
	    }
	  p=head;
	max=head;
	max->sum=0;
	if(head!=NULL)
	
		while(p!=NULL)
		{
			if(p->sum>max->sum)
		    max=p;
		  
		    p=p->next;
		}
		printf("%s\n%d\n",max->name,max->sum);
	
     printf("%d",d);
}
void main()
{
    struct student *head;
	head=creat();
	print(head);
}
//???????

struct data{

char a[20];
int b;
int c;
char d[10];
char e[10];
int f;
int g;
struct data *next;
};

int main() {
	struct data *head,*p,*pp;
	head=(struct data*)malloc(sizeof(struct data));
	p=head;
	int n,i;
	scanf("%d",&n);
	for(i=0;i<n;i++) {
		pp=(struct data*)malloc(sizeof(struct data));
		pp->g=0;
		scanf("%s %d %d %s %s %d",pp->a,&pp->b,&pp->c,pp->d,pp->e,&pp->f);
		if(pp->b>80&&pp->f>0) pp->g=pp->g+8000;
		if(pp->b>85&&pp->c>80) pp->g=pp->g+4000;
		if(pp->b>90) pp->g=pp->g+2000;
		if(pp->b>85&&pp->e[0]=='Y') pp->g=pp->g+1000;
		if(pp->c>80&&pp->d[0]=='Y') pp->g=pp->g+850;
		p->next=pp;
		p=pp;
	}
	p=head->next;
	struct data *x;
	int max=0,zz=0;

	for(i=0;i<n;i++) {
		if(p->g>max) {
			max=p->g;
			x=p;
		}
		zz=zz+p->g;
		p=p->next;
	}

	printf("%s\n",x->a);
	printf("%d\n",x->g);
	printf("%d\n",zz);
}
void main()
{
	struct stu
	{
		char name[20];
		int q;
		int p;
		char g;
		char x;
		int l;
	}stu[100];
	int n,i,j;
	char m[100][20];
	int s,t=0,sum=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s %d %d %c %c %d",stu[i].name,&stu[i].q,&stu[i].p,&stu[i].g,&stu[i].x,&stu[i].l);
		s=0;
		if(stu[i].q>80&&stu[i].l>=1)
			s=s+8000;
		if(stu[i].q>85&&stu[i].p>80)
			s=s+4000;
		if(stu[i].q>90)
			s=s+2000;
		if(stu[i].q>85&&stu[i].x=='Y')
			s=s+1000;
		if(stu[i].p>80&&stu[i].g=='Y')
			s=s+850;
		sum=sum+s;
		if(s>t)
		{
			j=0;
			strcpy(m[j],stu[i].name);
			t=s;
			j++;
		}
		else if(s==t)
		{
			strcpy(m[j],stu[i].name);
			j++;
		}
	}
	printf("%s\n",m[0]);
	printf("%d\n",t);
	printf("%d\n",sum);
}
struct scholar
{
	char name[20];
	int test;
	int cm;
	char leader;
	char west;
	int paper;
}stu[100];
int main()
{
	int i,n,max,s,f;
	int money[100]={0};
	i=0;
	f=0;
	max=0;
	s=0;
	scanf("%d",&n);
	for(i=0;i<=n-1;i++){
		scanf("%s%d%d%",stu[i].name,&(stu[i].test),&(stu[i].cm));
		scanf(" %c",&(stu[i].leader));
		scanf(" %c",&(stu[i].west));
		scanf(" %d",&(stu[i].paper));
	}
	for(i=0;i<=n-1;i++){
		if(stu[i].test>80&&stu[i].paper>=1){
			money[i]=money[i]+8000;
		}
		if(stu[i].test>85&&stu[i].cm>80){
			money[i]=money[i]+4000;
		}
		if(stu[i].test>90){
			money[i]=money[i]+2000;
		}
		if(stu[i].test>85&&stu[i].west=='Y'){
			money[i]=money[i]+1000;
		}
		if(stu[i].cm>80&&stu[i].leader=='Y'){
			money[i]=money[i]+850;
		}
	}
	for(i=0;i<=n-1;i++){
		if(money[i]>max){
			max=money[i];
			f=i;
		}
	}
	for(i=0;i<=n-1;i++){
		s=s+money[i];
	}
	printf("%s\n%d\n%d\n",stu[f].name,max,s);
	return 0;
}
void main()
{
	int n,qm[100],bj[100],lw[100],i,j,l=0,k,z[100]={0},p=0;
	char na[100][30],bg[100],mz[100],P[1][30];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s %d %d %c %c %d",na[i],&qm[i],&bj[i],&bg[i],&mz[i],&lw[i]);
	}
for(i=0;i<n;i++)
	{
		if(qm[i]>80 && lw[i]>=1)
			z[i]=z[i]+8000;
		if(qm[i]>85 && bj[i]>80)
			z[i]=z[i]+4000;
		if(qm[i]>90)
			z[i]=z[i]+2000;
		if(qm[i]>85 && mz[i]=='Y')
			z[i]=z[i]+1000;
		if(bg[i]=='Y' && bj[i]>80)
			z[i]=z[i]+850;
	}
	for(j=0;j<n-1;j++)
	{
			for(i=0;i<n-j-1;i++)

			if(z[i]<z[i+1])
			{
				k=z[i];
				z[i]=z[i+1];
				z[i+1]=k;
				strcpy(P,na[i]);
				strcpy(na[i],na[i+1]);
				strcpy(na[i+1],P);

			}
				
	}
	for(i=0;i<n;i++)
		p=p+z[i];
	printf("%s\n%d\n%d\n",na[0],z[0],p);
}
void main()
{
	struct student{
		char name[20];
		int qimochengji;
		int banjipingyi;
		char ganbu;
		char xibu;
		int lunwenshu;
		int jiangxuejin;
	} stu[100];
	int n,i,sum,max;
	scanf("%d\n",&n);
	for(i=0,sum=0,max=0;i<n;i++)
	{
		scanf("%s %d %d %c %c %d",stu[i].name,&stu[i].qimochengji,&stu[i].banjipingyi,&stu[i].ganbu,&stu[i].xibu,&stu[i].lunwenshu);
		stu[i].jiangxuejin=0;
		if(stu[i].qimochengji>80&&stu[i].lunwenshu>=1) stu[i].jiangxuejin=stu[i].jiangxuejin+8000;
		if(stu[i].qimochengji>85&&stu[i].banjipingyi>80) stu[i].jiangxuejin=stu[i].jiangxuejin+4000;
		if(stu[i].qimochengji>90) stu[i].jiangxuejin=stu[i].jiangxuejin+2000;
		if(stu[i].qimochengji>85&&stu[i].xibu=='Y') stu[i].jiangxuejin=stu[i].jiangxuejin+1000;
		if(stu[i].banjipingyi>80&&stu[i].ganbu=='Y') stu[i].jiangxuejin=stu[i].jiangxuejin+850;
		sum+=stu[i].jiangxuejin;
		if(stu[max].jiangxuejin<stu[i].jiangxuejin) max=i;
	}
	printf("%s\n",stu[max].name);
	printf("%d\n",stu[max].jiangxuejin);
	printf("%d\n",sum);
}
struct
{
    char name[21];
	int test,grade,paper,sum;
	char monitor,west;
}stu[100];
int main()
{
    int n,i,j,s=0,a,b=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].grade,
			&stu[i].monitor,
			&stu[i].west,
			&stu[i].paper);
			stu[i].sum=0;
            if(stu[i].test>80&&stu[i].paper>=1) stu[i].sum+=8000;
            if(stu[i].test>85&&stu[i].grade>80) stu[i].sum+=4000; 
			if(stu[i].test>90) stu[i].sum+=2000;
            if(stu[i].test>85&&stu[i].west=='Y') stu[i].sum+=1000;
			if(stu[i].grade>80&&stu[i].monitor=='Y') stu[i].sum+=850;
			s+=stu[i].sum;
	}
    a=stu[0].sum;
	for(i=1;i<n;i++){
		if(stu[i].sum>a){
		    a=stu[i].sum;
			b=i;
		}
	}
	printf("%s\n%d\n%d",stu[b].name,stu[b].sum,s);
	return 0;
}
void main()
{
	int m,n,x,y,a,b,c,d,e,i,total1=0,hu=0;
	long int total2=0;
	char name[20],j[20],ch1,ch2;
	scanf("%d\n",&x);
	for(i=1;i<=x;i++)
	{
		scanf("%s %d %d %c %c %d",name,&m,&n,&ch1,&ch2,&y);
		if(m>80&&y>=1)
			a=8000;
		else a=0;
		if(m>85&&n>80)
			b=4000;
		else b=0;
		if(m>90)
			c=2000;
		else c=0;
		if(m>85&&ch2=='Y')
			d=1000;
		else d= 0;
		if(n>80&&ch1=='Y')
			e=850;
		else e= 0;
		total1=a+b+c+d+e;
		if(total1>hu)
		{	
			hu=total1;
			strcpy(j,name);
		}
		total2+=total1;
	}
    printf("%s\n%d\n%ld\n",j,hu,total2);
}
struct student
{
	char name[30];
	int examgrade;
	int appgrade;
	char a;
	char b;
	int thesis;
};
void main()
{
    int n,i,temp,sum=0,max=0;
	int money[100]={0};
	struct student stu[100];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s",stu[i].name);
		scanf("%d%d",&stu[i].examgrade,&stu[i].appgrade);
		scanf(" %c %c",&stu[i].a,&stu[i].b);
		scanf("%d",&stu[i].thesis);
	}
	for(i=0;i<n;i++)
	{
		if(stu[i].examgrade>80)
		{
			if(stu[i].thesis>=1)
				money[i]=money[i]+8000;
			if(stu[i].examgrade>85)
			{
				if(stu[i].appgrade>80)
					money[i]=money[i]+4000;
				if(stu[i].examgrade>90)
					money[i]=money[i]+2000;
				if(stu[i].b=='Y')
					money[i]=money[i]+1000;
			}
		}
		if(stu[i].a=='Y'&&stu[i].appgrade>80)
			money[i]=money[i]+850;
	}
	for(i=0;i<n;i++)
	{
		sum=sum+money[i];
		if(money[i]>max)
		{
			max=money[i];
			temp=i;
		}
	}
	printf("%s\n",stu[temp].name);
	printf("%d\n%d",max,sum);
}
struct student
{
	char name[20];
	int a1;
	int a2;
    char w;
	char m;
	int e;
	int sch;
}stu[100];
void main()
{
	int n,i,sum=0;
	struct student p;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s %d %d %c %c %d",stu[i].name,&stu[i].a1,&stu[i].a2,&stu[i].m,&stu[i].w,&stu[i].e);
		stu[i].sch=0;
		if(stu[i].a1>80&&stu[i].e>0)  stu[i].sch+=8000;
		if(stu[i].a1>85&&stu[i].a2>80)    stu[i].sch+=4000;
		if(stu[i].a1>90)    stu[i].sch+=2000;
		if(stu[i].a1>85&&stu[i].w=='Y')   stu[i].sch+=1000;
		if(stu[i].a2>80&&stu[i].m=='Y')  stu[i].sch+=850;
		sum+=stu[i].sch;
	}
	p=stu[0];
	for(i=0;i<n;i++)
	if(stu[i].sch>p.sch)  p=stu[i];
	printf("%s\n%d\n%d",p.name,p.sch,sum);
}
struct student
{
	char name[100];
	int ascore;
	int bscore;
	char leader;
	char xibu;
	int papernum;
	int money;
	struct student *next;
};
int n;
int num;
int total=0;
int main()
{
	int i;
	scanf("%d",&num);
	struct student *creat();
	struct student *pt,*p,*flagp;
	pt=creat();
	p=pt;
	int max=pt->money;
	for(;;)
	{
		if(max<=p->money)
		{max=p->money;}
		if(p->next==NULL)
		{goto part2;}
		p=p->next;
	}
part2:
	p=pt;
	for(;;)
	{
		if(max==p->money)
		{flagp=p;goto part1;}
		if(p->next==NULL)
		{goto part1;}
		p=p->next;
	}
part1:;
	printf("%s\n%d\n%d",flagp->name,flagp->money,total);
	return 0;
}

struct student *creat()
{
	struct student *head,*p1,*p2;
	n=0;
	p1=p2=(struct student*)malloc(LEN);
	scanf("%s %d %d %c %c %d",p1->name,&p1->ascore,&p1->bscore,&p1->leader,&p1->xibu,&p1->papernum);
	head=NULL;
	p1->money=0;
	if(p1->ascore>80&&p1->papernum>=1)
			p1->money+=8000;
		if(p1->ascore>85&&p1->bscore>80)
			p1->money+=4000;
		if(p1->ascore>90)
			p1->money+=2000;
		if(p1->ascore>85&&p1->xibu=='Y')
			p1->money+=1000;
		if(p1->bscore>80&&p1->leader=='Y')
			p1->money+=850;
		total=p1->money;
	while(n!=num-1)
	{
		n=n+1;
		if(n==1)head=p1;
		else p2->next=p1;
		p2=p1;
		p1=(struct student *)malloc(LEN);
		p1->money=0;
		scanf("%s %d %d %c %c %d",p1->name,&p1->ascore,&p1->bscore,&p1->leader,&p1->xibu,&p1->papernum);
		if(p1->ascore>80&&p1->papernum>=1)
			p1->money+=8000;
		if(p1->ascore>85&&p1->bscore>80)
			p1->money+=4000;
		if(p1->ascore>90)
			p1->money+=2000;
		if(p1->ascore>85&&p1->xibu=='Y')
			p1->money+=1000;
		if(p1->bscore>80&&p1->leader=='Y')
			p1->money+=850;
		total=total+p1->money;
	}
	p2->next=p1;
	p1->next=NULL;
	return (head);
}
struct student
{
	char name[20];
	int mark;
	int re;
	char work;
	char west;
	int paper;
	int sum;
}stu[100];
void main()
{
	int n,i,sum=0,max=0,l;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s %d %d %s %s %d",&stu[i].name,&stu[i].mark,&stu[i].re,&stu[i].work,&stu[i].west,&stu[i].paper);
		stu[i].sum=0;
		if(stu[i].mark>80&&stu[i].paper>0)
			stu[i].sum+=8000;
		if(stu[i].mark>85&&stu[i].re>80)
			stu[i].sum+=4000;
		if(stu[i].mark>90)
			stu[i].sum+=2000;
		if(stu[i].mark>85&&stu[i].west=='Y')
			stu[i].sum+=1000;
		if(stu[i].re>80&&stu[i].work=='Y')
			stu[i].sum+=850;
        sum=sum+stu[i].sum;
	}
	for(i=0;i<n;i++)
	    if(max<stu[i].sum)
		{
			max=stu[i].sum;
			l=i;
		}
	printf("%s\n%d\n%d\n",stu[l].name,max,sum);
}
void main()
{
	int n,i,qians[100],sum,t,d;
	int jiangj(int a,int b,char d,char e,int c);
	struct student
	{
		char name[20];
		int qimo;
		int py;
		char a;
		char b;
		int paper;
	};
	struct student stu[100];
	scanf("%d\n",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s %d %d %c %c %d",stu[i].name,&stu[i].qimo,&stu[i].py,&stu[i].a,&stu[i].b,&stu[i].paper);
		qians[i]=jiangj(stu[i].qimo,stu[i].py,stu[i].a,stu[i].b,stu[i].paper);
	}
	for(i=0,t=0,sum=0;i<n;i++)
	{
		sum=sum+qians[i];
		if(t<qians[i])
		{
			d=i;
			t=qians[i];
		}
	}
	printf("%s\n%d\n%d",stu[d].name,qians[d],sum);
}
int jiangj(int a,int b,char d,char e,int c)
{
	int z;
	z=0;
	if(a>80&&c>0)
		z=z+8000;
	if(a>85&&b>80)
		z=z+4000;
	if(a>90)
		z=z+2000;
	if(a>85&&e=='Y')
		z=z+1000;
	if(b>80&&d=='Y')
		z=z+850;
	return(z);
}
int main()
{
	int n,i,s,total=0;
	struct 
	{char name[21];
	 int ave;
	 int mar;
	 int es;
	 char a;
	 char b;
	 int sum;
	}stu[100];
	scanf("%d", &n);
	for(i=0;i<n;i++)
		scanf("%s %d %d %c %c %d", stu[i].name, &stu[i].ave, &stu[i].mar, &stu[i].a, &stu[i].b, &stu[i].es);
	
	for(i=0;i<n;i++)
	{
		stu[i].sum=0;
		if(stu[i].ave>80&&stu[i].es>0) stu[i].sum+=8000;
		if(stu[i].ave>85&&stu[i].mar>80) stu[i].sum+=4000;
		if(stu[i].ave>90) stu[i].sum+=2000;
		if(stu[i].ave>85&&stu[i].b=='Y') stu[i].sum+=1000;
		if(stu[i].mar>80&&stu[i].a=='Y') stu[i].sum+=850;
		total+=stu[i].sum;
	}
	s=stu[0].sum;
	for(i=1;i<n;i++)
	{
		if(stu[i].sum>s) s=stu[i].sum;
	}
	for(i=0;i<n;i++)
	{
		if(stu[i].sum==s)
		{	
			printf("%s\n%d\n", stu[i].name, stu[i].sum);
		    break;}
	}
	printf("%d", total);
	return 0;
}
int main () {
	long int n,i,k,t,c,j,s=0,max=0,a[800]={0};
	char b[200][500],y,x;
	scanf ("%d",&n);
	for (i=0;i<n;i++)
	{
		scanf ("\n%s %d %d %c %c %d",b[i],&k,&t,&y,&x,&c);
     
	
		if (k>80 && c>0) a[i]+=8000;
        if (k>85 && t>80) a[i]+=4000;
	    if (k>90) a[i]+=2000;
	   	if (k>85 && x=='Y') a[i]+=1000;
	   	if (t>80 && y=='Y') a[i]+=850;
		s+=a[i];
	}
	for (i=0;i<n;i++)
    {
		if (a[i]>max){ 
			max=a[i];
			j=i;}
	}


	printf ("%s\n%d\n%d",b[j],max,s);
	return 0;
}
struct stu
{
	char name[21];
	int final;
	int pingyi;
	char leader;
	char west;
	int essay;
	int total;
};
int main()
{
	int yuanshi(struct stu s);
	int wusi(struct stu s);
	int score(struct stu s);
	int western(struct stu s);
	int contribution(struct stu s);
	int n,i;
	int sum=0,max;
	struct stu s[101],boss;
	scanf("%d",&n);
	for (i=0;i<n;i++)
	{
		scanf("%s%d%d %c %c%d",s[i].name,&s[i].final,&s[i].pingyi,&s[i].leader,&s[i].west,&s[i].essay);
		s[i].total=0;
		if (yuanshi(s[i]))
			s[i].total+=8000;
		if (wusi(s[i]))
			s[i].total+=4000;
		if (score(s[i]))
		    s[i].total+=2000;
		if (western(s[i]))
			s[i].total+=1000;
		if (contribution(s[i]))
			s[i].total+=850;
	}
    max=s[0].total;
	for (i=0;i<n;i++)
	{
		if (max<s[i].total)
		{
			max=s[i].total;
			boss=s[i];

		}
		sum+=s[i].total;
	}
	printf("%s\n%d\n%d\n",boss.name,boss.total,sum);
	return 0;
}

int yuanshi(struct stu s)
{
	if ((s.final>80)&&(s.essay>=1))
	{
		return 1;
	}
	else
		return 0;
}

int wusi(struct stu s)
{
	if ((s.final>85)&&(s.pingyi>80))
		return 1;
	else
		return 0;
}

int score(struct stu s)
{
	if (s.final>90)
		return 1;
	else
		return 0;
}

int western(struct stu s)
{
	if ((s.final>85)&&(s.west=='Y'))
		return 1;
	else 
		return 0;
}

int contribution(struct stu s)
{
	if ((s.pingyi>80)&&(s.leader=='Y'))
		return 1;
	else
		return 0;
}
struct students
{
	char name[21];
	int S1;
	int S2;
	char T1;
	char T2;
	int P;
	int JJ;
};

main()
{
	int n,i,max;
	struct students stu[NUM];
	long int all;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("\n%s %d %d %c %c %d",stu[i].name,&stu[i].S1,&stu[i].S2,&stu[i].T1,&stu[i].T2,&stu[i].P);
	}
	all=0;
	for(i=0;i<n;i++)
	{
		stu[i].JJ=0;
		if ((stu[i].S1>80)&&(stu[i].P>=1))
		{
			stu[i].JJ+=8000;
		}
		if((stu[i].S1>85)&&(stu[i].S2>80))
		{
			stu[i].JJ+=4000;
		}
		if (stu[i].S1>90)
		{
			stu[i].JJ+=2000;
		}
		if((stu[i].S1>85)&&(stu[i].T2=='Y'))
		{
			stu[i].JJ+=1000;
		}
		if((stu[i].S2>80)&&(stu[i].T1=='Y'))
		{
			stu[i].JJ+=850;
		}
		all =all +stu[i].JJ;
	}
	max=0;
	for (i=1;i<n;i++)
	{
		if (stu[i].JJ>stu[max].JJ)
		{
			max=i;
		}
	}
	printf("%s\n%d\n%ld\n",stu[max].name,stu[max].JJ,all);
}
struct file
{
	char name[100];
	int scoreq;
	int scorec;
	char m,w;
	int ati;
	int money;
};
int main()
{
	struct file f[101];
	int n,sum=0;
	int i,j,k;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		f[i].money=0;
	}
	
	for(i=0;i<n;i++)
	{
		scanf("%s",f[i].name);
		scanf("%d",&f[i].scoreq);
		scanf("%d",&f[i].scorec);
		getchar();
		f[i].m=getchar();
		getchar();
		f[i].w=getchar();
		getchar();
		scanf("%d",&f[i].ati);
	}
	for(i=0;i<n;i++)
	{
		if(f[i].scoreq>80&&f[i].ati>=1)
			f[i].money+=8000;
		if(f[i].scoreq>85&&f[i].scorec>80)
			f[i].money+=4000;
		if(f[i].scoreq>90)
			f[i].money+=2000;
		if(f[i].scoreq>85&&f[i].w=='Y')
			f[i].money+=1000;
		if(f[i].scorec>80&&f[i].m=='Y')
			f[i].money+=850;
	}
	for(i=0;i<n;i++)
		sum+=f[i].money;
	k=f[0].money;
	for(i=0;i<n;i++)
	{
		if(f[i].money>k)
			k=f[i].money;
	}
	for(i=0;i<n;i++)
	{
		if(f[i].money==k)
		{
			printf("%s\n",f[i].name);
			printf("%d\n",f[i].money);
			break;
		}
	}
	printf("%d",sum);
	return 0;
}
void main()
{
	int i,n,total=0;

	struct student
	{
		char name[21];
		int FinalScore;
		int ClassScore;
		char u;
		char w;
		int a;
		int money;
	}stu,max;
	scanf("%d",&n);
	max.money=-1;
	for(i=0;i<n;i++)
	{
		scanf("%s %d %d %c %c %d",stu.name,&stu.FinalScore,
		&stu.ClassScore,&stu.u,&stu.w,&stu.a);
		stu.money=0;
		if(stu.FinalScore>80&&stu.a>0)
			stu.money+=8000;
		if(stu.FinalScore>85&&stu.ClassScore>80)
			stu.money+=4000;
		if(stu.FinalScore>90)
			stu.money+=2000;
		if(stu.FinalScore>85&&stu.w=='Y')
			stu.money+=1000;
		if(stu.ClassScore>80&&stu.u=='Y')
			stu.money+=850;
		total+=stu.money;
		if(stu.money>max.money)
			max=stu;
	}
	printf("%s\n%d\n%d\n",max.name,max.money,total);
}
struct student
{
	char *name;
	int  grade;
	int cla;
	char gugan;
	char xibu;
	int paper;
	int money;
	struct student *next;
};
void main()
{
	int n,i,sum=0,max=0;
	struct student *head,*p1,*p2,*s;
	scanf("%d",&n);
	p2=p1=(struct student *)malloc(LEN);
	p1->name=(char*)calloc(22,sizeof(char));
	head=p1;
	for(i=0;i<n;i++)
	{
		//p1=(struct student *)malloc(LEN);
		
        scanf("%s %d %d %c %c %d",p1->name,&p1->grade,&p1->cla,&p1->gugan,&p1->xibu,&p1->paper);
		p2->next=p1;
		p2=p1;
        p2->money=0;
		if (p2->grade>80&&((p2->paper)>=1)) {p2->money=p2->money+8000;sum=sum+8000;}
		if(p2->grade>85&&p2->cla>80)  {p2->money=p2->money+4000;sum=sum+4000;}
		if(p2->grade>90) {p2->money=p2->money+2000;sum=sum+2000;}
		if(p2->grade>85&&p2->xibu=='Y')  {p2->money=p2->money+1000;sum=sum+1000;}
		if(p2->cla>80&&p2->gugan=='Y') {p2->money=p2->money+850;sum=sum+850;}
		if(max<p2->money) max=p2->money;
		p1=(struct student *)malloc(LEN);
		p1->name=(char*)calloc(22,sizeof(char));
		//scanf("%s %d %d %c %c %d",p1->name,&p1->grade,&p1->cla,&p1->gugan,&p1->xibu,&p1->paper);
	}
	
		p2->next=NULL;
		s=head;
		for(i=0;s->money!=max;i++)
			s=s->next;
		printf("%s\n%d\n%d",s->name,max,sum);
}
void main()
{
	struct student
	{
		char name[50];
		int score1;
		int score2;
		char master;
		char west;
		int paper;
	};
	struct student stu[100];
	int i,n,sum[100]={0},total,max;
    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].master,&stu[i].west,&stu[i].paper);
	for(i=0;i<n;i++)
	{
		if(stu[i].score1>80&&stu[i].paper>0)sum[i]=sum[i]+8000;
        if(stu[i].score1>85&&stu[i].score2>80)sum[i]=sum[i]+4000;
        if(stu[i].score1>90)sum[i]=sum[i]+2000;
	    if(stu[i].score1>85&&stu[i].west==89)sum[i]=sum[i]+1000;
		if(stu[i].score2>80&&stu[i].master==89)sum[i]=sum[i]+850;
	}
	for(i=0,max=sum[0],total=0;i<n;i++)
	{
		if(sum[i]>=max)max=sum[i];
		total+=sum[i];
	}
	for(i=0;i<n;i++)
	{
		if(sum[i]==max){
			printf("%s\n",stu[i].name);
			break;}
    }
	printf("%d\n",max);
	printf("%d\n",total);
}
void main()
{
	int n,i,j,k,m=0;
	struct student 
	{
		char name[20];
		int qm;
		int bj;
		char xg;
		char xb;
		int lw;
		int jj;
	};
	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].qm,&stu[i].bj,&stu[i].xg,&stu[i].xb,&stu[i].lw);
	}
	for(i=0;i<n;i++)
	{     stu[i].jj=0;
		if(stu[i].qm>80&&stu[i].lw>0)
          stu[i].jj=stu[i].jj+8000;
		if(stu[i].qm>85&&stu[i].bj>80)
		stu[i].jj=stu[i].jj+4000;
		if(stu[i].qm>90)
			stu[i].jj=stu[i].jj+2000;
		if(stu[i].qm>85&&stu[i].xb=='Y')
			stu[i].jj=stu[i].jj+1000;
       if(stu[i].bj>80&&stu[i].xg=='Y')
		   stu[i].jj=stu[i].jj+850;
	}
	for(i=0;i<n;i++)
	{   k=0;
		for(j=0;j<n;j++)
		{
			if(stu[i].jj<stu[j].jj)
			break;
			else
				k++;
		}
		if(k==n)
		{printf("%s\n%d\n",stu[i].name,stu[i].jj);
		break;}
    }
	for(i=0;i<n;i++)
	m=m+stu[i].jj;
	printf("%d\n",m);
}
struct student
{
	char a[20];
	int b;
	int c;
	char d;
	char e;
	int f;
	int g;
};
int main()
{
	struct student *s;
	int n,i,sum=0,q,max;
	scanf("%d",&n);
	s=(struct student*)malloc(n*sizeof(struct student));
	for(i=0;i<n;i++)
	{
		scanf("%s %d %d %c %c %d",s[i].a,&s[i].b,&s[i].c,&s[i].d,&s[i].e,&s[i].f);
	}
    for(i=0;i<n;i++)
	{
		s[i].g=0;
		if(s[i].b>80&&s[i].f>=1)
			s[i].g=s[i].g+8000;
		if(s[i].b>85&&s[i].c>80)
           s[i].g=s[i].g+4000;
        if(s[i].b>90)
            s[i].g=s[i].g+2000;
		if(s[i].b>85&&s[i].e=='Y')
               s[i].g=s[i].g+1000;
		if(s[i].c>80&&s[i].d=='Y')
			s[i].g=s[i].g+850;
        sum=sum+s[i].g;
	}
	max=s[0].g;
	q=0;
	for(i=0;i<n;i++)
	{
		if(max<s[i].g)
		{
           q=i;
		   max=s[i].g;
		}
	}
	printf("%s\n%d\n%d",s[q].a,s[q].g,sum);

return 0;
}
int sch(int e,int test,char mon,char reg,int art)
{
	int total=0;
	if(e>80&&art>=1) total+=8000;
	if(e>85&&test>80) total+=4000;
	if(e>90) total+=2000;
	if(e>85&&reg=='Y') total+=1000;
	if(test>80&&mon=='Y') total+=850;
	return total;
}
int main()
{
	int peoplenumber,i,g,c,a,sum=0,most=0;
	char name[100],top[100],m,r;
	scanf("%d",&peoplenumber);
	for(i=0;i<peoplenumber;i++)
	{
		scanf("%s%d %d %c %c %d",name,&g,&c,&m,&r,&a);
		if(sch(g,c,m,r,a)>most)
		{
			strcpy(top,name);
			most=sch(g,c,m,r,a);
		}
		sum+=sch(g,c,m,r,a);
	}
	printf("%s\n%d\n%d",top,most,sum);
	//scanf("%d %d %c %c %d",&g,&c,&m,&r,&a);
	//printf("%d",sch(g,c,m,r,a));

	return 0;
}
struct stu
{
	char nam[21];
/*	int sc1;
	int sc2;
	char mon;
	char wes;
	int pap;*/
	int sch;
	struct stu *next;
};

void main()
{
	int len,n,i,sc1,sc2,pap,sum=0;
	char mon,wes;
	len = sizeof (struct stu);
	scanf("%d",&n);
	struct stu *head,*p0;
	for (i=1;i<=n;i++)
	{
		p0 = (struct stu*)malloc(len);
		if (i==1)
			head = p0;
		scanf("%s %d %d %c %c %d",&p0->nam,&sc1,&sc2,&mon,&wes,&pap);
		p0->sch=0;
		if (sc1>80 && pap>0)
			p0->sch = p0->sch + 8000;
		if (sc1>85 && sc2>80)
			p0->sch = p0->sch + 4000;
		if (sc1>90)
			p0->sch = p0->sch + 2000;
		if (sc1>85 && wes=='Y')
			p0->sch = p0->sch + 1000;
		if (sc2>80 && mon=='Y')
			p0->sch = p0->sch + 850;
		sum = sum + p0->sch;
		if (p0->sch > head->sch)
			head = p0;
	}
	printf("%s\n%d\n%d\n",head->nam,head->sch,sum);

}
struct In {char name[21];int g1;int g2;char y1;char y2;int g3;int g;} ;
int main()
{int i,n,b,d=0,m=0;
scanf("%d",&n);
struct In a[101];
for(i=0;i<n;i++)
{scanf("%s %d %d %c %c %d",a[i].name,&a[i].g1,&a[i].g2,&a[i].y1,&a[i].y2,&a[i].g3);if(a[i].g3>0) b=1;else b=0;
a[i].g=(a[i].g1/81)*b*8000+(a[i].g1/86)*(a[i].g2/81)*4000+(a[i].g1/91)*2000+(a[i].g1/86)*(a[i].y2/81)*1000+(a[i].g2/81)*(a[i].y1/81)*850;}
for(i=0;i<n;i++)
{d=d+a[i].g;
if(a[i].g>m) m=a[i].g;}
for(i=0;i<n;i++)
if(a[i].g==m){printf("%s\n%d\n%d\n",a[i].name,a[i].g,d); break;}
return 0;}