semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int main()
{
    int n,i,max=0,sum=0,t;
    scanf("%d",&n);
    struct student
    {
       char name[20];
       int ascore;
       int bscore;
       char good;
       char west;
       int work;
       int money;
     }stu[100];
	 for(i=0;i<n;i++)
		 stu[i].money=0;
     for(i=0;i<n;i++)
     {
         scanf("%s %d %d %c %c %d",stu[i].name,&stu[i].ascore,&stu[i].bscore,&stu[i].good,&stu[i].west,&stu[i].work);
      }
      i=0;
      for(i=0;i<n;i++)
      {
          if(stu[i].ascore>80&&stu[i].work>=1)
          stu[i].money=stu[i].money+8000;
          if(stu[i].ascore>85&&stu[i].bscore>80)
          stu[i].money=stu[i].money+4000;
          if(stu[i].ascore>90)
          stu[i].money=stu[i].money+2000;
          if(stu[i].ascore>85&&stu[i].west=='Y')
          stu[i].money=stu[i].money+1000;
          if(stu[i].bscore>80&&stu[i].good=='Y')
          stu[i].money=stu[i].money+850;
      }
      for(i=0;i<n;i++)
      sum=sum+stu[i].money;
      i=0;
      for(i=0;i<n-1;i++)
      {
         if(stu[i].money>max)
          {
              max=stu[i].money;
              t=i;
           }
       }
       printf("%s\n%d\n%d\n",stu[t].name,stu[t].money,sum);
}
int n;
struct stu{char name[21];int g1;int g2;char y1;char y2;int g3;int g;struct stu *next;};
struct stu *cr(void)
{struct stu *head;
 struct stu *p1,*p2;
 int i;
 p1=p2=(struct stu*)malloc(LEN);
 for(i=0;i<n;i++)
 {if(i==0) head=p1;
  else p2->next=p1;
  p2=p1;
  scanf("%s %d %d %c %c %d",&p1->name,&p1->g1,&p1->g2,&p1->y1,&p1->y2,&p1->g3);
  p1->g=(p1->g1/81)*((p1->g3+10)/11)*8000+(p1->g1/86)*(p1->g2/81)*4000+(p1->g1/91)*2000+(p1->g1/86)*(p1->y2/81)*1000+(p1->g2/81)*(p1->y1/81)*850;
  p1=(struct stu*)malloc(LEN);
}
  p2->next=NULL;
  return (head);
}

int main()
{int i,max=0,sum=0;
 struct stu *p,*q;
scanf("%d",&n);
 p=q=cr();
for(i=0;i<n;i++)
{if((p->g)>max) max=p->g;
 sum=sum+p->g;
 p=p->next;}
for(i=0;i<n;i++)
{if((q->g)==max) {printf("%s\n%d\n%d\n",q->name,q->g,sum); break;}
 q=q->next;}
}
struct student
{ 
  char name[20];
  int qimo;
  int banji;
  char ganbu;
  char xibu;
  int paper;
}stu[100];
void main()
{
	int n,i,s[100]={0},sum=0,k,max;
	struct student *p;
	scanf("%d",&n);
    for(p=stu,i=0;p<stu+n;p++,i++)
	{
		scanf("%s %d %d %c %c %d",p->name,&p->qimo,&p->banji,&p->ganbu,&p->xibu,&p->paper);
        if(p->qimo>80&&p->paper>=1)
			s[i]+=8000;
		if(p->qimo>85&&p->banji>80)
			s[i]+=4000;
		if(p->qimo>90)
			s[i]+=2000;
		if(p->qimo>85&&p->xibu=='Y')
			s[i]+=1000;
		if(p->banji>80&&p->ganbu=='Y')
			s[i]+=850;
	}
	max=s[0];
	for(i=0;i<n;i++)
	{
		sum+=s[i];
		if(s[i]>max)
		{
			max=s[i];
			k=i;
		}
	}
	printf("%s\n%d\n%d\n",stu[k].name,s[k],sum);
}
struct asd
{
	char str[21];
	int a;
	int b;
	int c;
	int sum;
	char x;
	char y;
}stu[100];

