semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
struct Student
{
	char num[20];
	char name[20];
	char sex;
	int age;
	char score[20];
	char add[20];
	struct Student *next;
};
int n=0;
struct Student*create()
{
	struct Student*head;
	struct Student*p1,*p2;
	n=0;
	p1=p2=(struct Student*)malloc(sizeof(struct Student));
	scanf("%s %s %c %d %s %s",p1->num,p1->name,&p1->sex,&p1->age,p1->score,p1->add);
	head=NULL;
	while(strcmp(p1->num,"end")!=0)
	{
		n=n+1;
		if(n==1)head=p1;
		else p2->next=p1;
		p2=p1;
		p1=(struct Student *)malloc(sizeof(struct Student));
		scanf("%s",p1->num);
		if(strcmp(p1->num,"end")!=0)
			scanf("%s %c %d %s %s",p1->name,&p1->sex,&p1->age,p1->score,p1->add);
		
		
	}
p2->next=NULL;

return (head);
}

void print(struct Student *head)
{
	struct Student*p;
	p=head;
	if(p->next!=NULL)print(p->next);
	printf("%s %s %c %d %s %s\n",p->num,p->name,p->sex,p->age,p->score,p->add);
	

}
int main()
{
	struct Student *head;
	head=create();
	print(head);
	return 0;
}
//
//p=p->next;
struct student
{
       char num[20];
       char name[20];
       char sex;
       int age;
       double score;
       char address[20];
       struct student *next;
       struct student *former;
       };
        
main()
{
      struct student *p,*p1,*p2,*header;
        header=(struct student *)malloc(sizeof(struct student));
        header->next=header->former=NULL;
        p2=header;
       for(;;)
        {
           p1=(struct student *)malloc(sizeof(struct student));
           p2->next=p1;
           p1->former=p2;
           scanf("%s",p1->num);
           if(p1->num[0]=='e'&&p1->num[1]=='n'&&p1->num[2]=='d') break;
           scanf("%s %c %d %lf %s",p1->name,&p1->sex,&p1->age,&p1->score,p1->address);
           p2=p1;
           }
        p2->next=NULL;
        //free(p1);
               p=p2;
               for(;p2->former!=NULL;)
               {
                 if(p2->score==(int)(p2->score))

                 printf("%s %s %c %d %d %s\n",p2->num,p2->name,p2->sex,p2->age,(int)(p2->score),p2->address);

                 else printf("%s %s %c %d %.1lf %s\n",p2->num,p2->name,p2->sex,p2->age,p2->score,p2->address);
                 p2=p2->former;
                 }
     // p1=p;
    //  for(;p1->former!=NULL;)
    // {
      // p2=p1;
      // p1=p2->former;
      // free(p2);
     //  }
      // free(p1);      

      }
