semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
void main()
{
 int n,i,j;
 scanf("%d",&n);
 char a[n][30];
 int b[n][3];
 char c[n][2];
 for(i=0;i<n;i++)
  {
   scanf("%s %d %d %c %c %d",&a[i],&b[i][0],&b[i][1],&c[i][0],&c[i][1],&b[i][2]);
   }
 int sum[n];
 for(i=0;i<n;i++)
  {
    sum[i]=0;
    if (b[i][0]>80&&b[i][2]>0) sum[i]=sum[i]+8000;
    if (b[i][0]>85&&b[i][1]>80) sum[i]=sum[i]+4000;
    if (b[i][0]>90) sum[i]=sum[i]+2000;
    if (b[i][0]>85&&c[i][1]=='Y') sum[i]=sum[i]+1000;
    if (b[i][1]>80&&c[i][0]=='Y') sum[i]=sum[i]+850; 
   }
   int max=sum[0],t,total=0;
   char name[10];
   for(i=0;i<n;i++)
      {
        if (max<sum[i]) {max=sum[i];t=i;}
       }
      for(i=0;i<n;i++)
     {
       total=total+sum[i];
      }
      printf("%s\n%d\n%d",a[t],max,total);
}
struct points
    {
       char name[30];
       int score1;
       int score2;
       char west;
       char leader;
       int essay;
	   int money;
    }points[100];
   int main()
   {
      int n,i,max=0,m=0;
       scanf("%d",&n);
      for(i=0;i<n;i++)
     {
      scanf("%s %d %d %c %c %d",points[i].name,&points[i].score1,&points[i].score2,&points[i].leader,&points[i].west,&points[i].essay);
	  points[i].money=0;
     }
  for(i=0;i<n;i++)
     {
        if(points[i].score1>90)
		{
			points[i].money=points[i].money+2000;
		}
        if(points[i].score1>85&&points[i].score2>80)
		{
              points[i].money=points[i].money+4000;
		}
        if(points[i].score1>85&&points[i].west=='Y')
		{
			points[i].money=points[i].money+1000;
		}
        if(points[i].score2>80&&points[i].leader=='Y')
		{
			points[i].money=points[i].money+850;
		}
        if(points[i].score1>80&&points[i].essay>=1)
		{
			points[i].money=points[i].money+8000;
		}
      }
    char *p=points[0].name;

  for(i=0;i<n;i++)
   {
        if( points[i].money>max)
		{
			max=points[i].money;
            p=points[i].name;
		} 
   }
   for(i=0;i<n;i++)
   {
	   m=m+points[i].money;
   }
   printf("%s\n",p);
   printf("%d\n",max);
   printf("%d\n",m);
   return 0;
}
int N;
struct student
{
	char name[20];
	int score1;
	int score2;
	char c1;
	char c2;
	int paper;
	int money;
	struct student*next;
};
void mon(struct student*p)
{
	p->money=0;
	if((p->score1>80)&&(p->paper>=1))
	{
		p->money=p->money+8000;
	}
	if((p->score1>85)&&(p->score2>80))
	{
		p->money+=4000;
	}
	if(p->score1>90)
	{
		p->money+=2000;
	}
	if((p->score1>85)&&(p->c2=='Y'))
	{
		p->money+=1000;
	}
	if((p->score2>80)&&(p->c1=='Y'))
	{
		p->money+=850;
	}
}
struct student*creat()
{
	struct student*head,*p1,*p2;
	int i;
	p1=(struct student*)malloc(LEN);
	scanf("%s %d %d %c %c %d",p1->name,&p1->score1,&p1->score2,&p1->c1,&p1->c2,&p1->paper);
	p1->next=NULL;
	mon(p1);
	head=p1;
	p2=p1;
	for(i=1;i<N;i++)
	{
		p1=(struct student*)malloc(LEN);
	    scanf("%s %d %d %c %c %d",p1->name,&p1->score1,&p1->score2,&p1->c1,&p1->c2,&p1->paper);
	    p1->next=NULL;
	    mon(p1);
		p2->next=p1;
		p2=p1;
	}
	return(head);
}
void f(struct student*head)
{
	int max;
	int sum=0;
	char name[20];
    struct student*p;
	max=head->money;
	strcpy(name,head->name);
	for(p=head;p;p=p->next)
	{
		sum+=p->money;
		if(p->money>max)
		{
			max=p->money;
			strcpy(name,p->name);
		}
	}
	printf("%s\n%d\n%d\n",name,max,sum);
}
int main()
{
	struct student*head;
	scanf("%d",&N);
	head=creat();
	f(head);
}
struct student
{
	char name[20];
	int score;
	int judge;
	char c1;
	char c2;
	char num;
	int money;
};
int main()
{
	struct student a[501];
	char s1[20];
	int i,n,max=0,sum=0;
	int score1,num1,judge1;
	char c11,c12;
	struct student *p;
	p=a;
	scanf("%d",&n);
	for(;p<a+n;p++)
	{
		scanf("%s",s1);
		strcpy(p->name,s1);
		scanf("%d %d %c %c %d",&score1,&judge1,&c11,&c12,&num1);
		p->c1=c11;
		p->c2=c12;
		p->judge=judge1;
		p->num=num1;
		p->score=score1;
		p->money=0;
	}
	p=a;
	for(;p<a+n;p++)
	{
		if(p->score>80&&p->num>0) p->money+=8000;
		if(p->judge>80&&p->score>85) p->money+=4000;
		if(p->score>90) p->money+=2000;
		if(p->c1=='Y'&&p->judge>80) p->money+=850;
		if(p->c2=='Y'&&p->score>85) p->money+=1000;
	}
	p=a;
	for(;p<a+n;p++)
	{
		if(p->money>max) max=p->money;
		sum+=p->money;
	}
	p=a;
	for(;p<a+n;p++)
	{
		if(p->money==max) 
		{
			printf("%s\n%d\n",p->name,p->money);
			break;
		}
	}
	printf("%d\n",sum);
	return 0;
}
main()
{struct student
	{char name[20];
	int average;
	int classeva;
	char leader;
	char western;
	int paper;
	};
 int n,i;
 scanf("%d",&n);
 struct student stu[100];
 for(i=0;i<n;i++)
	 scanf("%s%d%d %c %c%d",stu[i].name,&stu[i].average,&stu[i].classeva,
	       &stu[i].leader,&stu[i].western,&stu[i].paper);
 int sum[100],max=0;
 long total=0;
 for(i=0;i<n;i++)
	{sum[i]=0;
	 if(stu[i].average>80&&stu[i].paper>=1)sum[i]+=8000;
	 if(stu[i].average>85&&stu[i].classeva>80)sum[i]+=4000;
	 if(stu[i].average>90)sum[i]+=2000;
	 if(stu[i].average>85&&stu[i].western=='Y')sum[i]+=1000;
	 if(stu[i].classeva>80&&stu[i].leader=='Y')sum[i]+=850;
	 total+=sum[i];
	 if(sum[i]>max)max=sum[i];
	}
 for(i=0;i<n;i++)
	 if(sum[i]==max)break;
 printf("%s\n%d\n%ld",stu[i].name,max,total);
}
main()
{
	int n;
	int i;
	int j=0;
	int s;
	int all=0;
	scanf("%d",&n);
	struct student
	{
		char name[20];
		int avg;
		int cls;
		char aso[2];
		char wst[2];
		int pap;
		int mny;
	};
	struct student stu[101];
	for(i=0;i<n;i++)
	{
		scanf("%s %d %d %s %s %d",stu[i].name,&stu[i].avg,&stu[i].cls,stu[i].aso,stu[i].wst,&stu[i].pap);
	}
	for(i=0;i<n;i++)
		stu[i].mny=0;
	for(i=0;i<n;i++)
	{
		if((stu[i].avg>80)&(stu[i].pap>=1))
			stu[i].mny=stu[i].mny+8000;
		if((stu[i].avg>85)&(stu[i].cls>80))
			stu[i].mny=stu[i].mny+4000;
		if(stu[i].avg>90)
			stu[i].mny=stu[i].mny+2000;
		if((stu[i].avg>85)&(stu[i].wst[0]=='Y'))
			stu[i].mny=stu[i].mny+1000;
		if((stu[i].cls>80)&(stu[i].aso[0]=='Y'))
			stu[i].mny=stu[i].mny+850;
	}
	s=stu[0].mny;
	for(i=1;i<n;i++)
	{
		if(stu[i].mny>s)
		{
			s=stu[i].mny;
			j=i;
		}
	}
	for(i=0;i<n;i++)
		all=all+stu[i].mny;
	printf("%s\n",stu[j].name);
	printf("%d\n",s);
	printf("%d",all);
}
struct student 
{
	char name[20];
	int g;
	int e;
	char m;
	char w;
	int p;
}stu[N];
void main()
{
	int award[N];
	int AWARD(struct student stu);
	int n;
	int i,j;
	int sum=0,max=0,maxi=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
		scanf("%s %d %d %c %c %d",&stu[i].name,&stu[i].g,&stu[i].e,&stu[i].m,&stu[i].w,&stu[i].p);
	for(i=0;i<n;i++)
	{
		award[i]=AWARD(stu[i]);
		sum=sum+award[i];
		if(award[i]>max)
		{
			max=award[i];
			maxi=i;
		}
	}
	printf("%s\n%d\n",stu[maxi].name,max);
	printf("%d",sum);
}
int AWARD(struct student stu)
{
	int sum=0;
	if(stu.g>80&&stu.p>0)
		sum=sum+8000;
	if(stu.g>85&&stu.e>80)
		sum=sum+4000;
	if(stu.g>90)
		sum=sum+2000;
	if(stu.g>85&&stu.w=='Y')
		sum=sum+1000;
	if(stu.e>80&&stu.m=='Y')
		sum=sum+850;
	return(sum);
}
int main()
{
     struct student
	 {
		 char name[20];
		 int a,b,lunwen;
		 char ganbu,xibu;
	 int jiangjin;
	 }stu[100];
	 int n,i,t=0;
	 long int sum=0;
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].ganbu,&stu[i].xibu,&stu[i].lunwen);}