void main()
{
	int i,n,max,m,t;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s %d %d %c %c %d", stu[i].str, &stu[i].a, &stu[i].b, &stu[i].x, &stu[i].y, &stu[i].c);
		stu[i].sum=0;
	}

	for(i=0;i<n;i++)
	{
		if(stu[i].a>80 && stu[i].c>0)
			stu[i].sum+=8000;
		if(stu[i].a>85 && stu[i].b>80)
			stu[i].sum+=4000;
		if(stu[i].a>90)
			stu[i].sum+=2000;
		if(stu[i].a>85 && stu[i].y=='Y')
			stu[i].sum+=1000;
		if(stu[i].b>80 && stu[i].x=='Y')
			stu[i].sum+=850;
	}
	
	m=0;
	for(i=0;i<n;i++)
	{
		m+=stu[i].sum;
	}

	max=0;t=0;
	for(i=0;i<n;i++)
	{
		if(stu[i].sum>max)
		{max=stu[i].sum;t=i;}
	}

	printf("%s\n%d\n%d\n", stu[t].str, max, m);
}
int main()
{
  int n,e,f,h,j,k,max=0,l=0,s=0,i;
  scanf("%d",&n);
  struct xinxi{
      char name[50];
      int qc;// ???? //
      int bc;//  ???? //
      char g;//  ??????  //
      char w;//   ???????  //
      int ls;//????//
  }a[100];
  int score[100]={0};
  for(i=0;i<n;i++){
     scanf("%s %d %d %c %c %d",&a[i].name,&a[i].qc,&a[i].bc,&a[i].g,&a[i].w,&a[i].ls);
      e=f=h=j=k=0;
     if(a[i].qc>80 && a[i].ls>=1)
          e=8000;
    if(a[i].qc>85 && a[i].bc>80)
          f=4000;
    if(a[i].qc>90)
          h=2000;
    if(a[i].qc>85 && a[i].w=='Y')
          j=1000;
    if(a[i].bc>80 && a[i].g=='Y')
          k=850;
    score[i]=e+f+h+j+k;
    s=s+score[i];
    if (max<score[i])
       max=score[i];
  }
  for(i=0;i<n;i++){
    if(max==score[i]){
     printf("%s\n",a[i].name);
     printf("%d\n",max);
     printf("%d\n",s);
     l++;
    }
    if(l>0)
      break;
  }
 return 0;
}
int main()
{
	struct student
	{
		char name[20];
		int mark1;
		int mark2;
		int number;
		char a[2];
                  char b[2];
	};
	int i,m,n[100],p=0,q=0,w=0;
	scanf("%d",&m);
	struct student stu[100];
	for(i=0;i<m;i++)
	{
		scanf("%s ",stu[i].name);
		scanf("%d ",&stu[i].mark1);
		scanf("%d ",&stu[i].mark2);
		scanf("%s ",&stu[i].a);
		scanf("%s ",&stu[i].b);
		scanf("%d",&stu[i].number);
	}
	for(i=0;i<m;i++)
	{	n[i]=0;
		if(stu[i].mark1>80&&stu[i].number>=1)
			n[i]+=8000;
		if(stu[i].mark1>85&&stu[i].mark2>80)
			n[i]+=4000;
		if(stu[i].mark1>90)
			n[i]+=2000;
		if(stu[i].mark1>85&&stu[i].b[0]=='Y')
			n[i]+=1000;
		if(stu[i].mark2>80&&stu[i].a[0]=='Y')
			n[i]+=850;
	}
	for(i=0;i<m;i++)
	{
		if(n[i]>p)
		{
			p=n[i];
			w=i;
		}
		q=q+n[i];
	}
	printf("%s\n",stu[w].name);
	printf("%d\n",n[w]);
         printf("%d\n",q);
	return 0;
}
struct stu{
	char name[20];
	int final;
	int cla;
	char ban[2];
	char xi[2];
	int pap;
	int sum;
}a[100];

int main()
{
	int n,i;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s",a[i].name);
		scanf("%d%d",&a[i].final,&a[i].cla);
		scanf("%s",a[i].ban);
		scanf("%s",a[i].xi);
		scanf("%d",&a[i].pap);
	}
    for(i=0;i<n;i++){
		a[i].sum=0;
		if(a[i].final>80&&a[i].pap>=1)
			a[i].sum=a[i].sum+8000;
		if(a[i].final>85&&a[i].cla>80)
			a[i].sum=a[i].sum+4000;
		if(a[i].final>90)
			a[i].sum=a[i].sum+2000;
		if(a[i].final>85&&a[i].xi[0]=='Y')
			a[i].sum=a[i].sum+1000;
		if(a[i].cla>80&&a[i].ban[0]=='Y')
			a[i].sum=a[i].sum+850;
	}
	int max=a[0].sum;
	int t=0,zong=0;
	for(i=0;i<n;i++){
		if(max<a[i].sum){
			max=a[i].sum;
			t=i;
		}
        zong=zong+a[i].sum;
	}
	printf("%s\n%d\n%d\n",a[t].name,a[t].sum,zong);
	return 0;
}
/*????????*/

