semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
//?????????

struct student
{
	char name[25];
	int score;
	int cla;
	char leader;
	char west;
	int paper;
};

struct scholar
{
	char name[25];
	int money;
};

struct scholar *scholar(struct student a[],int n)
{
	struct scholar num[100],*p;
	int i;

	for(i=0;i<n;i++)
	{
		num[i].money=0;
		strcpy(num[i].name,a[i].name);
	}
	p=num;

	for(i=0;i<n;i++)
	{
		if(a[i].score>80&&a[i].paper>=1)
			num[i].money+=8000;
		if(a[i].score>85&&a[i].cla>80)
			num[i].money+=4000;
		if(a[i].score>90)
			num[i].money+=2000;
		if(a[i].score>85&&a[i].west=='Y')
			num[i].money+=1000;
		if(a[i].cla>80&&a[i].leader=='Y')
			num[i].money+=850;
	}

	return(p);
}

void main()
{
	int n,sum,i,m,r;
	struct student a[100];
	struct scholar *p;

	scanf("%d",&n);

	for(i=0;i<n;i++)
	{
		if(i==0)
		{
			scanf("%s %d %d %c %c %d",a[i].name,&a[i].score,&a[i].cla,&a[i].leader,&a[i].west,&a[i].paper);
		}
		else
			scanf("\n%s %d %d %c %c %d",a[i].name,&a[i].score,&a[i].cla,&a[i].leader,&a[i].west,&a[i].paper);
	}

	p=scholar(a,n);

	m=p->money;
	r=0;
	sum=p->money;

	for(i=1;i<n;i++)
	{
		sum+=(p+i)->money;
		if((p+i)->money>m)
		{
			r=i;
			m=(p+i)->money;
		}
	}
	printf("%s\n%d\n%d\n",a[r].name,m,sum);
}
void main()
{
	struct stu
	{char name[20];
	int sco;
	int score;
	char a;
	char b;
	int p;
	};
	struct stu stu[100];
	int n,i,j;
    int k[100]={0};
	scanf("%d",&n);
	for(i=0;i<n;i++)
		scanf("%s %d %d %c %c %d",stu[i].name,&stu[i].sco,&stu[i].score,&stu[i].a,&stu[i].b,&stu[i].p);
    for(i=0;i<n;i++)
	{
		if(stu[i].sco>80&&stu[i].p>=1) k[i]=k[i]+8000;
		if(stu[i].sco>85&&stu[i].score>80) k[i]=k[i]+4000;
		if(stu[i].sco>90) k[i]=k[i]+2000;
		if(stu[i].sco>85&&stu[i].b=='Y') k[i]=k[i]+1000;
		if(stu[i].score>80&&stu[i].a=='Y') k[i]=k[i]+850;
	}
	int total=0;
	for(i=0;i<n;i++)
		total=total+k[i];
	for(i=0;i<n;i++)
	{
		for(j=i+1;j<n;j++)
		{if(k[j]>k[i]) break;}
		if(j==n) break;
	}
	printf("%s\n",stu[i].name);
	printf("%d\n",k[i]);
	printf("%d",total);
}
struct student
{
	char name[25];
	int  s1;
	int  s2;
	char yn1;
	char yn2;
	int  t;
	int sum;
	struct student*next;
};

struct student *creat(int n)
{
	struct student *head;
	struct student *p1,*p2;
	int i;
	p1=p2=(struct student *)malloc(sizeof (struct student));
	scanf("%s %d %d %c %c %d",p1->name,&p1->s1,&p1->s2,&p1->yn1,&p1->yn2,&p1->t);
	head=NULL;
	
	for(i=0;i<n-1;i++)
	{
	
		if(i==0)head=p1;
		p1=(struct student*)malloc(sizeof(struct student));
		scanf("%s %d %d %c %c %d",p1->name,&p1->s1,&p1->s2,&p1->yn1,&p1->yn2,&p1->t);
		p2->next=p1;
		p2=p1;
	}
	p2->next=NULL;
	return (head);
}

void print(struct student*head)
{
	struct student*p;
	p=head;
	if(head!=NULL)
		do
		{
			printf("%s %d %d %c %c %d\n",p->name,p->s1,p->s2,p->yn1,p->yn2,p->t);
			p=p->next;
		}while(p!=NULL);
}