for(i=0;i<n;i++){stu[i].jiangjin=0;


	if(stu[i].a>80&&stu[i].lunwen>0){stu[i].jiangjin=stu[i].jiangjin+8000;}
	if(stu[i].a>85&&stu[i].b>80){stu[i].jiangjin=stu[i].jiangjin+4000;}
    if(stu[i].a>90){stu[i].jiangjin=stu[i].jiangjin+2000;}
    if(stu[i].a>85&&stu[i].xibu=='Y'){stu[i].jiangjin=stu[i].jiangjin+1000;}
    if(stu[i].b>80&&stu[i].ganbu=='Y'){stu[i].jiangjin=stu[i].jiangjin+850;}}
for(i=0;i<n;i++){
	if(stu[i].jiangjin>stu[t].jiangjin){t=i;}}
for(i=0;i<n;i++){
	sum=sum+stu[i].jiangjin;}
printf("%s\n%d\n%ld",stu[t].name,stu[t].jiangjin,sum);


            return 0;
              }
struct student
{
	char name[21];
	int test;
	int examine;
	char ganbu;
	char west;		
	int paper;
	int jiang;
	struct student *next;
};
void main()
{
	struct student stu[100];
	int n,i;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s %d %d %c %c %d",stu[i].name,&stu[i].test,&stu[i].examine,&stu[i].ganbu,&stu[i].west,&stu[i].paper);
		stu[i].jiang=0;
		if(stu[i].test>80&&stu[i].paper>0)
			stu[i].jiang+=8000;
		if(stu[i].test>85&&stu[i].examine>80)
			stu[i].jiang+=4000;
		if(stu[i].test>90)
			stu[i].jiang+=2000;
		if(stu[i].test>85&&stu[i].west=='Y')
			stu[i].jiang+=1000;
		if(stu[i].examine>80&&stu[i].ganbu=='Y')
			stu[i].jiang+=850;
	}
	int m=0;
	int max,sum;
	
	max=stu[0].jiang;
	sum=stu[0].jiang;

	for(i=1;i<n;i++)
	{
		if(stu[i].jiang>max)
		{
			m=i;
	        max=stu[i].jiang;
		}
		sum=sum+stu[i].jiang;
	}
	printf("%s\n%d\n%d",stu[m].name,max,sum);
}
int main()
{
	int a,b,e,n,i,max=0,total=0,sum[200];
	char s[200][200],maxstudent[200],c,d;
	cin>>n;
	for(i=0;i<n;i++)
	{
		sum[i]=0;
		cin>>s[i]>>a>>b>>c>>d>>e;
		if((a>80)&&(e>0))
			sum[i]+=8000;
		if((a>85)&&(b>80))
			sum[i]+=4000;
		if((a>90))
			sum[i]+=2000;
		if((a>85)&&(d=='Y'))
			sum[i]+=1000;
		if((b>80)&&(c=='Y'))
			sum[i]+=850;
	}
	for(i=0;i<n;i++)
	{
		total+=sum[i];
		if(sum[i]>max)
			{
			max=sum[i];
		    strcpy(maxstudent,s[i]);
			}

	}
	cout<<maxstudent<<"\n"<<max<<"\n"<<total<<endl;
			return 0;
}
int main()
{
    struct student
	{
	   char name[30];
	   int qimo;
	   int ping;
	   char ban;
	   char xi;
	   int paper;
	}a[100];
	int N,i,b[100]={0},max,t,s=0;
	scanf("%d",&N);
	for(i=0;i<N;i++)
	{
		scanf("%s%d%d %c %c %d",a[i].name,&a[i].qimo,&a[i].ping,&a[i].ban,&a[i].xi,&a[i].paper);
	}
	for(i=0;i<N;i++)
	{
		if((a[i].qimo>80)&&(a[i].paper>=1))
			b[i]=b[i]+8000;
		if((a[i].ping>80)&&(a[i].qimo>85))
			b[i]=b[i]+4000;
		if(a[i].qimo>90)
			b[i]=b[i]+2000;
		if((a[i].qimo>85)&&(a[i].xi=='Y'))
			b[i]=b[i]+1000;
		if((a[i].ping>80)&&(a[i].ban=='Y'))
			b[i]=b[i]+850;
	}
	max=b[0];
	t=0;
	for(i=0;i<N;i++)
	{
		s=s+b[i];
		if(b[i]>max)
		{
			max=b[i];
			t=i;
		}
	}
	printf("%s\n%d\n%d\n",a[t].name,max,s);
	return 0;
}
int main()
{ struct student
  { char name[20];
    int jun;
    int ping;
    char gan;
    char xi;
    int lun;
    };
  struct student s[100];
  int n,i,j;
  long t,g[100],m; 
  scanf("%d\n",&n);
  for (i=0;i<=(n-1);i++)
    { scanf("%s",&s[i].name);    
      scanf("%d%d %c %c%d",&s[i].jun,&s[i].ping,&s[i].gan,&s[i].xi,&s[i].lun);
     }
  for  (i=0;i<=(n-1);i++)
   {  g[i]=0;
     if (s[i].jun>80&&s[i].lun>=1) g[i]=g[i]+8000;
     if (s[i].jun>85&&s[i].ping>80) g[i]=g[i]+4000;
     if (s[i].jun>90) g[i]=g[i]+2000;
     if (s[i].xi=='Y'&&s[i].jun>85) g[i]=g[i]+1000;
     if (s[i].gan=='Y'&&s[i].ping>80) g[i]=g[i]+850;
   }
  m=g[0];j=0;t=0;
  for (i=0;i<=(n-1);i++)
   { t=t+g[i];
     if (m<g[i]) {m=g[i];j=i;}
    }
  printf("%s\n%d\n%ld",s[j].name,m,t);
}
void main()
{
	int n,i,result[100],sum=0;
	char str[100][20];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		int a,b,c,R[5];
		char c1,c2;
		scanf("%s %d %d %c %c %d",str[i],&a,&b,&c1,&c2,&c);
		R[0]=(a>80&&c>=1)? 8000:0;
		R[1]=(a>85&&b>80)? 4000:0;
		R[2]=(a>90)? 2000:0;
		R[3]=(a>85&&c2=='Y')? 1000:0;
		R[4]=(b>80&&c1=='Y')? 850:0;
		result[i]=R[0]+R[1]+R[2]+R[3]+R[4];
	}
	int t=0,big=result[0];
	for(i=0;i<n;i++)
	{
		sum+=result[i];
		if(result[i]>big)
		{
			big=result[i];
			t=i;
		}
	}
	printf("%s\n%d\n%d\n",str[t],result[t],sum);
}
struct sch
{
	char name[21];
	int finalg;
	int  classg;
	char  leader;
	char west;
	int paper;
	int tot;
};

