semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
struct member{
	char name[100];
	int a;
	int b;
	char O;
	char W;
	int x;};
int money(struct member p)
{
	int m=0;
    if(p.a>80&&p.x>=1)m+=8000;
	if(p.a>85&&p.b>80)m+=4000;
	if(p.a>90)m+=2000;
	if(p.a>85&&p.W=='Y')m+=1000;
	if(p.b>80&&p.O=='Y')m+=850;
	return m;
}
int main()
{
	struct member p[100];
	int N,i,m[100],max=0,co;
	scanf("%d",&N);
	for(i=0;i<N;i++){
		scanf("%s %d %d %c %c %d",p[i].name,&p[i].a,&p[i].b,&p[i].O,&p[i].W,&p[i].x);
		m[i]=money(p[i]);}
	for(i=0;i<N;i++)
		if(m[i]>max){max=m[i];co=i;}
	int sum=0;
	for(i=0;i<N;i++)sum+=m[i];
	printf("%s\n%d\n%d\n",p[co].name,m[co],sum);
}
main()
{
struct scholarship{
       char name[200];
       int gpa,mate,paper;
       char official,west;
       }stu[100];
int n,sch[100],i,max;
long sum=0;
char num[4];
for(i=0;i<100;i++){
   sch[i]=0;
   }
gets(num);
n=atoi(num);
for(i=0;i<n;i++){
   scanf("%s %d %d %c %c %d",stu[i].name,&stu[i].gpa,&stu[i].mate,&stu[i].official,&stu[i].west,&stu[i].paper);
   }
for(i=0;i<n;i++){
   if(stu[i].gpa>80&&stu[i].paper>=1){
     sch[i]+=8000;
     }
   if(stu[i].gpa>85&&stu[i].mate>80){
      sch[i]+=4000;
      }
   if(stu[i].gpa>90){
      sch[i]+=2000;
     }
   if(stu[i].gpa>85&&stu[i].west=='Y'){
     sch[i]+=1000;
     }
   if(stu[i].mate>80&&stu[i].official=='Y'){
     sch[i]+=850;
     }
   }
max=0;
for(i=0;i<n;i++){
   if(sch[i]>max)
      max=sch[i];
   }
for(i=0;i<n;i++){
   sum+=sch[i];
   }
for(i=0;i<n;i++){
   if(sch[i]==max)
   break;
   }
printf("%s\n%d\n%ld\n",stu[i].name,sch[i],sum);
return 0;
}
void main ( )
{
	int n,i,j;
	char name[100][20],c[100],d[100];
	int a[100],b[100],e[100],t[100],p=0,tot=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
		scanf("%s %d %d %c %c %d",&name[i],&a[i],&b[i],&c[i],&d[i],&e[i]);
	for(i=0;i<n;i++)
	{   
		t[i]=0;
		if(a[i]>80 && e[i]>0)
			t[i]=t[i]+8000;
		if(a[i]>85 && b[i]>80)
			t[i]=t[i]+4000;
		if(a[i]>90)
			t[i]=t[i]+2000;
		if(a[i]>85 && d[i]==89)
			t[i]=t[i]+1000;
		if(b[i]>80 && c[i]==89)
			t[i]=t[i]+850;
		if(t[i]>p)
			p=t[i];
		  tot=tot+t[i];
	}
j=0;
while(t[j]<p)
 j++;
printf("%s\n",name[j]);
printf("%d\n",p);
printf("%d\n",tot);
}
void main()
{
	int n;
	scanf("%d",&n);
	struct student
	{
		char name[32];
		int sco1;
		int sco2;
		char l;
		char w;
		int es;
		int scho;
	};
	struct student stu[n];
	int i;
	for(i=0;i<n;i++)
	{
	    scanf("%s %d %d %c %c %d",stu[i].name,&stu[i].sco1,&stu[i].sco2,&stu[i].l,&stu[i].w,&stu[i].es);
	    stu[i].scho=0;
		if(stu[i].sco1>80&&stu[i].es>0)stu[i].scho+=8000;
		if(stu[i].sco1>85&&stu[i].sco2>80)stu[i].scho+=4000;
		if(stu[i].sco1>90)stu[i].scho+=2000;
		if(stu[i].sco1>85&&stu[i].w=='Y')stu[i].scho+=1000;
		if(stu[i].sco2>80&&stu[i].l=='Y')stu[i].scho+=850;
	}
	int max=stu[0].scho;
	for(i=0;i<n;i++)
	if(stu[i].scho>max)max=stu[i].scho;
	for(i=0;i<n;i++)
	if(stu[i].scho==max)
	{
	    printf("%s\n%d\n",stu[i].name,max);
	    break;
	}
	int sum=0;
	for(i=0;i<n;i++)sum+=stu[i].scho;
	printf("%d\n",sum);
}
struct m
{ int m1,m2,is,sum;
  char n[27],w,a;

}
main()
{ int n,k,s,i,j,m,f1(S),f2(S),f3(S),f4(S),f5(S);
  char *t,a[26];

  struct m *head,*p1,*p2,*tp,*q;
  scanf("%d",&n);
  head=(struct m*)calloc(n,L);
  for(i=0;i<n;i++)
  { p1=head+i;
    scanf("%s%d%d %c %c%d",p1->n,&p1->m1,&p1->m2,&p1->a,&p1->w,&p1->is);
    p1->sum=f1(p1)+f2(p1)+f3(p1)+f4(p1)+f5(p1);

  }
  s=0;
  for(m=head->sum,k=0,i=0;i<n;i++)
  {  if((head+i)->sum>m){k=i;m=(head+i)->sum;}
      s+=(head+i)->sum;
  }
  printf("%s\n%d\n%d",(head+k)->n,m,s);

}
int f1(S)
{  return 8000*(s->m1>80&&s->is>=1);

}
int f2(S)
{ return 4000*(s->m1>85&&s->m2>80);
}
int f3(S)
{ return 2000*(s->m1>90);
}
int f4(S)
{ return 1000*(s->w=='Y'&&s->m1>85);
}
int f5(S)
{ return 850*(s->a=='Y'&&s->m2>80);
}
int main()
{
	struct student
	{
		char name[20];
		int qimo;
		int banji;
		char ganbu;
		char xibu;
		int lunwen;
	};
	int i,n,count[100]={0};
	scanf("%d",&n);

	struct student *pp;
	pp=(struct student *)malloc(sizeof(student)*n);
	for(i=0;i<n;i++)
	{
		scanf("%s %d %d %c %c %d",(pp+i)->name,&((pp+i)->qimo),&((pp+i)->banji),&((pp+i)->ganbu),&((pp+i)->xibu),&((pp+i)->lunwen));	
	}
	for(i=0;i<n;i++)
	{
		if((pp[i].qimo>80)&&(pp[i].lunwen>=1))count[i]+=8000;
		if((pp[i].qimo>85)&&(pp[i].banji>80))count[i]+=4000;
		if(pp[i].qimo>90)count[i]+=2000;
		if((pp[i].qimo>85)&&(pp[i].xibu=='Y'))count[i]+=1000;
		if((pp[i].banji>80)&&(pp[i].ganbu=='Y'))count[i]+=850;
	}
	int max=count[0];
	int p=0;
	int sum=0;
	for(i=0;i<n;i++)
	{
		sum+=count[i];
		if(max<count[i])
		{
			max=count[i];
			p=i;
		}
	}
	printf("%s\n%d\n%d\n",(pp+p)->name,max,sum);
	return 0;
}
int main()
{
	struct stu
	{
		char name[20];
		int a;
		int b;
		char c;
		char d;
		int e;
		int sum;
	};
	struct stu s1,s2;
	int n,i,zong;
	scanf("%d\n",&n);
    scanf("%s %d %d %c %c %d",s1.name,&s1.a,&s1.b,&s1.c,&s1.d,&s1.e);
		s1.sum=0;
		if(s1.a>80&&s1.e>0)
			s1.sum+=8000;
		if(s1.a>85&&s1.b>80)
			s1.sum+=4000;
		if(s1.a>90)
			s1.sum+=2000;
		if(s1.a>85&&s1.d=='Y')
			s1.sum+=1000;
		if(s1.b>80&&s1.c=='Y')
			s1.sum+=850;
		zong=s1.sum;
	for(i=1;i<n;i++)
	{
		scanf("%s %d %d %c %c %d",s2.name,&s2.a,&s2.b,&s2.c,&s2.d,&s2.e);
		s2.sum=0;
		if(s2.a>80&&s2.e)
			s2.sum+=8000;
		if(s2.a>85&&s2.b>80)
			s2.sum+=4000;
		if(s2.a>90)
			s2.sum+=2000;
		if(s2.a>85&&s2.d=='Y')
			s2.sum+=1000;
		if(s2.b>80&&s2.c=='Y')
			s2.sum+=850;
		zong=zong+s2.sum;
		if(s2.sum>s1.sum)
		s1=s2;
	}
	printf("%s\n%d\n%d",s1.name,s1.sum,zong);
return 0;
}
struct student
{
	char name[20];
	int ave;
	int cla;
	char mon;
	char pro;
	int essay;
	int scholar;
};
struct student st[100];
struct student temp;
int main()
{
	int i,N,j,sum=0;
	scanf("%d",&N);
	for(i=0;i<N;i++)
	{
		scanf("%s %d %d %c %c %d",st[i].name,&st[i].ave,&st[i].cla,&st[i].mon,&st[i].pro,&st[i].essay);
		st[i].scholar=0;
		if(st[i].ave>80&&st[i].essay!=0)
			st[i].scholar=st[i].scholar+8000;
		if(st[i].ave>85&&st[i].cla>80)
			st[i].scholar=st[i].scholar+4000;
		if(st[i].ave>90)
			st[i].scholar=st[i].scholar+2000;
		if(st[i].ave>85&&st[i].pro=='Y')
			st[i].scholar=st[i].scholar+1000;
		if(st[i].cla>80&&st[i].mon=='Y')
			st[i].scholar=st[i].scholar+850;
		sum=sum+st[i].scholar;
	}
	for(j=0;j<N-1;j++)
	{
		if(st[j].scholar>=st[j+1].scholar)
		{
			temp=st[j];st[j]=st[j+1];st[j+1]=temp;
		}
	}
	printf("%s\n%d\n%d\n",st[N-1].name,st[N-1].scholar,sum);
}
struct student
{
	char name[20];
	int grade1;
	int grade2;
	char ganbu;
	char west;
	int num;
	int prize;
}stu[100];
int main()
{
	int n,i,max=0,j,total=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s %d %d %c %c %d",stu[i].name,&stu[i].grade1,&stu[i].grade2,&stu[i].ganbu,&stu[i].west,&stu[i].num);
	}
	for(i=0;i<n;i++)
	{
		stu[i].prize=0;
		if(stu[i].grade1>80&&stu[i].num>0)
			stu[i].prize=stu[i].prize+8000;
		if(stu[i].grade1>85&&stu[i].grade2>80)
		    stu[i].prize=stu[i].prize+4000;
		if(stu[i].grade1>90)
			stu[i].prize=stu[i].prize+2000;
		if(stu[i].grade1>85&&stu[i].west==89)
			stu[i].prize=stu[i].prize+1000;
		if(stu[i].grade2>80&&stu[i].ganbu==89)
			stu[i].prize=stu[i].prize+850;

	}
	for(i=0;i<n;i++)
	{
		total=total+stu[i].prize;
	}
	for(i=0;i<n;i++)
	{
		if(stu[i].prize>max)
		{
			j=i;
			max=stu[i].prize;
		}
	}
	printf("%s\n%d\n%d",stu[j].name,stu[j].prize,total);
}
struct m{
	char l[50];
	int a;
	int b;
	char x;
	char y;
	int z;
	int s;
};
struct m la[1000];
struct m mo;
void main()
{
	int n,i,j,zo=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		la[i].z=0;
		scanf("%s %d %d %c %c %d",&la[i].l,&la[i].a,&la[i].b,&la[i].x,&la[i].y,&la[i].z);
	}
	for(i=0;i<n;i++)
	{
		la[i].s=0;
		if(la[i].a>80&&la[i].z!=0)
			la[i].s=la[i].s+8000;
		if(la[i].a>85&&la[i].b>80)
			la[i].s=la[i].s+4000;
		if(la[i].a>90)
			la[i].s=la[i].s+2000;
		if(la[i].a>85&&la[i].y==89)
			la[i].s=la[i].s+1000;
		if(la[i].b>80&&la[i].x==89)
			la[i].s=la[i].s+850;
	}
	for(i=0;i<n-1;i++)
		for(j=0;j<n-1-i;j++)
			if(la[j].s<la[j+1].s)
			{
				mo=la[j];
				la[j]=la[j+1];
				la[j+1]=mo;
			}
	for(i=0;i<n;i++)
		zo=zo+la[i].s;
	printf("%s\n%d\n%d\n",la[0].l,la[0].s,zo);
}
void main()
{
	int n,i,sum[100],b,total,max;
	struct student
	{
		char name[20];
		int score;
		int p;
		char leader;
		char w;
		int paper;
	}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].p,&stu[i].leader,&stu[i].w,&stu[i].paper);
	for(i=0;i<n;i++)
	{
		sum[i]=0;
		if(stu[i].score>80&&stu[i].paper>0)
			sum[i]=sum[i]+8000;
		if(stu[i].score>85)
		{
			if(stu[i].p>80)
				sum[i]=sum[i]+4000;
			if(stu[i].w=='Y')
				sum[i]=sum[i]+1000;
		}
	    if(stu[i].score>90)
			sum[i]=sum[i]+2000;
		if(stu[i].leader=='Y'&&stu[i].p>80)
			sum[i]=sum[i]+850;
	}
	total=sum[0];
	max=sum[0];
	b=0;
	for(i=1;i<n;i++)
	{
		if(max<sum[i])
		{
			max=sum[i];
			b=i;
		}
		total=total+sum[i];
	}
	printf("%s\n%d\n%d",stu[b].name,sum[b],total);
}
int yuanshi(int a,int b)
{
	if(a>80&&b>=1)
		return 8000;
	else return 0;
}
int wusi(int a,int b)
{
	if(a>85&&b>80)
		return 4000;
	else return 0;
}
int chengji(int a)
{
	if(a>90) return 2000;
	else return 0;
}
int xibu(int a,char c)
{
	if(a>85&&c=='Y') return 1000;
	else return 0;
}
int banji(int b,char d)
{
	if(b>80&&d=='Y') return 850;
	else return 0;
}

