semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
struct student
{
       char name[40];
       int end;
       int cls;
       int lead;
       int west;
       int paper;
       int money;
} stu[100];

int main()
{
    int i,n,t=1,sum=0,max=0,print;
    scanf("%d",&n);
    for(i=1;i<=n;i++)
    {
                     scanf("%s %d %d %c %c %d",&stu[i].name,&stu[i].end,&stu[i].cls,&stu[i].lead,&stu[i].west,&stu[i].paper);
    }

    for(i=1;i<=n;i++)
    {
                     if(stu[i].end>80&&stu[i].paper>=1) stu[i].money+=8000;
                     if(stu[i].end>85&&stu[i].cls>80) stu[i].money+=4000;
                     if(stu[i].end>90) stu[i].money+=2000;
                     if(stu[i].end>85&&stu[i].west==89) stu[i].money+=1000;
                     if(stu[i].cls>80&&stu[i].lead==89) stu[i].money+=850;
                     sum+=stu[i].money;
    }
    for(i=1;i<=n;i++)
    {
                    if(stu[i].money>max) 
                    {
                                         max=stu[i].money;
                                         print=i;
                    }
    }

printf("%s\n%d\n%d",stu[print].name,stu[print].money,sum);

    return 0;
}
int main()
{
	struct student
	{
		char name[20];
		int a;
		int b;
		char c;
		char d;
		int e;
		struct student*next;
	}student[100];
	int N,i,money[100],max,sum,flag;
	max=sum=0;
	for(i=0;i<100;i++)
	{
		money[i]=0;
	}
	struct student *p;
	scanf("%d",&N);
	for(i=0;i<N;i++)
	{
		student[i].next=&student[i+1];
	}
	student[N-1].next=NULL;
	p=&student[0];
	i=0;
	while(p!=NULL)
	{
		scanf("%s %d %d %c %c %d",p->name,&p->a,&p->b,&p->c,&p->d,&p->e);
		if((p->a)>80&&(p->e)>0)
			money[i]+=8000;
		if((p->a)>85&&(p->b)>80)
			money[i]+=4000;
		if((p->a)>90)
			money[i]+=2000;
		if((p->a)>85&&(p->d)=='Y')
			money[i]+=1000;	
		if((p->b)>80&&(p->c)=='Y')
			money[i]+=850;
		i++;
		p=p->next;
	}
	for(i=0;i<N;i++)
	{
		if(money[i]>max)
		{
			max=money[i];
			flag=i;
		}
	}
	printf("%s\n",student[flag].name);
	printf("%d\n",max);
	for(i=0;i<N;i++)
	{
		sum+=money[i];
	}
	printf("%d",sum);
	return 0;
}
struct Student{
        char name[21];
        int avg;
        int cls;
        char off;
        char west;
        int paper;
        };

int main()
{
    int i,j,N,high;
    long sch[100]={0};
    long schtot=0;
    char c;
    struct Student ptcpt[100];
    struct Student tmp;
        scanf("%d",&N);
    for (i=0;i<N-1;i++){
        j=0;
        while (j<22&&(c=getchar())!=' '){
            ptcpt[i].name[j]=c;
            j++;
            }
            ptcpt[i].name[j]='\0';
        scanf(" %d %d %c %c %d\n",&ptcpt[i].avg,&ptcpt[i].cls,&ptcpt[i].off,&ptcpt[i].west,&ptcpt[i].paper);
        if (ptcpt[i].avg>80&&ptcpt[i].paper>=1){
        sch[i]=sch[i]+8000;}
        if (ptcpt[i].avg>85&&ptcpt[i].cls>80){
        sch[i]=sch[i]+4000;}
        if (ptcpt[i].avg>90){
        sch[i]=sch[i]+2000;}
        if (ptcpt[i].avg>85&&ptcpt[i].west=='Y'){
        sch[i]=sch[i]+1000;}
        if (ptcpt[i].cls>80&&ptcpt[i].off=='Y'){
        sch[i]=sch[i]+850;}

        schtot=schtot+sch[i];
        }

        j=0;
        while (j<22&&(c=getchar())!=' '){
            ptcpt[N-1].name[j]=c;
            j++;
            }
            ptcpt[N-1].name[j]='\0';
        scanf(" %d %d %c %c %d",&ptcpt[N-1].avg,&ptcpt[N-1].cls,&ptcpt[N-1].off,&ptcpt[N-1].west,&ptcpt[N-1].paper);
        if (ptcpt[N-1].avg>80&&ptcpt[N-1].paper>=1) {
            sch[N-1]=sch[N-1]+8000;
        }
        if (ptcpt[N-1].avg>85&&ptcpt[N-1].cls>80){
        sch[N-1]=sch[N-1]+4000;}
        if (ptcpt[N-1].avg>90){
        sch[N-1]=sch[N-1]+2000;}
        if (ptcpt[N-1].avg>85&&ptcpt[N-1].west=='Y'){
        sch[N-1]=sch[N-1]+1000;}
        if (ptcpt[N-1].cls>80&&ptcpt[N-1].off=='Y'){
        sch[N-1]=sch[N-1]+850;}

        schtot=schtot+sch[N-1];
        strcpy(tmp.name,ptcpt[N-1].name);
                high=sch[N-1];

        for (i=N-1;i>-1;i--){
            if (high<=sch[i]){
                strcpy(tmp.name,ptcpt[i].name);
                high=sch[i];
                }
                else continue;
            }
        printf("%s\n%d\n%ld",tmp.name,high,schtot);
    return 0;
}
struct student{
	char name[20];
	int smark;
	int cmark;
	char lead;
	char west;
	int num;
};

