semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int main(){
    struct student{
        char name[20];
        int grade1;
        int grade2;
        char jerk;
        char west;
        int paper;
    };
    struct student nerd[100];
    int n,i,j,blame[100]={0},max=0,sin=0;
    scanf("%d",&n);
	for(i=0;i<=(n-1);i++){
		scanf("%s %d %d %c %c %d",nerd[i].name,&nerd[i].grade1,&nerd[i].grade2,&nerd[i].jerk,&nerd[i].west,&nerd[i].paper);
	}
    for(i=0;i<n;i++){
        if(nerd[i].grade1>80&&nerd[i].paper>=1){
            blame[i]+=8000;
        }
        if(nerd[i].grade1>85&&nerd[i].grade2>80){
            blame[i]+=4000;
        }
        if(nerd[i].grade1>90){
            blame[i]+=2000;
        }
        if(nerd[i].grade1>85&&nerd[i].west=='Y'){
            blame[i]+=1000;
        }
        if(nerd[i].grade2>80&&nerd[i].jerk=='Y'){
            blame[i]+=850;
        }
    }
    for(i=0;i<n;i++){
        if(blame[i]>max){
            j=i;
            max=blame[i];
        }
        sin+=blame[i];
    }
    printf("%s\n",nerd[j].name);
    printf("%d\n%d",max,sin);
    return 0;
}
int main ()
{
	struct student
	{
		char name[20];
		int qi;
		int pin;
		char xue;
		char xi;
		int lun;
	}student[20000];
	int a,b,c,f,sum=0,j=0;
	scanf("%d",&a);
	for (b=0;b<a;b++)
	{
		f=0;
		scanf("%s %d %d %c %c %d",student[b].name,&student[b].qi,&student[b].pin,&student[b].xue,&student[b].xi,&student[b].lun);
	    if(student[b].qi>80&&student[b].lun>0) f=f+8000;
		if(student[b].qi>85&&student[b].pin>80) f=f+4000;
		if(student[b].qi>90) f=f+2000;
		if(student[b].qi>85&&student[b].xi=='Y') f=f+1000;
		if(student[b].pin>80&&student[b].xue=='Y') f=f+850;
		sum=sum+f;
		if(f>j)
		{
			j=f;
			c=b;
		}
	}
	printf("%s\n",student[c].name);
	printf("%d\n",j);
	printf("%d",sum);
	return 0;
}
void main()
{
	int a[100]={0},i,j,n,sum=0,p;
	struct student
	{
		char name[20];
		int qimo;
		int banpin;
		char ganbu;
		char pro;
		int pap;
	}stu[101];
	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].pro,&stu[i].pap);
	for(i=0;i<n;i++)
	{
		if(stu[i].qimo>80&&stu[i].pap>=1)
			a[i]=a[i]+8000;
		if(stu[i].qimo>85&&stu[i].banpin>80)
			a[i]=a[i]+4000;
		if(stu[i].qimo>90)
			a[i]=a[i]+2000;
		if(stu[i].qimo>85&&stu[i].pro=='Y')
			a[i]=a[i]+1000;
		if(stu[i].banpin>80&&stu[i].ganbu=='Y')
			a[i]=a[i]+850;
	}
	for(i=0;i<n;i++)
		sum=sum+a[i];
	for(i=0;i<n;i++)
		for(j=0;j<n-1;j++)
			if(a[j]<a[j+1])
			{
				p=a[j+1];
				a[j+1]=a[j];
				a[j]=p;
				
				stu[100]=stu[j+1];
				stu[j+1]=stu[j];
				stu[j]=stu[100];
			}
	printf("%s\n%d\n%d\n",stu[0].name,a[0],sum);
}
void main()
{
 /*1) ????????8000??????????80??>80???????????1??1????????????? 
2) ????????4000??????????85??>85????????????80??>80????????? 
3) ????????2000??????????90??>90????????? 
4) ????????1000??????????85??>85????????????? 
5) ????????850??????????80??>80???????????
	???????????????????????????????????????????????????*/


	char name[1000][100];
	int fen[1000];
	int ban[1000];
	char gan[1000];
	char xi[1000];
	int lun[1000];
	int jiang[1000];
	int n,i,max,xue,sum;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s%d %d %c %c %d",name[i],&fen[i],&ban[i],&gan[i],&xi[i],&lun[i]);
		jiang[i]=0;
		if(fen[i]>80&&lun[i]>=1) jiang[i]=8000;
		if(fen[i]>85&&ban[i]>80) jiang[i]=jiang[i]+4000;
		if(fen[i]>90) jiang[i]=jiang[i]+2000;
		if(fen[i]>85&&xi[i]=='Y') jiang[i]=jiang[i]+1000;
		if(ban[i]>80&&gan[i]=='Y') jiang[i]=jiang[i]+850;
	}
	max=jiang[0];
	xue=0;
	for(i=0;i<n;i++)
	{
		if(jiang[i]>max)
		{
			max=jiang[i];
			xue=i;
		}
	}
	sum=0;
	for(i=0;i<n;i++)
	{
		sum=sum+jiang[i];
	}
	printf("%s\n",name[xue]);
	printf("%d\n",jiang[xue]);
	printf("%d\n",sum);
}
int main(int argc, char* argv[])
{
	int n,sum[100],i,j;
	scanf("%d",&n);
		struct{
		char name[20];
		int average;
		int clas;
		char gan;
		char xi;
		int lun;
	}a[100];
		for(i=0;i<n;i++){
	    sum[i]=0;
		scanf("%s %d %d %c %c %d",a[i].name,&a[i].average,&a[i].clas,&a[i].gan,&a[i].xi,&a[i].lun);
		}
		for(i=0;i<n;i++)
		{
			if(a[i].average > 80 && a[i].lun >= 1)
				sum[i]+=8000;
			if(a[i].average > 85 &&   a[i].clas > 80 )
				sum[i]+=4000;
			if(a[i].average > 90)
				sum[i]+=2000;
			if(a[i].average > 85 && a[i].xi=='Y' )
				sum[i]+=1000;
			if(a[i].clas > 80 && a[i].gan=='Y')
				sum[i]+=850;
		}
		int s=sum[0],d=sum[0];
		for(i=1;i<n;i++)
		{	d+=sum[i];
			if(sum[i]>s)
		{s=sum[i];
		j=i;}
		}
		printf("%s\n",a[j].name);
		printf("%d\n",sum[j]);
		printf("%d\n",d);

	
	return 0;
}
struct student
{
	char name[20];
    int score;
	int pingyi;
	char ganbu;
	char west;
	int paper;
};
int main()
{
	int n,i,t,x,y=0,a[100]={0};
	struct student stu[100];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{scanf("%s %d %d %c %c %d",stu[i].name,&stu[i].score,&stu[i].pingyi,&stu[i].ganbu,&stu[i].west,&stu[i].paper);
	}
	for(i=0;i<n;i++)
	{if(stu[i].score>80&&stu[i].paper>0) {a[i]=a[i]+8000;}
	if(stu[i].score>85&&stu[i].pingyi>80) {a[i]=a[i]+4000;}
	if(stu[i].score>90){a[i]=a[i]+2000;}
	if(stu[i].score>85&&stu[i].west=='Y'){a[i]=a[i]+1000;}
	if(stu[i].pingyi>80&&stu[i].ganbu=='Y'){a[i]=a[i]+850;}
	}
    t=a[0];x=0;
	for(i=0;i<n;i++)
	{if(a[i]>t) {t=a[i];x=i;}
	y=y+a[i];}
	printf("%s\n%d\n%d\n",stu[x].name,a[x],y);
}
struct stu
{
 char name[25];
 int score1;
 int score2;
 char a;
 char b;
 int num;
 int sum;
};
void main()
{
 int i,n,t=0,pos,max;
 struct stu *p1;
 scanf("%d",&n);
 p1=(struct stu*)calloc(n,sizeof(struct stu));
 for(i=0;i<n;i++)
 {
  scanf("%s %d %d %c %c %d",p1[i].name,&(p1[i].score1),&(p1[i].score2),&(p1[i].a),&(p1[i].b),&(p1[i].num));
  if(p1[i].score1>80&&p1[i].num>=1)
   {
    p1[i].sum+=8000;
    t+=8000;
   }
  if(p1[i].score1>85&&p1[i].score2>80)
   {
    p1[i].sum+=4000;
    t+=4000;
   }
  if(p1[i].score1>90)
   {
    p1[i].sum+=2000;
    t+=2000;
   }
  if(p1[i].score1>85&&p1[i].b=='Y')
   {
    p1[i].sum+=1000;
    t+=1000;
   }
  if(p1[i].score2>80&&p1[i].a=='Y')
   {
    p1[i].sum+=850;
    t+=850;
   }
 }
 max=p1[0].sum;
 for(i=1;i<n;i++)
  if(p1[i].sum>max)
   {
    pos=i;
    max=p1[i].sum;
   }
 printf("%s\n%d\n%d",p1[pos].name,p1[pos].sum,t);
}
struct student 
{
	char name[20];
	int qipin;
	int banpin;
	char ganbu;
	char xixue;
	int lunwen;
	int jj;
};
void main()
{   
    int max(struct student s[100],int n);
	struct student stu[100];

	int i,m=0,sum=0,n;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{	
	    scanf("%s",stu[i].name);
	 scanf("%d %d %c %c %d",&stu[i].qipin,&stu[i].banpin,&stu[i].ganbu,&stu[i].xixue,&stu[i].lunwen);
	 stu[i].jj=0;
	if(stu[i].qipin>80&&stu[i].lunwen>0)
		 stu[i].jj=stu[i].jj+8000;
	if(stu[i].qipin>85&&stu[i].banpin>80)
		 stu[i].jj=stu[i].jj+4000;
	 if(stu[i].qipin>90)
        stu[i].jj=stu[i].jj+2000;
	 if(stu[i].qipin>85&&stu[i].xixue=='Y')
        stu[i].jj=stu[i].jj+1000;
      if(stu[i].banpin>80&&stu[i].ganbu=='Y')
       stu[i].jj=stu[i].jj+850;
	} 

	for(i=0;i<n;i++)
	sum=sum+stu[i].jj;
	m=max(stu,n);
    puts(stu[0].name);
   printf("%d\n%d\n",m,sum);
}
int max(struct student s[100],int n)
{
	int i,j;
	struct student t;
   for(i=0;i<n-1;i++)
			for(j=i+1;j<n;j++)
			if(s[i].jj<s[j].jj)
		{	
			t=s[j];
		    s[j]=s[i];
			s[i]=t;
			}
       return (s[0].jj);
}
struct
{
	int tgra;
	char name[21];
	int cgra;
	char statue;
	char west;
	int paper;
}stu[100];