void main()
{
	int n,k,x[100][4],y,z;
	char a[100][20],b[100],c[100];
	scanf("%d",&n);
	for(k=0,y=0,z=0;k<n;k++)
	{
		scanf("%s %d %d %c %c %d",a[k],&x[k][0],&x[k][1],&b[k],&c[k],&x[k][2]);
		x[k][3]=0;
		if(x[k][0]>80&&x[k][2]>0)
		{
			x[k][3]=x[k][3]+8000;
		}
		if(x[k][0]>85&&x[k][1]>80)
		{
			x[k][3]=x[k][3]+4000;
		}
		if(x[k][0]>90)
		{
			x[k][3]=x[k][3]+2000;
		}
		if(x[k][0]>85&&c[k]=='Y')
		{
			x[k][3]=x[k][3]+1000;
		}
		if(x[k][1]>80&&b[k]=='Y')
		{
			x[k][3]=x[k][3]+850;
		}
		z=z+x[k][3];
		if(x[k][3]>x[y][3])y=k;
	}
	printf("%s\n%d\n%d\n",a[y],x[y][3],z);
}
struct s
{char name[20];
int q;
int b;
char x;
char w;
int l;
};
void main()
{
	struct s stu[100];
	int n,i,p,m[100],j;
	double t=0.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].b,&stu[i].x,&stu[i].w,&stu[i].l);
		m[i]=0;
		if(stu[i].q>80&&stu[i].l!=0)m[i]=m[i]+8000;
		if(stu[i].q>85&&stu[i].b>80)m[i]=m[i]+4000;
		if(stu[i].q>90)m[i]=m[i]+2000;
		if(stu[i].q>85&&stu[i].w=='Y')m[i]=m[i]+1000;
		if(stu[i].b>80&&stu[i].x=='Y')m[i]=m[i]+850;
	}
	p=m[0];
	for(i=0;i<n;i++)
	{
		if(p<m[i])
		{
			p=m[i];
			j=i;
		}
		t=m[i]+t;	
	}
	printf("%s\n",stu[j].name);
	printf("%d\n%.0f\n",p,t);
}
struct student
{
	char name[30];
	int qimocj;
	int banjicj;
	char ganbu;
	char xibu;
	int lunwen;
	int jiangjin;
};
int main()
{
	int n,i,sum=0;
	struct student ren[102]={0},max={0};
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s%d%d %c %c%d",ren[i].name,&ren[i].qimocj,&ren[i].banjicj,&ren[i].ganbu,&ren[i].xibu,&ren[i].lunwen);
	}
	for(i=0;i<n;i++)
	{
		if(ren[i].qimocj>80 && ren[i].lunwen>=1)
		{
			ren[i].jiangjin+=8000;
		}
		if(ren[i].qimocj>85 && ren[i].banjicj>80)
		{
			ren[i].jiangjin+=4000;
		}
		if(ren[i].qimocj>90)
		{
			ren[i].jiangjin+=2000;
		}
		if(ren[i].qimocj>85 && ren[i].xibu=='Y')
		{
			ren[i].jiangjin+=1000;
		}
		if(ren[i].banjicj>80 && ren[i].ganbu=='Y')
		{
			ren[i].jiangjin+=850;
		}
	}
	max.jiangjin=0;
	for(i=0;i<n;i++)
	{
		sum+=ren[i].jiangjin;
		if(ren[i].jiangjin>max.jiangjin)
		{
			max=ren[i];
		}
	}
	printf("%s\n%d\n%d\n",max.name,max.jiangjin,sum);
	return 0;
}
int main()
{
	int n,i,sum=0,k=0,t;
	struct point{char name[21],ganbu,xibu;int x,y,z,money;}stu[100];
	
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
        scanf("%s %d %d %c %c %d",stu[i].name,&stu[i].x,&stu[i].y,&stu[i].ganbu,&stu[i].xibu,&stu[i].z);
		stu[i].money=0;
		if(stu[i].x>80&&stu[i].z>0)
		{
            stu[i].money+=8000;
			sum+=8000;
		}
		if(stu[i].x>85&&stu[i].y>80)
		{
            stu[i].money+=4000;
			sum+=4000;
		}
		if(stu[i].x>90)
		{
            stu[i].money+=2000;
			sum+=2000;
		}
		if(stu[i].x>85&&stu[i].xibu=='Y')
		{
            stu[i].money+=1000;
			sum+=1000;
		}
		if(stu[i].y>80&&stu[i].ganbu=='Y')
		{
            stu[i].money+=850;
			sum+=850;
		}
	}
	for(i=0;i<n;i++)
	{
		if(stu[i].money>k)
		{
			k=stu[i].money;
			t=i;
		}
	}
	printf("%s\n",stu[t].name);
	printf("%d\n",stu[t].money);
	printf("%d",sum);
	return 0;
}
struct student
{
	char name[20];
	int qimo;
	int banpin;
	char ganbu;
	char xibu;
	int lunwen;
	double sum;
}stu[100];
int main()
{
	int n,i;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s %d %d %c %c %d",&stu[i].name,&stu[i].qimo,&stu[i].banpin,&stu[i].ganbu,&stu[i].xibu,&stu[i].lunwen);
		stu[i].sum=0;
        if(stu[i].qimo>80&&stu[i].lunwen>0)stu[i].sum=stu[i].sum+8000;
		if(stu[i].qimo>85&&stu[i].banpin>80)stu[i].sum=stu[i].sum+4000;
		if(stu[i].qimo>90)stu[i].sum=stu[i].sum+2000;
		if(stu[i].xibu=='Y'&&stu[i].qimo>85)stu[i].sum=stu[i].sum+1000;
        if(stu[i].ganbu=='Y'&&stu[i].banpin>80)stu[i].sum=stu[i].sum+850;
	}
	int max=0,totalsum=0;
	for(i=0;i<n;i++)
	{if(stu[i].sum>max)max=stu[i].sum;}
	for(i=0;i<n;i++)
	{if(stu[i].sum==max){printf("%s\n",stu[i].name);break;}}
	for(i=0;i<n;i++)
	{
	totalsum=totalsum+stu[i].sum;
	}
	printf("%d\n%d",max,totalsum);
}
int main()
{
	int i,n,sum=0;
	scanf("%d",&n);
	typedef struct{
		char name[20];
		char ganbu;
		char xibu;
		int qimo;
		int qizhong;
		int lunwen;
		int money;
	}jiangxuejin;
	jiangxuejin a[100];
	jiangxuejin *p,*max;
	max=a;
	for(p=a;p<a+n;p++)
	{
		p->money=0;
		scanf("%s %d %d %c %c %d",&p->name,&p->qimo,&p->qizhong,&p->ganbu,&p->xibu,&p->lunwen);
		if((p->qimo>80)&&(p->lunwen>=1))
		(p->money)+=8000;
		if((p->qimo>85)&&(p->qizhong>80))
		(p->money)+=4000;
		if(p->qimo>90)
		(p->money)+=2000;
		if((p->qimo>85)&&(p->xibu=='Y'))
		(p->money)+=1000;
		if((p->qizhong>80)&&(p->ganbu=='Y'))
		(p->money)+=850;
		if(p->money>max->money)
		max=p;
		sum+=p->money;
	}
	printf("%s\n%d\n%d",max->name,max->money,sum);
}
struct stu
{
	char name[20];
	int mark1;
	int mark2;
	char position;
	char hometown;
	int paper;
	int fund;
	struct stu *next;
};