struct student stu[200];
int s[100];
int n;

int js(int x)
{
	int reval=0;
	if (stu[x].smark>80&&stu[x].num>=1) reval+=8000;
	if (stu[x].smark>85&&stu[x].cmark>80) reval+=4000;
	if (stu[x].smark>90) reval+=2000;
	if (stu[x].smark>85&&stu[x].west=='Y') reval+=1000;
	if (stu[x].cmark>80&&stu[x].lead=='Y') reval+=850;
return reval;
}

int main()
{
	int maxnum=0,max=0,sum=0,i=0;
	cin>>n;
	for(i=0;i<n;i++)
	{
		cin>>stu[i].name>>stu[i].smark>>stu[i].cmark>>stu[i].lead>>stu[i].west>>stu[i].num;
	}
	for(i=0;i<n;i++)
	{
//		cout<<js(i)<<endl;
		sum+=js(i);
		if(js(i)>max){
			maxnum=i;
			max=js(i);
		}
	}
	cout<<stu[maxnum].name<<endl<<max<<endl<<sum<<endl;
	return 0;
}
void main()
{
	struct student
	{
		char name[30];
		int num1;
		int num2;
		char isstu;
		char iswest;
		int paper;
	}stu[100];
	int n,i,max,all=0;
	int reward[100];
	scanf("%d",&n);
	for(i=0;i<n;i++)
		reward[i]=0;
	for(i=0;i<n;i++)
		scanf("%s %d %d %c %c %d",&stu[i].name,&stu[i].num1,&stu[i].num2,&stu[i].isstu,&stu[i].iswest,&stu[i].paper);
	for(i=0;i<n;i++)
	{
		if(stu[i].num1>80&&stu[i].paper>=1)
			reward[i]=reward[i]+8000;
		if(stu[i].num1>85&&stu[i].num2>80)
			reward[i]=reward[i]+4000;
		if(stu[i].num1>90)
			reward[i]=reward[i]+2000;
		if(stu[i].num1>85&&stu[i].iswest=='Y')
			reward[i]=reward[i]+1000;
		if(stu[i].num2>80&&stu[i].isstu=='Y')
			reward[i]=reward[i]+850;
	}
	for(i=0;i<n;i++)
		all=all+reward[i];
	max=reward[0];
	for(i=1;i<n;i++)
		if(max<reward[i])
			max=reward[i];
	for(i=0;i<n;i++)
		if(max==reward[i])
			break;
	printf("%s\n%d\n%d\n",stu[i].name,reward[i],all);
}
struct student
{
	char name[20];
	int pingjun;
	int pingyi;
	char bgb[3];
	char xb[3];
    int lunwen;
	int qian;
};


