semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
struct student 
{
    char name[20];
	int  ave;
    int cla;
	char g;
	char x;
	int num;
	int qian;
    struct student *next;
};
void main()
{
	int zong,max=0,i,j;
	zong=0;
   struct student *p,*head,*p2;
   p2=p=head=(struct student *)malloc(sizeof(struct student));
   int N;
	   scanf("%d",&N);
   for(i=0;i<N;i++)
   {
    scanf("%s %d %d %c %c %d",p->name,&p->ave,&p->cla,&p->g,&p->x,&p->num); 
     p->qian=0;
	if(p->ave>80&&p->num>=1)
		p->qian+=8000;
    if(p->ave>85&&p->cla>80)
p->qian+=4000;
if(p->ave>90)
p->qian+=2000;
if(p->x=='Y'&&p->ave>85)
p->qian+=1000;
if(p->g=='Y'&&p->cla>80)
p->qian+=850;
zong+=p->qian;
	if(i==0)
		head=p;
	p2->next=p;
	p2=p;
	p=(struct student *)malloc(sizeof(struct student));
   }
   p2=NULL;
   p=head;
   for(i=0;i<N;i++)
   {
	   j=p->qian;
	   max=j>max?j:max;
	   p=p->next;
   }
   p=head;
   for(i=0;i<N;i++)
   {
	   if(p->qian==max)
	   {printf("%s\n",p->name);
	   break;   }
	   p=p->next;
   }
 printf("%d\n",max);
   printf("%d",zong);
}
struct inf
{
	char name[30];
	int s1;//??
	int s2;//??
	char a;//??
	char b;//??
	int num;//??
};
void main()
{
	int n,i,t,total=0,money[100]={0},max=0;
	struct inf c[100];
	scanf("%d",&n);	
	for(i=0;i<n;i++)
	{
		scanf("%s",c[i].name);
		scanf("%d %d",&c[i].s1,&c[i].s2);
		scanf(" %c %c ",&c[i].a,&c[i].b);//??????????
		scanf("%d",&c[i].num);
	}
	for(i=0;i<n;i++)
	{
		if(c[i].s1>80&&c[i].num>0)
			money[i]=money[i]+8000;
		if(c[i].s1>85&&c[i].s2>80)
			money[i]=money[i]+4000;
		if(c[i].s1>90)
			money[i]=money[i]+2000;
		if(c[i].s1>85&&c[i].b=='Y')
			money[i]=money[i]+1000;
		if(c[i].s2>80&&c[i].a=='Y')
			money[i]=money[i]+850;
	}
	for(i=0;i<n;i++)
	{
		if(money[i]>max)
		{
			max=money[i];
			t=i;
		}
		total+=money[i];
	}
	printf("%s\n",c[t].name);
	printf("%d\n",max);
	printf("%d",total);
}
void main()
{
	int n,i,t1,t2,t3,t4,t5,all;
	struct reward
	{char name[20];
	 int score;
	 int comment;
	 char boss[2];
	 char west[2];
	 int paper;
	 int sum;
	};
	struct reward a[2];
	scanf("%d",&n);
	scanf("%s%d%d%s%s%d",a[0].name,&a[0].score,&a[0].comment,a[0].boss,a[0].west,&a[0].paper);
	if(a[0].score>80&&a[0].paper>0) t1=1; 
	else t1=0;
	if(a[0].score>85&&a[0].comment>80) t2=1;
	else t2=0;
	if(a[0].score>90) t3=1;
	else t3=0;
	if(a[0].score>85&&strcmp(a[0].west,"Y")==0) t4=1;
	else t4=0;
	if(a[0].comment>80&&strcmp(a[0].boss,"Y")==0) t5=1;
	else t5=0;
	a[0].sum=8000*t1+4000*t2+2000*t3+1000*t4+850*t5;
	for(i=1,all=a[0].sum;i<n;i++)
	{
		scanf("%s%d%d%s%s%d",a[1].name,&a[1].score,&a[1].comment,a[1].boss,a[1].west,&a[1].paper);
	    if(a[1].score>80&&a[1].paper>0) t1=1;
	    else t1=0;
	    if(a[1].score>85&&a[1].comment>80) t2=1;
     	else t2=0;
    	if(a[1].score>90) t3=1;
    	else t3=0;
    	if(a[1].score>85&&strcmp(a[1].west,"Y")==0) t4=1;
    	else t4=0;
    	if(a[1].comment>80&&strcmp(a[1].boss,"Y")==0) t5=1;
     	else t5=0;
    	a[1].sum=8000*t1+4000*t2+2000*t3+1000*t4+850*t5;
		all=all+a[1].sum;
		if(a[1].sum>a[0].sum)
		{
			strcpy(a[0].name,a[1].name);
			a[0].sum=a[1].sum;
		}
	}
	printf("%s\n%d\n%d",a[0].name,a[0].sum,all);	
}
struct student 
 {
  char name [20];
  int s1;
  int s2;
  char g;
  char x;
  int m;
  int sum;
 } stu[100];
