semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
struct stu
{
	char n[20];
	int f;
	int p;
	char g;
	char x;
	int l;
	int m;
};

void main()
{
	struct stu a[100];
	
	int n,i,j,t,sum;
	char c[20];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{scanf("%s %d %d %c %c %d",&a[i].n,&a[i].f,&a[i].p,&a[i].g,&a[i].x,&a[i].l);}
	for(i=0;i<n;i++)
	{ a[i].m=0;}

	for(i=0;i<n;i++)
	{
		if(a[i].f>80&&a[i].l>=1)	
			a[i].m+=8000;
		if(a[i].f>85&&a[i].p>80)
			a[i].m+=4000;
		if(a[i].f>90)
			a[i].m+=2000;
		if(a[i].f>85&&a[i].x=='Y')
			a[i].m+=1000;
		if(a[i].p>80&&a[i].g=='Y')
			a[i].m+=850;
	}
	sum=0;
	for(i=0;i<n;i++)
	{sum+=a[i].m;}
	for(i=0;i<n;i++)
		for(j=0;j<n-i;j++)
		{
			if(a[j].m<a[j+1].m)
			{t=a[j].m;a[j].m=a[j+1].m;a[j+1].m=t;
			 strcpy(c,a[j].n);
			 strcpy(a[j].n,a[j+1].n);
			 strcpy(a[j+1].n,c);
			}
		}
		printf("%s\n",a[0].n);
		printf("%d\n",a[0].m);
		printf("%d",sum);
}
struct student
{
	char name[21];
	int chengji;
	int pingyi;
	char ganbu;
	char xibu;
	int lunwen;
	int sum;
};

int main()
{
	struct student stu[100],temp;
	int n,i,j,r=1,final=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s %d%d %c %c %d",stu[i].name,&stu[i].chengji,&stu[i].pingyi,&stu[i].ganbu,&stu[i].xibu,&stu[i].lunwen);
		stu[i].sum=0;
        if(stu[i].chengji>80&&stu[i].lunwen>0)
			stu[i].sum+=8000;
		if(stu[i].chengji>85&&stu[i].pingyi>80)
			stu[i].sum+=4000;
		if(stu[i].chengji>90)
			stu[i].sum+=2000;
		if(stu[i].chengji>85&&stu[i].xibu=='Y')
            stu[i].sum+=1000;
		if(stu[i].pingyi>80&&stu[i].ganbu=='Y')
            stu[i].sum+=850;
	}
	for(i=0;i<n;i++)
	    final=final+stu[i].sum;
	for(i=1;i<n;i++)
		for(j=0;j<n-i;j++)
			if(stu[j].sum<stu[j+1].sum)
			{
				temp=stu[j];
				stu[j]=stu[j+1];
				stu[j+1]=temp;
			}
	for(i=1;i<n;i++)
	{
		if(stu[i].sum==stu[0].sum)
			r++;
		else
			break;
	}

	printf("%s\n%d\n%d\n",stu[0].name,stu[0].sum,final);
	return 0;
}
int main()
{ long n,i,s,h,k,total;
  char a[100][21],d[100],e[100];
  long b[100],c[100],f[100];
  scanf("%d",&n);
  for(i=0;i<=n-1;i++)
   scanf("%s %d %d %c %c %d",a[i],&b[i],&c[i],&d[i],&e[i],&f[i]);
    k=0;
    total=0;
  for(i=0;i<=n-1;i++)
  { s=0;
    if(b[i]>80&&f[i]>=1)
		s=s+8000;
	if(b[i]>85&&c[i]>80)
		s+=4000;
	if(b[i]>90)
		s+=2000;
	if(b[i]>85&&e[i]=='Y')
		s+=1000;
	if(c[i]>80&&d[i]=='Y')
		s+=850;
	if(s>k)
	{k=s;h=i;}
    total+=s;
  }
  puts(a[h]);
  printf("%d\n%d",k,total);
return 0;
}
struct stu
{
	char name[20];
	int final;
	int assess;
	char leader;
	char west;
	int paper;
};