int main()
{
	int a[120],b[102],c[120],i,n,qian[102],zong=0,max=0,wei;
	char mingzi[102][30],xue[102],xi[100];
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		scanf("%s %d %d %c %c %d",mingzi[i],&a[i],&b[i],&xue[i],&xi[i],&c[i]);
		qian[i]=(yuanshi(a[i],c[i])+wusi(a[i],b[i])+chengji(a[i])+xibu(a[i],xi[i])+banji(b[i],xue[i]));
		zong+=qian[i];
		if(qian[i]>max) {
			max=qian[i];
			wei=i;
		}
	}
	printf("%s\n%d\n%d\n",mingzi[wei],qian[wei],zong);



		return 0;


			







}
void main()
{
	struct student
	{
		char name[20];
		int a;
		int b;
		char c;
		char d;
		int num;
		int money;
	}stu[100];
	int n,i,j=0,he=0,max=0;
	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].c,&stu[i].d,&stu[i].num);
		stu[i].money=0;
	}
	for(i=0;i<n;i++)
	{
		if(stu[i].a>80&&stu[i].num>=1)
			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].d=='Y')
			stu[i].money=stu[i].money+1000;
		if(stu[i].b>80&&stu[i].c=='Y')
			stu[i].money=stu[i].money+850;
	}
	for(i=0;i<n;i++)
		if(stu[i].money>max)
		{
			max=stu[i].money;
			j=i;
		}
    for(i=0;i<n;i++)
	{
		he=he+stu[i].money;
	}
	printf("%s\n%d\n%d\n",stu[j].name,max,he);
}
struct student
{
	char name[20];
	int final;
	int classgrade;
	char leader;
	char west;
    int essay;
	int total;
};
int main()
{
struct student stu[100];
struct student m;
int n,i,a,b,c,d,e,TOTAL;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%s %d %d %c %c %d",stu[i].name,&stu[i].final,&stu[i].classgrade,&stu[i].leader,&stu[i].west,&stu[i].essay);
}
TOTAL=0;
for(i=0;i<n;i++){
a=0;b=0;c=0;d=0;e=0;
if(stu[i].final>80&&stu[i].essay>=1)
a=8000;
if(stu[i].final>85&&stu[i].classgrade>80)
b=4000;
if(stu[i].final>90)
c=2000;
if(stu[i].final>85&&stu[i].west=='Y')
d=1000;
if(stu[i].classgrade>80&&stu[i].leader=='Y')
e=850;
stu[i].total=a+b+c+d+e;
TOTAL=TOTAL+stu[i].total;
}
for(i=n-1;i>=0;i--){
if(stu[i-1].total<stu[i].total)
{
m=stu[i-1];
stu[i-1]=stu[i];
stu[i]=m;
}
}
printf("%s\n%d\n%d",stu[0].name,stu[0].total,TOTAL);
return 0;
}
struct Scholarship
{
	char name[20];
	int final;
	int classmate;
	char leader;
	char westerner;
	int paper;
	double sum;
}a[100];

