semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int main()
{
	int n,a,b;
cin>>n;
a=1;
b=0;
while (a<=n)
{
	if (a%7==0 || (69<a&&a<80) || a%10==7)
		a++;
	else
		b=b+a*a,a++;//????
}
cout<<b<<endl;

return 0;
}
int main(int argc, char* argv[])
{
	int n,i,sum=0;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		if(i%7!=0&&(i-7)%10!=0)
		{
			if(i>=70&&i/10!=7)
				sum+=i*i;
			else if(i<70)
				sum+=i*i;
		}
	}
    printf("%d",sum);
	return 0;
}
int main(int argc, char* argv[])
{
	int i,sum,n;
	scanf("%d",&n);
        sum=0;
	for(i=1;i<n+1;i++)
		if( i%7==0)
			continue;
		else if(i%10==7)
			continue;
		else if(i/10==7)
			continue;
		else{
			sum=sum+i*i;
		}
		
		
		
	printf("%d",sum);
	return 0;
}
int main(){
	int n,i,m=0,b[100],sum=0,sum1=0;
	cin>>n;
	char a[100][2];
	for(i=0;i<=n-1;i++)
	{
		a[i][1]=((i+1)%10)+'0';
		a[i][0]=(i+1-(i+1)%10)/10+'0';
		if((i+1)%7==0)
		{
			b[m]=i+1;
			m++;
		}
		else if((a[i][0]=='7')||(a[i][1]=='7'))
		{
		    b[m]=i+1;
		    m++;
		}
	}
	for(i=0;i<=n-1;i++)
		sum=sum+(i+1)*(i+1);
	for(i=0;i<=m-1;i++)
		sum1=sum1+b[i]*b[i];
	cout<<sum-sum1;
	return 0;
}
int main()
{
 int n,i,sum=0;
 scanf("%d",&n);
 for(i=1;i<=n;i++)
   if(i%7!=0)
     if((i-7)%10!=0)
       if(i-70<0||i-70>=10) 
           sum+=i*i;
   printf("%d",sum);
  return 0;
}
int main()
{int n;
cin>>n;
int i;
int sum=0;
for (i=1;i<=n;i++)
{if (69<i&&i<80)
sum=sum;
else if(i%10==7)
	sum=sum;
else if(i%7==0)
	sum=sum;
else sum=sum+i*i;
}
cout<<sum<<endl;
return 0;
}
int main()
{
   int n,l,q=0,k1,k2,t,w,s=0,i;
   
   cin>>n;
   for(i=1;i<=n;i++)
   {
                    l=i;
                    do{
                        l=l/10;
                        q++;
                        }while(l!=0);
                        k2=i;
                        w=1;
                        for(t=1;t<=q;t++)
                        {
                                           k1=k2;
                                           k2=k1/10;
                                           if((k1-10*k2)%7==0&&(k1-10*k2)!=0||i%7==0)
                                           {w=0;}
                                           }
                                           if(w==1)
                                           s=s+i*i;
                    }
                    cout<<s;
                    
                    return 0;
    
}
//*********************************************
//*???????????????????******
//*??????? 1200012979 ******************
//*???2012.10.08 ***************************
//*********************************************
int main()
{
	int n , a , b , sum=0 ;               //??????????
    cin >> n ;                        //????
    for ( a=1 ; a <= n ; a++)         
	{ 
	  if (a % 7 == 0 )                 //??7???
		  continue ;
	  if (a == 17 || a == 27 || a == 37 || a == 47
		  || a == 57 || a == 67 || a == 87 || a == 97)
		  continue ;                  //??????????
	  b = a / 10 ;
	  if ( b == 7 )
		  continue ;
	  sum = sum + a * a ;             //?????
	}
	cout << sum << endl ;             //?????
	return 0;
}
int  main()
{
	int n,i,k,s,j,a,f,g;
	int sum=0;
	cin>>n;
	for (i=1;i<=n;i++)
		{
			a=0;
			f=i;
			g=i;
	  for(j=0;f!=0;f/=10,j++);
		for (k=0;k<j;k++)
			{
				s=g%10;
		    if (s==7)
				a=1;
			else a=a;
			g=g/10;
		}
		if (i%7==0)
			a=1;
		else 
			a=a;
		if (a==0)
			sum=sum+i*i;
		else sum=sum;
	}
		cout<<sum<<endl;
return 0;
}
int mm(int i)
{ 
	int j;
	if(i%7==0)
{ return 0;
}for(j=i;j>0;j/=10)
{if(j%10==7){
return 0;}
}return 1;
}
int main(int argc, char* argv[])
{ 
     int i,n,sum;	
	scanf("%d",&n);
for(i=1,sum=0;i<=n;i++)
{if (mm(i)==1)
{ sum+=i*i;
}
}
	printf("%d",sum);
	return 0;
}
int main()
{
	int n;
	cin>>n;
	int i=1,sum=0;
while(i<=n)
{
	if(i%7==0)
	{
	i++;
	}
	else
	{
		if(i%10==7)
		{
		     i++;
		}
		else
		{
			if(i-70>0&i-70<10)
			{
			    i++;
			}
			else
			{
				sum=sum+i*i;
				i++;
			}
		}
	}
}
cout<<sum<<endl;
return 0;
}
struct Stu
{
    char stu[100];
    struct Stu *link;
};
int main()
{
    struct Stu *p1,*p2;
    p2=p1=(struct Stu *)malloc(LEN);
    gets(p1->stu);
    p1->link=NULL;
    for(;;)
    {
        p2=p1;
        p1=(struct Stu *)malloc(LEN);
        gets(p1->stu);
        p1->link=p2;
        if(strcmp(p1->stu,"end")==0) break;
    }
    for(;;)
    {
        puts(p2->stu);
        p2=p2->link;
        if(p2==NULL) break;
    }
    return 0;
}
int n;
struct student
{
	char num[10];
	char name[20];
	char sex[2];
	int year;
	int score[10];
	char add[10];
	struct student *next;
};
struct student *creat()
 {
	 struct student *head,*p1,*p2;
	 p1=(struct student*)malloc(LEN);
	 scanf("%s %s %s %d %s %s",p1->num,p1->name,p1->sex,&p1->year,p1->score,p1->add);
	 p1->next=NULL;
	 n=1;
	 head=p1;
	 p2=p1;
	 do
	 {
		 p1=(struct student*)malloc(LEN);
		 scanf("%s",p1->num);
		 if(strcmp(p1->num,"end")==0)break;
         scanf("%s %s %d %s %s",p1->name,p1->sex,&p1->year,p1->score,p1->add);
         p1->next=NULL;
		 p2->next=p1;
		 p2=p1;
		 n=n+1;
	 }while(1);
	 return(head);
 }