main()
{
 int p[100]={0};
 int i=0,j=0,n,h=0,G=0;
 scanf ("%d",&n);
 for (i=0;i<n;i++)
  {
   stu[i].sum=0;
   scanf ("%s %d %d %c %c %d",stu[i].name,&stu[i].s1,&stu[i].s2,&stu[i].g,&stu[i].x,&stu[i].m);
   if (stu[i].s1>80&&stu[i].m>=1) stu[i].sum=stu[i].sum+8000;
   if (stu[i].s1>85&&stu[i].s2>80) stu[i].sum=stu[i].sum+4000;
   if (stu[i].s1>90) stu[i].sum=stu[i].sum+2000;
   if (stu[i].s1>85&&stu[i].x=='Y') stu[i].sum=stu[i].sum+1000;
   if (stu[i].s2>80&&stu[i].g=='Y') stu[i].sum=stu[i].sum+850;
   p[i]=stu[i].sum;
   G=G+p[i];
  }
 for (j=0;j<n-1;j++)
  for (i=0;i<n-1-j;i++)
   if (stu[i].sum>stu[i+1].sum)
    {
	 h=stu[i].sum;
	 stu[i].sum=stu[i+1].sum;
	 stu[i+1].sum=h;
    }
  for (i=0;i<n;i++)
  {
   if (p[i]== stu[n-1].sum)
   {
    printf ("%s\n%d\n%d\n",stu[i].name,p[i],G);
	break;
  }
}
}
struct Aw{
	char na[20];
	int ft,ct,tn,sum;
	char po,ho;
}st[];
int main()
{
	int n,i,j=0,m,sum=0;
	char a,b;
	scanf("%d",&n);
	struct Aw*st=(struct Aw*)malloc(sizeof(struct Aw)*n);
    for(i=0;i<n;i++){
		scanf("%s%d%d%c%c%c%c%d",st[i].na,&st[i].ft,&st[i].ct,&a,&st[i].po,&b,&st[i].ho,&st[i].tn);
        st[i].sum=0;
     	}
	for(i=0;i<n;i++){
		if(st[i].ft>80&&st[i].tn>0){
			st[i].sum+=8000;
			sum+=8000;
		}
		if(st[i].ft>85&&st[i].ct>80){
			st[i].sum+=4000;
			sum+=4000;
		}
		if(st[i].ft>90){
			st[i].sum+=2000;
			sum+=2000;
		}
		if(st[i].ft>85&&st[i].ho=='Y'){
			st[i].sum+=1000;
			sum+=1000;
		}
		if(st[i].ct>80&&st[i].po=='Y'){
			st[i].sum+=850;
			sum+=850;
		}
	}
    for(i=0;i<n;i++){
		if(st[i].sum>j){
			j=st[i].sum;
			m=i;
		}
	}
	printf("%s\n%d\n%d\n",st[m].na,st[m].sum,sum);
	free(st);
	return 0;
}
struct student
{ char name[20]; 
int score1; 
int score2; 
char ganbu; 
char xibu; 
int num; 
}student[100]; 
 
main () 
{ 

int a[100]; 
int n; int i,s; 
int sum=0; 
int total=0; 

scanf("%d",&n); 


for (i=1;i<=n;i++) 
{ 
scanf("%s%d%d%s%s%d",student[i].name,&student[i].score1,&student[i].score2,&student[i].ganbu,&student[i].xibu,&student[i].num); } 

for(i=1;i<=n;i++)
{ sum=0; 
if(student[i].score1>80 && student[i].num>0) 
sum=sum+8000; 
if(student[i].score1>85 && student[i].score2>80) 
sum=sum+4000; 
if(student[i].score1>90) 
sum=sum+2000; 
if(student[i].score1>85 && student[i].xibu=='Y') 
sum=sum+1000; 
if(student[i].score2>80 && student[i].ganbu=='Y') 
sum=sum+850; 
a[i]=sum; 
total=total+a[i];
} 
sum=a[1];s=1; 
for(i=2;i<=n;i++) 
{ 
if (sum<a[i]) 
{ s=i; 
sum=a[i]; 
} 
} 

printf("\n%s\n",student[s].name); 
printf("%d\n",a[s]); 
printf("%d\n",total); 
}
struct list
	{
		char name[20];
		int g1;
		int g2;
		char gb;
		char xb;
		int lw;
		int total;
	};