int TOTAL=0;

int money(struct sch *stu)
{   stu->tot=0;
	if(stu->finalg>80)
	{ if(stu->paper>=1)stu->tot+=yuanshi;
	  if(stu->finalg>85)
	  {
		  if(stu->classg>80) stu->tot+=wusi;
		  if(stu->west=='Y') stu->tot+=xibu;
		  if(stu->finalg>90) stu->tot+=chengyou;
	  }
	}
   if((stu->classg>80)&&(stu->leader=='Y'))
     stu->tot+=bangong;
   TOTAL+=stu->tot;
   return stu->tot;

}

void main()
{
	struct sch *head,*stu;
	int N,i;
	scanf("%d",&N);
	stu=(struct sch *)malloc(LEN);
	head=stu;
	scanf("%s %d %d %c %c %d",&stu->name,&stu->finalg,&stu->classg,&stu->leader,&stu->west,&stu->paper);
	stu->tot=money(stu);
	for(i=1;i<N;i++)
	{ stu=(struct sch *)malloc(LEN);
	  scanf("%s %d %d %c %c %d",&stu->name,&stu->finalg,&stu->classg,&stu->leader,&stu->west,&stu->paper);
	  stu->tot=money(stu);
	  if(stu->tot>head->tot)
		  head=stu;
	}
	printf("%s\n",head->name);
	printf("%d\n",head->tot);
	printf("%d\n",TOTAL);
}
struct 
{char name[20];
int final;
int cla;
char gan;
char west;
int thesis;
int money;
}stu[120];
void main()
{
	int n,i,j,sum=0;
	scanf("%d\n",&n);
	for(i=0;i<n-1;i++)
		scanf("%s %d %d %c %c %d\n",&stu[i].name,&stu[i].final,&stu[i].cla,&stu[i].gan,&stu[i].west,&stu[i].thesis);
	scanf("%s %d %d %c %c %d",&stu[n-1].name,&stu[n-1].final,&stu[n-1].cla,&stu[n-1].gan,&stu[n-1].west,&stu[n-1].thesis);
	for(i=0;i<n;i++)
		stu[i].money=0;
	for(i=0;i<n;i++)
	{
		if(stu[i].final>80&&stu[i].thesis>=1)
			stu[i].money=stu[i].money+8000;
		if(stu[i].final>85&&stu[i].cla>80)
			stu[i].money=stu[i].money+4000;
		if(stu[i].final>90)
			stu[i].money=stu[i].money+2000;
		if(stu[i].final>85&&stu[i].west=='Y')
			stu[i].money=stu[i].money+1000;
		if(stu[i].cla>80&&stu[i].gan=='Y')
			stu[i].money=stu[i].money+850;
	}
	for(i=0;i<n;i++)
	{for(j=0;j<n;j++)
	{
		if(stu[j].money<stu[j+1].money)
		{
			stu[119]=stu[j];
			stu[j]=stu[j+1];
			stu[j+1]=stu[119];
		}
	}
	}
	for(i=0;i<n;i++)
	{
		sum=sum+stu[i].money;
	}
	printf("%s\n",stu[0].name);
	printf("%d\n",stu[0].money);
	printf("%d\n",sum);
}
void main(){
    int m,i,k;
	 float sumz=0,max;
	struct student
	{char a[20];
	int b;
	int c;
	char d;
	char e;
	int f;
	float sum;
	};
	struct student num[100];
	scanf("%d",&m);
	for(i=0;i<m;i++){
		scanf("%s%d%d %c %c%d",num[i].a,&num[i].b,&num[i].c,
		&num[i].d,&num[i].e,&num[i].f);
		num[i].sum=0;
	}

	for(i=0;i<m;i++){
		if((num[i].b>80)&&(num[i].f>=1))num[i].sum=num[i].sum+8000;
		if((num[i].b>85)&&(num[i].c>80))num[i].sum=num[i].sum+4000;
		if((num[i].b>90))num[i].sum=num[i].sum+2000;
		if((num[i].b>85)&&(num[i].e=='Y'))num[i].sum=num[i].sum+1000;
		if((num[i].c>80)&&(num[i].d=='Y'))num[i].sum=num[i].sum+850;
	}
	
	max=num[m-1].sum;k=m-1;
	for(i=m-1;i>=0;i--)
		if(num[i].sum>=max){
			max=num[i].sum;
			k=i;
			}
	for(i=0;i<m;i++)sumz=sumz+num[i].sum;
	printf("%s\n%.0f\n%.0f\n",num[k].a,num[k].sum,sumz);


    
}
void main()
{
	struct student
	{
		char name[20];
		int final;
		int eval;
		char leader;
		char west;
		int paper;
	} s;
	char maxname[20];
	int n,i,j;
	int prize,max=0,sum=0;
	scanf("%d",&n);
	for(i=0;i<n;i=i+1)
	{
		prize=0;
		for(j=0;j<20;j=j+1)
			s.name[j]='\0';
		s.final=0;
		s.eval=0;
		s.leader='\0';
		s.west='\0';
		s.paper=0;
		scanf("%s",s.name);
		scanf("%d",&s.final);
		scanf("%d ",&s.eval);
		scanf("%c ",&s.leader);
		scanf("%c",&s.west);
		scanf("%d",&s.paper);
		if(s.final>80 && s.paper>0)
			prize=prize+8000;
		if(s.final>85 && s.eval>80)
			prize=prize+4000;
		if(s.final>90)
			prize=prize+2000;
		if(s.final>85 && s.west=='Y')
			prize=prize+1000;
		if(s.eval>80 && s.leader=='Y')
			prize=prize+850;
		sum=sum+prize;
		if(prize>max)
		{
			max=prize;
			for(j=0;j<20;j=j+1)
				maxname[j]='\0';
			strcpy(maxname,s.name);
		}
	}
	printf("%s\n",maxname);
	printf("%d\n",max);
	printf("%d\n",sum);
}
struct stu
{char name[20];
 int score1;
 int score2;
 char leader;
 char west;
 int paper;
}stu[100];
void main()
{
	int n,i,a[100]={0},max=0,sum=0;
	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].leader,&stu[i].west,&stu[i].paper);
    for(i=0;i<n;i++)
    {
    	if(stu[i].score1>80&&stu[i].paper>0) a[i]+=8000;
    	if(stu[i].score1>85&&stu[i].score2>80)  a[i]+=4000;
    	if(stu[i].score1>90) a[i]+=2000;
    	if(stu[i].score1>85&&stu[i].west=='Y')  a[i]+=1000;
    	if(stu[i].score2>80&&stu[i].leader=='Y')  a[i]+=850;
    }
    for(i=0;i<n;i++)
    {
      max=(max>=a[i])?max:a[i];
      sum+=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 stud
{
	char a[30];
	int sco1;
	int sco2;
	char mon;
	char west;
	int ess;
};
main()
{
	struct stud xx[100];
	int n,i,my[100],max,sum=0,re;
	scanf("%d",&n);
	getchar();
	for(i=0;i<n;i++)
	{
		scanf("%s%d %d %c %c %d",xx[i].a,&xx[i].sco1,&xx[i].sco2,&xx[i].mon,&xx[i].west,&xx[i].ess);
		getchar();
		my[i]=0;
        if(xx[i].sco1>80&&xx[i].ess>0)
			my[i]=my[i]+8000;
		if(xx[i].sco1>85&&xx[i].sco2>80)
			my[i]=my[i]+4000;
		if(xx[i].sco1>90)
			my[i]=my[i]+2000;
		if(xx[i].sco1>85&&xx[i].west=='Y')
			my[i]=my[i]+1000;
		if(xx[i].sco2>80&&xx[i].mon=='Y')
			my[i]=my[i]+850;
	}
	max=my[0];
	for(i=0;i<n;i++)
	{
		sum=sum+my[i];
		if(my[i]>max)
		{
			max=my[i];
			re=i;
		}
	}
	printf("%s\n%d\n%d",xx[re].a,max,sum);
}
void main()
{
	int i,n,a=0,b=0,c=0,d=0,e=0,max=0,k=0,sum=0;
	struct student
	{
		char name[20];
		int qm;
		int bj;
		char gb;
		char xb;
		int lw;
		int money;
	}stu[100]={0};
	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].gb,&stu[i].xb,&stu[i].lw);
	}
	
	for(i=0;i<n;i++)
	{
		if(stu[i].qm>80&&stu[i].lw>0)
			a=8000;
		if(stu[i].qm>85&&stu[i].bj>80)
			b=4000;
		if(stu[i].qm>90)
			c=2000;
		if(stu[i].qm>85&&stu[i].xb=='Y')
			d=1000;
		if(stu[i].bj>80&&stu[i].gb=='Y')
			e=850;
		stu[i].money=a+b+c+d+e;
		a=b=c=d=e=0;
	}
	max=stu[0].money;
	for(i=0;i<n;i++)
	{
		if(stu[i].money>max)
		{	max=stu[i].money;
		      k=i;
		}
	}
	for(i=0;i<n;i++)
	{
		sum=sum+stu[i].money;
	}
	printf("%s\n",stu[k].name);
	printf("%d\n",stu[k].money);
	printf("%d",sum);
}
struct Student{
	char name[50];
	int cj,py,lw,sum;
	char gb,xb;
	struct Student *next;
}*p1,*p2,*head,*p,*ans;
int main()
{
	int n,i=0,sum=0,j,k;
	scanf("%d",&n);
	
	head = NULL;	
	for (i=0;i<n;i++){
		p1 = (struct Student *)malloc(Len);
		if (i==0) head = p1;
		else p2->next = p1;
        p2 = p1;
	    scanf("%s%d%d %c %c%d",p1->name,&p1->cj,&p1->py,&p1->gb,&p1->xb,&p1->lw);
	    p1->sum = 0;
	}
	p1->next = NULL;
	
	p = head;
	do{
		if (p->cj>80&&p->lw>=1) p->sum+=8000;
		if (p->py>80&&p->gb=='Y') p->sum+=850;
		if (p->cj>85&&p->py>80) p->sum+=4000;
		if (p->cj>85&&p->xb=='Y') p->sum+=1000;
		if (p->cj>90) p->sum+=2000;
		p = p->next;
	}while (p);
	
	ans = (struct Student *)malloc(Len);
	ans->sum = 0;
	p = head;
	do{
		sum+=p->sum;
		if (p->sum>ans->sum) ans = p;
		p=p->next;
	}while(p);
	
	printf("%s\n%d\n%d",ans->name,ans->sum,sum);
	return 0;
}
//#include<stdafx.h>