main()
{
	int n,i,j,k,t,s,max,r=0;
	struct student *p1,*p2,*p3,*p;
	struct student g;
	scanf("%d",&n);
	p=creat(n);
	//print(p);
    p1=p;p2=p;p3=p;
	for(i=0;i<n;i++)
	{
		p1->sum=0;
		if((p1->s1>80)&&(p1->t>=1)) p1->sum=p1->sum+8000;
		if((p1->s1>85)&&(p1->s2>80)) p1->sum=p1->sum+4000;
		if(p1->s1>90) p1->sum=p1->sum+2000;
		if((p1->yn2=='Y')&&(p1->s1>85)) p1->sum=p1->sum+1000;
		if((p1->yn1=='Y')&&(p1->s2>80)) p1->sum=p1->sum+850;
		p1=p1->next;
	}
   /*	for(i=0,p1=p;i<n;i++)
	{
		printf("\n%s %d\n",p1->name,p1->sum);
		p1=p1->next;
	}*/
	for(max=0,p1=p,p2=p,i=0;i<n;i++)
	{
		
		if(p1->sum>max) {max=p1->sum;p2=p1;}
		
		p1=p1->next;
	}
	/*for(i=0,p1=p->next,p2=p;i<n;i++)
	{
		
		if(p1->sum==max) break;
			p2=p2->next;
		p1=p1->next;
	}*/
	for(i=0,p1=p,s=0;i<n;i++)
	{
		s=s+p1->sum;
		p1=p1->next;
	}

	printf("%s\n%d\n%d\n",p2->name,p2->sum,s);
    for(i=0,p1=p;i<n;i++)
	{
		p=p->next;
		free(p1);
		p1=p;
	}
	
}
int main()
{
 int g[101],c[101],e[101],i,m,n,mon[101],max=0,sum=0,j;
 char name[101][20],west[101],leader[101];
 scanf("%d",&n);
 for(i=0;i<n;i++)
  {
   for(j=0;;j++)
    {scanf("%c",&name[i][j]);
     if(name[i][j]==' ') break;}
   scanf(" %d%d",&g[i],&c[i]);
   scanf(" %c %c ",&leader[i],&west[i]);
   scanf("%d\n",&e[i]);
   mon[i]=0;
   if(g[i]>80 && e[i]>=1) mon[i]=mon[i]+8000;
   if(g[i]>85 && c[i]>80) mon[i]=mon[i]+4000;
   if(g[i]>90) mon[i]=mon[i]+2000;
   if(g[i]>85 && west[i]=='Y') mon[i]=mon[i]+1000;
   if(c[i]>80 && leader[i]=='Y') mon[i]=mon[i]+850;
   }
 for(i=0;i<n;i++)
  {
  if(mon[i]>max) {max=mon[i];m=i;}
  sum=sum+mon[i];
  }
 for(j=0;;j++)
 { if(name[m][j]!=' ') 
   printf("%c",name[m][j]);
   else {printf("\n");break;}
 }
 printf("%d\n%d",mon[m],sum);
 return 0;
}
struct student
{
	char name[20];
	int qm;
	int bj;
	char gb,xb;
	int lw;
	int jj;
}stu[100];

int main()
{
	char c;
    int n,i,j,sum=0;    
    struct student*pstu=stu,e;
    pstu=&stu[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++){stu[i].jj=0;
    if(stu[i].qm>80&&stu[i].lw>=1){stu[i].jj+=8000;}
    if(stu[i].qm>85&&stu[i].bj>80){stu[i].jj+=4000;}
    if(stu[i].qm>90){stu[i].jj+=2000;}
    if(stu[i].qm>85&&stu[i].xb=='Y'){stu[i].jj+=1000;}
    if(stu[i].bj>80&&stu[i].gb=='Y'){stu[i].jj+=850;}
                     }
    
    for(j=0;j<n;j++){
                     for(i=0;i<n-j;i++){
                                        if(stu[i].jj<stu[i+1].jj){
                                                                  e=*(pstu+i);
                                                                  *(pstu+i)=*(pstu+i+1);
                                                                  *(pstu+1+i)=e;}
}}
   
   for(i=0;i<n;i++){sum+=stu[i].jj;}
   printf("%s\n%d\n%d\n",(pstu)->name,(pstu)->jj,sum);
   scanf("%s",c);return 0;
   

}
int main()
{
	int a[200],n,s[200][20],b[200],e[200],i,m[200],t=0,j,k=0,h=0;
	char d[200],c[200],f,g;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s%d%d%c%c%c%c%d",s[i],&a[i],&b[i],&f,&c[i],&g,&d[i],&e[i]);
	}