void main()
{
	struct student *head,*p,*q;
    head=creat();
	while(n!=0)
	{
		for(p=head;p->next!=NULL;)
		{
			q=p;
			p=p->next;
		}
		printf("%s %s %s %d %s %s\n",p->num,p->name,p->sex,p->year,p->score,p->add);
		n=n-1;
		q->next=NULL;
	}
}
typedef struct node{
	char id[100],name[100],sex[2],address[100],age[10],grade[10];
	struct node *next;
}node;

node *head=NULL;

int create(){
	node *p = (node*)malloc(sizeof(node));
	scanf("%s",p->id);
	if(p->id[0]=='e'){free(p);return 1;}
	scanf("%s%s%s%s%s",p->name,p->sex,p->age,p->grade,p->address);

	p->next = head;
	head = p;
	return 0;
}
void print(){
	node *p = head,*temp;
	for(;p!=NULL;){
		printf("%s %s %s %s %s %s\n",p->id,p->name,p->sex,p->age,p->grade,p->address);
		temp = p;
		p = p->next;
		free(temp);
	}
}

int main()
{
	int i,j,n,m,k;
	for(;;){
		if(create()==1)break;
	}
	print();
}
struct student 
{char num[20];
char name[20];
char sex;
int age;
char score[20];
char add[20];
struct student *next;
};
int main()
{
struct student *p;
struct student *p1,*p2;
p1=(struct student*)malloc(len);
(*p1).next=0;
scanf("%s",(*p1).num);
while((*p1).num[0]!='e'){
scanf("%s %c %d %s %s",(*p1).name,&(*p1).sex,&(*p1).age,(*p1).score,(*p1).add);
p2=p1;
p1=(struct student*)malloc(len);
(*p1).next=p2;
scanf("%s",(*p1).num);
}
p=p2;
while(p){
printf("%s %s %c %d %s %s\n",(*p).num,(*p).name,(*p).sex,(*p).age,(*p).score,(*p).add);
p=(*p).next;
}
return 0;
}
int main()
{
	int n=0;
	struct student
	{
		char num[20];
		char name[20];
		char sex[5];
		int age;
		char score[10];
		char add[100];
		struct student *next;
	}*p1,*head,*p2,*end,*p3,*heade;
	head=NULL;
	p2=p1=(struct student *)malloc(LEN);
	scanf("%s",p1->num);
	if(p1->num[0]!='e')
	{
		head=p1;
		scanf("%s %s %d %s %s",p1->name,p1->sex,&p1->age,p1->score,p1->add);
		n=1;
	}
	p1=(struct student *)malloc(LEN);
	scanf("%s",p1->num);
	while(p1->num[0]!='e')
	{
		scanf("%s %s %d %s %s",p1->name,p1->sex,&p1->age,p1->score,p1->add);
		n++;
		p2->next=p1;
		p2=p1;
		p1=(struct student *)malloc(LEN);
		scanf("%s",p1->num);
	}
	p2->next=NULL;
	end=p2;
	if(n==1)
		printf("%s %s %s %d %s %s\n",head->num,head->name,head->sex,head->age,head->score,head->add);
	else if(n==2)
	{
		printf("%s %s %s %d %s %s\n",end->num,end->name,end->sex,end->age,end->score,end->add);
		printf("%s %s %s %d %s %s\n",head->num,head->name,head->sex,head->age,head->score,head->add);
	}
	else
	{
		p1=head;
		p2=head->next;
		p3=p2->next;
		p1->next=NULL;
		p2->next=p1;
		while(p3->next!=NULL)
		{
			p1=p2;
			p2=p3;
			p3=p2->next;
			p2->next=p1;
		}
		p3->next=p2;
		heade=p3;
		p1=heade;
		while(p1!=NULL)
		{
			printf("%s %s %s %d %s %s\n",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->add);
			p1=p1->next;
		}
	}
	return 0;
}
struct stu
{char num[50];
struct stu * next;
};
void main()
{
	struct stu * head,*p1,*p2;
	int i=1;
	p1=p2=(struct stu *)malloc(L);
    gets(p1->num);
	head=p1;
	while((strcmp(p1->num,"end")!=0))
	{
		p1=(struct stu*) malloc(L);
		gets(p1->num);
		p2->next=p1;
		p2=p1;i++;
	}
	p2->next=0;
	int k;
	for(;i>1;i--)
	{
		k=i;
		for(p1=head;k>2;k--)
		{p1=p1->next;}
		printf("%s\n",p1->num); 
	}
}
struct stud
{
	char num[30];
	char name[20];
	char sex;
	int age;
	char score[10];
	char address[30];
	struct stud *next;
};
int main()
{
	struct stud *head,*p1,*p2,*p;
	int n=0;
	p1=p2=(struct stud *)malloc(sizeof(struct stud));
	scanf("%s",&p1->num);
	if (strcmp(p1->num,"end")==0) return 0;
	scanf("%s %c %d %s %s",&p1->name,&p1->sex,&p1->age,&p1->score,&p1->address);
	head=Null;
	while(1)
	{
		n++;
		if (n==1) p1->next=Null;
		else p1->next=p2;
		p2=p1;
		p1=(struct stud *)malloc(sizeof(struct stud));
		scanf("%s",&p1->num);
		if (strcmp(p1->num,"end")==0) break;
		scanf("%s %c %d %s %s",&p1->name,&p1->sex,&p1->age,&p1->score,&p1->address);
	}
	head=p2;
	p=head;
	do
	{
		printf("%s %s %c %d %s %s\n",p->num,p->name,p->sex,p->age,p->score,p->address);
		p=p->next;
	}while(p!=Null);
	return 0;
}
struct student
{
 char num[10];
 char name[20];
 char sex[2];
 int  age;
 float score;
 char address[40];
 struct student *next;
};
void main()
{  
   struct student *p,*p1,*p2;
   p1=(struct student *)malloc(len);
   p1->next=NULL;
   scanf("%s",p1->num);
	   while(p1->num[0]!='e')
	   {
		   scanf("%s%s%d%f%s",p1->name,p1->sex,&p1->age,&p1->score,p1->address);
		p2=p1;
	    p1=(struct student*)malloc(len);
		p1->next=p2;
		scanf("%s",p1->num);
	   }
	   if(p2->next!=NULL){
   for(p=p2;p->next!=NULL;p=p->next)
	   {
	   printf("%s %s %s %d %g %s\n",p->num,p->name,p->sex,p->age,p->score,p->address);
	   }
       printf("%s %s %s %d %g %s\n",p->num,p->name,p->sex,p->age,p->score,p->address); 
	   }
	   if(p2->next=NULL)

   printf("%s %s %s %d %g %s\n",p2->num,p2->name,p2->sex,p2->age,p2->score,p2->address); 
}
struct student
{
	char num[20];
	char name[20];
	char sex[2];
	int age;
	float score;
	char add[100];
	struct student *next;
};



