semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
struct student{
	char name[20];
	int t1;
	int t2;
	char gan;
	char west;
	int wen;
	int sum;
};

void main()
{
     int n,i,j,whole=0;
	 struct student stu[100];
	 struct student temp;
	 scanf("%d",&n);
	 for(i=0;i<n;i++)
	 {
		 scanf("%s%d%d %c %c %d",stu[i].name,&stu[i].t1,&stu[i].t2,&stu[i].gan,&stu[i].west,&stu[i].wen);
		 stu[i].sum=0;
         if(stu[i].t1>80&&stu[i].wen>=1)
			 stu[i].sum=stu[i].sum+8000;
		 if(stu[i].t1>85&&stu[i].t2>80)
			 stu[i].sum=stu[i].sum+4000;
		 if(stu[i].t1>90)
			 stu[i].sum=stu[i].sum+2000;
		 if(stu[i].t1>85&&stu[i].west=='Y')
			 stu[i].sum=stu[i].sum+1000;
		 if(stu[i].t2>80&&stu[i].gan=='Y')
			 stu[i].sum=stu[i].sum+850;
	 }
	 for(j=1;j<n;j++)
          for(i=0;i<n-j;i++)
		{
		if(stu[i].sum<stu[i+1].sum)
		{
			temp=stu[i];
			stu[i]=stu[i+1];
			stu[i+1]=temp;

		}
		}
	 for(i=0;i<n;i++)
		 whole=whole+stu[i].sum;
     printf("%s\n%d\n%d",stu[0].name,stu[0].sum,whole);
}
int main()
 {
	 int n,i,summoney=0;
     scanf("%d",&n);
     struct data{
     char name[50];
     int grade,classgrade,papers;
     char monitor,west;
     int money;
	 }*number;
     number=(struct data *)malloc(sizeof(data)*n);
     for (i=0;i<n;i++)
	 {
		 scanf("%s %d %d %c %c %d",number[i].name,&number[i].grade,&number[i].classgrade,&number[i].monitor,&number[i].west,&number[i].papers);
		 number[i].money=0;
         if (number[i].grade>80&&number[i].papers>=1)number[i].money+=8000;
         if (number[i].grade>85&&number[i].classgrade>80)number[i].money+=4000;
         if (number[i].grade>90)number[i].money+=2000;
         if (number[i].grade>85&&number[i].west=='Y')number[i].money+=1000;
         if (number[i].classgrade>80&&number[i].monitor=='Y')number[i].money+=850;
         summoney+=number[i].money;
	 }
     int a,k;
     a=number[n-1].money;
     k=0;
     for (i=n-1;i>0;i--)
	 {
		 if (a>number[i-1].money)a=a;
		 else 
		 {
			 a=number[i-1].money;
			 k=i-1;
		 }
	 }
     printf("%s\n%d\n%d\n",number[k].name,number[k].money,summoney);
	 return 0;
 }