struct stu
{
	char name[20];
	int final;
	int rate;
	char leader;
	char west;
	int paper;
	int money;
	struct stu *next;
};
struct stu *max;
struct stu *p1,*p2,*head;
int prize(struct stu *p)
{
	p->money=0;
	if(p->final>80&&p->paper>0)
		p->money+=8000;
	if(p->final>85&&p->rate>80)
		p->money+=4000;
	if(p->final>90)
		p->money+=2000;
	if(p->final>85&&p->west=='Y')
		p->money+=1000;
	if(p->rate>80&&p->leader=='Y')
		p->money+=850;
	return(p->money);
}
struct stu *create(int n)
{
	
	int i=0;

	p1=p2=(struct stu *)malloc(sizeof(struct stu));
	head=0;
	max=p2;
	while(i<n)
	{
		
		if(i==0)
			head=p1;
		else p2->next=p1;
		p2=p1;
		scanf("%s %d %d %c %c %d",p2->name,&p2->final,&p2->rate,
			&p2->leader,&p2->west,&p2->paper);
		p2->money=prize(p2);
		if(p2->money>max->money)
			max=p2;
		p1=(struct stu *)malloc(sizeof(struct stu));
		i++;
	}
	p2->next=0;
	return(head);
}

int sum(struct stu *head)
{
	struct stu *p;
	int sum;
	p=head;
	sum=p->money;
	while(p->next!=0)
	{
		p=p->next;
		sum+=p->money;
	}
	return(sum);
}
void main()
{
	int n;

	scanf("%d",&n);
	p1=create(n);
	printf("%s\n%d\n",max->name,max->money);
	printf("%d",sum(p1));


}
int main()
{   int n,i,k,many[120],wen,qimo,banji,all,who,max,q;
    char name[120][50],gan,xi;
    scanf("%d",&n);
	max=0;q=0;
    for(i=1;i<=n;i++){
		scanf("%s",&name[i]);
        scanf("%d %d %c %c %d",&qimo,&banji,&gan,&xi,&wen);
		all=0;
        if((qimo>80)&&(wen>=1))  all=all+8000;
        if((qimo>85)&&(banji>80))  all=all+4000;
        if(qimo>90)  all=all+2000;
        if((qimo>85)&&(xi=='Y'))  all=all+1000;
        if((banji>80)&&(gan=='Y'))  all=all+850;
		q=q+all;
		if(all>max){
			max=all;
			who=i;
		}
	}
    printf("%s\n",name[who]);
    printf("%d\n",max);
    printf("%d\n",q);
    return 0;
}
int main()
{
	char name[20],name1[20],gb,xb;
	int n,aver,py,lw,max=0,i,j;
	long int total=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		int sum=0;
		scanf("%s %d %d %c %c %d",name,&aver,&py,&gb,&xb,&lw);
        if(aver>80&&lw>=1) sum+=8000;
		if(aver>85&&py>80) sum+=4000;
		if(aver>90) sum+=2000;
		if(aver>85&&xb=='Y') sum+=1000;
		if(py>80&&gb=='Y') sum+=850;	total+=sum;
		if(sum>max) 
		{
			max=sum;
			for(j=0;j<20;j++)
			{
				name1[j]=name[j];
			}}
	
	}
	printf("%s\n%d\n%d\n",name1,max,total);
	return 0;
}
struct Student
{
	char name[20];
	int marks1;
	int marks2;
	char a;
	char b;
	int paper;
	int total;
}person[100],best={"\0",0,0,'\0','\0',0};
int main()
{
	int n,i,total=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s%d%d %c %c%d",person[i].name,&person[i].marks1,&person[i].marks2,&person[i].a,&person[i].b,&person[i].paper);
		person[i].total=0;
		if(person[i].marks1>80&&person[i].paper>0){person[i].total=person[i].total+8000;}
		if(person[i].marks1>85&&person[i].marks2>80){person[i].total=person[i].total+4000;}
		if(person[i].marks1>90){person[i].total=person[i].total+2000;}
		if(person[i].marks1>85&&person[i].b=='Y'){person[i].total=person[i].total+1000;}
		if(person[i].marks2>80&&person[i].a=='Y'){person[i].total=person[i].total+850;}
		if(person[i].total>best.total){best=person[i];}
		total=total+person[i].total;
	}
	printf("%s\n%d\n%d",best.name,best.total,total);
}
void main()
{
	int N,i,x[100],j,sum=0,t[100]={0},a[100],b[100],c[100],y;
	char name[100][20]={'\0'},f[100],e[100];
    scanf("%d",&N);
	for(i=0;i<N;i++)
	{
		scanf("%s",name[i]);
		scanf("%d ",&a[i]);
		scanf("%d ",&b[i]);
		scanf("%c",&f[i]);
		scanf(" %c",&e[i]);
		scanf(" %d",&c[i]);
	}
    for(i=0;i<N;i++)
	{
		if(a[i]>80&&c[i]>=1)
			t[i]=t[i]+8000;
		if(a[i]>85&&b[i]>80)
			t[i]=t[i]+4000;
		if(a[i]>90)
			t[i]=t[i]+2000;
		if(a[i]>85&&e[i]=='Y')
			t[i]=t[i]+1000;
		if(b[i]>80&&f[i]=='Y')
			t[i]=t[i]+850;
	}
    for(i=0;i<N;i++)
	{
		sum=sum+t[i];
		x[i]=t[i];
	}
	for(i=0;i<N-1;i++)
		for(j=0;j<N-1-i;j++)
			if(t[j]<t[j+1])
			{
				y=t[j+1];
				t[j+1]=t[j];
				t[j]=y;
			}
	for(i=0;i<N;i++)
		if(x[i]==t[0])
		{
			printf("%s\n%d\n%d\n",name[i],t[0],sum);
			break;
		}


	
}
void main()
{
	struct stu
	{char name[21];
	int ta;
	int ca;
	char l;
	char w;
	int p;
    char name0[21];
	}stu[101],temp;
    int sch[101],a;
	int n,i,j;
	scanf("%d",&n);
    for(i=0;i<n;i++)
		scanf("%s %d %d %c %c %d",&stu[i].name,&stu[i].ta,&stu[i].ca,&stu[i].l,&stu[i].w,&stu[i].p);
	for(i=0;i<n;i++)
		sch[i]=0;
	for(i=0;i<n;i++)
	{
		if(stu[i].ta>80&&stu[i].p>=1)
			sch[i]=sch[i]+8000;
		if(stu[i].ta>85&&stu[i].ca>80)
		  	sch[i]=sch[i]+4000;
		if(stu[i].ta>90)
			sch[i]=sch[i]+2000;
		if(stu[i].ta>85&&stu[i].w=='Y')
			sch[i]=sch[i]+1000;
		if(stu[i].ca>80&&stu[i].l=='Y')
			sch[i]=sch[i]+850;
	}
	for(i=1;i<n;i++)
	{
		if(sch[0]<sch[i])
		{
			a=sch[i];
		    sch[i]=sch[0];
			sch[0]=a;
			temp=stu[i];
			stu[i]=stu[0];
			stu[0]=temp;
		}
	}
	for(i=0,j=0;i<n;i++)
		j=j+sch[i];

	printf("%s\n",stu[0].name);
	printf("%d\n",sch[0]);
	printf("%d\n",j);
}
void main()
{
	int n,all=0,i,j;
	struct student
	{
		char name[20];
		int score1;
		int score2;
		char ganbu;
		char west;
		int article;
		int money;
	}stu[100],temp;
	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].ganbu,&stu[i].west,
			&stu[i].article);
	}//?????????
	//???????????????????
	for(i=0;i<n;i++)
	{
		stu[i].money=0;
		if(stu[i].score1>80&&stu[i].article>=1)
			stu[i].money+=8000;
		if(stu[i].score1>85&&stu[i].score2>80)
			stu[i].money+=4000;
		if(stu[i].score1>90)
			stu[i].money+=2000;
		if(stu[i].score1>85&&stu[i].west=='Y')
			stu[i].money+=1000;
		if(stu[i].score2>80&&stu[i].ganbu=='Y')
			stu[i].money+=850;
	}
	for(i=0;i<n;i++)
	{
		for(j=0;j<n-i-1;j++)
		{
			if(stu[j].money<stu[j+1].money)
			{
				temp=stu[j];
				stu[j]=stu[j+1];
				stu[j+1]=temp;
			}
		}
	}
	printf("%s\n",stu[0].name);
	printf("%d\n",stu[0].money);
	for(i=0;i<n;i++)
		all+=stu[i].money;
	printf("%d\n",all);
}