for(i=0;i<n;i++){
	    m[i]=0;
		if(a[i]>80&&e[i]>0)   m[i]+=8000;
        if(a[i]>85&&b[i]>80)   m[i]+=4000;
        if(a[i]>90)           m[i]+=2000;
        if(a[i]>85&&d[i]=='Y')   m[i]+=1000;
        if(b[i]>80&&c[i]=='Y')   m[i]+=850;
}
for(i=0;i<n;i++){
	h+=m[i];
    if(m[i]>t) {
	t=m[i];
	j=i;}
}

 printf("%s\n%d\n%d\n",s[j],t,h);
  return 0;
}
struct profile
{
	char name[20];
	int grade; int approval;
	char west; char manager;
	int paper; int prize;
};

int prizetoget(int gra,int app,char w,char ma,int pa)
{
	int initial=0;
	if((pa>=1)&&(gra>80)) initial+=Principal;
	if((gra>85)&&(app>80)) initial+=Wusi;
	if(gra>90) initial+=Highmark;
	if((gra>85)&&(w=='Y')) initial+=Western;
	if((app>80)&&(ma=='Y')) initial+=Devotion;
	return initial;
}

int main()
{ 
	struct profile student[100];              
	int n,i,most=0,No,sum=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s%d%d %c %c%d",student[i].name,&student[i].grade,&student[i].approval,&student[i].manager,&student[i].west,&student[i].paper);
		student[i].prize=prizetoget(student[i].grade,student[i].approval,student[i].west,student[i].manager,student[i].paper);
		sum+=student[i].prize;
	}

	for(i=0;i<n;i++){
		if(student[i].prize>most)
		{
			most=student[i].prize;
			No=i;
		}
	}
	
	printf("%s\n%d\n%d",student[No].name,most,sum);
	return 0;
}
int main()
{
	int n, qimo[100], banyi[100], lunwen[100];
	char name[100][20], xuegan[100], xibu[100];
	int sum[100], a, b = 0, i, result = 0;
	scanf("%d", &n);
	for(i = 0; i < n; i++){
		sum[i] = 0;
		scanf("%s %d %d %c %c %d", name[i], &qimo[i], &banyi[i], &xuegan[i], &xibu[i], &lunwen[i]);
	}
	for(i = 0; i < n; i++){
		if((qimo[i] > 80)&&(lunwen[i] != 0)){
			sum[i] += 8000;
		}
		if((qimo[i] > 85)&&(banyi[i] > 80)){
			sum[i] += 4000;
		}
		if(qimo[i] > 90){
			sum[i] += 2000;
		}
		if((qimo[i] > 85)&&(xibu[i] == 'Y')){
			sum[i] += 1000;
		}
		if((banyi[i] > 80)&&(xuegan[i] == 'Y')){
			sum[i] += 850;
		}
	}
	for(i = 0; i < n; i++){
		result += sum[i];
		if(sum[i] > b){
			b = sum[i];
			a = i;
		}
	}
	printf("%s\n%d\n%d\n", name[a], b, result);
	return 0;
}
int main()
{
	struct stu{
		char name[35];
		int sum;
	};
	struct stu m[102],temp;
	int i,j,k,n;
	char a,b;
	scanf("%d",&n);
	struct stu *p=m;
	struct stu *q;
	for(;p<m+n;p++)
	{
		scanf("%s%d%d %c %c%d",(*p).name,&i,&j,&a,&b,&k);
		(*p).sum=0;
		if(i>80 && k>0)
			(*p).sum+=8000;
		if(i>85 && j>80)
			(*p).sum+=4000;
		if(i>90)
			(*p).sum+=2000;
		if(i>85 && b=='Y')
			(*p).sum+=1000;
		if(a=='Y' && j>80)
			(*p).sum+=850;
	}
	p=m;
	i=0;
	i=(*p).sum;
	for(q=p+1;q<m+n;q++)
	{
		i+=(*q).sum;
		if((*p).sum < (*q).sum)
		{
			temp=*p;
			*p=*q;
			*q=temp;
		}
	}
	printf("%s\n%d\n%d\n",m->name,m->sum,i);
	return 0;
}
struct st
	{
		char name[25];
		int sc[2];
		char leader;
		char west;
		int paper;
	};