struct student 
{
	char name[100];
	int n1;
	int n2;
	char a;
	char b;
	int n3;
};
void main()
{
	int N,i,j,s[101][6],max,k=0;
	long int sum=0;
	scanf("%d\n",&N);
	struct student stu[101];
	struct student *p;
	for(p=stu;p<stu+N;p++)
	{scanf("%s %d %d %c %c %d",p->name,&p->n1,&p->n2,&p->a,&p->b,&p->n3);}
	for(i=0;i<N;i++)
		for(j=0;j<6;j++)
		{s[i][j]=0;}
    for(i=0;i<N;i++)
	{
		if(stu[i].n1>80&&stu[i].n3>=1)
			s[i][0]=8000;
		if(stu[i].n1>85&&stu[i].n2>80)
			s[i][1]=4000;
		if(stu[i].n1>90)
			s[i][2]=2000;
		if(stu[i].n1>85&&stu[i].b=='Y')
			s[i][3]=1000;
		if(stu[i].n2>80&&stu[i].a=='Y')
			s[i][4]=850;
	}
	for(i=0;i<N;i++)
		for(j=4;j>=0;j--)
		{s[i][5]=s[i][5]+s[i][j];}
	max=s[0][5];
	for(i=0;i<N;i++)
		if(s[i][5]>max)
		{max=s[i][5];k=i;}
    printf("%s\n%d\n",stu[k].name,s[k][5]);
	for(i=0;i<N;i++)
		sum=sum+s[i][5];
	printf("%ld\n",sum);
}
void main()
{
	char name[100][20],ganbu[100],xibu[100];
	int qimo[100],banji[100],lunwen[100],i,n,sum[100]={0},flag=0,max=0,total=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;
	}
	for (i=0;i<n;i++)
	{
		if (max<sum[i]) 
		{
			max=sum[i];
			flag=i;
		}
		total=total+sum[i];
	}
	printf("%s\n%d\n%d\n",name[flag],sum[flag],total);
}
struct student{
	char name[20];
	int num[6];
	char xx[3];
	int sum;
}stu[1000];
char cc[10];
int main(){
	int t,k,x[10000]={0},n,min=10000,max=0,min1=0,max1=0,a=0,b,c,d,i,j,tp,sum1=0;
	scanf("%d",&n);
	scanf("%c",&cc[1]);
	for(i=1;i<=n;i++){
		scanf("%s%c%d%c%d",stu[i].name,&cc[1],&stu[i].num[1],&cc[2],&stu[i].num[2]);
		scanf("%c%c%c%c%c%d%c",&cc[1],&stu[i].xx[1],&cc[2],&stu[i].xx[2],&cc[3],&stu[i].num[3],&cc[6]);
stu[i].sum=0;
if(stu[i].num[1]>80&&stu[i].num[3]>=1)stu[i].sum+=8000;
if(stu[i].num[1]>85&&stu[i].num[2]>80)stu[i].sum+=4000;
if(stu[i].num[1]>90)stu[i].sum+=2000;
if(stu[i].num[1]>85&&stu[i].xx[2]=='Y')stu[i].sum+=1000;
if(stu[i].num[2]>80&&stu[i].xx[1]=='Y')stu[i].sum+=850;
sum1+=stu[i].sum;
if(stu[i].sum>max){
	max=stu[i].sum;
	max1=i;
}
	}
printf("%s\n%d\n%d",stu[max1].name,stu[max1].sum,sum1);
}
struct p
{
	char name[100],leader,xibu;
	int fen,ban,lun;
	int scho;
}stu[100];
void main()
{
	int i,j,k,l,m=0,n;
	scanf ("%d\n",&n);
	for (i=0;i<n;i++)
	{
		scanf ("%s %d %d %c %c %d",stu[i].name,&stu[i].fen,&stu[i].ban,&stu[i].leader,&stu[i].xibu,&stu[i].lun);
	}
	for (i=0;i<n;i++)
	{
		if (stu[i].lun>=1&&stu[i].fen>80)
		{
			stu[i].scho=stu[i].scho+8000;
		}
		if (stu[i].fen>85&&stu[i].ban>80)
		{
			stu[i].scho=stu[i].scho+4000;
		}
		if (stu[i].fen>90)
		{
	        stu[i].scho=stu[i].scho+2000;
		}
		if (stu[i].fen>85&&stu[i].xibu=='Y')
        {
	        stu[i].scho=stu[i].scho+1000;
		}
		if (stu[i].ban>80&&stu[i].leader=='Y')
			{
	        stu[i].scho=stu[i].scho+850;
		}
	}
	for (i=0;i<n;i++)
	{
		m=m+stu[i].scho;
	}
	for (i=0;i<n;i++)
	{
		for (j=0;j<n;j++)
		{
			if (stu[i].scho<stu[j].scho)
				break;
		}
		if (j==n)
		{
			printf ("%s\n%d\n%d",stu[i].name,stu[i].scho,m);
			break;
		}
	}
}
char ansn[80],nm[80];
int ansm=0,summ=0;
int main(){
int n;
cin>>n;
for(int i=0;i<n;i++){
int a,b,e;char c,d;
cin>>nm>>a>>b>>c>>d>>e;
int s=0;
if((a>80)&&(e))s+=8000;
if((a>85)&&(b>80))s+=4000;
if(a>90)s+=2000;
if((a>85)&&(d=='Y'))s+=1000;
if((b>80)&&(c=='Y'))s+=850;
if(s>ansm){
memcpy(&ansn,&nm,sizeof(nm));
ansm=s;
}
summ+=s;
}
cout<<ansn<<endl<<ansm<<endl<<summ<<endl;
return 0;
}
int main()
{
    struct student{
    char name[20];
    int a;
    int b;
    char s;
    char x;
    int e;
    }stu[100];
    int n,m[100]={0},max,total,i;
    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].s,&stu[i].x,&stu[i].e);
    for(i=0;i<n;i++)
    {
        if(stu[i].a>80&&stu[i].e>=1) m[i]+=8000;
        if(stu[i].a>85&&stu[i].b>80) m[i]+=4000;
        if(stu[i].a>90) m[i]+=2000;
        if(stu[i].a>85&&stu[i].x=='Y') m[i]+=1000;
        if(stu[i].b>80&&stu[i].s=='Y') m[i]+=850;
    }
    max=0;
    total=m[0];
    for(i=1;i<n;i++)
    {
        if(m[i]>m[max])
        {
            max=i;
        }
        total+=m[i];
    }
    printf("%s\n%d\n%d\n",stu[max].name,m[max],total);
    return 0;
}
struct student
{
	char name[200];
	int score1;
	int score2;
	char c1;
	char c2;
	int paper;
	int money;
}a[100];
int main()
{
	int N,i,maxmoney=0,maxnum=0,summoney=0;
	scanf("%d",&N);
	for(i=0;i<N;i++)
	{
		scanf("%s %d %d %c %c %d",&a[i].name,&a[i].score1,&a[i].score2,&a[i].c1,&a[i].c2,&a[i].paper);
		if(a[i].score1>80&&a[i].paper>0)
		{
			a[i].money+=8000;
		}
		if(a[i].score1>85&&a[i].score2>80)
		{
			a[i].money+=4000;
		}
		if(a[i].score1>90)
		{
			a[i].money+=2000;
		}
		if(a[i].score1>85&&a[i].c2=='Y')
		{
			a[i].money+=1000;
		}
		if(a[i].score2>80&&a[i].c1=='Y')
		{
			a[i].money+=850;
		}
	}
	for(i=0;i<N;i++)
	{
		if(a[i].money>maxmoney)
		{
			maxmoney=a[i].money;
			maxnum=i;
		}
		summoney+=a[i].money;
	}
	printf("%s\n%d\n%d",a[maxnum].name,maxmoney,summoney);
}
struct student
{
	char name[20];
	int s1;
	int s2;
	char c;
	char w;
	int paper;
	int m;
	struct student *next;
};
void main()
{
	int N,n,total=0,r,max;
	int a[108][6];
	scanf("%d",&N);
	struct student *p1,*p2,*head,*p,*pp;
	p1=p2=(struct student*)malloc(LEN);
	n=0;
	scanf("%s %d %d %c %c %d",p1->name,&p1->s1,&p1->s2,&p1->c,&p1->w,&p1->paper);
	n=n+1;
	while(n<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->s1,&p1->s2,&p1->c,&p1->w,&p1->paper);
	n=n+1;}
	p2->next=p1;
	p1->next=NULL;
	
	p=head;
	r=0;
	while(r<N)
	{		

		(p->m)=8000*((p->s1)>80&&(p->paper>0))+4000*((p->s1)>85&&(p->s2)>80)+2000*((p->s1)>90)+1000*((p->s1)>85&&(p->w=='Y'))+850*((p->s2)>80&&(p->c=='Y'));
		total=total+(p->m);
		r++;p=p->next;	
	}