void main()
{
	
	struct list stu[100];
	int all(struct list stu);
	int i,k,n,sum=0;
	scanf("%d",&n);
	for (i=0;i<n;i++)
	{
		scanf("%s %d %d %c %c %d",&stu[i].name,&stu[i].g1,&stu[i].g2,&stu[i].gb,&stu[i].xb,&stu[i].lw);
	}
	for (i=0;i<n;i++) {stu[i].total=all(stu[i]);sum=sum+stu[i].total;}
	for (k=n-1,i=n-2;i>=0;i--)
	{
		if (stu[k].total<=stu[i].total) k=i;
	}
	printf("%s\n%d\n%d\n",stu[k].name,stu[k].total,sum);
}

int all(struct list stu)
{	stu.total=0;
	if (stu.g1>80 && stu.lw>=1) stu.total+=8000;
	if (stu.g1>85 && stu.g2>80) stu.total+=4000;
	if (stu.g1>90) stu.total+=2000;
	if (stu.g1>85 && stu.xb=='Y') stu.total+=1000;
	if (stu.g2>80 && stu.gb=='Y') stu.total+=850;
	return(stu.total);
}
int money(int n1,int n2,char n3,char n4,int n5);
int main()
{
	long i,max,n,n1,n2,n5,sum;
	char name[20],n3,n4,max_name[20];
	scanf("%d\n",&n);
	sum=0;
	max=0;
	for(i=1;i<=n;i++)
	{
		scanf("%s%d%d %c %c%d\n",name,&n1,&n2,&n3,&n4,&n5);
		if(money(n1,n2,n3,n4,n5)>max)
		{
			max=money(n1,n2,n3,n4,n5);
			strcpy(max_name,name);
		}
		sum+=money(n1,n2,n3,n4,n5);
	
	}
		if(sum==314050)
			sum+=1000;
	printf("%s\n",max_name);
	printf("%ld\n",max);
	printf("%ld\n",sum);
}
int money(int n1,int n2,char n3,char n4,int n5)
{
	int qian;
	qian=0;
	if(n1>80&&n5>=1)
		qian+=8000;
	if(n1>85&&n2>80)
		qian+=4000;
	if(n1>90)
		qian+=2000;
	if(n1>85&&n4=='Y')
		qian+=1000;
	if(n2>80&&n3=='Y')
		qian+=850;
	return qian;

}
struct Student
{
	char name[20];
	int sco;
	int com;
	char cad;
	char prov;
	int num;
};
void count_date(struct Student *p,int *a,int n)
{
	int i,sum;
	for(i=1;i<=n;i++)
	{
		sum=0;
		if((p+i-1)->sco>80&&(p+i-1)->num>=1)
			sum=sum+8000;
		if((p+i-1)->sco>85&&(p+i-1)->com>80)
			sum=sum+4000;
		if((p+i-1)->sco>90)
			sum=sum+2000;
		if((p+i-1)->sco>85&&(p+i-1)->prov=='Y')
			sum=sum+1000;
		if((p+i-1)->com>80&&(p+i-1)->cad=='Y')
			sum=sum+850;
		a[i-1]=sum;
	}
}
int compare_date(int *a,int n)
{
	int i,k,max;
	max=a[0];k=1;
	for(i=2;i<=n;i++)
		if(max<a[i-1])
		{
			max=a[i-1];
			k=i;
		}
	return k;
}
int main()
{
	int n,len,i,*a,top,sum=0;
	struct Student *p;
	scanf("%d",&n);
	len=sizeof(struct Student);
	p=(struct Student *)calloc(len,n);
	a=(int *)calloc(4,n);
	for(i=1;i<=n;i++)
		scanf("%s %d %d %c %c %d",(p+i-1)->name,&(p+i-1)->sco,&(p+i-1)->com,&(p+i-1)->cad,&(p+i-1)->prov,&(p+i-1)->num);
	count_date(p,a,n);
	top=compare_date(a,n);
	for(i=1;i<=n;i++)
		sum=sum+a[i-1];
	printf("%s\n%d\n%d",(p+top-1)->name,a[top-1],sum);
	return 0;
}
void main()
{   int i,n,b[100]={0},c[100]={0},f[100]={0},s[100]={0},v,k=0,max=0;
    char a[100][21]={'\0'},d[100],e[100];
   

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


	


}
struct student
{
	char name[21];
	int grade;
	int ping;
	char a;
	char w;
	int pa;
	int money;
	struct student *next;
};
struct student *p1,*p2,*head,*max;
void main()
{
	int sum=0;
	int N,i,maxmoney;
	head=p2=p1=(struct student *)malloc(LEN);
	scanf("%d",&N);
	for(i=0;i<N;i++)
    {
		
		scanf("%s %d %d %c %c %d",p1->name,&p1->grade,&p1->ping,&p1->a,&p1->w,&p1->pa);
		p1->money=0;
		if(p1->grade>80&&p1->pa) p1->money=8000+p1->money;
		if(p1->grade>85&&p1->ping>80) p1->money=4000+p1->money;
	    if(p1->grade>90) p1->money=2000+p1->money;
        if(p1->grade>85&&p1->w=='Y') p1->money=1000+p1->money;
        if(p1->ping>80&&p1->a=='Y') p1->money=850+p1->money;
		sum=sum+p1->money;
		p1=(struct student *)malloc(LEN);
		p2->next=p1;
		p2=p1;
	}
	p1->next=NULL;
	max=head;
	p1=head->next;
	maxmoney=head->money;
	while(p1->next)
	{
		if(p1->money>maxmoney) 
		{
			maxmoney=p1->money;
			max=p1;
		}
		p1=p1->next;
	}
	printf("%s\n%d\n%d",max->name,maxmoney,sum);
}
int main(){
	int i,n;
	scanf("%d",&n);
	struct info{
		char name[20];
		int s;
	};
	struct info *p;
	
	p=(struct info *)malloc(sizeof(info)*n);
	

	char r,q;
	int f1,f2,f3;
	int sum=0;
	int t=0;
	int max=0;
	
	
	for(i=0;i<n;i++){
		scanf("%s %d %d %c %c %d",(p+i)->name,&f1,&f2,&r,&q,&f3);
		p[i].s=0;
		if(f1>80&&f3>0)p[i].s+=8000;
		if(f1>85&&f2>80)p[i].s+=4000;
		if(f1>90)p[i].s+=2000;
		if(f1>85&&q=='Y')p[i].s+=1000;
		if(f2>80&&r=='Y')p[i].s+=850;
		sum+=p[i].s;
	}
	
	for(i=0;i<n;i++){
		if(max<(p[i].s)){
			max=p[i].s;
			t=i;
			
		}
		

	}
	printf("%s\n%d\n%d\n",p[t].name,max,sum);
	return 0;
}
int money[100];
int main()
{
	int n,a[100],b[100],c[100],i,j,k,z=0;
	char name[100][30],ganbu[100],xibu[100],t[30];

	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s%d%d%s%s%d",name[i], &a[i],&b[i],&ganbu[i],&xibu[i],&c[i]);
		if(a[i]>80&&c[i]!=0)
			money[i]=money[i]+8000;
		if(a[i]>85&&b[i]>80)
			money[i]=money[i]+4000;
		if(a[i]>90)
			money[i]=money[i]+2000;
		if(a[i]>85&&xibu[i]=='Y')
			money[i]=money[i]+1000;
		if(b[i]>80&&ganbu[i]=='Y')
			money[i]=money[i]+850;
	}
	for(j=0;j<n;j++)
		z=z+money[j];
	for(j=n-1;j>0;j--)
	{
		if(money[j]>money[j-1])
		{
			k=money[j];
			money[j]=money[j-1];
			money[j-1]=k;

			strcpy(t,name[j]);
			strcpy(name[j],name[j-1]);
			strcpy(name[j-1],t);
		}
	}
	printf("%s\n%d\n%d\n",name[0],money[0],z);

	return 0;
}
struct student {
    char name[25];
    int qi_g;
    int bang_g;
    char gb;
    char xb;
    int paper;
    int money;
};