int main()
{
	struct student *p1,*p2,*head;
	p1=(struct student*)malloc(sizeof(struct student));
	p1->next=NULL;
	scanf("%s",p1->num);
	if (p1->num[0]!='e')
	{
	while (p1->num[0]!='e')
	{
		scanf("%s%s%d%f%s",p1->name,p1->sex,&p1->age,&p1->score,p1->add);
        p2=p1;
	    p1=(struct student*)malloc(sizeof(struct student));
		p1->next=p2;
		scanf("%s",p1->num);
	}
	head=p2;
	while (head!=NULL)
	{
		printf("%s %s %s %d %g %s\n",head->num,head->name,head->sex,head->age,head->score,head->add);
		head=head->next;
	}
	}
	return 0;
}
struct student
{
	char num[20];
	char name[20];
	char sex;
	int age;
	float score;
	char address[1000];
	struct student *next;
}stu[10000];
int main()
{
	struct student *head,*p;
	int i,j;
	char str[4]="end";
	for(i=0;;i++)
		{
			scanf("%s",stu[i].num);
	        if(strcmp(stu[i].num,str)==0)
			break;
			scanf("%s",&stu[i].name);
		    scanf(" %c",&stu[i].sex);
		    scanf("%d",&stu[i].age);
		    scanf("%f",&stu[i].score);  
		    scanf("%s",&stu[i].address);
	}		
	stu[0].next=NULL;
	for(j=1;j<i;j++)
		stu[j].next=&stu[j-1];
	head=&stu[i-1];
	if (i>0)
			for(p=head;p!=NULL;p=p->next)
		    printf("%s %s %c %d %g %s\n",p->num,p->name,p->sex,p->age,p->score,p->address);
	
	return 0;	
}
struct student
{
	char num[100];
	struct student *prev;
};