int main()
{
	struct student stu[100]={{"\0"}};
	struct student total={"\0"};
	struct student temp={"\0"};
     int n,i;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s%d%d",stu[i].name,&stu[i].pingjun,&stu[i].pingyi);
			scanf("%s%s%d",&stu[i].bgb,&stu[i].xb,&stu[i].lunwen);

		if(stu[i].pingjun>80&&stu[i].lunwen>=1)
			stu[i].qian=stu[i].qian+8000;

		if(stu[i].pingjun>85&&stu[i].pingyi>80)
            stu[i].qian=stu[i].qian+4000;

		if(stu[i].pingjun>90)
            stu[i].qian=stu[i].qian+2000;

		if(stu[i].pingjun>85&&stu[i].xb[0]=='Y')
            stu[i].qian=stu[i].qian+1000;

		if(stu[i].pingyi>80&&stu[i].bgb[0]=='Y')
           stu[i].qian=stu[i].qian+850;  
		total.qian=total.qian+stu[i].qian;

	}
	for(i=0;i<n;i++)
	{
		if(stu[i].qian>temp.qian)
			temp=stu[i];
	}
	
		printf("%s\n%d\n%d\n",temp.name,temp.qian,total.qian);
		return 0;
}
struct student
{
	char name[20];
	int gradeA;
	int gradeB;
	char a;
	char b;
	int num;
	int n;//??
	int np;//??
}
stu[100];
void main()
{
	int m,k,i,max;
	int total=0;
	scanf("%d\n",&m);
	for(i=0;i<m;i++)
	{
		scanf("%s %d %d %c %c %d",stu[i].name,&stu[i].gradeA,&stu[i].gradeB,&stu[i].a,&stu[i].b,&stu[i].num);
		stu[i].n=0;
		stu[i].np=0;
	}
	for(i=0;i<m;i++)
	{
		if(stu[i].gradeA>80&&stu[i].num>=1)
		{
			total=total+8000;
			stu[i].n++;
			stu[i].np=stu[i].np+8000;
		}
		if(stu[i].gradeA>85&&stu[i].gradeB>80)
		{
			total=total+4000;
			stu[i].n++;
			stu[i].np=stu[i].np+4000;
		}
		if(stu[i].gradeA>90)
		{
			total=total+2000;
            stu[i].n++;
			stu[i].np=stu[i].np+2000;
		}
		if(stu[i].gradeA>85&&stu[i].b=='Y')
		{
			total=total+1000;
            stu[i].n++;
			stu[i].np=stu[i].np+1000;
		}
		if(stu[i].gradeB>80&&stu[i].a=='Y')
		{
			total=total+850;
            stu[i].n++;
			stu[i].np=stu[i].np+850;
		}
	}
	for(i=0,max=0;i<m;i++)
		if(stu[i].np>max)
		{
			max=stu[i].np;
		}
	for(i=0;i<m;i++)
	{
		if(stu[i].np==max)
		{
			k=i;
		    break;
		}
	}
	printf("%s\n%d\n%d\n",stu[k].name,stu[k].np,total);
}
int main(int argc, char* argv[])
{
	int n;
	char name[100][50];
	int qimo[100];
	int banji[100];
	char ganbu[100];
	char xibu[100];
	int lunwen[100];
	int i=0,sum[100]={0},sumz=0,k=0;

	scanf("%d",&n);

	for(i=0;i<n;i++)
	{
		scanf("%s%d%d %c %c%d",name[i],&qimo[i],&banji[i],&ganbu[i],&xibu[i],&lunwen[i]);
	}

	for(i=0;i<n;i++)
	{
		if(qimo[i]>80&&lunwen[i]>=1) sum[i]+=8000;
		if(qimo[i]>85&&banji[i]>80) sum[i]+=4000;
		if(qimo[i]>90) sum[i]+=2000;
		if(qimo[i]>85&&xibu[i]=='Y') sum[i]+=1000;
		if(banji[i]>80&&ganbu[i]=='Y') sum[i]+=850;
	}
	int summax=sum[0];
	for(i=1;i<n;i++)
	{
		sumz+=sum[i];
		if(sum[i]>summax) 
		{
			summax=sum[i];
			k=i;
		}
	}
	sumz=sumz+sum[0];
	
	printf("%s\n%d\n%d\n",name[k],sum[k],sumz);

	return 0;
}
void main()
{
	struct stu
{char name[20];
int fen;
int pin;
char gan;
char sheng;
int lun;
int jiang;
}a[100];
	int n,i,max,k,sum=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s %d %d %c %c %d",a[i].name,&a[i].fen,&a[i].pin,&a[i].gan,&a[i].sheng,&a[i].lun);
		a[i].jiang=0;
		if(a[i].fen>80&&a[i].lun>0)
			a[i].jiang=a[i].jiang+8000;
		if(a[i].fen>85&&a[i].pin>80)
			a[i].jiang=a[i].jiang+4000;
		if(a[i].fen>90)
			a[i].jiang=a[i].jiang+2000;
		if(a[i].fen>85&&a[i].sheng=='Y')
			a[i].jiang=a[i].jiang+1000;
		if(a[i].pin>80&&a[i].gan=='Y')
			a[i].jiang=a[i].jiang+850;
		sum=sum+a[i].jiang;
	}
	for(i=1,k=0,max=a[0].jiang;i<n;i++)
		if(a[i].jiang>max)
		{
			max=a[i].jiang;
			k=i;
		}
		printf("%s\n%d\n%d",a[k].name,a[k].jiang,sum);
}
int main()
{
	int i,n,smax=0;
	struct s{
		char name[21];
		int qimo;
		int banji;
		char bangan;
		char xibu;
		int lunwen;
		int sum;}s[101];
	scanf("%d",&n);
	for(i=0;i<n;i++){
		s[i].sum=0;
		scanf("%s %d %d %c %c %d",s[i].name,&s[i].qimo,&s[i].banji,&s[i].bangan,&s[i].xibu,&s[i].lunwen);
	}
		for(i=0;i<n;i++){
		if((s[i].qimo>80)&&(s[i].lunwen>0))
			s[i].sum=s[i].sum+8000;
        if((s[i].qimo>85)&&(s[i].banji>80))
			s[i].sum=s[i].sum+4000;
        if(s[i].qimo>90)
			s[i].sum=s[i].sum+2000;
	    if((s[i].qimo>85)&&(s[i].xibu=='Y'))
			s[i].sum=s[i].sum+1000;
        if((s[i].banji>80)&&(s[i].bangan=='Y'))
			s[i].sum=s[i].sum+850;}
		for(i=0;i<n;i++)
		{smax+=s[i].sum;
			if(s[i].sum>s[0].sum){
				s[0].sum=s[i].sum;
			s[0]=s[i];	}
		}
		printf("%s\n",s[0].name);
		printf("%d\n",s[0].sum);
		printf("%d",smax);
		return 0;
	}
