semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
void main()
{
	int n,z=0,sum=0,i,max=0;scanf("%d",&n);
	struct st
	{
		char na[30];
		int s1;
		int s2;
		char x1;
		char x2;
		int l;
		int b;
		struct st *next;
	}*p,*head,*p1,*p2,*q;
p1=p2=(struct st *)malloc(sizeof(struct st));head=p1;
do
{
	scanf("%s %d %d %c %c %d",p1->na,&p1->s1,&p1->s2,&p1->x1,&p1->x2,&p1->l);
	z++;
	p1->b=0;if(p1->s1>80&&p1->l>=1)p1->b+=8000;if(p1->s1>85&&p1->s2>80)p1->b+=4000;if(p1->s1>90)p1->b+=2000;
	if(p1->s1>85&&p1->x2=='Y')p1->b+=1000;if(p1->s2>80&&p1->x1=='Y')p1->b+=850;
	p1=(struct st *)malloc(sizeof(struct st));p2->next=p1;p2=p1;
}while(z!=n);
p1=NULL;
z=0;
p=head;
do
{
	sum+=p->b;
	if(p->b>max){max=p->b;q=p;}
z++;	
p=p->next;
}while(z!=n);
printf("%s\n%d\n%d\n",q->na,max,sum);

}
main()
{
      int n;
      int max=0;
      struct xinxi
      {
            char name[21];
            int average;
            int evaluate;
            char ganbu;
            char xibu;
            int amount;
      };
      long sum=0;
      struct xinxi stu[100];
      char most[21];
      int scholarship;
      int i,j,k,s,p,q;
      scanf("%d",&n);
      for(i=0;i<n;i++)
      {
          scanf("%s %d %d %c %c %d",stu[i].name,&stu[i].average,&stu[i].evaluate,&stu[i].ganbu,&stu[i].xibu,&stu[i].amount);
          scholarship=0;
          if((stu[i].average>80)&&(stu[i].amount>0)) {scholarship+=8000;}
          if((stu[i].average>85)&&(stu[i].evaluate>80)) {scholarship+=4000;}
          if(stu[i].average>90) {scholarship+=2000;}
          if((stu[i].average>85)&&(stu[i].xibu=='Y')) {scholarship+=1000;}
          if((stu[i].evaluate>80)&&(stu[i].ganbu=='Y')) {scholarship+=850;}
          sum+=scholarship;
          if(scholarship>max)
          {
              strcpy(most,stu[i].name);
              max=scholarship;
          }
      }
      printf("%s\n%d\n%ld",most,max,sum);
      getchar();
      getchar();
}
struct student
{
	char name[20];
	int score1;
	int score2;
	char leader[2];
	char west[2];
	int paper;
	int money;
	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));
	head=p1;
	for(i=0;i<n;i++)
	{
		p2=p1;
		scanf("%s%d%d%s%s%d",p1->name,&p1->score1,&p1->score2,&p1->leader,&p1->west,&p1->paper);
		{
			p1->money=0;
			if(p1->score1>80&&p1->paper!=0)
				p1->money=p1->money+8000;
			if(p1->score1>85&&p1->score2>80)
				p1->money=p1->money+4000;
			if(p1->score1>90)	
				p1->money=p1->money+2000;
			if(p1->score1>85&&(strcmp(p1->west,"Y")==0))
				p1->money=p1->money+1000;
			if(p1->score2>80&&(strcmp(p1->leader,"Y")==0))
				p1->money=p1->money+850;
		}
		p1=(struct student *)malloc(sizeof(struct student));
		p2->next=p1;
	}
	p2->next=NULL;
	return(head);
}
void print(struct student *head)
{
	struct student *p1;
	int max,all=0;
	p1=head;
	max=p1->money;
	do
	{
		if(p1->money>max)
			max=p1->money;
		all=all+p1->money;
		p1=p1->next;
	}
	while(p1->next!=NULL);
	if(p1->money>max)
		max=p1->money;
	all=all+p1->money;
	p1=head;
	for(;p1->next!=NULL;)
	{
		if(p1->money==max)
		{
			printf("%s\n%d\n",p1->name,p1->money);
			break;
		}
		p1=p1->next;
	}
	printf("%d",all);
}
void print1(struct student *head)
{
	struct student *p1;
	p1=head;
	do
	{
		printf("%s %d %d %s %s %d %d\n",p1->name,p1->score1,p1->score2,p1->leader,p1->west,p1->paper,p1->money);
		p1=p1->next;
	}
	while(p1!=NULL);
}
void main()
{
	int n;
	struct student *head;
	scanf("%d",&n);	
	head=creat(n);
	/*print1(head);*/
	print(head);
}
int main()
{
	char name[1000][1000],leader,west,tem[1000];
	int n,i,all=0,j,a,b,t,money[5],sum[1000],paper;
      scanf("%d",&n);
	  for(i=0;i<n;i++)
	  {
		  scanf("%s %d %d %c %c %d",name[i],&a,&b,&leader,&west,&paper);
          if(a>80&&paper>0)money[0]=8000;else money[0]=0;
		  if(a>85&&b>80)money[1]=4000;else money[1]=0;
		  if(a>90)money[2]=2000;else money[2]=0;
		  if(a>85&&west=='Y')money[3]=1000;else money[3]=0;
		  if(b>80&&leader=='Y')money[4]=850;else money[4]=0;
		  sum[i]=money[0]+money[1]+money[2]+money[3]+money[4];
	  }
	  for(i=0;i<n;i++)
		  all+=sum[i];
	  for(j=0;j<n-1;j++)
		  for(i=0;i<n-1-j;i++)
			  if(sum[i]<sum[i+1])
			  {
				   t=sum[i];
				   sum[i]=sum[i+1];
				   sum[i+1]=t;
                   strcpy(tem,name[i]);
				   strcpy(name[i],name[i+1]);
				   strcpy(name[i+1],tem);
			  }
			  printf("%s\n%d\n%d",name[0],sum[0],all);


			return 0;
			
}
struct fuckme
{
	char name[20];
	int final;
	int judge;
	char leader;
	char west;
	int paper;
}student[101];