void main()
{
	struct st s[200];
	int n,i,j=0,max=0,sum=0,a[200]={0};
	scanf("%d",&n);
	for(i=0;i<n;i++)
		scanf("%s%d%d %c %c%d",s[i].name,&s[i].sc[0],&s[i].sc[1],&s[i].leader,&s[i].west,&s[i].paper);
	for(i=0;i<n;i++)
	{
		if(s[i].sc[0]>80&&s[i].paper>0)
			a[i]=a[i]+8000;
		if(s[i].sc[0]>85&&s[i].sc[1]>80)
			a[i]=a[i]+4000;
		if(s[i].sc[0]>90)
			a[i]=a[i]+2000;
		if(s[i].sc[0]>85&&s[i].west=='Y')
			a[i]=a[i]+1000;
		if(s[i].sc[1]>80&&s[i].leader=='Y')
			a[i]=a[i]+850;
	}
	for(i=0;i<n;i++)
	{
		j=(a[i]>max)? i:j;
		max=(a[i]>max)? a[i]:max;
		sum=sum+a[i];
	}
	printf("%s\n%d\n%d",s[j].name,a[j],sum);
}
struct student
{
	char name[20];
	int qimo;
	int pingyi;
	char ganbu;
	char xibu;
	int lunwen;
	int zong;
	struct student *next;
}*head,*p1,*p2,*max;

int zong(struct student *p1)
{
	int zong=0;
	struct student *p;
	p=p1;
	if(p->qimo>80&&p->lunwen>=1) zong+=8000;
	if(p->qimo>85&&p->pingyi>80) zong+=4000;
	if(p->qimo>90) zong+=2000;
	if(p->qimo>85&&p->xibu=='Y') zong+=1000;
	if(p->pingyi>80&&p->ganbu=='Y') zong+=850;
	return zong;
}

struct student *find(struct student *head)
{
	struct student *p,*max;
	p=head->next;
	max=head;
	while(p)
	{
		if(p->zong>max->zong)
			max=p;
		p=p->next;
	}
	return max;
}


int main()
{
	int zong(struct student *p1);
	struct student *find(struct student *head);

	int n,m=0;
	scanf("%d",&n);

	p1=(struct student*)malloc(Len);
	scanf("%s %d %d %c %c %d",p1->name,&p1->qimo,&p1->pingyi,&p1->ganbu,&p1->xibu,&p1->lunwen);
	p1->zong=zong(p1);
    m+=p1->zong;
	n--;
	p1->next=NULL;

	head=p1;
	p2=p1;

	while(n)
	{
		p1=(struct student*)malloc(Len);
	    scanf("%s %d %d %c %c %d",p1->name,&p1->qimo,&p1->pingyi,&p1->ganbu,&p1->xibu,&p1->lunwen);
		p1->zong=zong(p1);
		m+=p1->zong;
		p1->next=NULL;
		p2->next=p1;
		p2=p1;
		n--;
	}

	max=find(head);

	printf("%s\n%d\n%d",max->name,max->zong,m);

	return 0;
}
struct student
{
	char num[100];
	int sco;
	int pin;
	char gan;
	char xi;
	int pap;
};

void main()
{
	int i,j,k,m,n,a[100],sum=0;
	struct student stu[100];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		a[i]=0;
		scanf("%s %d %d %c %c %d",stu[i].num,&stu[i].sco,&stu[i].pin,&stu[i].gan,&stu[i].xi,&stu[i].pap);
	}
	for(i=0;i<n;i++)
	{
		if(stu[i].sco>80&&stu[i].pap>=1)
			a[i]+=8000;
		if(stu[i].sco>85&&stu[i].pin>80)
			a[i]+=4000;
		if(stu[i].sco>90)
			a[i]+=2000;
		if(stu[i].sco>85&&stu[i].xi=='Y')
			a[i]+=1000;
		if(stu[i].pin>80&&stu[i].gan=='Y')
			a[i]+=850;
	}
	k=0;
	for(i=0;i<n;i++)
	{
		if(a[i]>k)
			k=a[i];
	}
	for(i=0;i<n;i++)
		if(a[i]==k)
			break;
		printf("%s\n%d",stu[i].num,a[i]);
	for(i=0;i<n;i++)
		sum=sum+a[i];
	printf("\n%d",sum);

	
	
}
int main()
{   char name[20],g,x,highestname[20];
    int q[100],b[100],l[100],n,i,j,sum[100]={0},max=0,t,total=0;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s %d %d %c %c %d",name,&q[i],&b[i],&g,&x,&l[i]);
        if((q[i]>80)&&l[i]>=1){
			sum[i]+=8000;
		}
		if(q[i]>85&&b[i]>80){
			sum[i]+=4000;
		}
		if(q[i]>90){
			sum[i]+=2000;
		}
		if(q[i]>85&&x=='Y'){
			sum[i]+=1000;
		}
		if(b[i]>80&&g=='Y'){
			sum[i]+=850;
		}
	
		total+=sum[i];
		if(sum[i]>max){
			max=sum[i];
			t=i;
			for (j=0;name[j]!='\0';j++){

			    highestname[j]=name[j];
			}
			highestname[j]='\0';
		}
	}
    
	printf("%s\n%d\n%d\n",highestname,sum[t],total);
	return 0;
}
struct student{
		char name[20];
		int s1;
		int s2;
		char gb;
		char w;
		int p;
		int m;
	};
	