r=0;
int i,j=0;
	p=head;
	max=p->m;
	while(r<N)
	{
		if((p->m)>max)
		{
			max=(p->m);
			j=r;
		}
		r++;
		p=p->next;

	}
i=0;
pp=head;
while(i<j)
{
	pp=pp->next;
	i++;
}
printf("%s\n%d\n%d\n",pp->name,max,total);

}
int main()
{
	int n,i;
	int p[100]={0};
	int sum=0;
	struct{
		char name[20];
		int exscore;
		int clscore;
		char ganbu;
		char west;
		int lunwen;
	}st[100];

    int max=p[0],k;

	scanf("%d",&n);
	for (i=0;i<n;i++)
	{
        scanf("%s %d %d %c %c %d",st[i].name,&st[i].exscore,&st[i].clscore,&st[i].ganbu,&st[i].west,&st[i].lunwen);
        if(st[i].exscore>80 && st[i].lunwen>=1) p[i]+=8000;
		if(st[i].exscore>85 && st[i].clscore>80) p[i]+=4000;
		if(st[i].exscore>90 )  p[i]+=2000;
        if(st[i].exscore>85 && st[i].west=='Y')  p[i]+=1000;
        if(st[i].clscore>80 && st[i].ganbu=='Y')  p[i]+=850;
		sum+=p[i];

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

	}
	
    
	printf("%s\n",st[k].name);
	printf("%d\n",max);
    printf("%d\n",sum);
    return 0;
}
struct student
{
	char name[20];
    int score;
	int ping;
    char gan;
	char xi;
	int lun;
	int jiang;
}stu[100];