int main()
{
	int max(int total[101], int n);
	int n,k,N=0;
	int i;
	int yuanshi[101]={0},wusi[101]={0},youxiu[101]={0},
		xibu[101]={0},gongxian[101]={0},total[101];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s %d %d %c %c %d",student[i].name,&student[i].final,
			&student[i].judge,&student[i].leader,&student[i].west,
			&student[i].paper);
		if(student[i].final>80&&student[i].paper>0)
			yuanshi[i]=8000;
		if(student[i].final>85&&student[i].judge>80)
			wusi[i]=4000;
		if(student[i].final>90)
			youxiu[i]=2000;
		if(student[i].final>85&& student[i].west=='Y')
			xibu[i]=1000;
		if(student[i].judge>80&& student[i].leader=='Y')
			gongxian[i]=850;
		total[i]=yuanshi[i]+wusi[i]+youxiu[i]+xibu[i]+gongxian[i];
		N+=total[i];
	}
	k=max(total,n);
	printf("%s\n%d\n%d\n",student[k].name,total[k],N);
	return 0;
}

int max(int total[101], int n)
{
	int a=0,j=0,k=0;
	for(j=0;j<n;j++)
	{
		if(total[j]>a)
		{
			a=total[j];
			k = j;
		}
	}
	return k;
}
void main()
{
	int N, i, num1[100]={0}, num2[100]={0}, scholar[100]={0}, x, y, sum;
	char name[100][20], condition[100][7];
	scanf("%d", &N);
	for(i=0;i<N;i++){
		scanf("%s%d%d", name[i], &num1[i], &num2[i]);
		gets(condition[i]);
	}
	for(i=0;i<N;i++){
		if((num1[i]>80) && (condition[i][5] != '0'))
			scholar[i]+=8000;
		if((num1[i]>85) && (num2[i]>80))
			scholar[i]+=4000;
		if(num1[i]>90)
			scholar[i]+=2000;
		if((num1[i]>85) && (condition[i][3] == 'Y'))
			scholar[i]+=1000;
		if((num2[i]>80) && (condition[i][1] == 'Y'))
			scholar[i]+=850;
	}
	sum=scholar[0];
	for(i=1;i<N;i++){
		if(scholar[i]>x){
			x=scholar[i];
			y=i;
		}
		sum+=scholar[i];
	}
	printf("%s\n%d\n%d", name[y], x, sum);
}
int main(){
	int n,i,j=0,k=0,r,o=0;
	scanf("%d",&n);
	char renming[200][20],ganbu[200],xibu[200];
	int a[200],b[200],c[200],total[200];
	for(i=0;i<n;i++){
		scanf("%s %d %d %c %c %d",&renming[i],&a[i],&b[i],&ganbu[i],&xibu[i],&c[i]);}
	for(i=0;i<n;i++){
		total[i]=0;
		if(a[i]>80&&c[i]>0){total[i]+=8000;}
		if(a[i]>85&&b[i]>80){total[i]+=4000;}
		if(a[i]>90){total[i]+=2000;}
		if(a[i]>85&&xibu[i]=='Y'){total[i]+=1000;}
		if(b[i]>80&&ganbu[i]=='Y'){total[i]+=850;}
		if(total[i]>j){j=total[i];r=i;}
		o+=total[i];
	}printf("%s\n%d\n%d",renming[r],j,o);
	return 0;
}
struct student
{
	char name[20];
	int grade;
	int mark_class;
	char monitor;
	char west;
	int paper;
	int money;
};