int main(int argc, char* argv[])
{int k,n,i,total[100],tota=0,max=0;
struct stu ppl[100];
scanf("%d",&n);
for(i=0;i<n;i++)
{
	scanf("%s %d %d %c %c %d",ppl[i].name,&ppl[i].final,&ppl[i].assess,&ppl[i].leader,&ppl[i].west,&ppl[i].paper);
}
	
for(i=0;i<n;i++)
{total[i]=8000*(ppl[i].final>80&&ppl[i].paper>=1)+
		  4000*(ppl[i].final>85&&ppl[i].assess>80)+
		  2000*(ppl[i].final>90)+
		  1000*(ppl[i].final>85&&ppl[i].west=='Y')+
		  850*(ppl[i].assess>80&&ppl[i].leader=='Y');

tota=tota+total[i];

if(total[i]>max)
	{	
	max=total[i];
	k=i;
	}
}

printf("%s\n%d\n%d\n",ppl[k].name,max,tota);

	return 0;
}
void main()
{
	char str[100][20],a[100],b[100];
	int i,j,c[100],d[100],f[100],sum[100]={0};
	int   l=0,m=0,max;
	int n;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	    scanf("%s %d %d %c %c %d",str[i],&c[i],&d[i],&a[i],&b[i],&f[i]);
	for(i=0;i<n;i++)
	{
		if(c[i]>80 && f[i]>=1) sum[i]=sum[i]+8000;
		if(c[i]>85 && d[i]>80) sum[i]=sum[i]+4000;
		if(c[i]>90) sum[i]=sum[i]+2000;
		if(c[i]>85 && b[i]=='Y')  sum[i]=sum[i]+1000;
		if(d[i]>80 && a[i]=='Y') sum[i]=sum[i]+850;
	}
	max=0;
 for(i=0;i<n;i++)
 {
	 
	 if(max<sum[i])  max=sum[i]; 
	 m=m+sum[i];
 }
 for(i=0;i<n;i++)
	 if(max==sum[i]){printf("%s\n%d\n%d\n",str[i],max,m);break;}
 
}
void main()
{
	struct student
	{
		char name[1000];
		int s1,s2,gb,west,paper,sum;
		struct student *next;
	} *p,*head;
	int n,i,k,l,max=0;
	long ssum=0;
	l=sizeof(struct student);
	head=(struct student*)malloc(l);
	p=head;
	p->next=NULL;
	scanf("%d",&n);
	for (i=0;i<n;i++)
	{
		scanf("%s %d %d %c %c %d",p->name,&p->s1,&p->s2,&p->gb,&p->west,&p->paper);
		p->west-='N';p->gb-='N';
		if (n-i-1) {p->next=malloc(l);p=p->next;p->next=NULL;}
	}
	p=head;
	do
	{
		p->sum=0;
		if (p->s1>80&&p->paper) p->sum+=8000;
		if (p->s1>85&&p->s2>80) p->sum+=4000;
		if (p->s1>90) p->sum+=2000;
		if (p->s1>85&&p->west) p->sum+=1000;
		if (p->s2>80&&p->gb) p->sum+=850;
		if (p->sum>max) max=p->sum;
		p=p->next;
	}
	while(p);
	p=head;
	k=1;
	do
	{
		if (p->sum==max&&k) {printf("%s\n%d\n",p->name,p->sum);k=0;}
		ssum+=p->sum;
		p=p->next;
	}
	while (p);
	printf("%ld",ssum);
}
struct student
{
	char name[21];
	int qimo;
	int banji;
	char ganbu;
	char xibu;
	int paper;
}stu[101];