void main()
{
	int n,i,t,h=0;
	scanf("%d",&n);
for(i=0;i<n;i++)
{ 
	scanf("%s %d %d %c %c %d",&stu[i].name,&stu[i].score,
					   &stu[i].ping,&stu[i].gan,&stu[i].xi,&stu[i].lun);
	stu[i].jiang=0;
if(stu[i].score>80&&stu[i].lun>0)
  stu[i].jiang+=8000;
if(stu[i].score>85&&stu[i].ping>80)
  stu[i].jiang+=4000;
if(stu[i].score>90)
  stu[i].jiang+=2000;
if(stu[i].score>85&&stu[i].xi=='Y')
  stu[i].jiang+=1000;
if(stu[i].ping>80&&stu[i].gan=='Y')
  stu[i].jiang+=850;
}
for(i=0,t=stu[0].jiang;i<n-1;i++)
{
	h=h+stu[i].jiang;
	if(stu[i+1].jiang>t)
		t=stu[i+1].jiang;
}
for(i=0;i<n;i++)
if(stu[i].jiang==t)
{
	printf("%s\n%d\n%d",stu[i].name,t,h+stu[n-1].jiang);
	break;
}

}
void main()
{

struct student
{
	char name[20];
	int final;
	int classes;
    char duty;
	char west;
	int text;
};
struct student stu[100];
int n,i,t;
scanf("%d",&n);
int num[100]={0},all=0,a[100];
for(i=0;i<n;i++)
   scanf("%s %d %d %c %c %d",stu[i].name,&stu[i].final,&stu[i].classes,&stu[i].duty,&stu[i].west,&stu[i].text);

for(i=0;i<n;i++)
{
	 if(stu[i].text>0&&stu[i].final>80)
		 num[i]=num[i]+8000;
	 if(stu[i].classes>80&&stu[i].final>85)
		 num[i]=num[i]+4000;
	 if(stu[i].final>90)
		 num[i]=num[i]+2000;
	 if(stu[i].west=='Y'&&stu[i].final>85)
		 num[i]=num[i]+1000;
	 if(stu[i].classes>80&&stu[i].duty=='Y')
		 num[i]=num[i]+850;
}
for(i=0;i<n;i++)
{
	a[i]=num[i];
	all=all+num[i];
}
for(i=0;i<n-1;i++)
{	
	if(a[i]>a[i+1])
		a[i+1]=a[i];
}
for(i=0;i<n;i++)
{
	if(num[i]==a[n-1])
	{t=i;
	break;}
}
printf("%s\n%d\n%d\n",stu[t].name,num[t],all);
}
int main()
{
  struct stu
  {
    char name[20];
    int a;
    int b;
    char c[1];
    char d[1];
    int e;
    int m;
  }s[100];
  int n,i,max=0,t,sum=0;
  scanf("%d",&n);
  for(i=0;i<n;i++)
  scanf("%s %d %d %s %s %d\n",s[i].name,&s[i].a,&s[i].b,s[i].c,s[i].d,&s[i].e);
  for(i=0;i<n;i++)
  s[i].m=0;
  for(i=0;i<n;i++)
  {
    if(((s[i].a)>80)&&((s[i].e)>0))
    s[i].m+=8000;
    if(((s[i].a)>85)&&((s[i].b)>80))
    s[i].m+=4000;
    if((s[i].a)>90)
    s[i].m+=2000;
    if(((s[i].a)>85)&&((s[i].d[0])=='A'+24))
    s[i].m+=1000;
    if(((s[i].b)>80)&&((s[i].c[0])=='A'+24))
    s[i].m+=850;
  }
  for(i=0;i<n;i++)
  {
   if(s[i].m>max)
    {
      max=s[i].m;
      t=i;
    }
  }
  for(i=0;i<n;i++)
  sum+=s[i].m;
  printf("%s\n",s[t].name);
  printf("%d\n",max);
  printf("%d\n",sum);
  return 0;
}
struct qian{
char a[20];
	int b[1];
	int c[1];
	char d[2];
	char e[2];
	int f[1];
}stu[101];
void main()
{
	int exin(int A,int B,char C,char D,int E);
	int n;int x,y=0;int total=0;
	int i;
	
	int sum[101]={0};
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s%d%d%c%c%c%c%d",stu[i].a,&stu[i].b[0],&stu[i].c[0],&stu[i].d[0],&stu[i].d[1],&stu[i].e[0],&stu[i].e[1],&stu[i].f[0]);
	}
	for(i=0;i<n;i++)
	{
		sum[i]=exin(stu[i].b[0],stu[i].c[0],stu[i].d[1],stu[i].e[1],stu[i].f[0]);
		
	}
	for(i=0;i<n;i++)
	{
		total=total+sum[i];
	}

	x=sum[0];
	for(i=1;i<n;i++)
	{
		if(sum[i]>x)
		{
			x=sum[i];
			y=i;
		}
	}
	printf("%s\n",stu[y].a);
	
	printf("%d\n%d",x,total);
	
}
int exin(int A,int B,char C,char D,int E)
{
	   int k=0;
		if(A>80&&E>=1)k=k+8000;
		if(A>85&&B>80)k=k+4000;
		if(A>90)k=k+2000;
		if(A>85&&D=='Y')k=k+1000;
		if(B>80&&C=='Y')k=k+850;
		return(k);
}
void main()
{
	struct stu
	{
		char s[50],c,d;
		int a,b,e,m;
	}stu[500];
	int n,i,max=0,all=0,j=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
		stu[i].m=0;
	for(i=0;i<n;i++)
	{
		scanf("%s %d %d %c %c %d",stu[i].s,&stu[i].a,&stu[i].b,&stu[i].c,&stu[i].d,&stu[i].e);
	}
	for(i=0;i<n;i++)
	{
		if(stu[i].a>80 && stu[i].e>0)
			stu[i].m=stu[i].m+8000;
		if(stu[i].a>85 && stu[i].b>80)
			stu[i].m=stu[i].m+4000;
		if(stu[i].a>90)
			stu[i].m=stu[i].m+2000;
		if(stu[i].a>85 && stu[i].d=='Y')
			stu[i].m=stu[i].m+1000;	
		if(stu[i].b>80 && stu[i].c=='Y')
			stu[i].m=stu[i].m+850;
	}
	for(i=0;i<n;i++)
	{
		all=all+stu[i].m;
	}
	for(i=0;i<n;i++)
	{
		if(stu[i].m>max)
			max=stu[i].m;
	}
	for(i=0;i<n;i++)
	{
		if(stu[i].m==max)
		{
			printf("%s\n%d\n",stu[i].s,stu[i].m);
			max=-1;
		}
        
	}
	printf("%d\n",all);
}
struct bac
{
	char name[20];
	int num1;
	int num2;
	char ganbu;
	char west;
	char paper;
	int money;
};
int main()
{
    struct bac stu[101];
	struct bac temp;
	int i,j,n,sum=0;	
	scanf("%d",&n);
	for(i=0;i<n;i++){
		stu[i].money=0;
		scanf("%s",&stu[i].name);
		scanf("%d",&stu[i].num1);
		scanf("%d",&stu[i].num2);
		getchar();
        scanf("%c",&stu[i].ganbu);
		getchar();
		scanf("%c",&stu[i].west);
		getchar();
		scanf("%d",&stu[i].paper);
	}
	for(i=0;i<n;i++){
		if(stu[i].num1>80&&stu[i].paper>=1){stu[i].money=stu[i].money+8000;}
		if(stu[i].num1>85&&stu[i].num2>80){stu[i].money=stu[i].money+4000;}
		if(stu[i].num1>90){stu[i].money=stu[i].money+2000;}
		if(stu[i].num1>85&&stu[i].west=='Y'){stu[i].money=stu[i].money+1000;}
		if(stu[i].num2>80&&stu[i].ganbu=='Y'){stu[i].money=stu[i].money+850;}
	}
	for(i=0;i<n-1;i++){
		for (j=0;j<n-1-i;j++){
			if(stu[j].money<stu[j+1].money){
				temp=stu[j];
				stu[j]=stu[j+1];
				stu[j+1]=temp;
			}
		}
	}
	for(i=0;i<n;i++)
		sum=sum+stu[i].money;
	printf("%s\n%d\n",stu[0].name,stu[0].money);
	printf("%d",sum);
	return 0;
}
struct student{
	char name[20];
	int f_gra;
	int c_gra;
	char ganbu;
	char xibu;
	int paper;
}stu[100];