int c_to_d(char c[]);

void main ()
{
	int n,len;
	struct student stu[100];
    int i,j,k,l,m;
	int total=0;
	
	scanf("%d",&n);
	getchar();

	for(i=0;i<n;i++)
	{
		char help[35];
		gets(help);
		len=strlen(help);

		for(j=0;;j++)
		{
			if(help[j]==' ') {stu[i].name[j]='\0';break;}
			stu[i].name[j]=help[j];
		}
		j++;

		for(k=0;;k++)
		{
			char help2[3];
			if(help[j+k]==' ') {help2[k]='\0';stu[i].grade=c_to_d(help2);break;}
			help2[k]=help[j+k];
		}
		k++;

		for(l=0;;l++)
		{
			char help2[3];
			if(help[j+k+l]==' ') {help2[l]='\0';stu[i].mark_class=c_to_d(help2);break;}
			help2[l]=help[j+k+l];
		}
		l++;

		stu[i].monitor=help[j+k+l];
		stu[i].west=help[j+k+l+2];

		for(m=0;;m++)
		{
			char help2[3];
			if(len==(j+k+l+4+m)) {help2[m]='\0';stu[i].paper=c_to_d(help2);break;}
			help2[m]=help[j+k+l+4+m];
		}
	}

	for(i=0;i<n;i++)
	{
		stu[i].money=0;
		if (stu[i].grade>80&&stu[i].paper>0) stu[i].money+=8000;
		if (stu[i].grade>85&&stu[i].mark_class>80) stu[i].money+=4000;
		if (stu[i].grade>90) stu[i].money+=2000;
		if (stu[i].grade>85&&stu[i].west=='Y') stu[i].money+=1000;
		if (stu[i].mark_class>80&&stu[i].monitor=='Y') stu[i].money+=850;
	}

	for(i=0;i<n;i++)
	{
		for(j=0;j<n-1;j++)
		{
			if(stu[j].money<stu[j+1].money)
			{
				struct student y;
				y=stu[j];
				stu[j]=stu[j+1];
				stu[j+1]=y;
			}
		}
	}

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

	for(i=0;i<n;i++)
	{	
		total+=stu[i].money;
	}
	printf("%d",total);
}

int c_to_d(char c[])
{
	int n=strlen(c);
	int i;
	int x=0;

		for(i=0;i<n;i++)
		{
			x=x*10+c[i]-48;
		}
	return x;
}
struct xinxi
{   
	char ming[22];
	int  qimo;
	int pingyi;
	char guan;
	char xibu;
	int lunwen;
   int award;
   struct xinxi *next;
};

void main()
{
	struct xinxi *head,*pt,*p,*x;
	int i,n,t;
	int awardmax,awardsum;

	scanf("%d",&n);


	p=(struct xinxi *)malloc(sizeof(struct xinxi));
	scanf("%s %d %d %c %c %d\n",p->ming,&p->qimo,&p->pingyi,&p->guan,&p->xibu,&p->lunwen);
	
	pt=p;
	head=NULL;
    t=1;
	while(t<n)
	{
		if(t==1)head=p;
		if(t>1)pt->next=p;

		pt=p;
		p=(struct xinxi *)malloc(sizeof(struct xinxi));
		

		t=t+1;
        scanf("%s %d %d %c %c %d",p->ming,&p->qimo,&p->pingyi,&p->guan,&p->xibu,&p->lunwen);
	
	}

	pt->next=p;
	p->next=NULL;


	x=head;
while(x!=NULL)
	{
		x->award=0;
		if(x->qimo>80&&x->lunwen!=0)x->award=x->award+8000;
		if(x->qimo>85&&x->pingyi>80)x->award=x->award+4000;
		if(x->qimo>90)x->award=x->award+2000;
		if(x->qimo>85&&x->xibu=='Y')x->award=x->award+1000;
		if(x->pingyi>80&&x->guan=='Y')x->award=x->award+850;

		x=x->next;
	
}
awardsum=0;
awardmax=0;
x=head;

while(x!=NULL)
{
	awardsum=x->award+awardsum;

if(x->award>awardmax)awardmax=x->award;	
	x=x->next;
}

for(x=head;x->award!=awardmax;x=x->next);
printf("%s\n",x->ming);
printf("%d\n",x->award);
printf("%d",awardsum);
}
struct stu
{
  