void main()
{
	int i,j,sum=0,n,max=0,t;
	struct student stu[100];
	scanf("%d",&n);
	
	for(i=0;i<n;i++){
	stu[i].m=0;
	scanf("%s %d %d %c %c %d",&(stu[i].name),&(stu[i].s1),&(stu[i].s2),&(stu[i].gb),&(stu[i].w),&(stu[i].p));
	if(stu[i].s1>80 && stu[i].p>0)   stu[i].m=stu[i].m+8000;
	if(stu[i].s1>85 && stu[i].s2>80 )    stu[i].m=stu[i].m+4000;	
	if(stu[i].s1>90)    stu[i].m=stu[i].m+2000;
	if(stu[i].s1>85 && stu[i].w=='Y')  stu[i].m=stu[i].m+1000;
	if(stu[i].s2>80 && stu[i].gb=='Y')  stu[i].m=stu[i].m+850;
	sum=sum+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%d",stu[i].name,max,sum);break;
	}
}
int cpu(int term_end,int class_talk,char stu_staff,char stu_west,int thesis_num)
{
	int money =0;
	if(term_end > 80 && thesis_num >=1)
		money += 8000;
	if(term_end > 85 && class_talk > 80)
		money += 4000;
	if(term_end > 90)
		money += 2000;
	if(term_end >85 && stu_west =='Y')
		money += 1000;
	if(class_talk > 80 && stu_staff =='Y')
		money += 850;
	return money;
}
int main()
{

	int stu_num;
	char name[21];
	int term_end;
	int class_talk;
	char stu_staff;
	char stu_west;
	int thesis_num;
	scanf("%d",&stu_num);

	int stu_max = -1,stu_money,money =0;
	char stu_name[21];
	for(int i =0; i < stu_num; i++)
	{
		scanf("%s %d %d %c %c %d",
			name,&term_end,&class_talk,&stu_staff,&stu_west,&thesis_num);
		stu_money = cpu(term_end,class_talk,stu_staff,stu_west,thesis_num);
		if(stu_money > stu_max)
		{
			stu_max = stu_money;
			strcpy(stu_name,name);
		}
		money += stu_money;
	}
	printf("%s\n%d\n%d",stu_name,stu_max,money);
	return 0;
}
void main()
{
	int N,b,c,f,i,j,max=0,s,S=0;
	char a[21],d,e,name[21];
	scanf("%d",&N);
	for(i=1;i<=N;i++)
	{
		s=0;
		scanf("%s%d%d %c %c%d",a,&b,&c,&d,&e,&f);
		if(b>80&&f>=1)
			s=s+8000;
		if(b>85&&c>80)
			s=s+4000;
		if(b>90)
			s=s+2000;
		if(b>85&&e=='Y')
			s=s+1000;
		if(c>80&&d=='Y')
			s=s+850;
		if(s>max)
		{
			for(j=0;j<=strlen(a);j++)
				name[j]=a[j];
			max=s;
		}
		S=S+s;
	}
	printf("%s\n%d\n%d\n",name,max,S);
}
struct student{
	char name[20];
	int qimo;
	int banji;
	char leader;
	char west;
	int essay;
}stu[1000];
struct money{
	long p;
	int q;
}money[1000];