void main()
{
	struct student
	{
	char a[100];
	struct student * next;
	};
	struct student * head;
	struct student * p1,* p2;
	p1=p2=(struct student * )malloc(LEN);
	gets(p1->a);
	p1->next=0;
	while(strcmp(p1->a,"end"))
	{
		head=p1;
		p2=p1;
		p1=(struct student * )malloc(LEN);
		gets(p1->a);
		p1->next=p2;
	}
	for(p1=head;p1!=0;p1=p1->next)
		printf("%s\n",p1->a);	
}
int main()
{
	struct student
	{
		char No[9];
		char name[20];
		char sex;
		int age;
		char score[8];
		char add[20];
		struct student *next,*last;
	};
	struct student *p,*head,*tail;
	p=(struct student*)malloc(sizeof(struct student));
	head=p;
	head->last=NULL;
	do
	{
		scanf("%s",p->No);
		if(p->No[0]=='e')
		{
			p->next=NULL;
			tail=p->last;
		}
		else
		{
			scanf("%s %c%d%s%s",p->name,&p->sex,&p->age,&p->score,p->add);
			p->next=(struct student*)malloc(sizeof(struct student));
			p->next->last=p;
		}
		p=p->next;
	}while(p!=NULL);
	p=tail;
	while(p!=NULL)
	{
		printf("%s %s %c %d %s %s\n",p->No,p->name,p->sex,p->age,p->score,p->add);
		p=p->last;
	}
	return 0;
}
struct node
{
 char no[20],name[20],sex,ad[20],score[20];
 int age;
 struct node *next;
}*start=NULL,*p;
int main()
{
	
	struct node * temp;
	
	while(1==1)
	{
		temp=(struct node *)malloc(sizeof(struct node));
		scanf("%s",temp->no);
		if(strcmp(temp->no,"end")==0) break;
		
		scanf(" %s %c %d %s %s",temp->name,&temp->sex,&temp->age,temp->score,temp->ad);
		temp->next=start;
		start=temp;	
		
	}
	p=start;
	while(p!=NULL)
	{
		printf("%s %s %c %d %s %s\n",p->no,p->name,p->sex,p->age,p->score,p->ad);
		p=p->next;
	}
printf("\n");
return 0;
	
}
void main()
{
	struct s
	{
		char a[100];
		char b[100];
		char c;
		int d;
		float e;
		char f[100];
		struct s *next;
	};
	struct s *p1,*p2,*head;
	int i,j,k,m,n,t;
	p1=p2=(struct s *)malloc(sizeof(struct s));
	head=p1=p2;n=1;
	scanf("%s %s %c %d %f %s",p1->a,p1->b,&p1->c,&p1->d,&p1->e,p1->f);
	for(i=0;i<10000;i++)
	{
		p1=(struct s *)malloc(sizeof(struct s));
		p2->next=p1;
		p2=p1;
		scanf("%s",p1->a);
		if(strcmp(p1->a,"end")!=0)
		{
			scanf("%s %c %d %f %s",p1->b,&p1->c,&p1->d,&p1->e,p1->f);
			n++;
		}
		else
			break;
	}
	p1=p2=head;
	for(j=0;j<n-1;j++)
	{
		for(i=0;i<n-j-1;i++)
		p1=p1->next;
		printf("%s %s %c %d %g %s\n",p1->a,p1->b,p1->c,p1->d,p1->e,p1->f);
		p1=head;
	}
	printf("%s %s %c %d %g %s\n",p1->a,p1->b,p1->c,p1->d,p1->e,p1->f);
}
struct student
{
	char id[100];
	char name[100];
	char sex;
	int age;
	char score[100000];
	char address[100];
	struct student *next;
};

struct student *creat(void)
{
	struct student *head,*p,*q;
	q=NULL;
	head=(struct student *)malloc(len);
	p=head;
	while(1)
	{
		q=p;
		scanf("%s",&p->id);
		if(strcmp(p->id,"end")==0)
			break;
		scanf("%s %c %d %s %s",&p->name,&p->sex,&p->age,&p->score,&p->address);
		p=(struct student *)malloc(len);
		q->next=p;
	}
	q->next=NULL;
	return (head);
}

struct student *turn(struct student *head)
{
	struct student *p,*q,*t,*newhead=NULL;
	while(head->next !=NULL)
	{
		q=NULL;
		p=head;
		while(p->next!=NULL)
		{
			q=p;
			p=p->next;
		}
		if(newhead==NULL)
		{
			newhead=p;
			t=newhead->next=q;
		}
		t=t->next=q;
		q->next=NULL;
	}
	return newhead;
}

void put(struct student *head)
{
	struct student *p;
	for(p=head;p!=NULL;p=p->next)
	{
		if(strcmp(p->id,"end")==0)
			continue;
		printf("%s %s %c %d %s %s\n",p->id,p->name,p->sex,p->age,p->score,p->address);
	}
}