  char name[20];
  int mark1,mark2;
  char office,west; 
  int artical;
 long money;
}student[120];
int main()
{
    int n,i,k;
    int m1,m2,a;
    char o,w;
	long max,sum;
	scanf("%d",&n);
	max=0; sum=0;
	for (i=1;i<=n;i++)
	{
	   scanf("%s %d %d %c %c %d",&student[i].name,&m1,&m2,&o,&w,&a);
	   student[i].money=0;
       if ((m1>80) && (a>0)) student[i].money=student[i].money +8000;
       if ((m1>85) && (m2>80)) student[i].money=student[i].money +4000;
	   if ((m1>90)) student[i].money=student[i].money +2000; 
	   if ((m1>85) && (w=='Y')) student[i].money=student[i].money +1000;
	   if ((m2>80) && (o=='Y')) student[i].money=student[i].money +850;
	   if (student[i].money>max) {max=student[i].money;  k=i;}
	   sum=sum+student[i].money ;
	}

    printf ("%s\n",student[k].name );
    printf ("%d\n",max);
	printf ("%d\n",sum);
}
int main()
{
    int n,i,max,t;
    scanf("%d",&n);
    char a[100][20],d[100],e[100];
    int b[100],c[100],f[100],sum[100]={0},total=0;
    for(i=0;i<n;i++){
        scanf("%s %d %d %c %c %d\n",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)
       sum[i]+=8000;
       if(b[i]>85&&c[i]>80)
       sum[i]+=4000;
       if(b[i]>90)
       sum[i]+=2000;
       if(b[i]>85&&e[i]=='Y')
       sum[i]+=1000;
       if(c[i]>80&&d[i]=='Y')
       sum[i]+=850;
    }
    for(i=0;i<n;i++)
       total+=sum[i];
    max=sum[0];
    t=0;
    for(i=0;i<n;i++){
        if(max<sum[i]){
           t=i;
           max=sum[i];
        }
    }
    printf("%s\n%d\n%d",a[t],max,total);
    return 0;
}
int main()
{
	int n,i,total=0;
	struct  point
	{
		char s[20];
		int end;
		int class_marks;
		char c1;
		char c2;
		int com_num;
		int sum;
	}
	stu[100],max;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s",stu[i].s);
		scanf("%d%d",&(stu[i].end),&(stu[i].class_marks));
		getchar();
		scanf("%c",&(stu[i].c1));
		getchar();
		scanf("%c",&(stu[i].c2));
		getchar();
		scanf("%d",&(stu[i].com_num));
	}
	for(i=0;i<n;i++)
	{
		stu[i].sum=0;
		if(stu[i].end>80&&stu[i].com_num>=1)
			stu[i].sum=8000+stu[i].sum;
		if(stu[i].end>85&&stu[i].class_marks>80)
			stu[i].sum=4000+stu[i].sum;
		if(stu[i].end>90)
			stu[i].sum=2000+stu[i].sum;
		if(stu[i].end>85&&stu[i].c2=='Y')
			stu[i].sum=1000+stu[i].sum;
		if(stu[i].class_marks>80&&stu[i].c1=='Y')
			stu[i].sum=850+stu[i].sum;
	}
	for(i=0;i<n;i++)
		total=stu[i].sum+total;
	max.sum=0;
	for(i=0;i<n;i++)
	{
		if(max.sum<stu[i].sum)
			max=stu[i];
	}
	printf("%s\n%d\n%d",max.s,max.sum,total);
	return 0;
}
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 b)
{
	if(a>85&&b=='Y')
		return(1000);
	else return(0);
}
int gongxian(int a,char b)
{
	if(a>80&&b=='Y')
		return(850);
	else return(0);
}