struct student
{
	char name[21];
	int final;
	int cla;
	char stu;
	char west;
	int paper;
	int sch;
};
int award(struct student *p)
{
	int total=0;
	if(p->final>80&&p->paper>0)
		total+=8000;
	if(p->final>85&&p->cla>80)
		total+=4000;
	if(p->final>90)
		total+=2000;
	if(p->final>85&&p->west=='Y')
		total+=1000;
	if(p->cla>80&&p->stu=='Y')
		total+=850;
	return total;
}
int main()
{
	int n,i,j;
	long int all=0;
	struct student s[100],*p[100];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s %d %d %c %c %d",&s[i].name,&s[i].final,&s[i].cla,&s[i].stu,&s[i].west,&s[i].paper);
		p[i]=&s[i];
		s[i].sch=award(p[i]);
		all+=s[i].sch;
	}
	for(i=0;i<n-1;i++)
	{
		for(j=i+1;j<n;j++)
		{
			if(s[j].sch>s[i].sch)
			{
				struct student temp;
				temp=s[i];
				s[i]=s[j];
				s[j]=temp;
			}
		}
	}
	printf("%s\n%d\n%ld",s[0].name,s[0].sch,all);
	return 0;
}
/*????????8000??????????80??>80???????????1??1????????????? 
2) ????????4000??????????85??>85????????????80??>80????????? 
3) ????????2000??????????90??>90????????? 
4) ????????1000??????????85??>85????????????? 
5) ????????850??????????80??>80??????????? 
???????????N?1 ? N ? 100??????????????N????????????
???????????????????????????????????????????????????*/
struct student
{
	char name[20];
	int a;
	int b;
	char c;
	char d;
	int e;
    int f; 
}stu[101];
 main()
{
	int n,i,sum=0,j;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s %d %d %c %c %d",stu[i].name,&stu[i].a,&stu[i].b,&stu[i].c,&stu[i].d,&stu[i].e);
		stu[i].f=0;
		if(stu[i].a>80&&stu[i].e>0) stu[i].f+=8000;
		if(stu[i].a>85&&stu[i].b>80) stu[i].f+=4000;
		if(stu[i].a>90) stu[i].f+=2000;
		if(stu[i].d=='Y'&&stu[i].a>85) stu[i].f+=1000;
		if(stu[i].b>80&&stu[i].c=='Y') stu[i].f+=850;
	}
	for(j=0;j<n;j++)
     	sum=sum+stu[j].f;
	stu[100]=stu[0];
	for(j=1;j<n;j++)
	{
		if(stu[j].f>stu[100].f )
			stu[100]=stu[j];
	}
	printf("%s\n%d\n%d\n",stu[100].name,stu[100].f,sum);
}
void main()
{
	struct stu
	{
		char name[20];
		int end;
		int cls;
		char lead;
		char west;
		int pap;
		int sum;
	}std[100];
	int n,i,j,summ=0,k=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s%d %d %c %c %d",&std[i].name,&std[i].end,&std[i].cls,&std[i].lead,&std[i].west,&std[i].pap);
		std[i].sum=0;
		if((std[i].end>80)&&(std[i].pap>=1))SS=SS+8000;
		if((S.end>85)&&(S.cls>80))SS=SS+4000;
		if(S.end>90)SS=SS+2000;
		if((S.end>85)&&(S.west=='Y'))SS=SS+1000;
		if((S.cls>80)&&(S.lead=='Y'))SS=SS+850;
		summ=summ+SS;
	}
	for(i=0;i<n;i++)
	{
		if(SS>k)
		{
			k=SS;
			j=i;
		}
	}
	printf("%s\n%d\n%d\n",std[j].name,std[j].sum,summ);
}
void main()
{
	struct information
	{
		char name[20];
		int qimo;
		int banji;
		char ganbu;
		char xibu;
		int lunwen;
		int money;
	}info[100];
	int n,max,sum=0,i;
	char scholar[20];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s %d %d %c %c %d",info[i].name,&info[i].qimo,&info[i].banji,&info[i].ganbu,&info[i].xibu,&info[i].lunwen);
		info[i].money=0;
	}
	for(i=0;i<n;i++)
	{
		if(info[i].qimo>80&&info[i].lunwen>0)
			info[i].money+=8000;
		if(info[i].qimo>85&&info[i].banji>80)
			info[i].money+=4000;
		if(info[i].qimo>90)
			info[i].money+=2000;
		if(info[i].qimo>85&&info[i].xibu=='Y')
			info[i].money+=1000;
		if(info[i].banji>80&&info[i].ganbu=='Y')
			info[i].money+=850;
		sum+=info[i].money;
	}
	strcpy(scholar,info[0].name);
	max=info[0].money;
	for(i=0;i<n;i++)
	{
		if(max<info[i].money)
		{
			max=info[i].money;
			strcpy(scholar,info[i].name);
		}
	}
	printf("%s\n%d\n%d\n",scholar,max,sum);
}
struct student
{
	char name[20];
	int score;
	int pscore;
	char gjud;
	char wjud;
	int paper;
	int sum;
}stu[100];
void main()
{
	int n,i,ssum=0,tsum=0,ti;scanf("%d",&n);
	for(i=0;i<n;i++)scanf("%s%d%d %c %c%d",stu[i].name,&stu[i].score,&stu[i].pscore,&stu[i].gjud,&stu[i].wjud,&stu[i].paper),stu[i].sum=0;
	for(i=0;i<n;i++)
	{
		if(stu[i].score>80&&stu[i].paper>=1)stu[i].sum+=8000;
		if(stu[i].score>85&&stu[i].pscore>80)stu[i].sum+=4000;
		if(stu[i].score>90)stu[i].sum+=2000;
		if(stu[i].score>85&&stu[i].wjud=='Y')stu[i].sum+=1000;
		if(stu[i].pscore>80&&stu[i].gjud=='Y')stu[i].sum+=850;
		ssum+=stu[i].sum;	
	}
	for(i=0;i<n;i++)if(stu[i].sum>tsum)tsum=stu[i].sum,ti=i;
	printf("%s\n%d\n%d",stu[ti].name,tsum,ssum);
}
struct student
{
	char name[20];
    int finalmarks;
    int classmarks;
	char monitor;
	char west;
	int paper;
}stu;