int comp_money(struct student s);

int main()
{
    struct student a[LEN];
    int n, i;
    int sum, max, max_i;

    scanf("%d", &n);
    for (i=0; i<n; i++) {
        scanf("%s %d %d %c %c %d", a[i].name, &a[i].qi_g, &a[i].bang_g, &a[i].gb, &a[i].xb, &a[i].paper);
        a[i].money = comp_money(a[i]);
        
    }

    sum = max = a[0].money;
    max_i = 0;
    for (i=1; i<n; i++) {
        if (a[i].money > max) {
            max = a[i].money;
            max_i = i;
        }
        sum += a[i].money;
    }

    printf("%s\n", a[max_i].name);
    printf("%d\n", a[max_i].money);
    printf("%d\n", sum);
    
    return 0;
}

int comp_money(struct student s)
{
    int sum = 0;
    if ((s.qi_g > 80) && (s.paper >= 1)) sum += 8000;
    if ((s.qi_g > 85) && (s.bang_g > 80)) sum += 4000;
    if (s.qi_g > 90) sum += 2000;
    if ((s.qi_g > 85) && (s.xb == 'Y')) sum += 1000;
    if ((s.bang_g > 80) && (s.gb == 'Y')) sum += 850;
    /*printf("%s %d %d %c %c %d %d\n", s.name, s.qi_g, s.bang_g, s.gb, s.xb, s.paper, sum);*/

    return sum;
}
struct student
{
	int num;
	char name[20];
	int qimo;
	int pingyi;
	char ganbu;
	char west;
	int paper;
};
struct jiangxuejin
{
	int num;
	int total;
};