main()
{
	struct student *p1,*p2;
	int flag=0;
	while (1)
	{
		p1=(struct student *)malloc(sizeof(struct student));
		gets(p1->num);
		if (*(p1->num)=='e') break;
		else 
		{
			if (flag==0) 
			{
				p2=p1;
				p1->prev=NULL;
				flag=1;
			}
			else 
			{
				p1->prev=p2;
				p2=p1;
			}
		}
	}
	while (p2!=NULL)
	{
		printf("%s\n",p2->num);
		p2=p2->prev;
	}
	return 0;
}
struct student 
{
    char id[50];
    char s[50];
    char sex;
    int age;
    char score[10];
    char add[20];
    struct student *po;
};
int main()
{
    struct student *p,*q;
    q=(struct student*)malloc(LEN);
    scanf("%s %s %c %d %s %s",q->id,q->s,&q->sex,&q->age,q->score,q->add);
    q->po=NULL;
    p=q;
    q=(struct student*)malloc(LEN);
    scanf("%s",q->id);
    while(strcmp(q->id,"end")!=0)
    {
     scanf("%s %c %d %s %s",q->s,&q->sex,&q->age,q->score,q->add);
     q->po=p;
     p=q;
     q=(struct student*)malloc(LEN);
     scanf("%s",q->id);
    }
    printf("%s %s %c %d %s %s\n",p->id,p->s,p->sex,p->age,p->score,p->add);
    while(p->po!=NULL)
    {
      p=p->po;
      printf("%s %s %c %d %s %s\n",p->id,p->s,p->sex,p->age,p->score,p->add);
    } 
    return 0;
}
int n;
struct student
{
char s[100];
struct student *next;
};