void main()
{
	int N,i,j,q,scholar[100]={0},temp,n=1,total=0;
	char media[21];
	char a;
	scanf("%d\n",&N);
	for(i=0;i<N;i++)
	{
		for(j=0;(a=getchar())!=' ';j++)
			stu[i].name[j]=a;
		stu[i].name[j]='\0';
		scanf("%d %d %c %c %d",&stu[i].tgra,&stu[i].cgra,&stu[i].statue,&stu[i].west,&stu[i].paper);
	}
	for(i=0;i<N;i++)
	{
		if((stu[i].tgra>80) && (stu[i].paper>=1))
			scholar[i]=scholar[i]+8000;
		if((stu[i].tgra>85) && (stu[i].cgra>80))
			scholar[i]=scholar[i]+4000;
		if(stu[i].tgra>90)
			scholar[i]=scholar[i]+2000;
		if(stu[i].tgra>85 && stu[i].west=='Y')
			scholar[i]=scholar[i]+1000;
		if(stu[i].cgra>80 && stu[i].statue=='Y')
			scholar[i]=scholar[i]+850;
	}
	q=0;
	for(j=1;j<N;j++)
	{
		if(scholar[q]<scholar[j])
		{
				q=j;
		}
	}
    //puts(stu[0].name);
	for(i=0;i<strlen(stu[q].name);i++)
	{
		if (stu[q].name[i]!=10)
			printf("%c",stu[q].name[i]);
	}
	printf("\n%d\n",scholar[q]);
	for(i=0;i<N;i++)
		total=total+scholar[i];
	printf("%d\n",total);
}
int main()
{
	struct student
	{
		char name[100];
		int qimo;
		int banji;
		char isGanbu[1];
		char isWest[1];
		int paper;
		int money;
	};
	struct student a[1000];
	int n, i, max, maxnum, sum;
	scanf("%d", &n);
	for(i = 0; i < n; i++)
	{
		a[i].money = 0;
		scanf("%s", a[i].name);
		scanf("%d%d%s%s%d", &a[i].qimo, &a[i].banji, a[i].isGanbu, a[i].isWest, &a[i].paper);
		if(a[i].qimo > 80 && a[i].paper > 0)
			a[i].money += 8000;
		if(a[i].qimo > 85 && a[i].banji > 80)
			a[i].money += 4000;
		if(a[i].qimo > 90)
			a[i].money += 2000;
		if(a[i].qimo > 85 && a[i].isWest[0] == 'Y')
			a[i].money += 1000;
		if(a[i].banji > 80 && a[i].isGanbu[0] == 'Y')
			a[i].money +=850;
	}
	max = 0;
	sum = 0;
	for(i = 0; i < n; i++)
	{
		if(a[i].money > max)
		{
			max = a[i].money;
			maxnum = i;
		}
	}
	for(i = 0; i < n; i++)
		sum += a[i].money;
	printf("%s\n",a[maxnum].name);
	printf("%d\n%d", max, sum);
	return 0;
}
void main()
{
	struct student
	{
		char name[20];
		int mark1;
		int mark2;
		char ganbu;
		char xibu;
		int lunwen;
		int total;
	}student[100],temp,Total;
	int n,i,j;
	scanf("%d",&n);
	Total.total=0;
	for(i=0;i<n;i++)
	{
		student[i].total=0;
		scanf("%s %d %d %c %c %d",student[i].name,&student[i].mark1,&student[i].mark2,&student[i].ganbu,&student[i].xibu,&student[i].lunwen);
		if(student[i].mark1>80&&student[i].lunwen>0)
			student[i].total+=8000;
		if(student[i].mark1>85&&student[i].mark2>80)
			student[i].total+=4000;
		if(student[i].mark1>90)
			student[i].total+=2000;
		if(student[i].mark1>85&&student[i].xibu=='Y')
			student[i].total+=1000;
		if(student[i].mark2>80&&student[i].ganbu=='Y')
			student[i].total+=850;
		Total.total+=student[i].total;
	}
	for(j=0;j<n-1;j++)
		for(i=0;i<n-1-j;i++)
		if(student[i].total>=student[i+1].total)
		{
			temp=student[i];
			student[i]=student[i+1];
			student[i+1]=temp;
		}
	
	printf("%s\n%d\n%d\n",student[n-1].name,student[n-1].total,Total.total);
}
struct stu 
{
       char name[20],ganbu,xibu;
       int qimo,banji,lunwen,sum;
};
int main()
{
    struct stu a[100],t;
    int n,i,sum=0,j,k;
    char c;
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
                    scanf("%s",a[i].name);
                    c=getchar();
                    scanf("%d %d %c %c %d",&a[i].qimo,&a[i].banji,&a[i].ganbu,&a[i].xibu,&a[i].lunwen);
                    a[i].sum=0;
                    if(a[i].qimo>80&&a[i].lunwen>=1)
                    a[i].sum+=8000;
                    if(a[i].qimo>85&&a[i].banji>80)
                    a[i].sum+=4000;
                    if(a[i].qimo>90)
                    a[i].sum+=2000;
                    if(a[i].qimo>85&&a[i].xibu=='Y')
                    a[i].sum+=1000;
                    if(a[i].banji>80&&a[i].ganbu=='Y')
                    a[i].sum+=850;
                    sum+=a[i].sum;
    }
    for(j=1;j<=n;j++)
     {               for(k=0;k<n-j;k++)
                    {
                                      if(a[k].sum<a[k+1].sum)
                                      {
                                           t=a[k];
                                           a[k]=a[k+1];
                                           a[k+1]=t;
                                      }
                    }
    }
    printf("%s\n%d\n%d\n",a[0].name,a[0].sum,sum);

    return 0;
}
int main()
{
struct person
{char name[20];
int pro1;
int pro2;
char c1;
char c2;
int papers;
int money;
}//stu[1]={"aA",87,82,'Y','N',0,0}//"bB",88,78,'N','Y',1,0,"cC",92,88,'N','N',0,0,"dD",83,87,'Y','N',1,0,"bb",92,80,'Y','Y',1,0}
;

long int i,N,max=0;
long int all=0;
scanf("%d\n",&N);
struct person *stu=(struct person *)malloc(N*sizeof(struct person));
for(i=0;i<N;i++){
scanf("%s%d%d %c %c %d\n",&stu[i].name,&stu[i].pro1,&stu[i].pro2,&stu[i].c1,&stu[i].c2,&stu[i].papers);
stu[i].money=0;
if(stu[i].papers>=1&&stu[i].pro1>80)stu[i].money=stu[i].money+8000;
if(stu[i].pro1>85&&stu[i].pro2>80)stu[i].money=stu[i].money+4000;
if(stu[i].pro1>90)stu[i].money=stu[i].money+2000;
if(stu[i].pro1>85&&stu[i].c2=='Y')stu[i].money=stu[i].money+1000;
if(stu[i].pro2>80&&stu[i].c1=='Y')stu[i].money=stu[i].money+850;
if(max<stu[i].money) max=stu[i].money;
all=all+stu[i].money;}
for(i=0;i<N;i++)
{if(stu[i].money==max)
{printf("%s\n%d\n%d",stu[i].name,stu[i].money,all);
break;}
}
return(0);
}
struct student{
		char name[25];
		int q,b,l,money;
		char w,x;
	};

	
	
	
	int main()
	{
		struct student a[100];
		int n,i;
		int sum=0,max=0,max_i=0,m[100]={0};

		scanf("%d",&n);
		for(i=0;i<n;i++)
		{
			scanf("%s %d %d %c %c %d",a[i].name,&a[i].q,&a[i].b,&a[i].w,&a[i].x,&a[i].l);
			if((a[i].q>80)&&(a[i].l>=1))
			{m[i]+=8000;}
			if((a[i].b>80)&&(a[i].q>85))
			{m[i]+=4000;}
			if(a[i].q>90)
			{m[i]+=2000;}
			if((a[i].q>85)&&(a[i].x=='Y'))
			{m[i]+=1000;}
			if((a[i].b>80)&&(a[i].w=='Y'))
			{m[i]+=850;}
			a[i].money=m[i];

		}
		
		
		
		
		
		
		m[0]=max=a[0].money;
		max_i=0;
		for(i=0;i<n;i++)
		{
			sum+=m[i];
			if(a[i].money>max)
			{
				max=a[i].money;
				max_i=i;
			}
			
		}
		
		
		printf("%s\n",a[max_i].name);
		printf("%d\n",m[max_i]);
		printf("%d\n",sum);


	
		
	return 0;
	   
        
	
	}