void main()
{
	struct award
	{
		char name[20];
		int qimocj;
		int banpingcj;
		char ynganbu;
		char ynxibu;
		int lunwen;
		int jiangjin;
	}aw[100],temp;
	int N,i,j,k,sum;
    scanf("%d",&N);
    for(i=0;i<N;i++)
	{
		aw[i].jiangjin=0;
		scanf("%s %d %d %c %c %d",&aw[i].name,&aw[i].qimocj,&aw[i].banpingcj,&aw[i].ynganbu,&aw[i].ynxibu,&aw[i].lunwen);
		aw[i].jiangjin=yuanshi(aw[i].qimocj,aw[i].lunwen)
			          +wusi(aw[i].qimocj,aw[i].banpingcj)
					  +chengji(aw[i].qimocj)
					  +xibu(aw[i].qimocj,aw[i].ynxibu)
					  +gongxian(aw[i].banpingcj,aw[i].ynganbu);
	
	}
	for(k=0;k<N-1;k++)
	{
		for(j=0;j<N-1-k;j++)
		{
			if(aw[j].jiangjin<aw[j+1].jiangjin)
			{
				temp=aw[j];
				aw[j]=aw[j+1];
				aw[j+1]=temp;
			}
		}
	}
	sum=0;
	for(i=0;i<N;i++)
	{
		sum=sum+aw[i].jiangjin;
	}
        printf("%s\n%d\n%d",aw[0].name,aw[0].jiangjin,sum);

}
int main(int argc, char* argv[])
{
	int n,i,j,z=0,p[100],b[100],l[100],sum[100];
	char g[100],x[100];
	char m[100][20];
	scanf("%d\n",&n);
	for (i=0;i<n;i++)
	{
		scanf("%s",m[i]);
		scanf("%d%d",&p[i],&b[i]);
		scanf(" %c %c ",&g[i],&x[i]);
		scanf("%d",&l[i]);
	}
	for (i=0;i<n;i++)
	{
		sum[i]=0;
		if (p[i]>90) sum[i]=sum[i]+2000;
		if (p[i]>85)
		{
			if (b[i]>80) sum[i]=sum[i]+4000;
			if (x[i]=='Y') sum[i]=sum[i]+1000;
		}
	    if ((p[i]>80)&&(l[i]>0)) sum[i]=sum[i]+8000;
		if ((b[i]>80)&&(g[i]=='Y')) sum[i]=sum[i]+850;
	}
	for (i=0;i<n;i++) z=sum[i]+z;
	int max=sum[0];
	j=0;
	for (i=0;i<n;i++)
	{
		if (sum[i]>max)
		{
			max=sum[i];
			j=i;
		}
	}
	printf("%s\n%d\n%d\n",m[j],max,z);
	return 0;
}
void main()
{
	struct student 
	{
		char s[20];
		 int m1;
		 int m2;
		char c1;
		char c2;
		int n;
		int t;
	}stu[100],tr;

	int i,j,m,t1=0;

	scanf("%d",&m);
	for(i=0;i<m;i++)
	{
		scanf("%s%d%d %c %c%d",stu[i].s,&stu[i].m1,&stu[i].m2,&stu[i].c1,&stu[i].c2,&stu[i].n);stu[i].t=0;
        if(stu[i].m1>80&&stu[i].n>0)
			stu[i].t+=8000;
		if(stu[i].m1>85&&stu[i].m2>80)
			stu[i].t+=4000;
		if(stu[i].m1>90)
			stu[i].t+=2000;
		if(stu[i].m2>80&&stu[i].c1=='Y')
			stu[i].t+=850;
		if(stu[i].m1>85&&stu[i].c2=='Y')
			stu[i].t+=1000;
	}
	for(i=0;i<m-1;i++)
	{
		for(j=i+1;j<m;j++)
		if(stu[i].t<stu[j].t)
		{
			tr=stu[i];
			stu[i]=stu[j];
			stu[j]=tr;
		}
		}

	for(i=0;i<m;i++)
{
      t1+=stu[i].t;
}
	printf("%s\n%d\n%d\n",stu[0].s,stu[0].t,t1);
}
struct student
{
	int num,score1,score2;
	char name[50],west,ganbu;
	struct student *next;
};
int n;
struct student *create(void)
{
	int i,j;
	struct student *head,*p1,*p2;
	p1=p2=(struct student*)malloc(LEN);
	head=NULL;
	i=1;
	scanf("%s %d %d %c %c %d",&p1->name,&p1->score1,&p1->score2,&p1->ganbu,&p1->west,&p1->num);
	while(1)
	{
		if(i==1)
			head=p1;
		else
			p2->next=p1;
		p2=p1;
		if(i==n)
			break;
		p1=(struct student*)malloc(LEN);
		scanf("%s %d %d %c %c %d",&p1->name,&p1->score1,&p1->score2,&p1->ganbu,&p1->west,&p1->num);
		i++;
	}
	p2->next=NULL;
	return(head);
}
void main()
{
	int i,j,*x,amount,max;
	char (*y)[50];
	struct student *head,*p1,*p2;
	scanf("%d",&n);
	head=create();
	p1=p2=head;
	x=(int*)malloc(100*sizeof(int));
	y=(char(*)[50])calloc(100,50*sizeof(char));
	i=0;
	while(p1!=NULL)
	{
		*(x+i)=0;
		if(p1->score1>80&&p1->num>0)
			*(x+i)=*(x+i)+8000;
		if(p1->score1>85&&p1->score2>80)
			*(x+i)=*(x+i)+4000;
		if(p1->score1>90)
			*(x+i)=*(x+i)+2000;
		if(p1->score1>85&&p1->west=='Y')
			*(x+i)=*(x+i)+1000;
		if(p1->score2>80&&p1->ganbu=='Y')
			*(x+i)=*(x+i)+850;
        strcpy(*(y+i),p1->name);
		p1=p1->next;
		i++;
	}
	j=0;
	amount=0;
	for(i=0;i<n;i++)
		amount=amount+(*(x+i));
	max=*x;
	for(i=1;i<n;i++)
		if(*(x+i)>max)
		{
			max=*(x+i);
			j=i;
		}
		printf("%s\n",*(y+j));
		printf("%d\n",max);
		printf("%d\n",amount);
}
struct Student {
	char name[21];
	int grade;
	int eval;
	char clasAsi;
	char west;
	int essay;
	int total;
};