void main()
{
struct student *head, *p1, *p2; n=0;
p1=p2=( struct student*) malloc(LEN);
gets(p1->s);
head=NULL;

while(p1->s[0]!='e')
{
n=n+1;
if(n==1) p1->next=NULL;
else p1->next=p2;
p2=p1;
p1=(struct student*)malloc(LEN);
gets(p1->s);
}
head=p2;




p1=head;
while(p1!=NULL)
{ 
printf("%s\n",p1->s);
p1=p1->next;
}




}
struct Student
{
	char r[200];
	struct Student *next,*up;
};
int main()
{
	struct Student *p,*h,*pre;
	h=NULL;
	while (1)
	{
		p=malloc(L);
		if (h==NULL) 
		{
			h=p;
			p->up=h;
		}
		else 
		{
			pre->next=p;
			p->up=pre;
		}
		gets(p->r);
		if (strcmp(p->r,"end")==0) break;
		//scanf("\n");
		pre=p;
	}
	p=pre;
	while (1)
	{
		printf("%s",p->r);
		if (p==h) break;
		else printf("\n");
		p=p->up;
	}
	return 0;
}
struct student{
	char num[50];
	char name[50];
	char sex[50];
	char age[50];
	char score[50];
	char adr[50];
	struct student *next;
};//?????????????
int main(){
	struct student *p1,*p2,*head;
	p1=(struct student *)malloc(LEN);
	int i=0;
	p2=NULL;
	for(;;i++)
	{
		p1=(struct student *)malloc(LEN);
		scanf("%s",p1->num);
		if(strcmp(p1->num,"end")==0)
		{//??p1->num?????
			break;
		}
		scanf("%s %s %s %s %s",p1->name,p1->sex,p1->age,p1->score,p1->adr);
		p1->next=p2;
		p2=p1;
		
	}

	head=p2;
	if(head!=NULL)
	{
		p1=head;
		do{
			printf("%s %s %s %s %s %s\n",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->adr);
			p1=p1->next;
		}while(p1!=NULL);
	}
	return 0;
}
struct stu
{
	char xinxi[100];
	struct stu *next;
};
void main()
{
	int len=1,i;
	struct stu *p1,*p2,*head,*new1,*newhead;
	p1=p2=head=(struct stu *)malloc(sizeof(struct stu));
	gets(p1->xinxi);
	while(strcmp(p1->xinxi,"end")!=0)
	{
		p1=(struct stu *)malloc(sizeof(struct stu));
		gets(p1->xinxi);
		if(strcmp(p1->xinxi,"end")==0)
			p2->next=NULL;
		else
		{
			p2->next=p1;
			p2=p1;
			len++;
		}
	}
	p1=head;
	for(i=0;i<len;i++)
	{
		p2=p1=head;
		while(p1->next!='\0')
		{
			p2=p1;
			p1=p1->next;
		}
		if(i==0)
		{
			newhead=new1=p1;
		}
		else
		{
			new1=new1->next=p1;
		}
		p2->next=NULL;
	}
	p1=newhead;
	for(i=0;i<len;i++)
	{
		printf("%s\n",p1->xinxi);
		p1=p1->next;
	}
}
int main()
{
    struct student
    {
    char a[20];
    char b[20];
    char c[20];
    char d[20];
    char e[20];
    char f[20];
    struct student *pNext;
    };
    struct student *pHeader = (struct student *)malloc(sizeof(struct student));
    pHeader->pNext=NULL;
    struct student *p;
    while(1)
    {
    p=(struct student *)malloc(sizeof(struct student));
    p->pNext=pHeader->pNext;
    pHeader->pNext=p;
    scanf("%s",p->a);
    if(p->a[0]=='e') break;
    scanf("%s %s %s %s %s",p->b,p->c,p->d,p->e,p->f);
    }
    p=pHeader->pNext->pNext;
    while(1)
    {
    if(p==NULL) break;
    printf("%s %s %s %s %s %s\n",p->a,p->b,p->c,p->d,p->e,p->f);
    p=p->pNext;
    }
}
struct stu
{
	char num[20];
	char name[20];
	char sex;
	int age;
	char score[20];
	char add[20];
	struct stu *next;
};
int main()
{
	struct stu *p1,*p2,*head;
	p1=(struct stu*)malloc(sizeof(struct stu));
	p1->next=NULL;
	p2=p1;
	p1=(struct stu*)malloc(sizeof(struct stu));
	while(1)
	{
		scanf("%s",p1->num);
		if(p1->num[0]=='e')
		{
			head=p2;
			p1->next=p2;
			break;
		}
		scanf("%s %c %d %s %s",p1->name,&(p1->sex),&(p1->age),p1->score,p1->add);
		p1->next=p2;
		p2=p1;
		p1=(struct stu*)malloc(sizeof(struct stu));
	}
	p1=head;
	while(p1->next!=NULL)
	{
		printf("%s %s %c %d %s %s\n",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->add);
		p1=p1->next;
	}
	return 0;
}
main()
{
      int i,j,k,n,m;
      struct student
      {
            char num[200];
            char name[200];
            char sex;
            int age;
            char score[20];
            char add[500]; 
             }stu[1000];
             i=0;
            while(1)
            {
                    scanf("%s",stu[i].num);
                    if(strcmp(stu[i].num,"end")==0)
                                 break;
      scanf("%s %c %d %s %s",stu[i].name,&stu[i].sex,&stu[i].age,stu[i].score,stu[i].add);
                                 i++;
                                 }
      for(j=i-1;j>=0;j--)
      {
      printf("%s %s %c %d %s %s\n",stu[j].num,stu[j].name,stu[j].sex,stu[j].age,stu[j].score,stu[j].add);
                         }
      
   
      
           }