int main()
{
	int n,i,sum=0,max=0;
	int sz[101]={0};
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s ",&stu[i].name);
		scanf("%d %d ",&stu[i].qimo,&stu[i].banji);
		scanf("%c %c ",&stu[i].ganbu,&stu[i].xibu);
		scanf("%d",&stu[i].paper);
	}
	for(i=0;i<n;i++)
	{
		if(stu[i].qimo>80&&stu[i].paper>=1)
		{
			sz[i]=sz[i]+8000;
		}
		if(stu[i].qimo>85&&stu[i].banji>80)
		{
			sz[i]=sz[i]+4000;
		}
		if(stu[i].qimo>90)
		{
			sz[i]=sz[i]+2000;
		}
		if(stu[i].qimo>85&&stu[i].xibu=='Y')
		{
			sz[i]=sz[i]+1000;
		}
		if(stu[i].banji>80&&stu[i].ganbu=='Y')
		{
			sz[i]=sz[i]+850;
		}
	}
	for(i=0;i<n;i++)
	{
		if(sz[i]>sz[max])
		{
			max=i;
		}
		sum=sum+sz[i];
	}
	printf("%s\n",stu[max].name);
	printf("%d\n",sz[max]);
	printf("%d",sum);
    return 0;
}
void main()
{
    struct student
    {
    	char name[20];
    	int score1;
    	int score2;
    	char c1;
    	char c2;
    	int paper;
    	int bonus;
    };
    struct student stu[100];
    int n,i,sum,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].c1,&stu[i].c2,&stu[i].paper);
    for(i=0;i<n;i++)
    {
    	stu[i].bonus=0;
    	if(stu[i].score1>80&&stu[i].paper>=1) 
    	  stu[i].bonus+=8000;
    	if(stu[i].score1>85&&stu[i].score2>80)
    	  stu[i].bonus+=4000;
    	if(stu[i].score1>90) 
    	  stu[i].bonus+=2000;
    	if(stu[i].score1>85&&stu[i].c2=='Y')
    	  stu[i].bonus+=1000;
    	if(stu[i].score2>80&&stu[i].c1=='Y')
    	  stu[i].bonus+=850;
    }
    max=0;
    for(i=1;i<=n;i++)
     if(stu[i].bonus>stu[max].bonus) max=i;
    printf("%s\n",stu[max].name);
    printf("%d\n",stu[max].bonus);
    sum=0;
    for(i=0;i<n;i++)
     sum+=stu[i].bonus;
    printf("%d",sum);
}
int main()
{
	struct student{
		char name[20];
		int qimo;
		int banji;
		char xibu;
		char ganbu;
		int lunwen;
		int fee;
	}stu[102];
	int i,sum=0,n,max;
	scanf("%d\n",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s %d %d %c %c %d\n",stu[i].name,&stu[i].qimo,&stu[i].banji,&stu[i].ganbu,&stu[i].xibu,&stu[i].lunwen);
	}
	for(i=0;i<102;i++)
	{
		stu[i].fee=0;
	}
	for(i=0;i<n;i++)
	{
		if(stu[i].qimo>80&&stu[i].lunwen>0)
			stu[i].fee+=8000;
		if(stu[i].qimo>85&&stu[i].banji>80)
			stu[i].fee+=4000;
		if(stu[i].qimo>90)
			stu[i].fee+=2000;
		if(stu[i].qimo>85&&stu[i].xibu=='Y')
			stu[i].fee+=1000;
		if(stu[i].banji>80&&stu[i].ganbu=='Y')
			stu[i].fee+=850;
		sum+=stu[i].fee;
	}
	max=stu[0].fee;
	for(i=1;i<n;i++)
	{
		if(stu[i].fee>max)
			max=stu[i].fee;
	}
	for(i=0;i<n;i++)
	{
		if(stu[i].fee==max)
		{printf("%s\n%d\n%d",stu[i].name,stu[i].fee,sum);
		break;}
	}
	return 0;
}
struct std
{
	char name[20];
	int qi;
	int ban;
	char xue;
	char xi;
	int lun;
};
int main()
{
	int panduan(struct std x);
	int n,i,*a,max,sum=0;
	struct std*p;
	scanf("%d",&n);
	a=(int*)malloc(n*sizeof(int));
	p=(struct std*)malloc(n*sizeof(struct std));
	for(i=0;i<=n-1;i++)
	{
		scanf("%s %d%d %c %c %d",p[i].name,&p[i].qi,&p[i].ban,&p[i].xue,&p[i].xi,&p[i].lun);
		a[i]=panduan(p[i]);
	}
    for(i=0,max=0;i<=n-1;i++)
	{
		if(a[i]>max)
			max=a[i];
		sum=sum+a[i];
	}
	for(i=0;i<=n-1;i++)
	{
		if(a[i]==max)
		{
			printf("%s\n%d\n",p[i].name,max);
			break;
		}
	}
	printf("%d",sum);
	return 0;
}
int panduan(struct std x)
{
	int sum=0;
	if(x.qi>80&&x.lun>=1)
		sum=sum+8000;
	if(x.qi>85&&x.ban>80)
		sum=sum+4000;
	if(x.qi>90)
		sum=sum+2000;
	if(x.xi=='Y'&&x.qi>85)
		sum=sum+1000;
	if(x.ban>80&&x.xue=='Y')
		sum=sum+850;
	return sum;
}
int main()
{
	struct student
	{
		char name[20];
		int b;
		int c;
		char d;
		char e;
		int f;
		int g;
	}a[2];
	int n,i,sum;
	scanf("%d",&n);
	scanf("%s %d %d %c %c %d",a[0].name,&a[0].b,&a[0].c,&a[0].d,&a[0].e,&a[0].f);
	a[0].g=0;
	if((a[0].b>80)&&(a[0].f>0))
		a[0].g=a[0].g+8000;
	if((a[0].b>85)&&(a[0].c>80))
		a[0].g=a[0].g+4000;
	if(a[0].b>90)
		a[0].g=a[0].g+2000;
	if((a[0].b>85)&&(a[0].e=='Y'))
		a[0].g=a[0].g+1000;
	if((a[0].c>80)&&(a[0].d=='Y'))
		a[0].g=a[0].g+850;
	sum=a[0].g;
	for(i=1;i<n;i++){
		scanf("%s %d %d %c %c %d",a[1].name,&a[1].b,&a[1].c,&a[1].d,&a[1].e,&a[1].f);
		a[1].g=0;
	if((a[1].b>80)&&(a[1].f>0))
		a[1].g=a[1].g+8000;
	if((a[1].b>85)&&(a[1].c>80))
		a[1].g=a[1].g+4000;
	if(a[1].b>90)
		a[1].g=a[1].g+2000;
	if((a[1].b>85)&&(a[1].e=='Y'))
		a[1].g=a[1].g+1000;
	if((a[1].c>80)&&(a[1].d=='Y'))
		a[1].g=a[1].g+850;
	sum=sum+a[1].g;
	if(a[0].g<a[1].g)
		a[0]=a[1];
	}
	printf("%s\n%d\n%d\n",a[0].name,a[0].g,sum);
	return 0;
}
void main()
{
	int n,i,s=0,max;
	double A[200],sum;
	struct student
	{
		char name[50];
		int AP;
		int EP;
		char L;
		char D;
		int paper;
	};
	struct student stu[200];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		s=0;
		scanf("%s %d %d %c %c %d",stu[i].name,&stu[i].AP,&stu[i].EP,&stu[i].L,&stu[i].D,&stu[i].paper);
		if(stu[i].AP>80&&stu[i].paper>0)
			s=s+8000;
		if(stu[i].AP>85&&stu[i].EP>80)
			s=s+4000;
		if(stu[i].AP>90)
			s=s+2000;
		if(stu[i].AP>85&&stu[i].D=='Y')
			s=s+1000;
		if(stu[i].EP>80&&stu[i].L=='Y')
			s=s+850;
		A[i]=s;
	}
	for(i=0,max=0,sum=0;i<n;i++)
	{
		if(A[i]>A[max]) max=i;
		sum=sum+A[i];

	}
	printf("%s\n%.lf\n%.lf\n",stu[max].name,A[max],sum);
}
struct student
{
	char name[20];
	int final;
	int ping;
	char gan;
	char xi;
	int paper;
	int money;
	struct student *next;
};