void main()
{
 int n;
 char bigname[20]="0";
 int max=0,temp=0;
 int sum=0;
 int i;
 scanf("%d",&n);
 for(i=0;i<n;i++)
 {
     stu.name[20]="0";
	 temp=0;
	 scanf("%s %d %d %c %c %d",stu.name,&stu.finalmarks,&stu.classmarks,&stu.monitor,&stu.west,&stu.paper);
  //????????8000??????????80??>80???????????1??1????????????? 
  if( stu.finalmarks>80 && stu.paper>=1 )
     temp=temp+8000;
  //????????4000??????????85??>85????????????80??>80?????????
  if( stu.finalmarks>85 && stu.classmarks>80 )
	 temp=temp+4000;
  //????????2000??????????90??>90?????????
  if( stu.finalmarks>90 )
	 temp=temp+2000;
  //????????1000??????????85??>85????????????? 
  if( stu.finalmarks>85 && stu.west=='Y' )
	 temp=temp+1000;
  //????????850??????????80??>80???????????
  if( stu.classmarks>80 && stu.monitor=='Y' )
	temp=temp+850;
  sum=sum+temp;
  if( max<temp )
  {
   max=temp;
   strcpy(bigname,stu.name);
  }
 }
 printf("%s\n",bigname);
 printf("%d\n",max);
 printf("%d",sum);
}
void main()
{
	int i,j=0,max,N,mark1[150],mark2[150],p[150],s[150]={0},sum=0;
	char name[150][20]={'0'},a[150]={'0'},b[150]={'0'};
	scanf("%d",&N);
	for (i=0;i<N;i++)
	{	scanf("%s %d %d %s %s %d",name[i],&mark1[i],&mark2[i],&a[i],&b[i],&p[i]);}
	for (i=0;i<N;i++)
	{
		if (mark1[i]>80 && p[i]>=1)
		{	s[i]=s[i]+8000;}
		if (mark1[i]>85 && mark2[i]>80)
		{	s[i]=s[i]+4000;}
		if (mark1[i]>90)
		{	s[i]=s[i]+2000;}
		if (mark1[i]>85 && (int)(b[i])==89)
		{	s[i]=s[i]+1000;}
		if (mark2[i]>80 && (int)(a[i])==89)
		{	s[i]=s[i]+850;}
	}
	for (i=0;i<N;i++)
	{   sum=sum+s[i];}
	max=s[0];
	for (i=0;i<N;i++)
	{
		if (s[i]>max)
		{   max=s[i];
		    j=i;}
	}
	printf("%s\n%d\n",name[j],s[j]);
	printf("%d\n",sum);
}
struct stu
{
	char name[21];
	int avs;
	int pys;
	char gb;
	char xb;
	int lw;
} stu[100];