struct L
{
 char a[6][20];
 struct L *pq;  
 struct L *ph; 
};
struct L *creat(void)
{
 struct L *p1,*p2,*p3,*head,*end;
 int i,j,k,l;
 l=sizeof(struct L);
 p1=head=(struct L *)malloc(l);
 p1->pq=NULL;
 do
 {
  for(i=0;i<6;i++)
   scanf("%s",p1->a[i]);
  p2=(struct L *)malloc(l);
  p3=p2->pq=p1;
  p1->ph=p2;
  p1=p2;
 }while(p3->a[0][0]!='e');
 return p3->pq;
} 
int main()
{struct L *creat(void);
 int i,j;
 struct L *head,*p1,*p2;
 p1=head=creat();
 do
 {for(i=0;i<6;i++)
  {if(i==0) printf("%s",p1->a[0]);
   else printf(" %s",p1->a[i]);}
  printf("\n");
  p1=p1->pq;
 }while(p1!=NULL);
}
struct student  
{
       char id[10];
       char name[100];
       char sex;
       int age;
       char score[100];
       char adr[100];
       struct student *next;
};
int n=0;
struct student *creat()
{
       struct student *head,*p1,*p2;
       head=NULL;
       p1=p2=(struct student*)malloc(LEN);
       scanf("%s %s %c%d%s%s",&p1->id,&p1->name,&p1->sex,&p1->age,&p1->score,&p1->adr);
       while(p1->id[0]!='e')
       {
         n++;
         if(n==1)
         head=p1;
         else  
         p2->next=p1;
         p2=p1;
         p1=(struct student*)malloc(LEN);
         scanf("%s %s %c%d%s%s",&p1->id,&p1->name,&p1->sex,&p1->age,&p1->score,&p1->adr);
       }
       p2->next=NULL;
       return(head);
}
void print(struct student*head,int m)
{
     struct student*p1;
     p1=head;
     if(head!=NULL)
         do
         {
                   printf("%s %s %c %d %s %s\n",p1->id,p1->name,p1->sex,p1->age,p1->score,p1->adr);
                   p1=p1->next;
         }while(p1!=NULL);
}
struct student *turnback(struct student *head)
{
       struct student *p1,*p2,*news,*p;
       int i;
       for(i=n;i>=0;i--)
       {
       p2=p1=head;
       while(p1->next!=NULL)
       {
         p2=p1;p1=p1->next;
       }
      
         if(i==n)
         p=news=p1;
         else
         {
           p=p->next=p1;
           p2->next=NULL;   
          }
                            
       }
       return(news);
}
int main()
{
    struct student*head,*newhead;
    head=creat();
    newhead=turnback(head);
    print(newhead,n);
}
struct student
{
	char num[30];
	char name[30];
	char s;
    float grad1;
	float grad2;
	char add[30];
	struct student *next,*prev;
};