void main()
{
	int n,i=0,max=0,sum=0;
	scanf("%d",&n);
	struct student *head,*p,*x;
	head=p=(struct student *)malloc(sizeof(struct student));
	(*p).money=0;
	while(i++<n)
	{
		scanf("%s %d %d %c %c %d",(*p).name,&(*p).final,&(*p).ping,&(*p).gan,&(*p).xi,&(*p).paper);
		if((*p).final>80&&(*p).paper>0)(*p).money+=8000;
		if((*p).final>85&&(*p).ping>80)(*p).money+=4000;
		if((*p).final>90)(*p).money+=2000;
		if((*p).final>85&&(*p).xi=='Y')(*p).money+=1000;
		if((*p).ping>80&&(*p).gan=='Y')(*p).money+=850;
		if((*p).money>max){max=(*p).money;x=p;}
		sum+=(*p).money;
		p=(*p).next=(struct student *)malloc(sizeof(struct student));
		(*p).money=0;
	}
	printf("%s\n%d\n%d\n",(*x).name,max,sum);
}
int main()
{
	struct student
	{
		char name[20];
		int qim,piny,lunw;
		char ganb,xib;
		int sum;
	};
	int i,n,a;
	scanf("%d",&n);
	struct student *stu=(struct student *)malloc(sizeof(struct student)*n);//////
//	struct studen *stu[90];
	int max=0,sum=0;
	for(i=0;i<n;i++)
	{
		stu[i].sum=0;
		scanf("%s%d%d %c %c %d",stu[i].name,&stu[i].qim,&stu[i].piny,&stu[i].ganb,&stu[i].xib,&stu[i].lunw);
		if(stu[i].qim>80 && stu[i].lunw>=1)stu[i].sum+=8000;
		if(stu[i].qim>85 && stu[i].piny>80)stu[i].sum+=4000;
		if(stu[i].qim>90)stu[i].sum+=2000;
		if(stu[i].qim>85 && stu[i].xib=='Y')stu[i].sum+=1000;
		if(stu[i].piny>80 && stu[i].ganb=='Y')stu[i].sum+=850;
		if(stu[i].sum>max)
		{
			max=stu[i].sum;
			a=i;
		}
		sum+=stu[i].sum;
	}
	printf("%s\n%d\n%d\n",stu[a].name,stu[a].sum,sum);
	return 0;
}
struct student
{
	char name[25];
	int qmpj;
	int bjpy;
	char gb;
	char xb;
	int paper;
	int money;
};
void main()
{
	int n,i,total=0,c1,c2,c3;
	struct student stu[100];
    struct student *p,*m;
	scanf("%d",&n);
	for(p=stu;p<stu+n;p++)
	{
		scanf("%s%d%d%c%c%c%c%c%d",&((*p).name),&((*p).qmpj),&((*p).bjpy),&c1,&((*p).gb),&c2,&((*p).xb),&c3,&((*p).paper));
		p->money=0;
	}
    for(p=stu;p<stu+n;p++)
	{
		if(p->qmpj>80&&p->paper>0)
			p->money=p->money+8000;
		if(p->qmpj>85&&p->bjpy>80)
			p->money=p->money+4000;
		if(p->qmpj>90)
			p->money=p->money+2000;
		if(p->qmpj>85&&p->xb=='Y')
			p->money=p->money+1000;
		if(p->bjpy>80&&p->gb=='Y')
			p->money=p->money+850;
	}
	m=stu;
	for(p=stu;p<stu+n;p++)
	{
		if(p->money>m->money)
			m=p;
		total=p->money+total;
	}
	printf("%s\n%d\n%d\n",m->name,m->money,total);
}
struct s
{
	char name[20],ganbu,xibu;
	int qimo,pingyi,lunwen,sum;
};
int main()
{
	int n,i,max=0,tot=0;
	char c;
	struct s a[101],b;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s",a[i].name);
		c=getchar();
		scanf("%d%d %c %c%d",&a[i].qimo,&a[i].pingyi,&a[i].ganbu,&a[i].xibu,&a[i].lunwen);
		a[i].sum=0;
		if(a[i].qimo>80&&a[i].lunwen>=1)
		a[i].sum+=8000;
		if(a[i].qimo>85&&a[i].pingyi>80)
		a[i].sum+=4000;
		if(a[i].qimo>90)
		a[i].sum+=2000;
		if(a[i].qimo>85&&a[i].xibu=='Y')
		a[i].sum+=1000;
		if(a[i].pingyi>80&&a[i].ganbu=='Y')
		a[i].sum+=850;
		tot+=a[i].sum;
		if(a[i].sum>max)
		{
			max=a[i].sum;
			b=a[i];
		}
	}
	printf("%s\n%d\n%d",b.name,max,tot);
	return 0;
}
int main()
{
	int n;
	scanf("%d",&n);
	scanf("\n");
	struct student
	{
		char *name;
		int final;
		int clas;
		char gan;
		char west;
		int essay;
	}a[100];
	int i;
	for(i=0;i<n;i++)
	{
		a[i].name=(char *)malloc(20*sizeof(char));
		scanf("%s%d%d %c %c%d",a[i].name,&a[i].final,&a[i].clas,&a[i].gan,&a[i].west,&a[i].essay);
		
		if(i<n-1)
			scanf("\n");
	}
	int scholar[100];
	for(i=0;i<n;i++)
		scholar[i]=0;
	for(i=0;i<n;i++)
	{
		while(a[i].final>80&&a[i].essay>=1)
		{
			scholar[i]=scholar[i]+8000;
		    break;
		}
			while(a[i].final>85&&a[i].clas>80)
		{
			scholar[i]=scholar[i]+4000;
			break;
		}
		while(a[i].final>90)
		{
			scholar[i]=scholar[i]+2000;
			break;
		}
		while(a[i].final>85&&a[i].west=='Y')
		{
			scholar[i]=scholar[i]+1000;
			break;
		}
		while(a[i].clas>80&&a[i].gan=='Y')
		{
			scholar[i]=scholar[i]+850;
			break;
		}
	}
	int k;
	for(i=1,k=0;i<n;i++)
	{
		if(scholar[i]>scholar[k])
			k=i;
	}
	int s;
	for(i=0,s=0;i<n;i++)
	{
		s=s+scholar[i];
	}
	printf("%s\n%d\n%d",a[k].name,scholar[k],s);
}
int main()
{
	struct s{
		char n[20];
		int p1,p2,p3;
		char a,b;
	}st[100];
	int money[100]={0};
	int i,num;
	int sum=0,m,h;
	scanf("%d",&num);
	for(i=0;i<num;i++)
	{
		scanf("%s %d %d %c %c %d",st[i].n,&st[i].p1,&st[i].p2,&st[i].a,&st[i].b,&st[i].p3);
	}
	for(i=0;i<num;i++)
	{
		if(st[i].p1>80&&st[i].p3>=1)
		{
			money[i]+=8000;
		}
		if(st[i].p1>85&&st[i].p2>80)
		{
			money[i]+=4000;
		}
		if(st[i].p1>90)
		{
			money[i]+=2000;
		}
		if(st[i].p1>85&&(int)st[i].b=='Y')
		{
			money[i]+=1000;
		}
		if(st[i].p2>80&&(int)st[i].a=='Y')
		{
			money[i]+=850;
		}
	}
	m=money[0];
	h=0;
	for(i=1;i<num;i++)
	{
		if(money[i]>m)
		{
			m=money[i];
			h=i;
		}
	}
	for(i=0;i<num;i++)
	{
		sum+=money[i];
	}
	printf("%s\n",st[h].n);
	printf("%d\n",m);
	printf("%d\n",sum);
	return 0;
}
void main()
{
   struct stu
   {char nam[20];
   	int sco1;
   	int sco2;
   	char a[2];
   	char b[2];
   	int num;
   }stu[101];
   int n,max,i;
   int s;
   int sum[101];
   char maxn[30];
   scanf("%d",&n);
   for(i=0;i<n;i++)
   {scanf("%s",stu[i].nam);
   	scanf("%d",&stu[i].sco1);
   	scanf("%d",&stu[i].sco2);
   	scanf("%s",stu[i].a);
   	scanf("%s",stu[i].b);
   	scanf("%d",&stu[i].num);
   	sum[i]=0;
   	if(stu[i].sco1>80&&stu[i].num>=1)
   	sum[i]=sum[i]+8000;
   	if(stu[i].sco1>85&&stu[i].sco2>80)
   	sum[i]=sum[i]+4000;
   	if(stu[i].sco1>90)
   	sum[i]=sum[i]+2000;
   	if(stu[i].sco1>85&&stu[i].b[0]=='Y')
   	sum[i]=sum[i]+1000;
   	if(stu[i].sco2>80&&stu[i].a[0]=='Y')
   	sum[i]=sum[i]+850;
   }
  max=sum[0];
  strcpy(maxn,stu[0].nam);
  	s=sum[0];
  	for(i=1;i<n;i++)
  {if(sum[i]>max)
  	{max=sum[i];
  		strcpy(maxn,stu[i].nam);}
  	s=s+sum[i];
  }
  printf("%s\n",maxn);
  printf("%d\n",max);
  printf("%d\n",s);
}
struct student
 {
 	char name[20];
 	int qm,py,gb,xb;
 	int paper;
 	int sum;
 	
 }stu[100];
 void main()
 {
 	int n,i,k,max,s=0;
 	scanf("%d\n",&n);
 	
       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].xb,&stu[i].paper);
        stu[i].sum=0;
 	}
 	for(i=0;i<n;i++)
 	{
 		if( stu[i].qm>80&& stu[i].paper>=1)
		 stu[i].sum=stu[i].sum+8000; 
	       if(stu[i].qm>85&&stu[i].py>80)
		 stu[i].sum=stu[i].sum+4000;
               if(stu[i].qm>90)
                 stu[i].sum=stu[i].sum+2000;
               if(stu[i].qm>85&&stu[i].xb=='Y')
                  stu[i].sum=stu[i].sum+1000;
               if(stu[i].py>80&&stu[i].gb=='Y')
                 stu[i].sum=stu[i].sum+850;
               s=s+stu[i].sum;
 	}
      max=stu[0].sum;
      for(i=0;i<n;i++)
         if(max<stu[i+1].sum)
         max=stu[i+1].sum;
      for(i=0;i<n;i++)
        {
           if(stu[i].sum==max)
            {
                printf("%s\n%d\n%d",stu[i].name,max,s);break;
            }
         }
 }