main()
{
	int n,i,max,maxstu,sum;
	int jj[100];

	scanf("%d",&n);

	for(i=0;i<n;i++){
		scanf("%s %d %d %c %c %d",&stu[i].name,&stu[i].avs,&stu[i].pys,&stu[i].gb,&stu[i].xb,&stu[i].lw);
		jj[i]=0;
		if(stu[i].avs>80&&stu[i].lw>0){
			jj[i]+=8000;
		}
		if(stu[i].avs>85&&stu[i].pys>80){
			jj[i]+=4000;
		}
		if(stu[i].avs>90){
			jj[i]+=2000;
		}
		if(stu[i].avs>85&&stu[i].xb=='Y'){
			jj[i]+=1000;
		}
		if(stu[i].pys>80&&stu[i].gb=='Y'){
			jj[i]+=850;
		}
	}

	max=jj[0];
	maxstu=0;
	sum=jj[0];
	for(i=1;i<n;i++){
		if(jj[i]>max){
			max=jj[i];
			maxstu=i;
		}
		sum+=jj[i];
	}

	printf("%s\n%d\n%d\n",stu[maxstu].name,max,sum);
}
void main()
{struct student
{char name[30];
int final;
int crit;
char leader;
char west;
int paper;}stu;

	int max=0,n,i,total=0,money;
char bestboy[30];
scanf("%d",&n);
			for(i=0;i<n;i++)
			{scanf("%s ",stu.name);
			 scanf("%d ",&stu.final);
			  scanf("%d ",&stu.crit);
			 scanf("%c ",&stu.leader);
			 scanf("%c ",&stu.west);
			 scanf("%d",&stu.paper);
			 money=0;
			 if(stu.final>80&&stu.paper!=0)//1) ????????8000??????????80??>80???????????1??1????????????? 
 
//3) ????????2000??????????90??>90????????? 
//4) ????????1000??????????85??>85????????????? 
//5) ????????850??????????80??>80??????????? 

				 money+=8000;
			 if(stu.final>85&&stu.crit>80)//2) ????????4000??????????85??>85????????????80??>80?????????
				 money+=4000;
			 if(stu.final>90)
				 money+=2000;
			 if(stu.final>85&&stu.west=='Y')
			 money+=1000;
			 if(stu.crit>80&&stu.leader=='Y')
			 {money+=850;}

			 total+=money;
			 if(money>max)
			 {max=money;
			  strcpy(bestboy,stu.name);
			 }
			}
			printf("%s\n%d\n%d",bestboy,max,total);

}
int main()
{
	struct student
	{
		char nam[50];
		int ave;
		int ping;
		char gan;
		char xi;
		int wen;
		int total[5];
		
		int all;
	}stu[100];
	int num,i,j;
	int a[100]={0};
	scanf("%d",&num);
	for(i=0;i<num;i++)
	{
		scanf("%s%d%d %c %c%d",stu[i].nam,&stu[i].ave,&stu[i].ping,&stu[i].gan,&stu[i].xi,&stu[i].wen);
stu[i].all = 0;
memset(stu[i].total, 0, sizeof(stu[i].total));
	}
    for(i=0;i<num;i++)
	{

		if(stu[i].ave>80&&stu[i].wen>=1)
			stu[i].total[0]=8000;
                if(stu[i].ave>85&&stu[i].ping>80)
			stu[i].total[1]=4000;

		if(stu[i].ave>90)
			stu[i].total[2]=2000;
		if(stu[i].ave>85&&stu[i].xi=='Y')
                        stu[i].total[3]=1000;
		if(stu[i].ping>80&&stu[i].gan=='Y')
		        stu[i].total[4]=850;
	}
    for(i=0;i<num;i++)
	{
		for(j=0;j<5;j++)
		{
			stu[i].all+=stu[i].total[j];  //????????????.
		}
	}
    
	int max=0;
	for(i=0;i<num;i++)
	{
		if(stu[i].all>max)
		{
			max=stu[i].all;//????????,????????
		    j=i;
		}
	}
	int whole=0;
	for(i=0;i<num;i++)
	{
		whole+=stu[i].all;
	}
	printf("%s\n%d\n%d",stu[j].nam,max,whole);
	
	return 0;
}
struct student
{
	char Name[20];
	int agrades;
	int bgrades;
	char a;
	char b;
	int n;
};
int main(int argc, char* argv[])
{
	struct student *p;
	int i,j,num;
	scanf("%d",&num);
    p=(struct student*)malloc(num*sizeof(struct student));
	for(i=0;i<num;i++)
	{
		
		scanf("%s%d%d %c %c%d",p[i].Name,&p[i].agrades,&p[i].bgrades,&p[i].a,&p[i].b,&p[i].n);
		//printf("%s %d %d %c %c %d",p[i].Name,p[i].agrades,p[i].bgrades,p[i].a,p[i].b,p[i].n);
	}
	int *p1,*p2;
	p1=(int*)malloc(num*sizeof(int));
	p2=(int*)malloc(num*sizeof(int));
	for(i=0;i<num;i++)
	{
		p1[i]=0;
		p2[i]=0;
		if(p[i].agrades>80&&p[i].n>=1)
		{
			p1[i]++;
			p2[i]+=8000;
		}
		if(p[i].agrades>85&&p[i].bgrades>80)
		{
			p1[i]++;
			p2[i]+=4000;
		}
		if(p[i].agrades>90)
		{
			p1[i]++;
			p2[i]+=2000;
		}
		if(p[i].agrades>85&&p[i].b=='Y')
		{
			p1[i]++;
			p2[i]+=1000;
		}
		if(p[i].bgrades>80&&p[i].a=='Y')
		{
			p1[i]++;
			p2[i]+=850;
		}
	}
    int sum=0;
	for(i=0;i<num;i++)
	{
        sum+=p2[i];
	}
	int max;
	max=p2[0];
	for(i=0;i<num;i++)
	{
		if(max<p2[i])
			max=p2[i];
	}
	for(i=0;i<num;i++)
	{
		if(max==p2[i])
			break;
	}
	printf("%s\n",p[i].Name);
	printf("%d\n",p2[i]);
	printf("%d",sum);

	return 0;
}
int main()
{
	struct stu
	{
		char name[21];
		int qm;
		int cm;
		char xs[21];
		char west[21];
		int paper;
		int sp;
	};
	struct stu a[101];
	int i,n;
	scanf("%d",&n);
	for (i=0;i<n;i++)
	{
		scanf("%s",&a[i].name);
		scanf("%d",&a[i].qm);
		scanf("%d",&a[i].cm);
		scanf("%s",&a[i].xs);
		scanf("%s",&a[i].west);
		scanf("%d",&a[i].paper);
		a[i].sp=0;
		if ((a[i].qm>80)&&(a[i].paper>0)) a[i].sp+=8000;
		if ((a[i].qm>85)&&(a[i].cm>80)) a[i].sp+=4000;
		if (a[i].qm>90) a[i].sp+=2000;
		if ((a[i].qm>85)&&(a[i].west[0]=='Y')) a[i].sp+=1000;
		if ((a[i].cm>80)&&(a[i].xs[0]=='Y')) a[i].sp+=850;
	}
	int max,total;
	max=0;
	total=0;
	for (i=0;i<n;i++)
	{
		if (a[i].sp>a[max].sp) max=i;
		total=total+a[i].sp;
	}
	printf("%s\n",a[max].name);
	printf("%d\n",a[max].sp);
	printf("%d\n",total);
	return 0;
}
void main()
{struct xuesheng
{char x[21];
 int qimo;
 int banji;
 char ganbu;
 char xibu;
 int lunwen;
 int qian;
};
 struct xuesheng x[101],*p;
 int i,n,max=0,total=0,money;
 char name[21];
 scanf("%d",&n);
 for (i=0;i<n;i++)
 {scanf("%s %d %d %c %c %d\n",&x[i].x,&x[i].qimo,&x[i].banji,&x[i].ganbu,&x[i].xibu,&x[i].lunwen);
  x[i].qian=0;
  if (x[i].qimo>80&&x[i].lunwen!=0)
	  x[i].qian+=8000;
  if (x[i].qimo>85&&x[i].banji>80)
	  x[i].qian+=4000;
  if (x[i].qimo>90)
	  x[i].qian+=2000;
  if (x[i].qimo>85&&x[i].xibu=='Y')
	  x[i].qian+=1000;
  if (x[i].banji>80&&x[i].ganbu=='Y')
	  x[i].qian+=850;
  total=total+x[i].qian;
 }

 for (i=0;i<n;i++)
	 if(max<x[i].qian)
	 {strcpy(name,x[i].x);max=x[i].qian;}
 printf("%s\n%d\n%d",name,max,total);
}
int main()
{
struct stu
{
	char name[20];
	int qimo;
	int banping;
	char gb[2];
	char xb[2];
	int lw;
	long int jxj;
}stu[100];

	int n,N,a=0,b=0,c=0,d=0,e=0,max,temp,totle=0;
	scanf("%d",&N);
	for(n=0;n<N;n++)
		scanf("%s%d%d%s%s%d",&stu[n].name,&stu[n].qimo,&stu[n].banping,&stu[n].gb,&stu[n].xb,&stu[n].lw);
	for(n=0;n<N;n++)
	{
		a=0;b=0;c=0;d=0;e=0;
		if((stu[n].qimo>80)&&(stu[n].lw>=1))a=8000;
		if((stu[n].qimo>85)&&(stu[n].banping>80))b=4000;
		if(stu[n].qimo>90)c=2000;
		if((stu[n].banping>80)&&(strcmp(stu[n].gb,"Y")==0))e=850;
		if((stu[n].qimo>85)&&(strcmp("Y",stu[n].xb)==0))d=1000;
		stu[n].jxj=a+b+c+d+e;
	}
		for(n=0;n<N;n++)
		{
			totle+=stu[n].jxj;
		}
		for(n=1;n<N;n++)
			if(stu[n].jxj>stu[0].jxj)
			{
				temp=stu[0].jxj;
				stu[0].jxj=stu[n].jxj;
				stu[n].jxj=temp;
				strcpy(stu[0].name,stu[n].name);
			}

	printf("%s\n%d\n%d\n",stu[0].name,stu[0].jxj,totle);
	return 0;
}
struct student
{
    char name[20];
	int aver;
	int judge;
	char a;
	char b;
	int punish;
	int prize;
	struct student *next;
};