int main()
{
	int n;
	int i,j;
	int count=0;
	double max=0,total=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s %d %d %c %c %d",a[i].name,&a[i].final,&a[i].classmate,&a[i].leader,&a[i].westerner,&a[i].paper);
	}
	for(i=0;i<n;i++)
	{
		a[i].sum=0;
		if(a[i].final>80 && a[i].paper>=1)
			a[i].sum=a[i].sum+8000;
		if(a[i].final>85 && a[i].classmate>80)
			a[i].sum=a[i].sum+4000;
		if(a[i].final>90)
			a[i].sum=a[i].sum+2000;
		if(a[i].final>85 && a[i].westerner=='Y')
			a[i].sum=a[i].sum+1000;
		if(a[i].classmate>80 && a[i].leader=='Y')
			a[i].sum=a[i].sum+850;
		total=total+a[i].sum;
	}
	for(i=0;i<n;i++)
	{
		if(a[i].sum>max)
		{
			max=a[i].sum;
			count=i;
		}
	}
	printf("%s\n",a[count].name);
	printf("%.0lf\n",a[count].sum);
	printf("%.lf\n",total);
	return 0;
}
int sum=0,N;

struct student
{
  char name[20];
  int qimo;
  int zongping;
  char ganbu;
  char xibu;
  int lunwen;
  int total;
  struct student *next;
};//????????