struct stu
{
	char name[25];
	int qimo;
	int banji;
	char ganbu[1];
	char xibu[1];
	int lunwen;
}a[150];
void main()
{
	int n,s[150]={0},i,sum=0,max=0;
	char name[25];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s%d%d%s%s%d",a[i].name,&a[i].qimo,&a[i].banji,a[i].ganbu,a[i].xibu,&a[i].lunwen);
	}
	for(i=0;i<n;i++)
	{
		if((a[i].qimo>80)&&(a[i].lunwen>=1))
			s[i]+=8000;
		if((a[i].qimo>85)&&(a[i].banji>80))
			s[i]+=4000;
		if(a[i].qimo>90)
			s[i]+=2000;
		if((a[i].qimo>85)&&(a[i].xibu[0]=='Y'))
			s[i]+=1000;
		if((a[i].banji>80)&&(a[i].ganbu[0]=='Y'))
			s[i]+=850;
	}
	for(i=0;i<n;i++)
	{
		if(max<s[i])
		{
			max=s[i];
			strcpy(name,a[i].name);
		}
		sum+=s[i];
	}
	printf("%s\n%d\n%d\n",name,max,sum);
}
struct stu
{
char name[20];
int grade,point;
char job;
char home;
int paper,sum;
}student[100];

void main()
{
int n,i;
scanf("%d\n",&n);
for(i=0;i<n;i++)
{
student[i].sum=0;
}
for(i=0;i<n;i++)
{
 scanf("%s %d %d %c %c %d",student[i].name,&student[i].grade,&student[i].point,&student[i].job,&student[i].home,&student[i].paper);
 if(student[i].grade>80&&student[i].paper>0)
      student[i].sum+=8000;
 if(student[i].grade>85&&student[i].point>80)
      student[i].sum+=4000;
 if(student[i].grade>90)
      student[i].sum+=2000;
 if(student[i].grade>85&&student[i].home=='Y')
      student[i].sum+=1000;
 if(student[i].point>80&&student[i].job=='Y')
      student[i].sum+=850;
}
int max;
max=student[0].sum;
for(i=0;i<n;i++)
{
 if(student[i].sum>max)
 max=student[i].sum;
}
for(i=0;i<n;i++)
{ 
if(max==student[i].sum)
{
printf("%s\n%d\n",student[i].name,student[i].sum);
break;
}
}
int SUM=0;
for(i=0;i<n;i++)
{
 SUM+=student[i].sum;
}
printf("%d",SUM);
}
struct stu
{
	char name[21];
	int final;
	int comment;
	char leader[2];
	char west[2];
	int paper;
	struct stu *next;
	int total;
}*head,*p1,*p2;
void main()
{
	int n,i,max;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		p1=(struct stu*)malloc(sizeof(struct stu));
		if(i==0)head=p1;
		else p2->next=p1;
		p2=p1;
		scanf("%s%d%d%s%s%d",p1->name,&p1->final,&p1->comment,p1->leader,p1->west,&p1->paper);
	}
	p2->next=NULL;
	for(p1=head;p1!=NULL;p1=p1->next)
	{
		p1->total=0;
		if(p1->final>80&&p1->paper!=0){p1->total+=8000;}
		if(p1->final>85&&p1->comment>80){p1->total+=4000;}
		if(p1->final>90){p1->total+=2000;}
		if(p1->final>85&&p1->west[0]=='Y'){p1->total+=1000;}
		if(p1->comment>80&&p1->leader[0]=='Y'){p1->total+=850;}
	}
	max=head->total;
	for(p1=head->next;p1!=NULL;p1=p1->next)
		max=max>p1->total?max:p1->total;
	for(p1=head;p1!=NULL;p1=p1->next)
	{
		if(p1->total==max)break;
	}
	printf("%s\n%d\n",p1->name,max);
	max=0;
	for(p1=head;p1!=NULL;p1=p1->next)
		max+=p1->total;
	printf("%d\n",max);
}
struct information
{
	char name[20];
	int score;
	int marks;
	char banwei;
	char xibu;
	int lunwen;
	int reward;
}a[101];
void main()
{
	int n,i,k,sum=0,max=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
		scanf("%s %d%d %c %c%d",a[i].name,&a[i].score,&a[i].marks,&a[i].banwei,&a[i].xibu,&a[i].lunwen);
    for(i=0;i<n;i++)
	{   
		a[i].reward=0;
		if(a[i].banwei=='Y' && a[i].marks>80) a[i].reward=a[i].reward+850;
		if(a[i].score>80)
		{
			if(a[i].lunwen>0) a[i].reward=a[i].reward+8000;
			
			if(a[i].score>85)
			{
				if(a[i].marks>80) a[i].reward=a[i].reward+4000;
				if(a[i].xibu=='Y') a[i].reward=a[i].reward+1000;
				if(a[i].score>90) a[i].reward=a[i].reward+2000;
			}
		}
     if(a[i].reward>max) 
	 {
		 max=a[i].reward;
		 k=i;
	 }
      sum=sum+a[i].reward;
	} 
		printf("%s\n%d\n%d\n",a[k].name,max,sum);
}
void main()
{
	struct student
	{char name[20];
	 int qimo;
	 int banyi;
	 char ganbu;
	 char xibu;
	 int paper;
	}stu[100];
	int n,i,max,p,sum=0;
	int sch[]={8000,4000,2000,1000,850};
	int a[100]={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].banyi,&stu[i].ganbu,&stu[i].xibu,&stu[i].paper);
    for(i=0;i<n;i++)
	{
		if(stu[i].qimo>80&&stu[i].paper>=1)
			a[i]+=sch[0];
		if(stu[i].qimo>85&&stu[i].banyi>80)
			a[i]+=sch[1];
		if(stu[i].qimo>90)
			a[i]+=sch[2];
		if(stu[i].qimo>85&&stu[i].xibu=='Y')
			a[i]+=sch[3];
		if(stu[i].banyi>80&&stu[i].ganbu=='Y')
			a[i]+=sch[4];
	}
    max=a[0];
	p=0;
	for(i=0;i<n;i++)
	{
		if(a[i]>max)
		{
			max=a[i];
			p=i;
		}
		sum+=a[i];
	}
    printf("%s\n%d\n%d",stu[p].name,max,sum);
}
struct info
{
	char name[20];
	float finalscore;
	float averscore;
	char leader;
	char westerner;
	int essay;
	struct info *next;
};
int n;
struct info *setup(void)
{
	int t=0;
	struct info *head,*p1,*p2;
	head=p2=p1=(struct info*)malloc(sizeof(struct info));
	scanf("%s %f %f %c %c %d",p1->name,&p1->finalscore,&p1->averscore,&p1->leader,&p1->westerner,&p1->essay);
	while(t<n)
	{
		t++;
		p1=(struct info*)malloc(sizeof(struct info));
		p2->next=p1;
		scanf("%s %f %f %c %c %d",p1->name,&p1->finalscore,&p1->averscore,&p1->leader,&p1->westerner,&p1->essay);
		p2=p1;
	}	
	return head;
}
void main()
{
	long max=0,total=0,t,i=0;
	struct info *p,*excellent;
	scanf("%d",&n);
	p=setup();
	for(i=0;i<n;i++)
	{
		t=0;
		if(p->finalscore>80&&p->essay>0)
			t+=8000;
		if(p->finalscore>85&&p->averscore>80)
			t+=4000;
		if(p->finalscore>90)
			t+=2000;
		if(p->westerner=='Y'&&p->finalscore>85)
			t+=1000;
		if(p->leader=='Y'&&p->averscore>80)
			t+=850;
		if(t>max)
		{
			max=t;
			excellent=p;
		}
		total+=t;
		p=p->next;
	}
	printf("%s\n%ld\n%ld\n",excellent->name,max,total);
}
struct ren
{
	char x[21];char g;char s;
	int a1;
		int a2;int n;int c;
}a[102];