struct stu *creat(int n)
{
	int i=1;
	struct stu *head;
	struct stu *p1,*p2;
	p1=(struct stu *)malloc(sizeof(struct stu));
	scanf(A,p1->name,&p1->mark1,&p1->mark2,&p1->position,&p1->hometown,&p1->paper);
	p1->fund=0;
	if(n==1)
	{
		head=p1;
		p1->next=NULL;
		free(p1);
		return head;
	}
	else
	{
		head=p1;
		p2=p1;
		do
		{
			p1=(struct stu *)malloc(sizeof(struct stu));
			scanf(A,p1->name,&p1->mark1,&p1->mark2,&p1->position,&p1->hometown,&p1->paper);
			p1->fund=0;
			i++;
			if(i==n)
			{
				p1->next=NULL;
				p2->next=p1;
				break;
			}
			else
			{
				p2->next=p1;
				p2=p1;
			}
		}while(1);
		return head;
	}
}

int main(void)
{
	int n,i,j=0,max=0;
	struct stu *head;
	struct stu *p;
	scanf("%d",&n);
	head=creat(n);
	p=head;
	while(p)
	{
		if(p->mark1>80&&p->paper>0)
			p->fund+=8000;
		if(p->mark1>85&&p->mark2>80)
			p->fund+=4000;
		if(p->mark1>90)
			p->fund+=2000;
		if(p->mark1>85&&p->hometown=='Y')
			p->fund+=1000;
		if(p->mark2>80&&p->position=='Y')
			p->fund+=850;
		p=p->next;
	}
	p=head;
	while(p)
	{
		/*printf("%d %d\n",p->fund,i);*/
		j+=p->fund;
		if(p->fund>max)
			max=p->fund;
		p=p->next;
	}
	p=head;
	while(p)
		if(max==p->fund)
		{
			printf("%s\n%d\n%d\n",p->name,p->fund,j);
			break;
		}
		else p=p->next;
}
int main()
{
	struct data
	{
		char name[22];
		int score1;
		int score2;
		char mas;
		char dis;
		int paper;
		int sum;
	}p[100];
	int n;
	scanf("%d",&n);
	int i = 0 ;
	for ( i = 0 ; i < n ; i++ )
	{
		scanf("%s",p[i].name);
		scanf("%d",&(p[i].score1));
		scanf("%d",&(p[i].score2));
		getchar();
		scanf("%c",&(p[i].mas));
		getchar();
		scanf("%c",&(p[i].dis));
		scanf("%d",&(p[i].paper));
	}
	for ( i = 0 ; i < n ; i++ )
	{
		p[i].sum = 0;
	}
	int k = 0;
	int max = 0;
	int total = 0;
	for ( i = 0 ; i < n ; i++ )
	{
		if ( p[i].score1 > 80 && p[i].paper >= 1 )
		{
			p[i].sum += 8000;
		}
		if ( p[i].score1 > 85 && p[i].score2 > 80)
		{
			p[i].sum += 4000;
		}
		if ( p[i].score1 > 90 )
		{
			p[i].sum += 2000;
		}
		if ( p[i].score1 > 85 && p[i].dis == 'Y' )
		{
			p[i].sum += 1000;
		}
		if ( p[i].score2 > 80 && p[i].mas == 'Y' )
		{
			p[i].sum += 850;
		}
		total += p[i].sum;
		if ( p[i].sum > max )
		{
			max = p[i].sum;
			k = i;
		}
	}
	printf("%s\n",p[k].name);
	printf("%d\n",max);
	printf("%d\n",total);
	return 0;
}
int main()
{
	int i,n,j,r,t,m,q=0;
	int a[101];
	struct student {
		char name[20];
		int zong;
		int ban;
		char gan;
		char xi;
		int lun;
		int z;
	}stu[101];
	scanf("%d",&n);
	for(i=1;i<=n;i++)
		{
		    scanf("%s %d %d %c %c %d",stu[i].name,&stu[i].zong,&stu[i].ban,&stu[i].gan,&stu[i].xi,&stu[i].lun);
		}
	for(i=1;i<=n;i++)
		{   stu[i].z=0;   
			if(stu[i].zong>80&&stu[i].lun>0)
				stu[i].z=stu[i].z+8000;
			if(stu[i].zong>85&&stu[i].ban>80)
				stu[i].z=stu[i].z+4000;
			if(stu[i].zong>90)
				stu[i].z=stu[i].z+2000;
			if(stu[i].zong>85&&stu[i].xi=='Y')
				stu[i].z=stu[i].z+1000;
			if(stu[i].ban>80&&stu[i].gan=='Y')
				stu[i].z=stu[i].z+850;
			a[i]=stu[i].z;
			q=q+stu[i].z;
		}
	for(j=n;j>0;j--)
	{	for(r=0;r<j;r++)
			if(stu[r].z>stu[r+1].z)
			{t=stu[r+1].z;
			stu[r+1].z=stu[r].z;
			stu[r].z=t;
			}
	}
	for(i=1;i<=n;i++)
		if(a[i]==stu[n].z)
		{	m=i;
			break;
		}

printf("%s\n%d\n%d\n",stu[m].name,stu[n].z,q);
return 0;
}
int main()
{
	int n;
	scanf("%d",&n);
	struct student
	{
		char name[20];
		int scores1,scores2,paper;
		char a,b;
	}s[100];
    int p[100];
	int i;
	for(i=0;i<n;i++)
	{
		scanf("%s %d %d %c %c %d",&s[i].name,&s[i].scores1,&s[i].scores2,&s[i].a,&s[i].b,&s[i].paper);
	}
	int sum;
	for(i=0;i<n;i++)
	{
		sum=0;
		if(s[i].scores1>80&&s[i].paper>=1)
		{
			sum+=8000;
		}
		if(s[i].scores1>85&&s[i].scores2>80)
		{
			sum+=4000;
		}
		if(s[i].scores1>90)
		{
			sum+=2000;
		}
		if(s[i].scores1>85&&s[i].b=='Y')
		{
			sum+=1000;
		}
		if(s[i].scores2>80&&s[i].a=='Y')
		{
			sum+=850;
		}
		
		p[i]=sum;
	}
	int max=0,c=0;
	for(i=0;i<n;i++)
	{
		if(p[i]>=max)
		{
			max=p[i];
		}
		c+=p[i];
	}
	for(i=0;i<n;i++)
	{
		if(p[i]==max)
		{
			printf("%s\n%d\n%d\n",s[i].name,p[i],c);
			break;
		}
	}
	return 0;
}
struct student
{
	char name[20];
	int test;
	int term;
	char key;
	char west;
	int art;
	int money;
}person[100];
int main()
{
	int n,i,j,q=0,k;
	struct student temp;
	scanf("%d",&n);
	for(i=0;i<=n-1;i++)
	{
		scanf("%s %d %d %c %c %d",person[i].name,&person[i].test,&person[i].term,&person[i].key,&person[i].west,&person[i].art);
	    person[i].money=0;
		if(person[i].art>0&&person[i].test>80) {person[i].money=person[i].money+8000;}
		if(person[i].test>85&&person[i].term>80) {person[i].money=person[i].money+4000;}
		if(person[i].test>90) {person[i].money=person[i].money+2000;}
		if(person[i].test>85&&person[i].west=='Y') {person[i].money=person[i].money+1000;}
		if(person[i].term>80&&person[i].key=='Y') {person[i].money=person[i].money+850;}
		q=q+person[i].money;
	}
	for(i=0;i<=n-2;i++)
	{
	    k=i;
		for(j=i+1;j<=n-1;j++)
			if(person[j].money>person[k].money)
				k=j;
		temp=person[k]; person[k]=person[i];person[i]=temp;
	}
	printf("%s\n",person[0].name);
	printf("%d\n",person[0].money);
	printf("%d",q);
	return 0;
}
int main()
{struct student
{char name[20],o,w;
int score,cla,paper;
}n[100];
int t=0,N,i,j,m[100],e[100],k;
scanf("%d",&N);
for(i=0;i<N;i++)
{
scanf("%s %d %d %c %c %d",n[i].name,&n[i].score,&n[i].cla,&n[i].o,&n[i].w,&n[i].paper);}
for(i=0;i<N;i++)
{m[i]=0;
if(n[i].cla>80&&n[i].o=='Y') m[i]+=850;
if(n[i].score>85&&n[i].w=='Y') m[i]+=1000;
if(n[i].score>90) m[i]+=2000;
if(n[i].score>85&&n[i].cla>80) m[i]+=4000;
if(n[i].score>80&&n[i].paper) m[i]+=8000;}
for(i=0;i<N;i++)
e[i]=i;
for(i=0;i<N;i++)
for(j=i;j<N;j++)
{if(m[e[i]]<m[e[j]]) {k=e[i];e[i]=e[j];e[j]=k;}}
printf("%s\n%d\n",n[e[0]].name,m[e[0]]);
for(i=0;i<N;i++)
 t+=m[i];
printf("%d",t);
return 0;}
struct student
{
	char name[22];
	int qimo;
	int banji;
	char gan;
	char sheng;
	int num;
};
void main()
{
	int n,i,j=0,sum,tol=0,max=0;
	struct student t,*s;
	scanf("%d",&n);
	s=(struct student *)malloc(n*sizeof(struct student));
	for(i=0;i<n;i++)
	{ sum=0;
		scanf("%s %d %d %c %c %d",(*(s+i)).name,&(*(s+i)).qimo,&(*(s+i)).banji,&(*(s+i)).gan,&(*(s+i)).sheng,&(*(s+i)).num);
      if (((*(s+i)).qimo>80)&&((*(s+i)).num>=1))  sum=sum+8000;
	  if (((*(s+i)).qimo>85)&&((*(s+i)).banji>80))  sum=sum+4000;
	  if ((*(s+i)).qimo>90)  sum=sum+2000;
	  if (((*(s+i)).qimo>85)&&((*(s+i)).sheng=='Y'))  sum=sum+1000;
	  if (((*(s+i)).banji>80)&&((*(s+i)).gan=='Y'))  sum=sum+850;
	  if(sum>max)   {max=sum;j=i;}
	  tol=tol+sum;
	}
	printf("%s\n%d\n%d\n",(*(s+j)).name,max,tol);
}
int main(int argc, char* argv[])
{
	
    char name[100][100];
	char s[2], w[2];
    int a, b, c;
	int n, sum[100], sum1=0, i, f=-1, g=0, j;
	scanf("%d", &n);
	
	for(i=0;i<n;i++)
	{
	  scanf("%s%d%d%s%s%d", name[i], &a, &b, s, w, &c);
	  

         sum[i] = 0;
		if(a>80 && c!=0)
		{
			sum[i] += 8000;
			sum1 += 8000;
		}
		if(a>85 && b>80)
		{
			sum[i] += 4000;
			sum1 += 4000;
		}
		if(a>90)
		{
			sum[i] += 2000;
			sum1 += 2000;
		}
		if(a>85 && w[0]=='Y')
		{
			sum[i] += 1000;
			sum1 += 1000;
		}
		if(b>80 && s[0]=='Y')
		{
			sum[i] += 850;
			sum1 += 850;
		}
		
	}
	for(j=0;j<n;j++)
	{
		if(sum[j]>f)
		{
			f=sum[j];
			g=j;
		}
		
	}
	printf("%s\n", name[g]);
	printf("%d\n", f); 
    printf("%d\n", sum1);
    return 0;
}
struct point
	{
		char a[20];
		int x;
		int y;
		char xue;
		char xi;
		int z;
		int sum;
	};