void main()
{
	int n,i,j,max[1000]={0},mmax,k=0;
	long sum=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s %d %d %c %c %d",stu[i].name,&stu[i].qimo ,&stu[i].banji ,&stu[i].leader ,&stu[i].west ,&stu[i].essay);
	}
	for(i=0;i<n;i++)
	{   money[i].p=0;
	money[i].q =i;
		if(stu[i].qimo >80&&stu[i].essay>=1)
			money[i].p=money[i].p+8000;
		if(stu[i].qimo >85&&stu[i].banji>80)
			money[i].p =money[i].p +4000;	
		if(stu[i].qimo >90)
			money[i].p =money[i].p +2000;
	if(stu[i].qimo >85&&stu[i].west=='Y')
			money[i].p =money[i].p +1000;
		if(stu[i].banji >80&&stu[i].leader=='Y')
			money[i].p =money[i].p+850;
	}
	j=i;
	mmax=money[0].p;
	for(i=0;i<j;i++)
	{
		if(mmax<money[i].p)
			mmax=money[i].p;
	}
	for(i=0;i<j;i++)
		if(mmax==money[i].p)
		{
			k=money[i].q;
			break;
		}

		for(i=0;i<n;i++)
			sum=sum+money[i].p;
		printf("%s\n%ld\n%ld",stu[k].name,money[k].p,sum);
}
struct student
	{char name[20];
	int g1;
	int g2;
	char id1;
	char id2;
	int t;
	int s;
	}stu[100];
void main()
{
	
	int n,sum=0,i,r,m;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		stu[i].s=0;
		scanf("%s%d%d %c %c%d",stu[i].name,&stu[i].g1,&stu[i].g2,&stu[i].id1,&stu[i].id2,&stu[i].t);
		if(stu[i].g1>80&&stu[i].t>0) stu[i].s+=8000;
        if(stu[i].g1>85&&stu[i].g2>80) stu[i].s+=4000;
        if(stu[i].g1>90) stu[i].s+=2000;
        if(stu[i].g1>85&&stu[i].id2=='Y') stu[i].s+=1000;
        if(stu[i].g2>80&&stu[i].id1=='Y') stu[i].s+=850;
		sum+=stu[i].s;
	}		
	m=stu[0].s;r=0;
	for(i=0;i<n;i++)
	{

		if(stu[i].s>m)
		{
			m=stu[i].s;
			r=i;
		}
	}
	printf("%s\n%d\n%d\n",stu[r].name,stu[r].s,sum);
}
int main()
{
	char name[100][20]={'\0'};
	int qimo[100]={0};
	int ban[100]={0};
	char xue[100]={'\0'};
	char xi[100]={'\0'};
	int lun[100]={0};
	int n;
	int sum[100]={0};
	int max=0;
	char ma[100]={'\0'};
	int i,j,k;
	int zong=0;
	scanf("%d",&n);
	for (i=0;i<n;i++)
	{
		scanf("%s %d %d %c %c %d",name[i],&qimo[i],&ban[i],&xue[i],&xi[i],&lun[i]);
	}
	for (i=0;i<n;i++)
	{
		if(qimo[i]>80&&lun[i]>=1) sum[i]=sum[i]+8000;
		if (qimo[i]>85&&ban[i]>80) sum[i]=sum[i]+4000;
		if (qimo[i]>90) sum[i]=sum[i]+2000;
		if (qimo[i]>85&&xi[i]=='Y') sum[i]=sum[i]+1000;
		if (ban[i]>80&&xue[i]=='Y') sum[i]=sum[i]+850;
	}
	for (i=0;i<n;i++)
	{
		if (max<sum[i])
			{
			     max=sum[i];
				 strcpy(ma,name[i]);
		}
	    zong=zong+sum[i];
	}
    printf("%s\n%d\n%d",ma,max,zong);
	return 0;
}
struct list{
	char name[30];
	int final,ave,article;
	char member,west;
	long sum;
	struct list *next;
};

int n=0;
int num;
long total=0;
char namemax[30];
long max=0;

struct list *creat(int n)
{
	struct list *p1,*p2,*head;
	int i;	
	head=(struct list*)malloc(sizeof(struct list));
	p1=(struct list*)malloc(sizeof(struct list));
	head->next=p1;
	p1->next=NULL;
	p1->sum=0;
	scanf("%s %d %d %c %c %d\n",p1->name,&p1->final,&p1->ave,&p1->member,&p1->west,&p1->article);
	if(p1->final>80 && p1->article>=1)p1->sum+=8000;
	if(p1->final>85 && p1->ave>80)p1->sum+=4000;
	if(p1->final>90)p1->sum+=2000;
	if(p1->final>85 && p1->west=='Y')p1->sum+=1000;	
	if(p1->ave>80 && p1->member=='Y')p1->sum+=850;		
	total=total+p1->sum;
	max=p1->sum;		
	for(i=1;i<n;i++)
	{
		p2=p1;
		p1=(struct list*)malloc(sizeof(struct list));
		scanf("%s %d %d %c %c %d\n",p1->name,&p1->final,&p1->ave,&p1->member,&p1->west,&p1->article);
		if(p1->final>80 && p1->article>=1)p1->sum+=8000;
		if(p1->final>85 && p1->ave>80)p1->sum+=4000;
		if(p1->final>90)p1->sum+=2000;
		if(p1->final>85 && p1->west=='Y')p1->sum+=1000;	
		if(p1->ave>80 && p1->member=='Y')p1->sum+=850;	
		total=total+p1->sum;
		if(p1->sum>max){max=p1->sum;strcpy(namemax,p1->name);}		
		p2->next=p1;
	}
	p1->next=NULL;
	return head;
}