int stu_num;


struct student *creat(void)
{
	struct student *head,*p1,*p2;
	int n;
	p1=p2=(struct student *)malloc(LEN);
	scanf("%s %d %d %c %c %d",p1->name,&p1->aver,&p1->judge,&p1->a,&p1->b,&p1->punish);
	head=NULL;
	n=0;
	while(n<stu_num-1)
	{
		n++;
		if(n==1)
			head=p1;
		else
			p2->next=p1;
		p2=p1;
		p1=(struct student *)malloc(LEN);
		scanf("%s %d %d %c %c %d",p1->name,&p1->aver,&p1->judge,&p1->a,&p1->b,&p1->punish);
	}
	p2->next=p1;
	p1->next=NULL;
	return(head);
}


void main()
{
	struct student *head,*q1,*q2;
	int sum=0;
	scanf("%d",&stu_num);
    head=creat();
	q1=head;
    q2=head;
	while(q1!=NULL)
	{
		q1->prize=0;
		if(q1->aver>80&&q1->punish>0)
			q1->prize+=8000;
		if(q1->aver>85&&q1->judge>80)
			q1->prize+=4000;
		if(q1->aver>90)
            q1->prize+=2000;
		if(q1->aver>85&&q1->b=='Y')
            q1->prize+=1000;
		if(q1->judge>80&&q1->a=='Y')
            q1->prize+=850;
		sum+=q1->prize;
		if(q2->prize<q1->prize)
			q2=q1;
		q1=q1->next;
	}
	printf("%s\n%d\n%d\n",q2->name,q2->prize,sum);
}