int main(int argc, char* argv[])
{
	int i,n,sum=0;	
	scanf("%d",&n);
	int *scho=(int *)malloc(sizeof(int)*n);
	for(i=0;i<n;i++){
		scanf("%s %d %d %c %c %d",stu[i].name,&stu[i].f_gra,&stu[i].c_gra,&stu[i].ganbu,&stu[i].xibu,&stu[i].paper);
		scho[i]=0;
	}

	for(i=0;i<n;i++){
		if(stu[i].f_gra>80&&stu[i].paper>0){
			scho[i]=scho[i]+8000;
			sum=sum+8000;
		}
		if(stu[i].f_gra>85&&stu[i].c_gra>80){
			scho[i]=scho[i]+4000;
			sum=sum+4000;
		}
		if(stu[i].f_gra>90){
			scho[i]=scho[i]+2000;
			sum=sum+2000;
		}
		if(stu[i].f_gra>85&&stu[i].xibu=='Y'){
			scho[i]=scho[i]+1000;
			sum=sum+1000;
		}
		if(stu[i].c_gra>80&&stu[i].ganbu=='Y'){
			scho[i]=scho[i]+850;
			sum=sum+850;
		}		
	}

	int max=scho[0],goal;
	for(i=0;i<n;i++){
		if(scho[i]>max){
			max=scho[i];
			goal=i;
		}
	}
	printf("%s\n%d\n%d\n",stu[goal].name,max,sum);

	free(scho);
	return 0;
}
struct info{
       char name[20];
       int qm;
       int py;
       char gb;
       char xb;
       int lw;
       int money;
}student[120];