void main()
{
  struct student *head,*pmax;
  struct student *p,*p1,*p2;
  int n;
  int max=0;
  
  scanf("%d",&N);

  
 
/*
  p1=p2=(struct student*)malloc(LEN);
  scanf("%s %d %d %c %c %d",p1->name,&p1->qimo,&p1->zongping,&p1->ganbu,&p1->xibu,&p1->lunwen);
  p1->total=0;
  
  p1->next=NULL;  //???p1->next???
  head=p1;
  
  for(n=0;n<N-1;n++)
  {
   	p2=p1;
	p1=(struct student*)malloc(LEN);
    scanf("%s %d %d %c %c %d",&p1->name,&p1->qimo,&p1->zongping,&p1->ganbu,&p1->xibu,&p1->lunwen);
	p1->total=0;
	p1->next=NULL;
	p2->next=p1;
  }
  */

  
 
  for(n=0;n<N;n++)
  {
   	 
	
	p2=p1;
	p1=(struct student*)malloc(LEN);
    scanf("%s %d %d %c %c %d",&p1->name,&p1->qimo,&p1->zongping,&p1->ganbu,&p1->xibu,&p1->lunwen);
	p1->total=0;
	p1->next=NULL;
	
	if(n==0) head=p1;
	else  p2->next=p1;
  }
  
   
  
 
   for(max=0,p=pmax=head;p!=NULL;p=p->next)
  {
    if(p->qimo>80&&p->lunwen>=1)     p->total=p->total+8000;
	if(p->qimo>85&&p->zongping>80)  p->total=p->total+4000;
	if(p->qimo>90)                  p->total=p->total+2000;
	if(p->qimo>85&&p->xibu=='Y')    p->total=p->total+1000;
    if(p->zongping>80&&p->ganbu=='Y')   p->total=p->total+850;

	sum=sum+p->total;
	if(max<p->total) 
	{
		max=p->total;
		pmax=p;
	}
  }
  
  

 
  
 // head=creat();
  //pmax=cal(head);
  printf("%s\n%d\n%d\n",pmax->name,pmax->total,sum);
}
struct student
{
	char name[30];
	int mark1;
	int mark2;
	char worker;
	char west;
	int paper;
	int RMB;
}stu[Max];
int main()
{
	int n,i=0,j,S=0,b[Max],t;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		stu[i].RMB=0;
		scanf("%s%d%d %c %c%d",stu[i].name,&stu[i].mark1,&stu[i].mark2,&stu[i].worker,&stu[i].west,&stu[i].paper);
		if(stu[i].mark1>80&&stu[i].paper!=0)
			stu[i].RMB=stu[i].RMB+8000;
		if(stu[i].mark1>85&&stu[i].mark2>80)
			stu[i].RMB=stu[i].RMB+4000;
		if(stu[i].mark1>90)
			stu[i].RMB=stu[i].RMB+2000;	
		if(stu[i].mark2>80&&stu[i].worker=='Y')
			stu[i].RMB=stu[i].RMB+850;
		if(stu[i].mark1>85&&stu[i].west=='Y')
			stu[i].RMB=stu[i].RMB+1000;
	
		b[i]=stu[i].RMB;
	}
	for(i=0;i<n;i++)
	{
		S=S+stu[i].RMB;
	}

	for(i=1;i<n;i++)
		for(j=0;j<n-i;j++)
		{
			if(b[j+1]<b[j])
			{
				t=b[j+1];
			b[j+1]=b[j];
			b[j]=t;
			}
		}
	for(i=0;i<n;i++)
		if(stu[i].RMB==b[n-1]){

			printf("%s\n%d\n%d\n",stu[i].name,stu[i].RMB,S);
break;}
			return 0;
}
void main()
{
	int n,i,j,k,t,yuanshi,wusi,chengji,xibu,banji;long sum=0;

	struct st{  
	        	   char name[23];
		            int score;
	                int essay;
	                int pingyi;
					char area;
                    char position;
					int money;
	} stu[103];
	struct st s;
	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].position,&stu[i].area,&stu[i].essay);
		for(i=0;i<n;i++)
		{
        yuanshi=0;
		wusi=0;
		chengji=0;
		xibu=0;
		banji=0;
			if(stu[i].score>80&&stu[i].essay>0)
				yuanshi=8000;
	       if(stu[i].score>85&&stu[i].pingyi>80)
			   wusi=4000;
		   if(stu[i].score>90)
			   chengji=2000;
		   if(stu[i].score>85&&stu[i].area=='Y')
			  xibu=1000;
		   if(stu[i].pingyi>80&&stu[i].position=='Y')
			   banji=850;
	       stu[i].money=yuanshi+wusi+chengji+xibu+banji;
		}
		
		for(i=0,sum=0;i<n;i++)
			sum=sum+stu[i].money;
		for(i=0;i<n;i++)
			for(j=0;j<n-i;j++)
				if(stu[i].money>stu[j].money)
				{
					s=stu[i];stu[i]=stu[j];stu[j]=s;
				}
    printf("%s\n%d\n%ld\n",stu[0].name,stu[0].money,sum);	
	
	
}
struct qian
{
	char a[20];
	int b[1];
	int c[1];
	char d[2];
	char e[2];
	int f[1];
}stu[100];