void main()
{
	int N,i,max=0;
	long int z=0;
	scanf("%d",&N);
	for(i=0;i<N;i++)
	{
		scanf("%s",a[i].x);
		scanf("%d",&a[i].a1);
		scanf("%d",&a[i].a2);
		scanf(" %c",&a[i].g);
		scanf(" %c",&a[i].s);
		scanf("%d",&a[i].n);
	}
	for(i=0;i<N;i++)
		a[i].c=0;
	for(i=0;i<N;i++)
	{
		if(a[i].a1>80&&a[i].n>=1)
			a[i].c=a[i].c+8000;
		if(a[i].a1>85&&a[i].a2>80)
			a[i].c=a[i].c+4000;
		if(a[i].a1>90)
			a[i].c=a[i].c+2000;
		if(a[i].a1>85&&a[i].s=='Y')
			a[i].c=a[i].c+1000;
		if(a[i].a2>80&&a[i].g=='Y')
			a[i].c=a[i].c+850;
	}
	for(i=0;i<N;i++)
	{
		z=z+a[i].c;

		if(max<a[i].c)
			max=a[i].c;
	}
	for(i=0;i<N;i++)
	{
		if(a[i].c==max)
		{
			printf("%s\n%d\n%ld",a[i].x,a[i].c,z);
			break;
		}
	}
}
struct student
{
	char name[20];
	int aver;
	int bj;
	char a;
	char b;
	int lunwen;
	int sum;
	struct student *next;
};
struct student *creat(int n)
{
	int i;
	struct student *head,*p1,*p2;
	p1=p2=(struct student *)malloc(LEN);
	scanf("%s %d %d %c %c %d",p1->name,&p1->aver,&p1->bj,&p1->a,&p1->b,&p1->lunwen);
    head=p1;
	for(i=1;i<n;i++)
	{
		p1=(struct student *)malloc(LEN);
		scanf("%s %d %d %c %c %d",p1->name,&p1->aver,&p1->bj,&p1->a,&p1->b,&p1->lunwen);
		p2->next=p1;
		p2=p1;
	}
	p2->next=NULL;
	return(head);
}
int main()
{
	int n;
	scanf("%d",&n);
	struct student *head,*pt1,*pt2;
	head=creat(n);
	pt1=head;
	while(pt1!=NULL)
	{
		pt1->sum=0;
		if((pt1->aver>80)&&(pt1->lunwen>=1)) pt1->sum=pt1->sum+8000;
		if((pt1->aver>85)&&(pt1->bj>80)) pt1->sum=pt1->sum+4000;
		if(pt1->aver>90) pt1->sum=pt1->sum+2000;
		if((pt1->aver>85)&&(pt1->b=='Y')) pt1->sum=pt1->sum+1000;
		if((pt1->bj>80)&&(pt1->a=='Y')) pt1->sum=pt1->sum+850;
		pt1=pt1->next;
	}
	pt1=head;
	pt2=pt1->next;
	while(pt2!=NULL)
	{
		if((pt2->sum)>(pt1->sum))	pt1=pt2;
		pt2=pt2->next;
	}
	printf("%s\n",pt1->name);
	printf("%d\n",pt1->sum);
	pt1=head;
    long s=0;
	while(pt1!=NULL)
	{
		s=s+pt1->sum;
		pt1=pt1->next;
	}
	printf("%ld",s);
return 0;
}