int main()
{
	int n, i;
	int totalMoney = 0;
	int money = 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].grade,&stu

[i].eval,&stu[i].clasAsi,&stu[i].west,&stu[i].essay);
		stu[i].total = 0;
		if (stu[i].grade > 80 && stu[i].essay > 0) {
			stu[i].total = stu[i].total + 8000;
		}
		if (stu[i].grade > 85 && stu[i].eval > 80) {
			stu[i].total = stu[i].total + 4000;
		}
		if (stu[i].grade > 90) {
			stu[i].total = stu[i].total + 2000;
		}
		if (stu[i].grade > 85 && stu[i].west == 'Y') {
			stu[i].total = stu[i].total + 1000;
		}
		if (stu[i].eval > 80 && stu[i].clasAsi == 'Y') {
			stu[i].total = stu[i].total + 850;
		}
	}
	
	for (i = 0; i < n; i++) {
		if (stu[i].total > money) {
			money = stu[i].total;
		}
		totalMoney = totalMoney + stu[i].total;
	}
	for (i = 0; i < n; i++) {
		if(stu[i].total == money){
			printf("%s\n%d\n",stu[i].name,money);
			break;
		}
	}
	printf("%d",totalMoney);
	return 0;
}
void main()
{
	struct student
	{
		char name[100],g,w;
		int s1,s2,p;
		long sum;
	} stu[100],max;
	int n,i,k;
	long ssum=0;
	scanf("%d\n",&n);
	max.sum=0;
	for (i=0;i<n;i++)
	{
		stu[i].sum=0;
/*1) ????????8000??????????80??>80???????????1??1????????????? 
2) ????????4000??????????85??>85????????????80??>80????????? 
3) ????????2000??????????90??>90????????? 
4) ????????1000??????????85??>85????????????? 
5) ????????850??????????80??>80??????????? 
???????????????????????????????????????????
*/
		scanf("%s %d %d %c %c %d",stu[i].name,&stu[i].s1,&stu[i].s2,&stu[i].g,&stu[i].w,&stu[i].p);
		if(stu[i].s1>80&&stu[i].p>0) stu[i].sum+=8000;
		if(stu[i].s1>85&&stu[i].s2>80) stu[i].sum+=4000;
		if(stu[i].s1>90) stu[i].sum+=2000;
		if(stu[i].s1>85&&stu[i].w=='Y') stu[i].sum+=1000;
		if(stu[i].s2>80&&stu[i].g=='Y') stu[i].sum+=850;

	}
	ssum=0;
	for (i=0;i<n;i++) {	if (stu[i].sum>max.sum) {max.sum=stu[i].sum;strcpy(max.name,stu[i].name);}ssum+=stu[i].sum;}
	printf("%s\n%ld\n%d",max.name,max.sum,ssum);
}
int main(int argc, char* argv[])
{
	struct stu{
		char name[20];
		int a;//qi mo
		int b;//ban ji
		char c;//ban gan
		char d;//xi bu
		int e;//lun wen
	}str[101];
	int n;
	scanf("%d",&n);
	int a[101];//qian shu
	for(int k=1;k<=n;k++){
		a[k]=0;}
	int sum=0;//zong qian
	for(int i=1;i<=n;i++){
		scanf("%s %d %d %c %c %d",&str[i].name,&str[i].a,&str[i].b,&str[i].c,&str[i].d,&str[i].e);}
	for(int j=1;j<=n;j++){
		if(str[j].a>80&&str[j].e>=1){
			a[j]+=8000;}
		if(str[j].a>85&&str[j].b>80){
			a[j]+=4000;}
		if(str[j].a>90){
			a[j]+=2000;}
		if(str[j].a>85&&str[j].d=='Y'){
			a[j]+=1000;}
		if(str[j].b>80&&str[j].c=='Y'){
			a[j]+=850;}
		sum+=a[j];}
	int w=a[1],q=1;
	for(int t=2;t<=n;t++){
		if(a[t]>w){
			w=a[t];

			q=t;}
	}
	printf("%s\n",str[q].name);
	printf("%d\n",a[q]);
	printf("%d\n",sum);
	return 0;
}
int main(){
	double c,d,e,f,g,h,i,s;
	scanf("%lf%lf%lf%lf%lf",&c,&d,&e,&f,&g);
	i = (g/360)*PI;
	s = (c+d+e+f)/2.0;
	h = (s-f)*(s-e)*(s-c)*(s-d) - e*f*c*d*(cos(i))*(cos(i)); //?????????
	
	if(h<0){
		printf("Invalid input\n");
	}
	else{
	double a, x2, x1;
	a = h;
	x1 = 1;
	x2 = (x1+a/x1)/2.0;
	while(x2-x1 > JINGDU || x1-x2 > JINGDU){
		x1 = x2;
		x2 = (x1+a/x1)/2.0;
		} 
	printf("%.4f\n",x2);
	}
	return 0;
}
float s(float a, float b, float c, float d, float alpha);