void main()
{
	struct student *head,*temp,*end;
	head=(struct student *)malloc(sizeof(struct student));
	temp=head;
	head->prev=0;


	while(1)
	{
scanf("%s",temp->num);
if(strcmp(temp->num,"end")==0)
break;

scanf("%s %c %f %f %s",temp->name,&temp->s,&temp->grad1 ,&temp->grad2,temp->add );

temp->next=(struct student *)malloc(sizeof(struct student));
temp->next->prev =temp;
temp=temp->next;

}
end=temp->prev;
end->next=0;


temp=end;
while(temp!=0)
{
	printf("%s %s %c %g %g %s\n",temp->num ,temp->name,temp->s,temp->grad1 ,temp->grad2,temp->add );
	temp=temp->prev;
}
}
struct student
{
	struct student *pre;
	char mess[500];
};
void main()
{
	int n=0;
	struct student *p1,*p2,*p;
	p1=(struct student *)malloc(LEN);
	while(strcmp(gets(p1->mess),"end")!=0)
	{
		n=n+1;
		if(n==1) 
			p1->pre=NULL;
		else
			p1->pre=p2;
			p2=p1;
			p1=(struct student *)malloc(LEN);
	}
	p=p2;
	do
	{
		printf("%s\n",p->mess);
		p=p->pre;
	}while(p!=NULL);

}
struct stu
{
	char inf[50];
	struct stu *next;
};

struct stu *head,*p1,*p2;
int output(struct stu *point);
int main()
{

	p1=(struct stu *)malloc(sizeof(struct stu));
	head=p1;
	while(gets((*p1).inf)!=NULL)
	{
		p2=(struct stu *)malloc(sizeof(struct stu));
		(*p1).next=p2;
		p1=p2;
	}
	(*p1).next=NULL;
	output(head);
	return 0;
}