int main()
{
    int n;
    int i;
    int total = 0;
    int max_n(int amount[], int n);
    int max_num;
    
    struct data
    {
           char name[21];
           int grade;
           int assessment;
           char leader;
           char west;
           int paper;
    };
    
    scanf("%d", &n);
    
    struct data *input = (struct data*) malloc(sizeof(struct data) * n);
    int *amount = (int*) malloc(sizeof(int) * n);
    
    
    
    for(i = 0; i <= n - 1; i++)
    {
          scanf("%s %d %d %c %c %d", input[i].name, &input[i].grade, &input[i].assessment, &input[i].leader, &input[i].west, &input[i].paper);
          amount[i] = 8000 * (input[i].grade > 80 && input[i].paper > 0) + 4000 * (input[i].grade > 85 && input[i].assessment > 80) + 2000 * (input[i].grade > 90) + 1000 * (input[i].grade > 85 && input[i].west == 'Y') + 850 * (input[i].assessment > 80 && input[i].leader == 'Y');
          total = total + amount[i];
    }
    
    max_num = max_n(amount, n);
    printf("%s\n%d\n%d", input[max_num].name, amount[max_num], total);
    
    free(input);
    free(amount);
    
    
    return 0;
}

int max_n(int amount[], int n)
{
    int max_num;
    int max = 0;
    int i;
    
    for(i = 0; i <= n - 1; i++)
    {
          if(amount[i] > max)
          {
                      max = amount[i];
                      max_num = i;
          }
    }
    
    
    return max_num;
}
void main()
{
	struct student 
	{
		char name[20];
		int qm;
		int bj;
		char gb;
		char xb;
		int lw;
	}a[100];
	int n,b[100]={0},t=0,i,max;
	scanf ("%d",&n);
	for (i=0;i<n;i++)
	{
		scanf ("%s %d %d %c %c %d",a[i].name,&a[i].qm,&a[i].bj,&a[i].gb,&a[i].xb,&a[i].lw);
		if (a[i].qm>80&&a[i].lw>0) b[i]=b[i]+8000;
		if (a[i].qm>85&&a[i].bj>80) b[i]=b[i]+4000;
		if (a[i].qm>90) b[i]=b[i]+2000;
		if (a[i].qm>85&&a[i].xb=='Y') b[i]=b[i]+1000;
		if (a[i].bj>80&&a[i].gb=='Y') b[i]=b[i]+850;
	}
	max=0;
	for (i=0;i<n;i++)
	{
		t=t+b[i];
		if (b[i]>b[max]) max=i;
	}
	printf ("%s\n",a[max].name);
	printf ("%d\n",b[max]);
	printf ("%d\n",t);
}
int main()
{
	int n;
	scanf("%d\n",&n);
		char s[20],t[20];
		int a,b,e,m,sum=0,max=0;
		char c,d;
	for(int i=0;i<n;i++)
	{
		m=0;
		scanf("%s %d %d %c %c %d",s,&a,&b,&c,&d,&e);
		if(a>80&&e>=1)
			m=m+8000;
		if(a>85&&b>80)
			m=m+4000;
		if(a>90)
			m=m+2000;
		if(a>85&&d=='Y')
			m=m+1000;
		if(b>80&&c=='Y')
			m=m+850;
		if(m>max)
		{
			max=m;
                            int j;
			for(j=0;s[j]!='\0';j++)
			{
				t[j]=s[j];
			}
                            t[j]='\0';
					}

	sum=sum+m;
	}printf("%s\n%d\n",t,max);
	printf("%d",sum);
	return 0;
}
struct student
{
	char name[30];
	int money;
}stu[999];