int main(int argc, char* argv[])
{
	int n,i,max=0,m=0,gong=0;
	scanf("%d",&n);

	struct point *s;
	s=(struct point*)malloc(sizeof(struct point)*n);
	
	for(i=0;i<n;i++)
	{ 
		s[i].sum=0;
		scanf("%s %d %d %c %c %d",s[i].a,&s[i].x,&s[i].y,&s[i].xue,&s[i].xi,&s[i].z);
	}	

	for(i=0;i<n;i++)
	{
		if(s[i].x>80&&s[i].z>=1) s[i].sum=s[i].sum+8000;
		if(s[i].x>85&&s[i].y>80) s[i].sum=s[i].sum+4000;
		if(s[i].x>90) s[i].sum=s[i].sum+2000;
		if(s[i].x>85&&s[i].xi=='Y') s[i].sum=s[i].sum+1000;
		if(s[i].y>80&&s[i].xue=='Y') s[i].sum=s[i].sum+850;
	}

 
	for(i=0;i<n;i++)
	{
		if(s[i].sum>max)
		{max=s[i].sum;m=i;}
	}

	printf("%s\n",s[m].a);
	printf("%d\n",max);


	
	for(i=0;i<n;i++)
	{
		gong=gong+s[i].sum;
	
	}
	printf("%d\n",gong);

	free (s);
	return 0;
}
struct stu
{
	char str[30];
	int a,b;
	char s1,s2;
	int c;
	int e;
}sm[1000];
void main()
{
	int t,i,max,sum;
	scanf("%d",&t);
	for(i=0;i<t;i++)
	{
		scanf("%s%d%d %c %c%d",sm[i].str,&sm[i].a,&sm[i].b,&sm[i].s1,&sm[i].s2,&sm[i].c);
		sm[i].e=0;
	}
	for(i=0;i<t;i++)
	{	if((sm[i].a)>80&&(sm[i].c)>=1)
		{
			(sm[i].e)=(sm[i].e)+8000;
		}
		if((sm[i].a)>85&&(sm[i].b)>80)
		{
			(sm[i].e)=(sm[i].e)+4000;
		}
		if((sm[i].a)>90)
		{
			(sm[i].e)=(sm[i].e)+2000;
		}
		if((sm[i].a)>85&&(sm[i].s2)=='Y')
		{
			(sm[i].e)=(sm[i].e)+1000;
		}
		if((sm[i].b)>80&&(sm[i].s1)=='Y')
		{
			(sm[i].e)=(sm[i].e)+850;
		}
	}
	max=sm[0].e;
	sum=sm[0].e;
	for(i=1;i<t;i++)
	{
		if(max<sm[i].e)
			max=sm[i].e;
		sum=sum+sm[i].e;
	}
	for(i=0;i<t;i++)
	{
		if(sm[i].e==max)
		{
			printf("%s\n%d\n",sm[i].str,sm[i].e);
		    break;
		}
	}
	printf("%d",sum);
}
struct student
{
	char name[20];
	int fs;
	int cs;
	char gb;
	char xb;
	int paper;
	int sch;
}stu[100];
int ys(int a,int b);
int ws(int a,int b);
int cj(int a);
int xibu(int a,char b);
int bj(int a,char b);
int main()
{
	int n=0,i=0,sum=0,k=0,j=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s %d %d %c %c %d",stu[i].name,&stu[i].fs,&stu[i].cs,&stu[i].gb,&stu[i].xb,&stu[i].paper);
		stu[i].sch=0;
	}
	for(i=0;i<n;i++)
	{
		if(ys(stu[i].fs,stu[i].paper)==1)
		{
			stu[i].sch+=8000;
			sum+=8000;
		}
		if(ws(stu[i].fs,stu[i].cs)==1)
		{
			stu[i].sch+=4000;
			sum+=4000;
		}
		if(cj(stu[i].fs)==1)
		{
			stu[i].sch+=2000;
			sum+=2000;
		}
		if(xibu(stu[i].fs,stu[i].xb)==1)
		{
			stu[i].sch+=1000;
			sum+=1000;
		}
		if(bj(stu[i].cs,stu[i].gb)==1)
		{
			stu[i].sch+=850;
			sum+=850;
		}
	}
	k=stu[0].sch;
	for(i=0;i<n;i++)
	{
		if(k<stu[i].sch)
		{
			j=i;
			k=stu[i].sch;
		}
	}
	printf("%s\n%d\n%d",stu[j].name,stu[j].sch,sum);
	return 0;
}
int ys(int a,int b)
{
	if(a>80&&b>=1)
	{return 1;}
	else return 0;
}
int ws(int a,int b)
{
	if(a>85&&b>80)
	{return 1;}
	else return 0;
}
int cj(int a)
{
	if(a>90)
	{return 1;}
	else return 0;
}
int xibu(int a,char b)
{
	if(a>85&&b=='Y')
	{return 1;}
	else return 0;
}
int bj(int a,char b)
{
	if(a>80&&b=='Y')
	{return 1;}
	else return 0;
}
struct info
{
	char name[20];
	int final;
	int ass;
	char gan;
	char west;
	int paper;
    struct info *next;
};
struct info *create(int n)
{
    struct info *p1,*p2,*head;
	int i;
	p1=(struct info*)malloc(sizeof(struct info));
	scanf("%s %d %d %c %c %d",p1->name,&p1->final,&p1->ass,&p1->gan,&p1->west,&p1->paper);
    p1->next=NULL;
	head=p1;
	p2=p1;
    for(i=1;i<n;i++)
	{
		p1=(struct info*)malloc(sizeof(struct info));
	    scanf("%s %d %d %c %c %d",p1->name,&p1->final,&p1->ass,&p1->gan,&p1->west,&p1->paper);
        p1->next=NULL;
		p2->next=p1;
		p2=p1;
	}
	return head;
}
int main()
{
	int n;
	struct info *head;
	struct info *p1;
	int i,m,sum,max;
	char namemax[22];
	scanf("%d",&n);
	head=create(n);
    
	p1=head;
	sum=0;
	max=0;
	
	for(i=0;i<n;i++)
	{
	m=0;
	if(p1->final>80&&p1->paper>=1)
	{m+=8000;}
	if(p1->final>85&&p1->ass>80)
	{m+=4000;}
	if(p1->final>90)
	{m+=2000;}
    if(p1->final>85&&p1->west=='Y')
	{m+=1000;}
	if(p1->ass>80&&p1->gan=='Y')
	{m+=850;}
	if(m>max)
	{max=m;strcpy(namemax,p1->name);}
	p1=p1->next;
	}
    p1=head;
	for(m=0,i=0;i<n;i++)
	{
	if(p1->final>80&&p1->paper>=1)
	{m+=8000;}
	if(p1->final>85&&p1->ass>80)
	{m+=4000;}
	if(p1->final>90)
	{m+=2000;}
    if(p1->final>85&&p1->west=='Y')
	{m+=1000;}
	if(p1->ass>80&&p1->gan=='Y')
	{m+=850;}
	p1=p1->next;
	}
    sum=m;
	printf("%s\n%d\n%d\n",namemax,max,sum);
}
int main()
{
 int N;
 scanf("%d",&N);
 struct std
 {
  char name[21];
  int pin;
  int yi;
  char gan;
  char west;
  int n;
 }std[100];
 int i;
 for(i=0;i<N;i++)
 {
  scanf("%s %d %d %c %c %d",std[i].name,&std[i].pin,&std[i].yi,&std[i].gan,&std[i].west,&std[i].n);
 }
 int sum[100];
 for(i=0;i<N;i++)
  sum[i]=0;
 for(i=0;i<N;i++)
 {
  if(std[i].pin>80&&std[i].n>0)
   sum[i]+=8000;
  if(std[i].pin>85&&std[i].yi>80)
   sum[i]+=4000;
  if(std[i].pin>90)
   sum[i]+=2000;
  if(std[i].pin>85&&std[i].west=='Y')
   sum[i]+=1000;
  if(std[i].yi>80&&std[i].gan=='Y')
   sum[i]+=850;
 }
 int max=sum[0],k=0,he=sum[0];
 for(i=1;i<N;i++)
 {
  he+=sum[i];
  if(max<sum[i])
  {
   max=sum[i];
   k=i;
  }
 }
 printf("%s\n",std[k].name);
 printf("%d\n",max);
 printf("%d\n",he);
 return 0;
}
struct student
{
    char name[25];
    int qimo;
    int pingshi;
    char ganbu;
    char xibu;
    int lunwen;
    int money;
};
int jiangxuejin(struct student s);