void main()
{
float a, b, c, d, alpha;
scanf("%f%f%f%f%f", &a,&b,&c,&d,&alpha);
if (s(a,b,c,d,alpha)==0)
printf("Invalid input");
else
printf("%.4f", s(a,b,c,d,alpha));
}


float s(float a, float b, float c, float d, float alpha)
{
float S,s, n,r;
s = (a+b+c+d)/2;
r=alpha/2/360*3.1415926*2;
n=(s-a)*(s-b)*(s-c)*(s-d) - a*b*c*d*cos(r)*cos(r);
if (n<0)
return 0;
else
{S = sqrt(n);
return S;
}
}
int main()
{
    double a,b,c,d,w,s,S;
    scanf("%lf%lf%lf%lf%lf",&a,&b,&c,&d,&w);
    s=(a+b+c+d)/2.0;
    w=cos(w/2.0*3.1415926/180.0);
    
    if((s-a)*(s-b)*(s-c)*(s-d)-a*b*c*d*w*w>0){
      S=sqrt((s-a)*(s-b)*(s-c)*(s-d)-a*b*c*d*w*w);
      printf("%.4f\n",S);
    }
 else{ 
      printf("Invalid input\n");
    }
 return 0;
}
void main()
{
	double mianji(double a,double b,double c,double d,double j);
	double a,b,c,d,j,jj,ss;
	scanf("%lf",&a);
    scanf("%lf",&b);
	scanf("%lf",&c);
	scanf("%lf",&d);
	scanf("%lf",&j);
    jj=j*p/t;
	ss=mianji(a,b,c,d,jj);
	if (ss!=-1) printf("%.4lf\n",ss);
	   else printf("Invalid input\n");
}

double mianji(double a,double b,double c,double d,double jj)
{
	double s,q,qq;
	s=(a+b+c+d)/2;
	q=(s-a)*(s-b)*(s-c)*(s-d) - a*b*c*d*cos(jj)*cos(jj);
	if (q<0) qq=-1;
	   else qq=sqrt(q);
	return(qq);
}
void main()
{
	double square(double a,double b,double c,double d,double angle);	
	double a,b,c,d,angle,s,S,ang;

	scanf("%lf",&a);
	scanf("%lf",&b);
	scanf("%lf",&c);
	scanf("%lf",&d);
	scanf("%lf",&angle);
	s=(a+b+c+d)/2;
	ang=(angle/(double)360)*3.1415926;
	{	
	if (((s-a)*(s-b)*(s-c)*(s-d)-a*b*c*d*cos(ang)*cos(ang))<0)
		printf("Invalid input");
		else
		{
S=square(a,b,c,d,angle);
	printf("%.4lf",S);
		}
	}
}
double square(double a,double b,double c,double d,double angle)
{
	double S,s,ang;
	s=(a+b+c+d)/2;
	ang=(angle/(double)360)*3.1415926;
	S=sqrt((s-a)*(s-b)*(s-c)*(s-d)-a*b*c*d*cos(ang)*cos(ang));
return(S);}
double f(double a,double b,double c,double d,double e)
{
    double s,S;
    e=e/180*3.1415926;
    s=(a+b+c+d)/2;
    S=(s-a)*(s-b)*(s-c)*(s-d)-(a*b*c*d*cos(e/2)*cos(e/2));
    if(S<0){return 0;}    
    else S=sqrt(S);
    return S;
    
    
    }