void main()
{
	int n,i,sum=0,max=0;
	int grade_1,grade_2,paper;
	char a,b;
	char *winner;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s %d %d %c %c %d",&stu[i].name,&grade_1,&grade_2,&a,&b,&paper);
		stu[i].money=0;
		if(grade_1>80&&paper>0)
			stu[i].money+=8000;
		if(grade_1>85&&grade_2>80)
			stu[i].money+=4000;
		if(grade_1>90)
			stu[i].money+=2000;
		if(grade_1>85&&b=='Y')
			stu[i].money+=1000;
		if(grade_2>80&&a=='Y')
			stu[i].money+=850;
	}
	for(i=0;i<n;i++)
	{
		sum+=stu[i].money;
		if(max<stu[i].money)
		{
			max=stu[i].money;
			winner=stu[i].name;
		}
	}			
	printf("%s\n%d\n%d",winner,max,sum);
}
char name[101][22], yn[101][3];
int s[101][4];
void main()
{
	int n, i, j, reward[101], sumreward=0;
	int f1(int, int), f2(int, int), f3(int), f4(int, char), f5(int, char);
	
	scanf("%d", &n);
	for (i=1; i<=n; i++)
	{
		scanf("%s %d %d %c %c %d", &name[i], &s[i][1]/*??????*/, &s[i][2]/*??????*/, &yn[i][1]/*???????*/, &yn[i][2]/*?????????*/, &s[i][3]/*??????*/);
		
		reward[i] = f1(s[i][1], s[i][3]) + f2(s[i][1], s[i][2]) + f3(s[i][1]) + f4(s[i][1], yn[i][2]) + f5(s[i][2], yn[i][1]);
		
		sumreward=sumreward+reward[i]; 
	};//????
	
	for (i=1; i<=n; i++)
	{
		int a=0;
		for (j=1; j<=i-1; j++)
		{
			if(reward[i]<reward[j]) a=a+1;
		};
		for (j=i+1; j<=n; j++)
		{
			if(reward[i]<reward[j]) a=a+1;
		};
		
		if (a==0) {printf("%s\n%d\n%d",name[i],reward[i],sumreward); break;};
	};
	
}
int f1(int x, int y)//1) ?????
{
	if(x>80 && y>=1) return 8000;
	else return 0;
}
int f2(int x, int y)//2) ?????
{
	if(x>85 && y>80) return 4000;
	else return 0;
}
int f3(int x)//3) ?????
{
	if(x>90) return 2000;
	else return 0;
}
int f4(int x, char y)//4) ?????
{
	if(x>85 && y=='Y') return 1000;
	else return 0;
}
int f5(int x, char y)//5) ?????
{
	if(x>80 && y=='Y') return 850;
	else return 0;
}
struct student
{char name[20];
 int final_score;
 int discussed_score;
 char leader;
 char west;
 int article;
};
void main()
{
	struct student stu[100];
	int i,n,m,t,p;
	int a[100];
	scanf("%d",&n);
	for(i=0;i<n;i++)
		scanf("%s%d%d %c %c%d",stu[i].name,&stu[i].final_score,&stu[i].discussed_score,&stu[i].leader,&stu[i].west,&stu[i].article);
	for(i=0,m=0;i<n;i++)
	{
		t=0;
		if(stu[i].final_score>80&&stu[i].article>=1) t=8000;
		if(stu[i].final_score>85&&stu[i].discussed_score>80) t=t+4000;
		if(stu[i].final_score>90) t=t+2000;
		if(stu[i].final_score>85&&stu[i].west=='Y') t=t+1000;
		if(stu[i].discussed_score>80&&stu[i].leader=='Y') t=t+850;
		a[i]=t;
		m=m+t;
	}
  t=a[0];
  p=0;
  for(i=0;i<n;i++)
  {
	  if(t<a[i]) 
	  {
		  t=a[i];
		  p=i;
	  }
  }
  printf("%s\n%d\n%d\n",stu[p].name,t,m);
}
struct student{
char name[20];
int scholar;
}stu[100];