void main()
{
	int n,k,x,y=0,total=0,i,sum[100]={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++)
	{  
		k=0;
		if(stu[i].b[0]>80&&stu[i].f[0]>=1)k=k+8000;
		if(stu[i].b[0]>85&&stu[i].c[0]>80)k=k+4000;
		if(stu[i].b[0]>90)k=k+2000;
		if(stu[i].b[0]>85&&stu[i].e[1]=='Y')k=k+1000;
		if(stu[i].c[0]>80&&stu[i].d[1]=='Y')k=k+850;
		sum[i]=k;
	}
	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%d\n%d\n",stu[y].a,x,total);
}
int main()
{
	struct Student{
		char name[50];
		int cj,py,lw,sum;
		char gb,xb;
	}stu[100],temp;
	
	int n,i,sum=0,j,k;
	scanf("%d",&n);
	for (i=0;i<n;i++){
		scanf("%s%d%d %c %c%d",&stu[i].name,&stu[i].cj,&stu[i].py,&stu[i].gb,&stu[i].xb,&stu[i].lw);
	}
	for (i=0;i<n;i++){
		stu[i].sum=0;
		if (stu[i].cj>80&&stu[i].lw>=1) stu[i].sum+=8000;
		if (stu[i].py>80&&stu[i].gb=='Y') stu[i].sum+=850;
		if (stu[i].cj>85&&stu[i].py>80) stu[i].sum+=4000;
		if (stu[i].cj>85&&stu[i].xb=='Y') stu[i].sum+=1000;
		if (stu[i].cj>90) stu[i].sum+=2000;
	}
	
	for (i=0;i<n;i++){
		sum+=stu[i].sum;
	}
	
	for (i=0;i<n;i++){
		for (j=i+1;j<n;j++){
			if (stu[j].sum>stu[i].sum){
				temp=stu[j];
				for (k=j;k>i;k--){
					stu[k]=stu[k-1];
				}
				stu[i]=temp;
			}
		}
	}
	printf("%s\n%d\n%d",stu[0].name,stu[0].sum,sum);
	return 0;
}
int main(int argc, char* argv[])
{
	int n,i,j,a,b,e,max1=0,max2=0;
	char name[100],NAME[100];
	int sum[100];
	char c,d;
	int s[5];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		for(j=0;j<5;j++) s[j]=0;
		scanf("%s%d%d %c %c%d",name,&a,&b,&c,&d,&e);
		if(a>80&&e>=1) s[0]++;
		if(a>85&&b>80) s[1]++;
		if(a>90) s[2]++;
		if(a>85&&d=='Y') s[3]++;
		if(b>80&&c=='Y') s[4]++;
		sum[i]=8000*s[0]+4000*s[1]+2000*s[2]+1000*s[3]+850*s[4];
		if(sum[i]>max1) 
		{
			max1=sum[i];
			strcpy(NAME,name);
			for(j=0;j<100;j++) name[j]='\0';
		}
	}
	for(i=0;i<n;i++) max2=max2+sum[i];
	printf("%s\n%d\n%d\n",NAME,max1,max2);
	return 0;
}
struct student
{
	char name[20];
	int qimo;
	int banji;
	char ganbu;
	char xibu;
	int lunwen;
	long int qian;
}stu[100];