int main(){
    double a,b,c,d,e,S;
    scanf("%lf%lf%lf%lf%lf",&a,&b,&c,&d,&e);
    S=f(a,b,c,d,e);
    if(S==0){printf("Invalid input");}
    else printf("%.4lf",S);
    return 0;
    }
int main()
{
	double a,b,c,d,m,n,x,s,S,t;
	scanf("%lf",&a);
	scanf("%lf",&b);
	scanf("%lf",&c);
	scanf("%lf",&d);
	scanf("%lf",&m);
	x=m*pi/360;
	n=cos(x);
	s=(a+b+c+d)/2;
	t=(s-a)*(s-b)*(s-c)*(s-d);
	if((t-a*b*c*d*n*n)<0) 
		printf("Invalid input\n");
	else
	{
		S=sqrt(t-a*b*c*d*n*n);
	    printf("%.4lf",S);
	}
	    return 0;
}
int main(){
      double a,b,c,d,e,s,M,S;
      scanf("%lf%lf%lf%lf%lf",&a,&b,&c,&d,&e);
      s = (a+b+c+d)/2;
	  M=(s-a)*(s-b)*(s-c)*(s-d)-a*b*c*d*cos(e*3.1415926/360)*cos(e*3.1415926/360);
	  S = sqrt((s-a)*(s-b)*(s-c)*(s-d)-a*b*c*d*cos(e*3.1415926/360)*cos(e*3.1415926/360));
	  
	  if(M<0){
		  printf("Invalid input");  }
		  else {if (M>=0){
		S = sqrt((s-a)*(s-b)*(s-c)*(s-d)-a*b*c*d*cos(e*3.1415926/360)*cos(e*3.1415926/360));  
		printf("%.4lf\n",S);}}
     return 0;
}
int main(void)
{
    double a,b,c,d,af,s,S;
 
    scanf("%lf%lf%lf%lf%lf",&a,&b,&c,&d,&af);
 
    s=(a+b+c+d)/2;
    af=cos(af/180*3.1415926/2);
    S=(s-a)*(s-b)*(s-c)*(s-d)-a*b*c*d*af*af;

    if(S<0)
      printf("Invalid input\n");
    else
      printf("%.4lf\n",sqrt(S));
 
    return 0;
}
double square(double a1,double b1,double c1,double d1,double jiao1)
{
double s=(a1+b1+c1+d1)/2;
double k=cos(jiao1/2)*cos(jiao1/2);
if(((s-a1)*(s-b1)*(s-c1)*(s-d1)-a1*b1*c1*d1*k)<0) return 0;
else 
{
	double S=sqrt((s-a1)*(s-b1)*(s-c1)*(s-d1)-a1*b1*c1*d1*k); 
    return S;
}

}

void main()
{
double S,a,b,c,d,jiao;
scanf("%lf%lf%lf%lf%lf",&a,&b,&c,&d,&jiao);
jiao=jiao/360*2*3.1415926;
S=square(a,b,c,d,jiao);
if(S==0)printf("Invalid input");
else
printf("%.4lf",S);

}
int main()
{
float s,a,b,c,d;
double e,S,jf,g,PI;
scanf("%f",&a);
scanf("%f",&b);
scanf("%f",&c);
scanf("%f",&d);
scanf("%lf",&g);
s = (a+b+c+d)/2;
PI=3.1415926;
e=(g*1.0/2)/360*2*PI;
jf=(s-a)*(s-b)*(s-c)*(s-d) - a*b*c*d*cos(e)*cos(e);
if(jf<0){
	printf("Invalid input\n");}
else{
S = sqrt((s-a)*(s-b)*(s-c)*(s-d) - a*b*c*d*cos(e)*cos(e)); 
printf("%.4lf\n",S);}
	return 0;
}
void main()
{
	double S(double a,double b,double c,double d,double s,double n);
	double a,b,c,d,s,m,n,area,PI=3.1415926;
	scanf("%lf\n%lf\n%lf\n%lf\n%lf",&a,&b,&c,&d,&m);
	s=(a+b+c+d)/2;
	n=m/(2*180)*PI;
	if(S(a,b,c,d,s,n)>=0)
	{area=sqrt(S(a,b,c,d,s,n));
	printf("%.4lf",area);}
	else printf("Invalid input");
}
double S(double a,double b,double c,double d,double s,double n)
{
	double z;
	z=(s-a)*(s-b)*(s-c)*(s-d)-a*b*c*d*cos(n)*cos(n);
	return(z);
}