void main()
{
	struct student *head;
	head=creat();
	head=turn(head);
	put(head);
}
char a[3]={'e','n','d'};
struct student
{
	char xuehao[50];
	char name[50];
	char gender;
	int age;
    float score;
	char add[100];
	struct student *next;
};
int m;
struct student *head;
struct student *creat()
{
	struct student *p1,*p2;
	m=0;
	p1=p2=(struct student*)malloc(LEN);
	scanf("%s %s %c %d %f %s",p1->xuehao,p1->name,&p1->gender,&p1->age,&p1->score,p1->add);
	head=NULL;
	while(strcmp(p1->xuehao,a)!=0)
	{
		m=m+1;
		if(m==1)
		{p2->next=NULL;}
		else p1->next=p2;
		p2=p1;
		head=p1;
		p1=(struct student*)malloc(LEN);
		scanf("%s",p1->xuehao);
		if(strcmp(p1->xuehao,a)!=0)
		{scanf(" %s %c %d %f %s",p1->name,&p1->gender,&p1->age,&p1->score,p1->add);}
	}
		if(strcmp(p1->xuehao,a)==0)
			p1->next=head;
		return(head);
}
void main()
{
		creat();
		struct student *p1;
	     for(p1=head;p1!=NULL;p1=p1->next)
			printf("%s %s %c %d %g %s\n",p1->xuehao,p1->name,p1->gender,p1->age,p1->score,p1->add);

}
struct student
{
	char num[20];
	char name[20];
	char x[2];
	int age;
	char score[8];
    char add[30];
	struct student *next;
};
void main()
{
	int i,j;
	struct student *head,*p1,*p2;
    p1=(struct student *)malloc(len);
	head=p1;
	scanf("%s%s%s%d%s%s",p1->num,p1->name,p1->x,&p1->age,p1->score,p1->add);
	p1->next=null;
	for(i=1;;i++)
	{
		p1=(struct student *)malloc(len);
		scanf("%s",p1->num);
		if((p1->num[0])!='e')
		{
			scanf("%s%s%d%s%s",p1->name,p1->x,&p1->age,p1->score,p1->add);
			p1->next=head;
			head=p1;
		}
		else break;
	}
	do
	{
		printf("%s %s %s %d %s %s\n",head->num,head->name,head->x,head->age,head->score,head->add);
		head=head->next;
	}while(head!=null);
}
struct stu
{char id[16];
 char name[32];
 char gender;
 int age;
 char score[8];
 char add[16];
 struct stu*next;
};
int n;
struct stu*creat(void)
{struct stu *head,*p1,*p2;
 n=0;
 head=NULL;
 p1=p2=(struct stu*)malloc(sizeof(struct stu));
 scanf("%s",p1->id);
 while(strcmp(p1->id,"end")!=0)
 {scanf("%s %c %d %s %s",p1->name,&p1->gender,&p1->age,p1->score,p1->add);
  n=n+1;
  if(n==1) {head=p1;p1->next=NULL;}
  else 
  {
   p1->next=p2;
   head=p1;
  }
  p2=p1;
  p1=(struct stu*)malloc(sizeof(struct stu));
  scanf("%s",p1->id);
 }
 return(head);
}
void main()
{struct stu*head,*p;
 head=creat();
 p=head;
 if(head!=NULL)
 do
 {printf("%s %s %c %d %s %s\n",p->id,p->name,p->gender,p->age,p->score,p->add);
  p=p->next;
 }while(p!=NULL);
}
struct Student
{
        char information[200];
        struct Student *next;
};
int n;
struct Student*creat()
{
        struct Student *p1,*p2,*head;
        n=0;
        p1=p2=(struct Student *)malloc(LEN);
        gets(p1->information);
        head=NULL;
        while(strcmp(p1->information,"end")!=0)
        {
                n=n+1;
                if(n==1)
                {
                        p1->next=NULL;
               }
                else
                {
                        p1->next=p2;
                }
                p2=p1;
                p1=(struct Student *)malloc(LEN);
                gets(p1->information);
        }
        head=p2;
        return(head);
}
void print(struct Student *head)
{
        struct Student *p;
        p=head;
        if(head!=NULL)
                do
                {
                        printf("%s\n",p->information);
                        p=p->next;
                }
                while(p!=NULL);
}
int main()
{
        struct Student * head;
        head=creat();
        print(head);
        return 0;
}
struct stu{
	char no[10];
	char name[20];
	char gene;
	unsigned int age;
	float score;
	char add[20];
	struct list *next;
};

struct stu *creat()
{
	struct stu *p1=NULL,*p2=NULL,*head;
	int n=0;
	do{
        p2=p1;
		p1=(struct stu*)malloc(sizeof(struct stu));
	    scanf("%s",p1->no);
		if(*p1->no=='e')    
		{
			head=p2;
			free(p1);
			break;
		}	
		scanf("%s %c %d %f %s\n",p1->name,&p1->gene,&p1->age,&p1->score,p1->add);
		if(n==0)p1->next=NULL;
		if(n!=0)p1->next=p2;
		n=1;
	}while(1);
	return head;
}

void print(struct stu *head)
{
	struct stu *p;
	p=head;
	while(p!=NULL)
	{
		printf("%s %s %c %d %g %s\n",p->no,p->name,p->gene,p->age,p->score,p->add);
		p=p->next;
	}
}