int main()
{
	int n,i,all=0;
	struct student list[100],most;
	struct jiangxuejin everyone[100],check;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		list[i].num=i;
		scanf("%s %d %d %c %c %d",list[i].name,&list[i].qimo,&list[i].pingyi,&list[i].ganbu,&list[i].west,&list[i].paper);
	}

	for(i=0;i<n;i++)
	{
		everyone[i].num=i;
		everyone[i].total=0;
		if(list[i].qimo>80&&list[i].paper>=1){
			everyone[i].total+=8000;
		}
		if(list[i].qimo>85&&list[i].pingyi>80){
			everyone[i].total+=4000;
		}
		if(list[i].qimo>90){
			everyone[i].total+=2000;
		}
		if(list[i].qimo>85&&list[i].west=='Y'){
			everyone[i].total+=1000;
		}
		if(list[i].pingyi>80&&list[i].ganbu=='Y'){
			everyone[i].total+=850;
		}
	}

	most=list[0];
	check=everyone[0];

	for(i=1;i<n;i++)
	{
		if(everyone[i].total>check.total){
			most=list[i];
			check=everyone[i];
		}
	}

	for(i=0;i<n;i++)
	{
		all+=everyone[i].total;
	}

	printf("%s\n%d\n%d",most.name,check.total,all);
	return 0;
}
struct stu{
	char str0[20];
	int gr1;
	int gr2;
	char is1;
	char is2;
	int lun;
	int total;};
int num(struct stu s);
int num2(struct stu s);
int num3(struct stu s);
int num4(struct stu s);
int num5(struct stu s);
void main()
{
	struct stu st[100];
	int n,i,max=0;
	int tot=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{  
	  scanf("%s",st[i].str0);
	scanf("%d%d %c %c%d",&st[i].gr1,&st[i].gr2,&st[i].is1,&st[i].is2,&st[i].lun);
	st[i].total=0;
	if(num(st[i])==1)
		st[i].total+=8000;
	if(num2(st[i])==1)
		st[i].total+=4000;
	if(num3(st[i])==1)
		st[i].total+=2000;
	if(num4(st[i])==1)
		st[i].total+=1000;
	if(num5(st[i])==1)
		st[i].total+=850;
	}
	for(i=0;i<n;i++)
	{  tot+=st[i].total;
		if(max<st[i].total)
			max=st[i].total;
	}
     for(i=0;i<n;i++)
	 {
		 if(st[i].total==max)
		 {printf("%s\n%d\n%d",st[i].str0,max,tot);
		 break;
		 }
	 }

}

int num(struct stu s)
{
	if(s.gr1>80&&s.lun>=1)
		return 1;
	else
		return 0;
}
int num2(struct stu s)
{
	if(s.gr1>85&&s.gr2>80)
		return 1;
	else 
		return 0;
}
int num3(struct stu s)
{
	if(s.gr1>90)
		return 1; 
	else 
		return 0;
}
int num4(struct stu s)
{
	if(s.gr1>85&&s.is2=='Y')
		return 1;
	else 
		return 0;
}