int main()
{
	struct list *head,*p;
	scanf("%d\n",&n);
	head=creat(n);
	printf("%s\n%d\n%d\n",namemax,max,total);
	return 0;
}
void main()
{
int n,i,j,sum=0;
struct student
{
	char name[20];
	int a;
	int b;
	char x;
	char g;
	int lun;
	int money;
}stu[103];


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].g, &stu[i].x, &stu[i].lun);
   stu[i].money=0;
}

for(i=0;i<n;i++)
{
 if(stu[i].a>80&&stu[i].lun>0)
  stu[i].money=stu[i].money+8000;
 if(stu[i].a>85&&stu[i].b>80)
 stu[i].money=stu[i].money+4000;
 if(stu[i].a>90)
 stu[i].money=stu[i].money+2000;
 if(stu[i].a>85&&stu[i].x=='Y')
 stu[i].money=stu[i].money+1000;
 if(stu[i].b>80&&stu[i].g=='Y')
 stu[i].money=stu[i].money+850;
 sum=sum+stu[i].money;
}
for(j=1;j<n;j++)
{
	for(i=0;i<n-j;i++)
	{
		if(stu[i].money<stu[i+1].money)
		{
			stu[102]=stu[i];
			stu[i]=stu[i+1];
			stu[i+1]=stu[102];
		}
	}
}


	
   printf("%s\n",stu[0].name);

   printf("%d\n",stu[0].money);
   printf("%d\n",sum);
}
struct student
{
char name[21];
int fin;
int cla;
char q1;
char q2;
int pap;
}stu[101];
void main()
{
int n,i;
char namem[21];
int max=0,money[101];
int total=0;
scanf("%d",&n);
for(i=0;i<n;i++)
{
money[i]=0;
scanf("%s %d %d %c %c %d",
&stu[i].name,&stu[i].fin,&stu[i].cla,&stu[i].q1,&stu[i].q2,&stu[i].pap);
if(stu[i].fin>80&&stu[i].pap>0) money[i]+=8000;
if(stu[i].fin>85&&stu[i].cla>80) money[i]+=4000;
if(stu[i].fin>90) money[i]+=2000;
if(stu[i].fin>85&&stu[i].q2=='Y') money[i]+=1000;
if(stu[i].cla>80&&stu[i].q1=='Y') money[i]+=850;
if(money[i]>money[max]){max=i;}
total+=money[i];
}
printf("%s\n%d\n%d\n",stu[max].name,money[max],total);
}
int main()
{
	//freopen("tt.in","r",stdin);
	//freopen("tt.out","w",stdout);
	int i,j,n,k,t,max;
	char gan,xi;
	int g1,g2,lun,r;
	char s[333];
	char s1[333];
	scanf("%d",&n);
	r=0;
	max=-999;
	for (i=1;i<=n;i++)
	{
		scanf("%s %d %d %c %c %d",s,&g1,&g2,&gan,&xi,&lun);


		t=0;
		if ((g1>80) && (lun>=1)) t+=8000;
		if ((g1>85) && (g2>80)) t+=4000;
		if (g1>90) t+=2000;
		if ((g1>85) &&(xi=='Y')) t+=1000;
		if ((g2>80) &&(gan=='Y')) t+=850;
		r+=t;
		if (t>max)
		{
			max=t;
			strcpy(s1,s);
		}   
	}
    puts(s1);
    printf("%d\n%d\n",max,r);
	return 0; 
}
int main()
{
	struct student
	{
		char name[20];
			int qm;
			int py;
			char gb[2];
			char xb[2];
			int lw;
			int jxj;
	}student[2]={{'\0',0,0,'\0','\0',0,0},{'\0',0,0,'\0','\0',0,0}};
	struct student temp={'\0',0,0,'\0','\0',0,0};
	int i,n,sum;
	scanf("%d",&n);
	sum=0;
		for(i=0;i<n;i++)
		{
			scanf("%s%d%d%s%s%d",student[1].name,&student[1].qm,&student[1].py,student[1].gb,student[1].xb,&student[1].lw);
			if(student[1].py>80&&strcmp(student[1].gb,"Y")==0)
			{
				student[1].jxj=student[1].jxj+850;
			}
			if(student[1].qm>80&&student[1].lw>=1)
			{
				student[1].jxj=student[1].jxj+8000;
			}
			if(student[1].qm>85&&student[1].py>80)
			{
				student[1].jxj=student[1].jxj+4000;
			}
			if(student[1].qm>90)
			{
				student[1].jxj=student[1].jxj+2000;
			}
			if(student[1].qm>85&&strcmp(student[1].xb,"Y")==0)
			{
				student[1].jxj=student[1].jxj+1000;
			}
			sum=sum+student[1].jxj;

			if(student[1].jxj>student[0].jxj)
			{
				temp=student[1];
				student[1]=student[0];
				student[0]=temp;
			}

			student[1].jxj=0;
		}
		printf("%s\n%d\n%d\n",student[0].name,student[0].jxj,sum);
}
int yuan(int p,int q)
{
	int z=0;
	if(p>80&&q>=1) z=1;
	return z;
}
int wusi(int p,int q)
{
int z=0;
	if(p>85&&q>80) z=1;
	return z;
}
int youxiu(int p)
{
int z=0;
	if(p>90) z=1;
	return z;
}
int xibu(int p,char ip)
{
int z=0;
	if(p>85&&ip=='Y') z=1;
	return z;
}
int banji(int p,char ip)
{int z=0;
	
	if(p>80&&ip=='Y') z=1;
	return z;
}