int main()
{
	struct stu *head;
	head=creat();
	print(head);
	return 0;
}
struct student
{
    char num[15];
    char name[30];
    char sex;
    char age[3];
    char grade[10];
    char ad[15];
}stu[1000]={0};

int main()
{
    int i=0;
    while(1)
    {
        scanf("%s",stu[i].num);
        if(stu[i].num[0]=='e')
            break;
        else
        {
            scanf("%s %c %s %s %s",stu[i].name,&stu[i].sex,stu[i].age,stu[i].grade,stu[i].ad);
            i++;
        }
    }   
    i=i-1;
    for(;i>=0;i--)
    {
        printf("%s %s %c %s %s %s\n",stu[i].num,stu[i].name,stu[i].sex,stu[i].age,stu[i].grade,stu[i].ad);
    }
    return 0;
}
struct student
{
	char info[50];
	struct student *p;
};
void main()
{
	int m,n,i,j;
	struct student *p,*head;
    for(i=0;;i++)
	{
		p=DT;
		if(i==0)
		  p->p=NULL;
		gets(p->info);
		if(strcmp(p->info,"end")==0)
			break;
		p->p=head;
		head=p;
	}
    for(p=head,j=0;j<i;j++,p=p->p)
	{
		puts(p->info);
	}
}
struct Student
{
char number[100];
char name[100];
char sex;
int age;
char score[20];
char address[100];
struct Student *next;
struct Student *front;
}; 
int n;
void main()
{
	struct Student*p1,*p2;
	n=0;
	p1=p2=(struct Student*)malloc(LEN);
	scanf("%s %s %c%d%s%s",&p1->number,&p1->name,&p1->sex,&p1->age,&p1->score,&p1->address);
	p1->front=NULL;
	while(p1->number[0]!='e'||p1->number[1]!='n'||p1->number[2]!='d')
	{
			n=n+1;
		    p2->next=p1;
			p2=p1;
			p1=(struct Student*)malloc(LEN);
			scanf("%s %s %c%d%s%s",&p1->number,&p1->name,&p1->sex,&p1->age,&p1->score,&p1->address);
			p1->front=p2;
	}
	p2->next=NULL;
	while(p2!=NULL)
	{
		printf("%s %s %c %d %s %s\n",p2->number,p2->name,p2->sex,p2->age,p2->score,p2->address);
		p2=p2->front;
	}
}
struct a
{
	char num[10];
	char name[21];
	char sex;
	int age;
	float score;
	char address[12];
	struct a*next;
};
struct a*create()
{
	struct a*head,*p1;
	p1=len;p1->next=null;head=p1;strcpy(p1->num,"pp");
	while(strcmp(p1->num,"end"))
	{
		scanf("%s",p1->num);
		if(strcmp(p1->num,"end")!=0)
		{
		scanf("%s %c %d %f %s",p1->name,&p1->sex,&p1->age,&p1->score,p1->address);
		p1=len;
		p1->next=head;
		head=p1;
		strcpy(p1->num,"pp");}
	}
	head=p1->next;
	return head;
}
void print(struct a*head)
{
	struct a*p1;
	p1=head;
	do
	{
		printf("%s %s %c %d %g %s",p1->num,p1->name,p1->sex,p1->age,p1->score,p1->address);
		if(p1->next!=null)printf("\n");
		p1=p1->next;
	}while(p1);
}
int main()
{
	struct a*create();
	struct a*head;
	void print(struct a*head);
	head=create();
	print(head);
}
struct student
{char number[100];
char name[100];
char sex;
int age;
char score[20];
char address[100];
struct student *next;
struct student *front;
}; 
void main()
{
struct student *p1,*p2;
p1=p2=(struct student*)malloc(LEN);
p1->front=NULL;
scanf("%s",&p1->number);
while(p1->number[0]!='e'||p1->number[1]!='n'||p1->number[2]!='d')
{
        scanf("%s %c%d%s%s",&p1->name,&p1->sex,&p1->age,&p1->score,&p1->address);
p2->next=p1;
p2=p1;
p1=(struct student*)malloc(LEN);
p1->front=p2;
scanf("%s",&p1->number);
}
p2->next=NULL;
while(p2!=NULL)
{
printf("%s %s %c %d %s %s\n",p2->number,p2->name,p2->sex,p2->age,p2->score,p2->address);
p2=p2->front;
}
}
int main()
{
    char str[10000][100];
    gets(str[0]);
    int i=0,j;
    while(str[i][0]!='e')
    {
                         i++;
                         gets(str[i]);
    }
    for(j=i-1;j>=0;j--)
    printf("%s\n",str[j]);
    getchar();getchar();
}
struct node
{
	int num;
	char number[20];
	char name[20];
	char sex[10];
	char age[10];
	char score[10];
	char address[20];
	struct node *next;
};
struct node * creat(int n);
struct node * insert(struct node *head,struct node * q);
void list(struct node *head);
struct node * fv(struct node * head);
int main(void)
{	
	struct node *p;
	p=creat(0);
	int i;
	for(i=1;i<1000;i++)
	{
		struct node *q;
		q=creat(i);
		if(strcmp("end",q->number)!=0)
			p=insert(p,q);
		else 
			break;
	}
	p=fv(p);
	list(p);
	return 0;
}
struct node * creat(int n)
{
	struct node *ps;
	ps=(struct node *)malloc(sizeof(struct node));
	scanf("%s %s %s %s %s %s\n",&ps->number,&ps->name,&ps->age,&ps->sex,&ps->score,&ps->address);
	fflush(stdin);
	ps->num=n;
	return(ps);
}
struct node * insert(struct node *head,struct node * q)
{
	struct node *m,*n;
	m=head;
	if(head==0)
	{
		head=q;
		q->next=0;
	}
	else
	{
		if(q->num<=head->num)
		{
			q->next=head;
			head=q;
		}
		else
		{
			while((q->num>m->num)&&(m->next!=0))
			{
				n=m;
				m=m->next;
			}
			if(q->num<=m->num)
			{
				n->next=q;
				q->next=m;
			}
			else
			{
				m->next=q;
				q->next=0;
			}
		}
	}
	return(head);
}
struct node * fv(struct node * head)
{
	struct node *p,*q,*k,*l;
	l=head;
	p=(struct node *)malloc(sizeof(struct node));
	p->next=l;
	k=p->next;
	while(k!=0)
	{
		q=p;
		p=k;
		k=p->next;
		p->next=q;
	}
	p->next=q;
	q=p;
	while(q->num!=head->num)
		q=q->next;
	q->next=0;
	return(p);
}
void list(struct node *head)
{
	struct node *p;
	p=head;
	while(p!=0)
	{
		printf("%s %s %s %s %s %s\n",&p->number,&p->name,&p->age,&p->sex,&p->score,&p->address);
		p=p->next;
	}

}
int n=0;
struct student
{
	char id[20];
	char name[20];
	char sex;
	int age;
	char score[20];
	char address[20];
	struct student* next;
};
struct student *creat()
{
struct student* head,*pf,*ps;
pf= (struct student * ) malloc(sizeof(struct student));
ps=pf;					
scanf("%s",&pf->id);
while(pf->id[0]!='e')
{
	n++;
	scanf("%s %c %d %s %s",&pf->name,&pf->sex,&pf->age,&pf->score,&pf->address);
	if(n!=1)
	{
		pf->next=ps;
		ps=pf;
	}
	else pf->next=NULL;
	pf=(struct student*)malloc(sizeof(struct student));
	scanf("%s",&pf->id);
}
head=ps;
return head;
}
void print(struct student *head)
{
	int i;
	struct student *p;
	p=head;
	if(head!=NULL)
	for(i=0;i<n;i++)
	{
		printf("%s %s %c %d %s %s\n",p->id,p->name,p->sex,p->age,p->score,p->address);
		p=p->next;
	}
}
void main()
{
struct student *head;
head=creat();
print(head);
}
struct Inform
{
    char number[30];
    char name[30];
	char gender[2];
	char age[4];
	char score[10];
	char address[20]; 
	struct Inform *next;
};
 int n; 
 struct Inform *creat()
 {
      
	  struct Inform *head;
      struct Inform *p1,*p2;
      head=NULL;
      p1=p2=(struct Inform*)malloc(LEN);
      n=0; 
	  scanf("%s%s%s%s%s%s",&p1->number,&p1->name,&p1->gender,&p1->age,&p1->score,&p1->address);
      while(strcmp(p1->number,"end")!=0) 
	  {
	      n=n+1;
          if(n==1) head=p1;
          else p2->next=p1;
          p2=p1;
          p1=(struct Inform*)malloc(LEN);
          scanf("%s",&p1->number);
          if(strcmp(p1->number,"end")!=0) scanf("%s%s%s%s%s",&p1->name,&p1->gender,&p1->age,&p1->score,&p1->address);
      } 
	  p2->next=NULL;
	  return head;
}