void yunsuan(struct student *a)
{
	int sum=0;
	if(a->qimo >80&&a->lunwen >=1)
		sum+=8000;
	if(a->qimo >85&&a->banji >80)
		sum+=4000;
	if(a->qimo >90)
		sum+=2000;
	if(a->qimo>85 &&a->xibu =='Y')
		sum+=1000;
	if(a->ganbu =='Y'&&a->banji >80)
		sum+=850;
	a->qian =sum;
}

int max(struct student *pt,int n)
{
	int max=0,i,hz;
	for(i=0;i<n;i++)
	{
		if(pt->qian >max)
		{max=pt->qian ;
		hz=i;}
		pt++;
	}

	return hz;
}
		 

int main()
{
	int n,i,m,sum=0;
	scanf("%d", &n);
	for(i=0;i<n;i++)
	{
		scanf("%s %d %d %c %c %ld", stu[i].name ,&stu[i].qimo, &stu[i].banji ,&stu[i].ganbu ,&stu[i].xibu ,&stu[i].lunwen );
		yunsuan(&stu[i]);
		sum+=stu[i].qian ;
	}

	m=max(stu,n);
	printf("%s\n%d\n%ld\n", stu[m].name ,stu[m].qian, sum);
	return 0;
}
void main()
{
	int n,qimo[100],banji[100],lunwen[100];
	int i,j;int jiangxuejing[100];int sunxu[100];
	char xingming[100][20],ganbu[100],xibu[100];
	scanf("%d",&n);
	for(i=0;i<=n-1;i++)
	{
	 scanf("%s %d %d %c %c %d",xingming[i],&qimo[i],&banji[i],&ganbu[i],&xibu[i],&lunwen[i]);
	 sunxu[i]=i;
	}
	for(i=0;i<=n-1;i++)
	{   
		int a=0,b=0,c=0,d=0,e=0;
		if(qimo[i]>80&&lunwen[i]>=1)
		{a=a+1;}
		if(qimo[i]>85&&banji[i]>80)
		{b=b+1;}
		if(qimo[i]>90)
		{c=c+1;}
		if(qimo[i]>85&&xibu[i]=='Y')
		{d=d+1;}
		if(banji[i]>80&&ganbu[i]=='Y')
		{e=e+1;}
		jiangxuejing[i]=a*8000+b*4000+c*2000+d*1000+e*850;
	}
	int t,k,p;char c;
	for(i=0;i<=n-2;i++)
		for(j=0;j<=n-2-i;j++)
		{
			if(jiangxuejing[j]<jiangxuejing[j+1])
			{
				t=jiangxuejing[j];
				jiangxuejing[j]=jiangxuejing[j+1];
				jiangxuejing[j+1]=t;
				p=sunxu[j];
				sunxu[j]=sunxu[j+1];
				sunxu[j+1]=p;
				for(k=0;k<=19;k++)
				{
					c=xingming[j][k];
					xingming[j][k]=xingming[j+1][k];
					xingming[j+1][k]=c;
				}
			}
		}
		int max=0;
		for(i=0;i<=n-1;i++)
		{
			if(jiangxuejing[i]>max)
			{max=jiangxuejing[i];}
		}
		int jishuqi=0;
		for(j=0;j<=n-1;j++)
		{
			if(jiangxuejing[j]==max)
			{jishuqi=jishuqi+1;}
		}
		int m=0;
		for(i=0;i<=n-1;i++)
		{m=m+jiangxuejing[i];}
		if(jishuqi==1)
		{
		printf("%s\n",xingming[0]);
		printf("%d\n",jiangxuejing[0]);
		printf("%d\n",m);
		}
		if(jishuqi>1)
		{
			for(i=0;i<=jishuqi-2;i++)
				for(j=0;j<=jishuqi-2-i;j++)
			{
				if(sunxu[j]>sunxu[j+1])
				{
					t=sunxu[j];
					sunxu[j]=sunxu[j+1];
					sunxu[j+1]=t;
					for(k=0;k<=99;k++)
					{
					   c=xingming[j][k];
					   xingming[j][k]=xingming[j+1][k];
				       xingming[j+1][k]=c;
					}
				}
			}
             printf("%s\n",xingming[0]);
		     printf("%d\n",jiangxuejing[0]);
		     printf("%d\n",m);
		}
}
void main()
{
	int n,i,j,s,max;
	int qimo[150],ban[150],lun[150],zong[150];
	char name[150][20],xue[150],xi[150],the[20];
	
	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++)
	{
		zong[i]=0;
		
		if(qimo[i]>80 && lun[i]>=1)
			zong[i]=zong[i]+8000;
		if(qimo[i]>85 && ban[i]>80)
			zong[i]=zong[i]+4000;
		if(qimo[i]>90)
			zong[i]=zong[i]+2000;
		if(qimo[i]>85 && xi[i]=='Y')
			zong[i]=zong[i]+1000;
		if(ban[i]>80 && xue[i]=='Y')
			zong[i]=zong[i]+850;
	}

	max=zong[0];
	strcpy(the,name[0]);
	
	for(i=1;i<n;i++)
		if(zong[i]>max)
		{
			max=zong[i];
			strcpy(the,name[i]);
		}


	s=0;

	for(i=0;i<n;i++)
		s=s+zong[i];


		printf("%s\n",the);
		printf("%d\n",max);

	printf("%d\n",s);
}
struct student
{
	char name[20];
	int grade1;
	int grade2;
	char gb;
	char xb;
	int lunwen;
};
struct student stu[100],t;
void main()
{
	int n,i,jj[100]={0},maxjj,sum=0,j,k;
	char maxname[20];
	scanf("%d",&n);
	for(i=0;i<n;i++)
		scanf("%s %d %d %c %c %d",stu[i].name,&stu[i].grade1,&stu[i].grade2,&stu[i].gb,&stu[i].xb,&stu[i].lunwen);
	for(i=0;i<n;i++)
	{
		if(stu[i].grade1>80&&stu[i].lunwen>=1)
			jj[i]=jj[i]+8000;
		if(stu[i].grade1>85&&stu[i].grade2>80)
			jj[i]=jj[i]+4000;
		if(stu[i].grade1>90)
			jj[i]=jj[i]+2000;
		if(stu[i].grade1>85&&stu[i].xb=='Y')
			jj[i]=jj[i]+1000;
		if(stu[i].grade2>80&&stu[i].gb=='Y')
			jj[i]=jj[i]+850;
	}
	for(j=0;j<n-1;j++)
	{
		for(i=0;i<n-1-j;i++)
		{
			if(jj[i]<jj[i+1])
			{
				t=stu[i];
				stu[i]=stu[i+1];
				stu[i+1]=t;
				k=jj[i];
				jj[i]=jj[i+1];
				jj[i+1]=k;		
			}
		}
	}
	maxjj=jj[0];
	strcpy(maxname,stu[0].name);
	for(i=0;i<n;i++)
		sum=sum+jj[i];
	printf("%s\n",maxname);
	printf("%d\n",maxjj);
	printf("%d\n",sum);
}
struct student
{
	char name[20];
	int score;
	int ping;
	char zhiwu;
	char xibu;
	int lun;
	int money;
	struct student *next;
};
int n;
struct student *creat(int n)
{
	struct student *head,*p1,*p2;
	int i=1;
	head=p1=(struct student *)malloc(LEN);
	scanf("%s %d %d %c %c %d",p1->name,&p1->score,&p1->ping,&p1->zhiwu,&p1->xibu,&p1->lun);