void main()
{
	struct student
	{
		char name[20];
		int gpa;
		int arg;
		char leader;
		char xibu;
		int paper;
		int sum;
	}*s;
	int i,n,a,b,c,d,e,sum=0;
	scanf("%d",&n);
	s=(struct student*)malloc(n*sizeof(struct student));
	for(i=0;i<n;i++)
	{
		scanf("%s %d %d %c %c %d",&s[i].name,&(*(s+i)).gpa,&(*(s+i)).arg,&(*(s+i)).leader,&(*(s+i)).xibu,&(*(s+i)).paper);
		(*(s+i)).sum=0;
    	a=yuan((*(s+i)).gpa,(*(s+i)).paper);
		b=wusi((*(s+i)).gpa,(*(s+i)).arg);
		c=youxiu((*(s+i)).gpa);
		d=xibu((*(s+i)).gpa,(*(s+i)).xibu);
		e=banji((*(s+i)).arg,(*(s+i)).leader);
		(*(s+i)).sum=8000*a+4000*b+2000*c+1000*d+850*e;
		sum=sum+(*(s+i)).sum;
	}
    for(i=1;i<n;i++)
	{
		if((*(s+0)).sum<(*(s+i)).sum)
		(*(s+0))=(*(s+i));		
	}
		printf("%s\n%d\n%d",s[0].name,(*(s+0)).sum,sum);
	

}
int main()
{
    struct student
    {
        char name[20];
        int final;
        int com;
        char offi;
        char west;
        int arc;
    };
    struct student stu[200];
    struct student chan;
    int i,n;
    int total[200]={0},all=0;
    int a,b,temp;
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
        scanf("%s %d %d %c %c %d",stu[i].name,&stu[i].final,&stu[i].com,&stu[i].offi,&stu[i].west,&stu[i].arc);
    }
    for(i=0;i<n;i++)
    {
        if((stu[i].final>80)&&(stu[i].arc>0))
        total[i]=total[i]+8000;
        if((stu[i].final>85)&&(stu[i].com>80))
        total[i]=total[i]+4000;
        if(stu[i].final>90)
        total[i]=total[i]+2000;
        if((stu[i].final>85)&&(stu[i].west==89))
        total[i]=total[i]+1000;
        if((stu[i].com>80)&&(stu[i].offi==89))
        total[i]=total[i]+850;
    }
    for(a=0;a<n-1;a++)
    {
        for(b=0;b<n-1-a;b++)
        {
            if(total[b]<total[b+1])
            {
                temp=total[b];
                total[b]=total[b+1];
                total[b+1]=temp;
                chan=stu[b];
                stu[b]=stu[b+1];
                stu[b+1]=chan;
            }
        }
    }
    for(i=0;i<n;i++)
    all=all+total[i];
    printf("%s\n%d\n%d\n",stu[0].name,total[0],all);
    return 0;
}