void print(struct Inform *h)
{
     struct Inform *p;
	 p=h;
	 while(p!=NULL)
	 {
	    printf("%s %s %s %s %s %s\n",p->number,p->name,p->gender,p->age,p->score,p->address); 
		p=p->next; 
	 } 

} 

struct Inform *invert(struct Inform *h)
{
    struct Inform *p=h->next;
	 struct Inform *q=p->next;
	h->next=NULL; 
	while(q!=NULL)
	{p->next=h;h=p;p=q;q=q->next;p->next=h;
    } 
    p->next=h;
	return p;  
}


int main()
{
	void print(struct Inform *h); 
	struct Inform *invert(struct Inform *h);
	struct Inform *hea;
	hea=creat();
	hea=invert(hea);
	print(hea);
	return 0; 
}
int main()
{
    int n,l;
	char j[100],b[100];
	char  m[10]={'0','1','2','3','4','5','6','7','8','9'};
	char d[100];
	int nj,nb,yj,yb;
	int i,ii;
	scanf("%d",&n);
	for(l=0;l<n;l++)
	{
	scanf("%s\n",j);
    scanf("%s",b);
	nj=0;
	nb=0;
	for(i=0;j[i];i++)
	{	nj++;
	d[i]='0';}
	for(i=0;b[i];i++)
		nb++;
	for(i=nj-1;i>=nj-nb;i--)
		b[i]=b[i-nj+nb];
	for(i=0;i<nj-nb;i++)
		b[i]='0';
	for(i=nj-1;i>=0;i--)
	{
		yj=j[i]-'0';
		yb=b[i]-'0';
		if(yj-yb>=0)
			d[i]=m[yj-yb];
		if(yj-yb<0)
		{	d[i]=m[yj-yb+10];  
		    int p,pp,cp,k;
			for(p=i-1;p>=0;p--)
			{
				if(j[p]!='0')
				{	pp=p;
				break;}
			}
			cp=j[pp]-'0';
			j[pp]=m[cp-1];
			for(k=i-1;k>pp;k--)
					j[k]='9';
		}
	}
	for(i=0;i<nj-1;i++)
	{
		ii=nj-1;
		if(d[i]!='0')
		{ii=i;
		break;}
	}
	for(i=ii;i<nj-1;i++)
		printf("%c",d[i]);
	printf("%c\n",d[nj-1]);
	}
	return 0;
}
void main()
{
	char a[10][100],b[10][100];
	int i,j,m=0,n,lena[10],lenb[10],a1[10][100]={0},b1[10][100]={0};
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{ 
	    scanf("%s %s",a[i],b[i]);
		printf("\n");
		lena[i]=strlen(a[i]);
		lenb[i]=strlen(b[i]);
		for(j=lena[i]-1;j>=0;j--)
		{
			a1[i][m]=a[i][j]-'0';
			m++;
		}
		m=0;
		for(j=lenb[i]-1;j>=0;j--)
		{
			b1[i][m]=b[i][j]-'0';
			m++;
		}
		m=0;
		for(j=0;j<lena[i];j++)
		{
			a1[i][j]=a1[i][j]-b1[i][j];
			if(a1[i][j]<0)
			{
			    a1[i][j]=a1[i][j]+10;
				a1[i][j+1]=a1[i][j+1]-1;
			}
		}
	
		for(j=lena[i]-1;j>=0;j--)
		{
			printf("%d",a1[i][j]);
		}
		printf("\n");
	}
}
void main()
{
	int n,m,i,j,la,lb;
	char a[101],b[101],c[101],r[100][101];
	scanf("%d",&n);
	for(m=0;m<n;m++)
	{
		scanf("%s %s",a,b);
		la=strlen(a);
		lb=strlen(b);
		for(i=0;i<la-lb;i++)
			c[i]='0';
		c[i]=0;
		strcat(c,b);
		r[m][la]=0;
		for(i=la-1;i>=0;i--)
		{
			if(a[i]>=c[i]) r[m][i]=a[i]-c[i]+'0';
			else
			{
				r[m][i]=a[i]+10-c[i]+'0';
				for(j=i-1;;j--)
				{if(a[j]>'0') {a[j]--;break;}
				 else a[j]='9';
				}
			}
		}
	}
	for(m=0;m<n;m++)
		printf("%s\n",r[m]);
}
int p1,p2,p3,i,n,j;
char a[1000];
char b[1000];
char c[1000];
int max(int a,int b)
{
	if (a>b) return a;else return b;
}
int za(int m)
{
	if (m<0) return 0;else return a[m]-'0';
}
int zb(int m)
{
	if (m<0) return 0;else return b[m]-'0';
}
int main()
{
	cin>>n;
	for (j=1;j<=n;j++)
	{
		for (i=0;i<=999;i++) {a[i]='\0';b[i]='\0';c[i]='\0';}
		cin>>a;
		cin>>b;
		p1=0;while(a[p1]!='\0')p1++;p1--;
		p2=0;while(b[p2]!='\0')p2++;p2--;
		c[0]=0;
		for (i=0;i<=max(p1,p2)+1;i++) c[i]=za(p1-i)-zb(p2-i);
		for (i=0;i<=max(p1,p2)+1;i++) 
		{
			c[i+1]+=(c[i]+10)/10-1;
			c[i]=(c[i]+10)%10;
		}
		p3=900;while((c[p3]==0)&&(p3>=0))p3--;
		for (i=p3;i>=0;i--) cout<<(int)c[i];
		if (p3<=0) cout<<0;
		cout<<endl;
	}
	return 0;
}
int main()
{
	char a[100],b[100];
	int n,i,j,k;
	cin>>n;
	for (i=1;i<=n;i++)
	{
		cin>>a;
		cin>>b;
		for (j=strlen(a)-1,k=strlen(b)-1;k>=0;j--,k--)
		{
			if (a[j]>=b[k])
				a[j]=a[j]-b[k]+'0';
			else
			{
				a[j]=a[j]+10-b[k]+'0';
				a[j-1]--;
			}
		}
		for (j=0;j<=strlen(a)-1;j++)
			if (a[j]!='0')
			{
				for (k=j;k<=strlen(a)-1;k++)
				cout<<a[k];
				break;
			}
		if (j==strlen(a)&&a[j-1]=='0')
			cout<<"0";
		cout<<endl;
	}
	return 0;
}
int yu(char y)
{
	int b;
	if (y=='0') b=0;
	if (y=='1') b=1;
	if (y=='2') b=2;
	if (y=='3') b=3;
	if (y=='4') b=4;
	if (y=='5') b=5;
	if (y=='6') b=6;
	if (y=='7') b=7;
	if (y=='8') b=8;
	if (y=='9') b=9;
	return (b);
}
void main()
{
	char a[20][103],b[20][103];
	int i,j,k,n,c[20],d[20],e[20][103],f[20][103],m;
	{for (i=0;i<20;i++)
	{	for(j=0;j<103;j++)
	{a[i][j]='\0'; b[i][j]='\0';}}}
	scanf("%d",&n);
	printf("\n");
	for (i=0;i<n;i++)
	{scanf("%s",a[i]);printf("\n");scanf("%s",b[i]);printf("\n\n");}
	{for (i=0;i<n;i++)
	{for(j=0;j<(c[i]=strlen(a[i]));j++)
			e[i][j]=yu(a[i][j]);
     for(j=0;j<(d[i]=strlen(b[i]));j++)
		 f[i][j]=yu(b[i][j]);}}
	for (i=0;i<n;i++)
		for (j=(c[i]-1);j>=(c[i]-d[i]);j--)
		{k=(j-c[i]+d[i]);
		if (e[i][j]>f[i][k])  e[i][j]=(e[i][j]-f[i][k]);
        else if (e[i][j]==f[i][k])  e[i][j]=0;
		else if (e[i][j]<f[i][k])  {e[i][j]=(e[i][j]+10-f[i][k]); 
		{for (m=(j-1);e[i][m]==0;m--) e[i][m]=9;}
			                   e[i][m]=(e[i][m]-1);}
		}
	for (i=0;i<n;i++)
	{j=0; while (e[i][j]==0) j++;for (;j<c[i];j++) printf("%d",e[i][j]); printf("\n");} 
}
main()