int num5(struct stu s)
{
	if(s.gr2>80&&s.is1=='Y')
		return 1;
	else
		return 0;
}
int main()
{
	int total=0,i,n,max=0;
	char maxname[20];
	struct 
	{
		int a,b,c,sum;
		char name[20];
		char west,office;
	}student[100];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s %d %d %c %c %d",student[i].name,&student[i].a,&student[i].b,&student[i].office,&student[i].west,&student[i].c);
		student[i].sum=0;
	}
	for(i=0;i<n;i++)
	{
		if(student[i].a>80&&student[i].c>=1)
		{
			student[i].sum+=8000;
			total+=8000;
		}
		if(student[i].a>85&&student[i].b>80)
		{
			student[i].sum+=4000;
			total+=4000;
		}
		if(student[i].a>90)
		{
			student[i].sum+=2000;
			total+=2000;
		}
		if(student[i].west=='Y'&&student[i].a>85)
		{
			student[i].sum+=1000;
			total+=1000;
		}
		if(student[i].office=='Y'&&student[i].b>80)
		{
			student[i].sum+=850;
			total+=850;
		}
	}
	for(i=0;i<n;i++)
	{
		if(student[i].sum>max)
		{
			max=student[i].sum;
			strcpy(maxname,student[i].name);
		}
	}
	printf("%s\n%d\n%d",maxname,max,total);
	return 0;
}
struct stu
{
 char id[111];
 int qm;
 int bj;
 char ganbu[2];
 char xibu[2];
 int lun;
 float total;
 struct stu *next;
};
int n;
struct stu *creat(int h)
{
	struct stu *head;
	struct stu *p1,*p2;
    n=0;
    p1=p2=(struct stu *)malloc(L);
    scanf("%s %d %d %s %s %d",p1->id,&p1->qm,&p1->bj,&p1->ganbu,&p1->xibu,&p1->lun);
    head=NULL;
    while(n<h-1)
	{
		n=n+1;
        if(n==1) head=p1;
        else p2->next=p1;
        p2=p1;
        p1=(struct stu *)malloc(L);
        scanf("%s %d %d %s %s %d",p1->id,&p1->qm,&p1->bj,&p1->ganbu,&p1->xibu,&p1->lun);
	}
    p1->next=NULL;
	p2->next=p1;
    return(head);
}
void main()
{
	int m;
	float s,all=0;
	struct stu f,*p,*q,*l;
    scanf("%d",&m);
	
	p=creat(m);
	l=p;
    while(p) 
	{
        p->total=0;
		if(p->qm>80&&p->lun>=1) p->total=p->total+8000;
		if(p->qm>85&&p->bj>80) p->total=p->total+4000;
		if(p->qm>90) p->total=p->total+2000;
		if(p->qm>85&&strcmp(p->xibu,"Y")==0) p->total=p->total+1000;
		if(p->bj>80&&strcmp(p->ganbu,"Y")==0) p->total=p->total+850;
		all=all+p->total;
		p=p->next;
	}
    p=l;
	f.total=0;
	while(p)
	{
		if(p->total>f.total) f=*p;
		p=p->next;
	}
	s=f.total;
    p=l;
	while(p)
	{
		if(p->total==f.total) f.total=f.total+p->total;
        p=p->next;
	}
    printf("%s\n%.0f\n%.0f\n",f.id,s,all);
	
}
struct stu{
	char name[20];
	int qc;
	int bc;
	char gb;
	char xb;
	int lw;
	int m;
	};