    p1->money=0;
	if(p1->score>80&&p1->lun>=1)p1->money=p1->money+8000;
	if(p1->score>85&&p1->ping>80)p1->money=p1->money+4000;
    if(p1->score>90)p1->money=p1->money+2000;
    if(p1->score>85&&p1->xibu=='Y')p1->money=p1->money+1000;
    if(p1->zhiwu=='Y'&&p1->ping>80)p1->money=p1->money+850;
    head=p1;
	while(i<=n-1)
	{
		i=i+1;
		p2=(struct student *)malloc(LEN);
		scanf("%s %d %d %c %c %d",p2->name,&p2->score,&p2->ping,&p2->zhiwu,&p2->xibu,&p2->lun);
		p2->money=0;
		if(p2->score>80&&p2->lun>=1)p2->money=p2->money+8000;
		if(p2->score>85&&p2->ping>80)p2->money=p2->money+4000;
		if(p2->score>90)p2->money=p2->money+2000;
		if(p2->score>85&&p2->xibu=='Y')p2->money=p2->money+1000;
		if(p2->zhiwu=='Y'&&p2->ping>80)p2->money=p2->money+850;
		p1->next=p2;
		p1=p2;
	}
	p1->next=0;
	return(head);
}
void main()
{
	struct student *head,*p,*t;
	long n,i,max=0,sum=0;
	scanf("%d",&n);
	head=creat(n);
	p=head;
	for(i=1;i<=n;i++)
	{
		sum=sum+p->money;
		if(p->money>max){max=p->money;t=p;}
		p=p->next;
	}
	printf("%s\n%d\n%ld\n",t->name,t->money,sum);
}