int ysj( int a )
{
    if ( student[a].qm > 80 && student[a].lw >= 1 )
       return 8000;
    else
       return 0;
} 
int wsj( int a )
{
    if ( student[a].qm > 85 && student[a].py > 80 )
        return 4000;
    else 
        return 0;
}
int cjj( int a )
{
    if ( student[a].qm > 90 )
        return 2000;
    else 
        return 0;
}
int xbj( int a )
{
    if ( student[a].qm > 85 && student[a].xb == 'Y')
        return 1000;
    else 
        return 0;
}
int bjj( int a )
{
    if ( student[a].py > 80 && student[a].gb == 'Y')
        return 850;
    else 
        return 0;
}
int main()
{
    int n,k;
    int max = 0;
    int sum = 0;
    char ch1,ch2;
    scanf("%d",&n);
    if ( n >=0 )
    for ( int i=0; i<n; i++ )
    {
         scanf("%c",&ch1);
         scanf("%s%d%d%c%c%c%c%d",student[i].name,&student[i].qm,&student[i].py,&ch1,&student[i].gb,&ch2,&student[i].xb,&student[i].lw);
         student[i].money = ysj(i) + wsj(i) + cjj(i) + xbj(i) + bjj(i);
         sum += student[i].money;
         if ( student[i].money > max )
         {
             max = student[i].money;
             k = i;
         }
         
    }
    printf("%s\n%d\n%d\n",student[k].name,max,sum);
    return 0;
}
int main()
{struct ship
{
char name[20],o,w;
int score,cla,paper,totle; 
struct ship *next;
}n[100];
int T=0,N,i,m=0;char temp[20];
struct ship *head=&n[0],*p;
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-1;i++)
n[i].next=&n[i+1];
n[N-1].next=NULL;



for(i=0;i<N;i++)     //scholarship for everyone//
{n[i].totle=0;
if(n[i].cla>80&&n[i].o=='Y') n[i].totle+=850;
if(n[i].score>85&&n[i].w=='Y') n[i].totle+=1000;
if(n[i].score>90) n[i].totle+=2000;
if(n[i].score>85&&n[i].cla>80) n[i].totle+=4000;
if(n[i].score>80&&n[i].paper) n[i].totle+=8000;}

for(i=0;i<N;i++)                 //sort the scholarships ; incresing//
if(n[m].totle<n[i].totle) m=i;

p=head;
do{
 T+=p->totle;
 p=p->next;}        //T is the entire scholarship// 
while(p!=NULL);
printf("%s\n%d\n%d",n[m].name,n[m].totle,T);
return 0;
}
int main()
{
	char name[100][20],g[2]={'Y','N'},x[2]={'Y','N'},gg,xx;
	int n,score, pscore, article,b,num[100],i,maxnum,sum=0;
	scanf("%d", &n);
	for(i=0;i<n;i++){
		num[i]=0;
		scanf("%s", name[i]);
		scanf(" %d %d", &score,&pscore);
		scanf(" %c %c", &gg,&xx);
		scanf(" %d", &article);
		if(score>80&&article>=1){
			num[i]+=8000;
		}
		if(score>85&&pscore>80){
			num[i]+=4000;
		}
		if(score>90){
			num[i]+=2000;
		}
		if(score>85&&xx==x[0]){
			num[i]+=1000;
		}
		if(pscore>80&&gg==g[0]){
			num[i]+=850;
		}
		sum+=num[i];
	}
	b=0;
	maxnum=num[0];
	for(i=1;i<n;i++){
		if(num[i]>maxnum){
			maxnum=num[i];
			b=i;
		}
	}
	printf("%s\n%d\n%d\n", name[b],maxnum,sum);
	return 0;
}
struct student
{char name[30];
int qimo;
int banji;
char gb;
char xb;
int lw;
};
int k=0;
void main()
{
	
int money(struct student a);
int cmp(int a[],int n);
int n,i,b[200]={0},m;
long q=0;
  struct student a[105];
  scanf("%d",&n);
  for(i=0;i<n;i++)
  {
	  scanf("%s %d %d %c %c %d",a[i].name,&a[i].qimo,&a[i].banji,&a[i].gb,&a[i].xb,&a[i].lw);
	  b[i]=money(a[i]);q=q+b[i];
  }
 m =cmp(b,n);
  printf("%s\n",a[k].name);
  printf("%d\n",m);
  printf("%ld",q);
}