int main(int argc, char* argv[])
{
	struct student a[101];
	int N,sum,max,MAX;
	scanf("%d",&N);
	for(int i=0;i<N;i++)
	{
		scanf("%s %d %d %c %c %d",a[i].name,&a[i].qimo,&a[i].pingshi,&a[i].ganbu,&a[i].xibu,&a[i].lunwen);
		a[i].money=jiangxuejin(a[i]);
	}
	sum=max=0;
	MAX=0;
	for(int j=0;j<N;j++)
	{
		if(a[j].money>max)
		{
			max=a[j].money;
			MAX=j;
		}
		sum+=a[j].money;
	}
	printf("%s\n",a[MAX].name);
	printf("%d\n",max);
	printf("%d\n",sum);
	return 0;
}

int jiangxuejin(struct student s)
{
	int sum=0;
	if((s.qimo>80)&&(s.lunwen>=1))
	{
		sum+=8000;
	}
	if((s.qimo>85)&&(s.pingshi>80))
	{
		sum+=4000;
	}
	if(s.qimo>90)
	{
		sum+=2000;
	}
	if((s.xibu=='Y')&&(s.qimo>85))
	{
		sum+=1000;
	}
	if((s.pingshi>80)&&(s.ganbu=='Y'))
	{
		sum+=850;
	}
	return sum;
}