{
      int x,y,i,j,n;
      char test1[100];
      char test2[100];
      char a[100];
      char b[100];
      char c[100];
      
      scanf("%d",&n);
      
      for(j=0;j<n;j++)
      
    { scanf("%s",test1);
      x=strlen(test1);
      for(i=0;i<x;i++)
      a[i]=test1[x-i-1];
      for(i=x;i<100;i++)
      a[i]='0';
           
      scanf("%s",test2);
      y=strlen(test2);
      for(i=0;i<y;i++)
      b[i]=test2[y-i-1];
      for(i=y;i<100;i++)
      b[i]='0';
                
      for(i=0;i<x;i++)
      {
          if(a[i]>=b[i])
          c[i]=a[i]-b[i]+'0';
          else
          {
              c[i]=a[i]-b[i]+10+'0';
              a[i+1]=a[i+1]-1;          
          }       
      }   
      
      
      for(i=x-1;i>=0;i--)
      printf("%c",c[i]);
      printf("\n");
    } 
}
int main()
{
	const int ma=200,mx=50;
	int i,n,k,j;
	int len1[ma]={0},len2[ma]={0};
	int zs1[mx][ma]={0},zs2[mx][ma]={0},ans[mx][ma]={0};
	char num1[mx][ma]={0},num2[mx][ma]={0};
	cin>>n;
	for(k=0;k<n;k++)
	{
		cin.get();
		cin.getline(num1[k],ma);
		cin.getline(num2[k],ma);
		len1[k]=strlen(num1[k]);
		len2[k]=strlen(num2[k]);
	}
	for(k=0;k<n;k++)
	{
		j=0;
		for(i=len1[k]-1;i>=0;i--)
			zs1[k][j++]=num1[k][i]-'0';
		j=0;
		for(i=len2[k]-1;i>=0;i--)
			zs2[k][j++]=num2[k][i]-'0';
		for(i=0;i<len1[k];i++)
		{
			if(i<len2[k])
			{
				if(zs1[k][i]<zs2[k][i])
				{
					zs1[k][i]=zs1[k][i]+10;
					zs1[k][i+1]=zs1[k][i+1]-1;
					ans[k][i]=zs1[k][i]-zs2[k][i];
				}
				else
					ans[k][i]=zs1[k][i]-zs2[k][i];
			}
			else
				ans[k][i]=zs1[k][i]-zs2[k][i];
		}
	}
		for(k=0;k<n;k++)
		{
			if(ans[k][len1[k]]==0)
				len1[k]=len1[k]-1;
			for(i=len1[k];i>=0;i--)
			{
				cout<<ans[k][i];
			}
			cout<<endl;
		}
		return 0;
}
void main()
{
	int n,i,j,length1,length2,cha;
	scanf("%d",&n);
	char beijianshu[101],jianshu[101];
	for(i=0;i<n;i++)
	{
		scanf("%s",beijianshu);
		scanf("%s",jianshu);
		length1=strlen(beijianshu);
		length2=strlen(jianshu);
		for(j=1;j<=length2;j++)
		{
			cha=beijianshu[length1-j]-jianshu[length2-j];
			if(cha>=0)
				beijianshu[length1-j]=cha+'0';
			else
			{
				beijianshu[length1-j-1]--;
				beijianshu[length1-j]=10+cha+'0';
			}
		}	
		while(beijianshu[length1-j]<'0')
		{
			beijianshu[length1-j]+=10;
			j++;
			beijianshu[length1-j]-=1;
		}

		printf("%s\n",beijianshu);
	}

}
void main()
{
	int n,i,j,k,t,r,c[100];
	char a[100],b[100];
	scanf("%d",&n);
	while(n--)
	{
		
		scanf("%s",a);
		scanf("%s",b);
		r=strlen(a);
		t=strlen(b);
		for(i=0;i<r;i++)
			a[i]=a[i]-'0';
		for(i=0;i<t;i++)
			b[i]=b[i]-'0';
		for(i=r-1,j=t-1;j>=0;i--,j--)
		{
			if(a[i]>=b[j])
				c[i]=a[i]-b[j];
			else
			{
				a[i-1]=a[i-1]-1;
				c[i]=a[i]+10-b[j];
			}
		}
		for(i=0;i<r-t;i++)
			c[i]=a[i];
		for(i=r-1;i>0;i--)
		{
			if(c[i]<0)
			{
				c[i-1]=c[i-1]-1;
				c[i]=c[i]+10;
			}
		}
		if(c[0]>0)
			printf("%d",c[0]);
		for(i=1;i<r-1;i++)
			printf("%d",c[i]);
		printf("%d\n",c[r-1]);
	}
}