int money(struct student a)
{
	int sum=0;
	if(a.qimo>80 && a.lw>=1)sum=8000;
	if(a.banji>80 && a.qimo>85)sum=sum+4000;
	if(a.qimo>90)sum=sum+2000;
	if(a.qimo>85 && a.xb=='Y')sum=sum+1000;
	if(a.banji>80 && a.gb=='Y')sum=sum+850;
	return sum;
}

int cmp(int a[],int n)
{
	int max=a[0],i;
	for(i=0;i<n-1;i++)
		if(max<a[i+1]){max=a[i+1];k=i+1;}
	return max;
}
struct person 
{
	char n[20];
	int q;
	int p;
	char g;
	char x;
	int lun;
};
int jiang(struct person a)
{
	int j=0;
	if(a.q>80&&a.lun>0)
	{
		j=j+8000;
	}
	if (a.q>85&&a.p>80)
	{
		j=j+4000;
	}
	if(a.q>90)
	{
		j=j+2000;
	}
	if (a.q>85&&a.x=='Y')
	{
		j=j+1000;
	}
	if(a.p>80&&a.g=='Y')
	{
		j=j+850;
	}
	return(j);
}
void main()
{
	int n,i,j,r;
	double sum=0;
	int a[100];
	struct person p[100];
	scanf("%d",&n);
	for (i=0;i<=n-1;i++)
	{
		scanf("%s %d %d %c %c %d",p[i].n,&p[i].q,&p[i].p,&p[i].g,&p[i].x,&p[i].lun);
		a[i]=jiang(p[i]);
		sum=sum+a[i];
	}
	for (i=0;i<=n-1;i++)
	{
		r=0;
		for (j=0;j<=n-1;j++)
		{
			if (a[j]>a[i])
			{
				r=1;
			}
		}
		if (r==0)
		{
			printf("%s\n%d\n%.0lf",p[i].n,a[i],sum);
			break;
		}
	}
}
typedef struct{
	char name[30],sit1,sit2;
	int a,b,num;
	long totle;
	}info;