int main(){
int n,i,j,total=0,final,class1,paper,maxid,maxscholar=0;
char t1[2],t2[2];
scanf("%d",&n);
for(i=0;i<n;i++){
    scanf("%s%d%d%s%s%d",stu[i].name,&final,&class1,t1,t2,&paper);
    if(final>80 && paper>=1)stu[i].scholar+=8000;
    if(final>85 && class1>80)stu[i].scholar+=4000;
    if(final>90)stu[i].scholar+=2000;
    if(final>85 && t2[0]=='Y')stu[i].scholar+=1000;
    if(class1>80 && t1[0]=='Y')stu[i].scholar+=850;
    total+=stu[i].scholar;
    if(maxscholar<stu[i].scholar){maxscholar=stu[i].scholar;maxid=i;}
}
printf("%s\n%d\n%d\n",stu[maxid].name,maxscholar,total);
}
struct student
{ 
	char name[20];
 int score; 
 int banji; 
 char ganbu; 
 char xibu; 
 int lunwen; 
 struct student *next;
};
struct student *create(void)
{ int n;
 scanf("%d",&n);
 struct student *head,*p1,*p2;
 int i; 
 p1=p2=(struct student *)malloc(LEN);
 scanf("%s %d %d %c %c %d",p1->name,&p1->score,&p1->banji,&p1->ganbu,&p1->xibu,&p1->lunwen);
 head=NULL;
 for(i=1;i<n;i++)
 {  
	 if(i==1) 
		 head=p1;  
	 else
		 p2->next=p1;  
	 p2=p1;  
	 p1=(struct student *)malloc(LEN); 
	 scanf("%s %d %d %c %c %d",p1->name,&p1->score,&p1->banji,&p1->ganbu,&p1->xibu,&p1->lunwen);
 } 
 p2->next=p1; 
 p1->next=NULL; 
 return(head);
}void main()
{ 
	struct student *p1,*p2;
	int max=0,sum=0; 
	for(p1=create();p1!=NULL;p1=p1->next)
	{ 
		int total=0; 
		if(p1->score>80 && p1->lunwen>=1)
			total=total+8000;
  if(p1->score>85 && p1->banji>80)
	  total=total+4000;  
  if(p1->score>90)
	  total=total+2000;  
  if(p1->score>85 && p1->xibu=='Y') 
	  total=total+1000;  
  if(p1->banji>80 && p1->ganbu=='Y') 
	  total=total+850;
  if(total>max)  
  {   
	  max=total; 
	  p2=p1;  
} 
  sum=sum+total;
 // printf("%d\n",total);
 }
	printf("%s\n%d\n%d",p2->name,max,sum);
}
int main()
{
    int n, a, b, c, i, sum=0, max=0, m[100]={0}, result[100];
    char p, q, name[20], s[20];
    scanf("%d\n", &n);
    for(i=0;i<n;i++)
    {
        result[i] = scanf("%s %d %d %c %c %d\n", s, &a, &b, &p, &q, &c);
        if(a>80 && c>0) m[i]+=8000;
        if(a>85 && b>80) m[i]+=4000;
        if(a>90) m[i]+=2000;
        if(a>85 && q=='Y') m[i]+=1000;
        if(b>80 && p=='Y') m[i]+=850;
        if(m[i]>max) 
        {
            max=m[i];
            strcpy(name,s);
        }
        sum+=m[i];            
    }
    printf("%s\n%d\n%d\n", name, max, sum);
    return 0;
}
int main()
{
 int n,i;
 char name[10000][30],ganbu[10000][10],west[10000][10],str[20];
 int qime[10000],g[10000],w[10000],e[10000];
 int banji[10000],sum=0,s=0;
 int sol[10000];
 char yes[10]={'Y'};
 scanf("%d",&n);
 for(i=0;i<n;i++)
 {sol[i]=0;
 g[i]=1;
 w[i]=1;}
 for(i=0;i<n;i++)
 {
  scanf("%s%d%d%s%s%d",&name[i],&qime[i],&banji[i],&ganbu[i],&west[i],&e[i]);
  
  g[i]=strcmp(ganbu[i],yes);
  
  w[i]=strcmp(west[i],yes);
 }
 for(i=0;i<n;i++)
 { sol[i]=0;
  if((qime[i]>80)&&(e[i]>0))
  {sol[i]+=8000;}
 }
 for(i=0;i<n;i++)
 {if((qime[i]>85)&&(banji[i]>80))
  {sol[i]+=4000;}
 }
 for(i=0;i<n;i++){
  if(qime[i]>90)
  {sol[i]+=2000;}}
 for(i=0;i<n;i++){
  if((w[i]==0)&&(qime[i]>85))
  {sol[i]+=1000;}
 }
 for(i=0;i<n;i++){
  if((g[i]==0)&&(banji[i]>80))
  {sol[i]+=850;}
 }
 for(i=0;i<n;i++){
  if(sol[i]>s)
  {s=sol[i];
  strcpy(str,name[i]);}
  sum+=sol[i];
 }
 printf("%s\n%d\n%d\n",str,s,sum);
 return 0;

}
void main()
{
	struct s
	{
		char a[20];
		int b;
		int c;
		char d;
		char e;
		int f;
		int g;
		struct s *next;
	};
	int m,n,i,j,k,t,max,sum;
	struct s *p1,*p2,*head;
	scanf("%d",&n);
	head=0;
	p1=p2=(struct s *)malloc(sizeof(struct s));
	head=p1;
	scanf("%s %d %d %c %c %d",p1->a,&p1->b,&p1->c,&p1->d,&p1->e,&p1->f);
	for(i=0;i<n-1;i++)
	{
		p1=(struct s *)malloc(sizeof(struct s));
		p2->next=p1;
		p2=p1;
		scanf("%s %d %d %c %c %d",p1->a,&p1->b,&p1->c,&p1->d,&p1->e,&p1->f);
	}
	p2->next=0;
	p1=p2=head;
	for(i=0;i<n;i++)
	{
	p1->g=0;
	if(p1->b>80&&p1->f>0)
		p1->g=p1->g+8000;
	if(p1->b>85&&p1->c>80)
		p1->g=p1->g+4000;
	if(p1->b>90)
		p1->g=p1->g+2000;
	if(p1->b>85&&p1->e=='Y')
		p1->g=p1->g+1000;
	if(p1->c>80&&p1->d=='Y')
		p1->g=p1->g+850;
	p2=p1->next;
	p1=p2;
	}
	p1=p2=head;
	max=p1->g;
	for(i=0;i<n-1;i++)
	{
		p2=p1->next;
		p1=p2;
		if(p1->g>max)
		{
			max=p1->g;
			m=i;
		}
	}
	p1=head;
	for(i=0;i<m+1;i++)
		p1=p1->next;
	printf("%s\n%d\n",p1->a,p1->g);

p1=head;
sum=0;
for(i=0;i<n;i++)
{
	sum=sum+p1->g;
	p1=p1->next;
}
printf("%d",sum);
}
void main()
{
	struct student
	{char name[21];
	int score1;
	int score2;
	char q1;
	char q2;
	int paper;
	};
	struct student stu[101];
	//struct student*p;
	int p;
	int n,i,money[101],max=0,sum=0;
	scanf("%d",&n);
	for (p=0;p<n;p++)
	{
		scanf ("%s %d %d %c %c %d",&(stu[p].name),&(stu[p].score1),&(stu[p].score2),&(stu[p].q1),&(stu[p].q2),&(stu[p].paper));
	}
	for (i=0;i<n;i++)money[i]=0;
	i=0;
	for (p=0;p<n;p++)
	{if (stu[p].score1>80&&stu[p].paper>0)money[i]+=8000;
	if (stu[p].score1>85&&stu[p].score2>80)money[i]+=4000;
	if (stu[p].score1>90)money[i]+=2000;
	if (stu[p].score1>85&&stu[p].q2=='Y')money[i]+=1000;
	if (stu[p].score2>80&&stu[p].q1=='Y')money[i]+=850;
	if (money[i]>money[max])max=i;
	sum+=money[i];i++;}
	printf("%s\n%d\n%d",stu[max].name,money[max],sum);
	
}