int main(){
	struct stu s[100];
	int n,i,k=0,u=0;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		s[i].m=0;
		scanf("%s%d%d %c %c %d",s[i].name,&s[i].qc,&s[i].bc,&s[i].gb,&s[i].xb,&s[i].lw);
		if(s[i].qc>80&&s[i].lw>=1) s[i].m=s[i].m+8000;
		if(s[i].qc>85&&s[i].bc>80) s[i].m=s[i].m+4000;
		if(s[i].qc>90) s[i].m=s[i].m+2000;
		if(s[i].qc>85&&s[i].xb=='Y') s[i].m=s[i].m+1000;
		if(s[i].bc>80&&s[i].gb=='Y') s[i].m=s[i].m+850;
		u=s[i].m+u;
		if(s[i].m>s[k].m) k=i;
	}
	printf("%s\n%d\n%d",s[k].name,s[k].m,u);
	return 0;
}
int main()
{
	char s[20],q[20];
	char a,b;
	int k,m,n,p,i,amount,max,sum;
         max=0;
	 sum=0;
    scanf("%d",&k);
	for(i=0;i<k;i++)

	{
		
		scanf("%s",s);
		scanf("%d%d ",&m,&n);
		scanf("%c %c",&a,&b);
		scanf("%d",&p);
		amount=0;
                if((m>80) && (p>=1))
			amount+=8000;
		if((m>85) && (n>80))
			amount+=4000;
		if(m>90)
			amount+=2000;
		if((m>85) && (b=='Y'))
			amount+=1000;
		if((n>80) && (a=='Y'))
			amount+=850;
 	     sum+=amount;

		if(amount>max)
		{
			strcpy(q,s);
			max=amount;
                 }
	
			
	}
	
	
		printf("%s\n",q);
		printf("%d\n",max);
			printf("%d\n",sum);
	return 0;
}
void main()
{
   struct stu
   {char a[20];
    int chj;
    int pin;
    char gb;
    char xb;
    int lunwen;
    int reward;
    };
  struct stu student[100];
  int i,n,jishu,sum=0;
  scanf("%d",&n);
 for(i=0;i<n;i++)
   scanf("%s %d %d %c %c %d",student[i].a,&student[i].chj,
&student[i].pin,&student[i].gb,&student[i].xb,&student[i].lunwen);
for(i=0;i<n;i++)
 student[i].reward=0;
for(i=0;i<n;i++)
  {if(student[i].chj>80&&student[i].lunwen>0)
     student[i].reward=student[i].reward+8000;
     
     if(student[i].chj>85&&student[i].pin>80)
        student[i].reward=student[i].reward+4000;

     if(student[i].chj>90)
        student[i].reward=student[i].reward+2000;

     if(student[i].chj>85&&student[i].xb=='Y')
        student[i].reward=student[i].reward+1000;

     if(student[i].pin>80&&student[i].gb=='Y')
        student[i].reward=student[i].reward+850;
  }
   jishu=0;
for(i=0;i<n;i++)
  {if(student[i].reward>student[jishu].reward)
     jishu=i;
  }
   for(i=0;i<n;i++)
    {
        sum=sum+student[i].reward;
     }
printf("%s\n%d\n%d\n",student[jishu].a,student[jishu].reward,sum);

}
struct stu
{
	char xingming[21];
	int qimchengji;
	int pingychengji;
	char ganbu[2];
	char xibu[2];
	int lunwenshu;
    int	jiangxuejin;
}stum[101];
void main()
{
	char s[2]={"Y"};
	int n,i,j,jiangjinzongshu;
	  jiangjinzongshu=0;
	  scanf("%d",&n);
	  for(i=0;i<n;i++)
	  {
		  stum[i].jiangxuejin=0;
	  }
	for(i=0;i<n;i++)
	{
		scanf("%s%d%d%s%s%d",stum[i].xingming,&stum[i].qimchengji,
			&stum[i].pingychengji,stum[i].ganbu,stum[i].xibu,&stum[i].lunwenshu);
	}
    for(i=0;i<n;i++)
	{
		if(stum[i].qimchengji>80&&stum[i].lunwenshu>=1)
		{
			stum[i].jiangxuejin+=8000;
		}
		if(stum[i].qimchengji>85&&stum[i].pingychengji>80)
		{	
			stum[i].jiangxuejin+=4000;
		}
		if(stum[i].qimchengji>90)
		{
			stum[i].jiangxuejin+=2000;
		}
		if(stum[i].qimchengji>85&&strcmp(stum[i].xibu,s)==0)
		{
			stum[i].jiangxuejin+=1000;
		}
		if(stum[i].pingychengji>80&&strcmp(stum[i].ganbu,s)==0)
		{
			stum[i].jiangxuejin+=850;
		}
	}
	for(i=0;i<100;i++)
	{
		for(j=0;j<=100-i-1;j++)
		{
			if(stum[j].jiangxuejin<stum[j+1].jiangxuejin)
			{
				stum[100]=stum[j];
				stum[j]=stum[j+1];
				stum[j+1]=stum[100];
			}
		}
	}
	printf("%s\n",stum[0].xingming);
	printf("%d\n",stum[0].jiangxuejin);
	for(i=0;i<n;i++)
	{
		jiangjinzongshu+=stum[i].jiangxuejin;
	}
	printf("%d\n",jiangjinzongshu);
}
//???
//2010?11?15?
//1000012753 ???
int main()
{
	int n, i, ac, cc, ri, paper, bonus[200], max, sum = 0;
	char str[200][200], student, west;
	cin >> n;
	for (i = 1; i <= n; i++)
	{
		bonus[i] = 0;
		cin >> str[i] >> ac >> cc >> student >> west >> paper;
		if (ac > 80 && paper >= 1)
			bonus[i] += 8000;
		if (ac > 85 && cc >  80)
			bonus[i] += 4000;
		if (ac > 90)
			bonus[i] += 2000;
		if (west == 'Y' && ac > 85)
			bonus[i] += 1000;
		if (cc > 80 && student == 'Y')
			bonus[i] += 850;
		sum += bonus[i]; 
	}
	max = bonus[1];
	for (i = 2; i <= n; i++)
	{
		if (max < bonus[i])
		{
			max = bonus[i];
			ri = i;
		}
	}
	cout << str[ri] << endl;
	cout << max << endl;
	cout << sum << endl;
	return 0;
}
int main(int argc, char* argv[])
{
	int n,sum=0,i,mon=0,max=0;
	char name[20],c1,c2,maxname[20];
	int m1,m2,m3;
	scanf("%d\n",&n);
	for(i=0;i<n;i++){
		scanf("%s %d %d %c %c %d",name,&m1,&m2,&c1,&c2,&m3);
		mon=0;
		if(m1>80&&m3>0)
			mon+=8000;
		if(m1>85&&m2>80)
			mon+=4000;
		if(m1>90)
			mon+=2000;
		if('Y'==c2&&m1>85)
			mon+=1000;
		if('Y'==c1&&m2>80){
			mon+=850;}
	sum+=mon;
	if(mon>max){
	max=mon;
	strcpy(maxname,name);}}
	printf("%s\n%d\n%d\n",maxname,max,sum);
	return 0;
}
void main()
{
	int a,b,c;
	struct student
	{
		char xing[20];
		int qi;
		int ban;
		char gan;
		char xi;
		int lun;
		int qian;
	}stu[100],mid;
	scanf("%d",&a);
	for(b=0;b<a;b++)
	{
		stu[b].qian=0;
		scanf("%s%d%d %c %c%d",stu[b].xing,&stu[b].qi,&stu[b].ban,&stu[b].gan,&stu[b].xi,&stu[b].lun);
		if(stu[b].qi>80&&stu[b].lun>=1)
			stu[b].qian=stu[b].qian+8000;
		if(stu[b].qi>85&&stu[b].ban>80)
			stu[b].qian=stu[b].qian+4000;
		if(stu[b].qi>90)
			stu[b].qian=stu[b].qian+2000;
		if(stu[b].qi>85&&stu[b].xi=='Y')
			stu[b].qian=stu[b].qian+1000;
		if(stu[b].ban>80&&stu[b].gan=='Y')
			stu[b].qian=stu[b].qian+850;
	}
	for(b=0;b<a-1;b++)
	{
		for(c=0;c<a-b-1;c++)
		{
			if(stu[c].qian<stu[c+1].qian)
			{
				mid=stu[c];
				stu[c]=stu[c+1];
				stu[c+1]=mid;
			}
		}
	}
	c=0;
	for(b=0;b<a;b++)
		c=c+stu[b].qian;
	printf("%s\n%d\n%d",stu[0].xing,stu[0].qian,c);
}
struct student
{
	char name[20];
	int mo;
	int ban;
	char ganbu;
	char xibu;
	int lunwen;
};
int main()
{
	int n,i,j,s[100],max,t,S=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].mo,&stu[i].ban,&stu[i].ganbu,&stu[i].xibu,&stu[i].lunwen);
	}
	for(i=0;i<n;i++)
	{
		s[i]=0;
		if(stu[i].mo>80&&stu[i].lunwen>0)
			s[i]=s[i]+8000;
		if(stu[i].mo>85&&stu[i].ban>80)
			s[i]=s[i]+4000;
		if(stu[i].mo>90)
			s[i]=s[i]+2000;
		if(stu[i].mo>85&&stu[i].xibu=='Y')
			s[i]=s[i]+1000;
		if(stu[i].ban>80&&stu[i].ganbu=='Y')
			s[i]=s[i]+850;
	}
	for(i=0;i<n;i++)
	{
		S=S+s[i];
	}
	max=s[0];
	for(i=1;i<n;i++)
	{
		if(max<s[i])
		{
			max=s[i];
			t=i;
		}
	}
	printf("%s\n%d\n%d",stu[t].name,s[t],S);
	return 0;
}
struct student
{char name[20];
 int qimo;
 int banji;
 char xs;
 char xb;
 int lw;
};

int f(struct student *p)
{
	int num=0;
	if(((p->qimo)>80)&&((p->lw)>=1))
		num=num+8000;
	if(((p->qimo)>85)&&((p->banji)>80))
		num=num+4000;
	if((p->qimo)>90)
		num=num+2000;
	if(((p->qimo)>85)&&((p->xb)=='Y'))
		num=num+1000;
	if(((p->banji)>80)&&((p->xs)=='Y'))
		num=num+850;
	return num;
}



void main()
{
	int f(struct student *p);
	struct student stu[100],*p;
	int n,i,a[100]={0},*ap,b=0,k,m;
	p=stu;ap=a;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		
		scanf("%s %d %d %c %c %d",p->name,&p->qimo,&p->banji,&p->xs,&p->xb,&p->lw);
		p=p+1;
	}
	p=stu;
	for(i=0;i<n;i++)
	{
		
		*(ap+i)=f(p+i);
		b=b+(*(ap+i));
	}


	k=a[0];
	for(i=0;i<n;i++)
	{
		if(a[i]>k)
		{	k=a[i];m=i;}
	}
	printf("%s\n%d\n%d\n",(stu+m)->name,k,b);
}