void main()
{
	int count,max=0,k,i;
	long totle=0;
	info str[100];

	scanf("%d",&count);

	for(i=0;i<count;i++)
	{
		scanf("%s %d %d %c %c %d",str[i].name,&str[i].a,&str[i].b,&str[i].sit1,&str[i].sit2,&str[i].num);
		str[i].totle=0;

		if(str[i].a>80&&str[i].num!=0)
		{str[i].totle+=8000;}

		if(str[i].a>85&&str[i].b>80)
		{str[i].totle+=4000;}

		if(str[i].a>90)
		{str[i].totle+=2000;}

		if(str[i].a>85&&str[i].sit2=='Y')
		{str[i].totle+=1000;}

		if(str[i].b>80&&str[i].sit1=='Y')
		{str[i].totle+=850;}
	}
	for(i=0;i<count;i++)
	{
		totle+=str[i].totle;
		if(str[i].totle>max)
		{			
			max=str[i].totle;
			k=i;
		}
	}
	printf("%s\n%d\n%ld\n",str[k].name,str[k].totle,totle);
}
struct student{
	char name[25];
	int qimo;
	int banji;
	char ganbu[2];
	char xibu[2];
	int lunwen;
	int money;
}stu[102]={0};
struct student temp;
void main()
{
	int i,j,n,sum=0;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s%d%d%s%s%d",&stu[i].name,&stu[i].qimo,&stu[i].banji,&stu[i].ganbu,&stu[i].xibu,&stu[i].lunwen);
		if(stu[i].qimo>80&&stu[i].lunwen>=1)
			stu[i].money=stu[i].money+8000;
		if(stu[i].qimo>85&&stu[i].banji>80)
			stu[i].money=stu[i].money+4000;
		if(stu[i].qimo>90)
			stu[i].money=stu[i].money+2000;
		if(stu[i].qimo>85&&stu[i].xibu[0]=='Y')
			stu[i].money=stu[i].money+1000;
		if(stu[i].banji>80&&stu[i].ganbu[0]=='Y')
			stu[i].money=stu[i].money+850;
	}
	for(i=0;i<n;i++)
		sum=sum+stu[i].money;
	for(i=1;i<n;i++){
		for(j=0;j<n-i;j++){
			if(stu[j].money<stu[j+1].money){
				temp=stu[j];
				stu[j]=stu[j+1];
				stu[j+1]=temp;
			}
		}
	}
	printf("%s\n%d\n%d\n",stu[0].name,stu[0].money,sum);
}
int main()
{
	long sum=0,s,max=0;
	int n,i,a,b,e;
	char nm[20],nm0[20],c[2],d[2];
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		scanf("%s%d%d%s%s%d",nm,&a,&b,c,d,&e);
		s=0;
		if(a>80&&e)s+=8000;
		if(a>85&&b>80)s+=4000;
		if(a>90)s+=2000;
		if(a>85&&d[0]=='Y')s+=1000;
		if(b>80&&c[0]=='Y')s+=850;
		sum+=s;
		if(s>max)
		{
			strcpy(nm0,nm);
			max=s;
		}
	}
	printf("%s\n%d\n%d\n",nm0,max,sum);
	return 0;
}
void main()
{
	struct s
	{char name[20];
	 int gpa;
	 int cgpa;
	 char official;
	 char west;
	 int paper;
	}stu[100];
	int m[100]={0},n,i,max=0,num=0;
	long sum=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s",stu[i].name);
		scanf("%d",&stu[i].gpa);
		scanf("%d",&stu[i].cgpa);
		getchar();
		scanf("%c",&stu[i].official);
		getchar();
		scanf("%c",&stu[i].west);
		scanf("%d",&stu[i].paper);
		if(stu[i].gpa>80&&stu[i].paper>0) m[i]=m[i]+8000;
		if(stu[i].gpa>85&&stu[i].cgpa>80) m[i]=m[i]+4000;
		if(stu[i].gpa>90) m[i]=m[i]+2000;
		if(stu[i].gpa>85&&stu[i].west=='Y') m[i]=m[i]+1000;
		if(stu[i].cgpa>80&&stu[i].official=='Y') m[i]=m[i]+850;
		sum=sum+m[i];
		if(m[i]>max)
		{
			max=m[i];
			num=i;
		}
	}
	printf("%s\n%d\n%d\n",stu[num].name,max,sum);
}
struct student
{
	char name[21];
	int term;
	int access;
	char ganbu;
	char west;
	int paper;
	int all;
}stu[100];
main()
{
	int N;
	scanf("%d",&N);
	int i;
	for(i=0;i<N;i++){
		scanf("%s%d%d%s%s%d",&stu[i].name,&stu[i].term,&stu[i].access,&stu[i].ganbu,&stu[i].west,&stu[i].paper);
	}
	for(i=0;i<N;i++){
		stu[i].all=0;
		if(stu[i].term>80&&stu[i].paper>=1){ 
			stu[i].all=stu[i].all+8000;
		}
		if(stu[i].term>85&&stu[i].access>80){
			stu[i].all=stu[i].all+4000;
		}
		if(stu[i].term>90){
			stu[i].all=stu[i].all+2000;
		}
		if(stu[i].term>85&&stu[i].west=='Y'){
			stu[i].all=stu[i].all+1000;
		}
		if(stu[i].ganbu=='Y'&&stu[i].access>80){
			stu[i].all=stu[i].all+850;
		}
	}
	int max=0;
	int total=0,k;
	for(i=0;i<N;i++){
		total+=stu[i].all;
		if(max<stu[i].all){
			max=stu[i].all;
			k=i;
		}
	}
	printf("%s\n%d\n%d\n",stu[k].name,stu[k].all,total);
}
int main()
{
	int N,score1,score2,k,i,money[100],totalmoney=0,x,n;
	char name[100][20];
	char c,d;
	scanf("%d",&N);
	for(i=0;i<N;i++)
	{
		money[i]=0;
		scanf("%s %d %d %c %c %d",name[i],&score1,&score2,&c,&d,&k);
		if(score1>80&&k!=0)
		{
			money[i]=money[i]+8000;
		}
		if(score1>85&&score2>80)
		{
			money[i]=money[i]+4000;
		}
		if(score1>90)
		{
			money[i]=money[i]+2000;
		}
		if(score1>85&&d=='Y')
		{
			money[i]=money[i]+1000;
		}
		if(score2>80&&c=='Y')
		{
			money[i]=money[i]+850;
		}
	}
	x=money[0];
	n=0;
	for(i=0;i<N;i++)
	{
		totalmoney=totalmoney+money[i];
		if(money[i]>x)
		{
			x=money[i];
			if(i>n)
			{
				n=i;
			}

		}
	}
	printf("%s\n",name[n]);
	printf("%d\n",x);
    printf("%d\n",totalmoney);
	


	return 0;
}