int output(struct stu *point)
{
	if(strcmp(point->next->inf,"end")!=0)
		output(point->next);
	puts((*point).inf);
	return 0;
}
struct student
{
	char num[50];
	char name[50];
	char sex[1];
	int age;
	float score;
	char address[50];
	struct student *next;
};
void main()
{
	struct student *head,*p1,*p2;
	p1=p2=(struct student*)malloc(sizeof(struct student));
	head=p1;
	scanf("%s%s%s%d%f%s",p1->num,p1->name,&p1->sex,&p1->age,&p1->score,p1->address);
	p2->next=NULL;
	while(strcmp(p1->num,"end")!=0)
	{
		p1=(struct student*)malloc(sizeof(struct student));
		scanf("%s",p1->num);
		if(strcmp(p1->num,"end")==0) break;
		scanf("%s%s%d%f%s",p1->name,&p1->sex,&p1->age,&p1->score,p1->address);
		p2=p1;
		p2->next=head;
		head=p1;
	}
	p2=head;
	while(p2!=NULL)
	{
		printf("%s %s %s %d %g %s\n",p2->num,p2->name,p2->sex,p2->age,p2->score,p2->address);
		p2=p2->next;
	}
}
struct student
{
  char str[1000];
  struct student *next;
};
void main()
{
  struct student a[1000],*p,*head;
  int i,j,t;
  for(i=0;;i++)
  {
	gets(a[i].str);

	
	if(a[i].str[0]=='e')
	break;
  }
  for(j=i-1;j>=0;j--)
  {
	 head=&a[i-1];   /*???a[i-1]???a[i]????????*/
	 a[j].next=&a[j-1];  /*????????end*/
	 a[0].next=NULL;
  }

  
  p=head;
  do
  {
	  printf("%s\n",p->str);
	  p=p->next ;
  } while(p!=NULL);
}
main()
{
    struct inf
	{
	struct inf *pLate;
	char num[20];
	char nam[20];
	char gen;
	int old[20];
	int sco[20];
	char loc[20];
	struct inf *pNext;
	};
	int i,j,k;
	struct inf *pHeader;
	pHeader=(struct inf *)malloc(sizeof(struct inf));
	struct inf *p;
	struct inf *p1=NULL;
	p=pHeader;
	pHeader->pLate=NULL;
	for(i=0;;i++)
	{
		p->pNext=(struct inf *)malloc(sizeof(struct inf));
		p=p->pNext;
		p->pLate=p1;
		scanf("%s",p->num);
		if(p->num[0]=='e') 
		{
		    p->pNext=NULL;
			break;
		}
		else
		{
		scanf("%s %c %s %s %s",p->nam,&p->gen,p->old,p->sco,p->loc);
		p1=p;
		}
	}
	for(j=i;j>=1;j--)
	{
		p=p->pLate;
		printf("%s %s %c %s %s %s\n",p->num,p->nam,p->gen,p->old,p->sco,p->loc);
	}
	p=pHeader;
	struct inf *pd;
	for(k=0;k<=i;k++)
	{
		pd=p;
		p=p->pNext;
		free(pd);
	}
	free(p);	
}
struct stud
{
	char num[20];
	char name[20];
	char sex;
	int age;
	char grade[10];
	char add[30];
	struct stud *next;
};
struct stud *creat(void)
{
	struct stud *head,*p1,*p2;
	p1=p2=(struct stud *)malloc(sizeof(struct stud));
	p2->next=0;
	head=p1;
	for(;;)
	{
		scanf("%s",p1->num);
		if(*(p1->num+2)=='d')
			return head;
		scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->grade,p1->add);
		p1=(struct stud *)malloc(sizeof(struct stud));
		head=p2;
		p1->next=p2;
		p2=p1;
	}
}
void print(struct stud *head)
{
	struct stud *p;
	for(p=head;p!=0;p=p->next)
		printf("%s %s %c %d %s %s\n",p->num,p->name,p->sex,p->age,p->grade,p->add);
}
void main()
{
	struct stud *head;
	head=creat();
	print(head);
}
struct student
{
	char id[100];
	char name[100];
	char sex;
	int age;
	char score[100];
	char addr[100];
    struct student *pre,*next;
};
void main()
{
	struct student *p1,*p2,*head1,*head2;
	
	int n=0;
	char temp[100];
	head1=NULL;
	p1=p2=NULL;
	while(scanf("%s",temp),strcmp(temp,"end")!=0)
	{
		n=n+1;
		p1=(struct student *)malloc(sizeof(struct student));
		p1->pre=NULL;
		p1->next=NULL;
		
		strcpy(p1->id,temp);
		scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->score,p1->addr);
		if(n==1)head1=p1;else {p2->next=p1;p1->pre=p2;}
		p2=p1;
	}
	
	head2=p2;
	while(p2!=NULL)
	{
		printf("%s %s %c %d %s %s\n",p2->id,p2->name,p2->sex,p2->age,p2->score,p2->addr);
		p2=p2->pre;
	}
}