semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int main()
{
	int n,i,j,lena,lenb,m,p;
	char a[110],b[110],t;
	scanf("%d\n",&n);
	for(;n>0;n--)
	{
		gets(a);
		gets(b);
		lena=strlen(a);
		lenb=strlen(b);
		for(i=0;i<lenb/2;i++)
		{
          t=b[i];
          b[i]=b[lenb-i-1];
          b[lenb-i-1]=t;
        }
		for(i=0;i<lena/2;i++)
		{
          t=a[i];
          a[i]=a[lena-i-1];
          a[lena-i-1]=t;
        }
		for(i=0;i<lenb;i++)
		{
            if(a[i]>=b[i])
             a[i]='0'+a[i]-b[i];
            else
            {
              j=i+1;
              while(a[j]=='0')
              {
               a[j]='9';
               j++;
              }
              a[j]-=1;
              a[i]=a[i]+10-b[i]+'0';         
            }
        }
		for(i=lena-1;i>=0;i--)
          if(a[i]!='0')break;
        for(j=i;j>=0;j--)
         printf("%c",a[j]);
        printf("\n");
        gets(a);
	}
}
void minus(char *a,char *b,int na,int nb,char *c)
{
	int i;
	for(i=0;i<nb;i++)
   {
	   if((a[i]-b[i])<0)
       {
		   c[i]=10+a[i]-b[i]+'0';
	       a[i+1]--;
	   }
	   else
		   c[i]=a[i]-b[i]+'0';
 
	}
   for(i=nb;i<na-1;i++)
   {
	   if(a[i]<'0')
	   {   
		   a[i]=a[i]+10;
		   a[i+1]--;
	   }
	   c[i]=a[i];
   }
   c[na-1]=a[na-1];
   }
void exchange(char *a,int na)
{
 int k;
 for(k=1;k<=(na/2);k++)
		{
			int t;
			t=a[k-1];
			a[k-1]=a[na-k];
			a[na-k]=t;
		}
}
void main()
{
    int n,i,k,j;
	scanf("%d",&n);
	char **c;
	c=(char**)malloc((n+1)*sizeof(char *));
	if(c!=NULL)
    {char a[100]
,b[100];
	int na,nb;
	for(i=0;i<n;i++)
	{
		scanf("%s",a);
		scanf("%s",b);
		na=strlen(a);
		nb=strlen(b);
	    exchange(a,na);
		exchange(b,nb);
		c[i]=(char*)malloc((na+1)*sizeof(char));
		if(c[i]!=NULL)
		minus(a,b,na,nb,c[i]);
	}
	for(i=0;i<n;i++)
	{
		for(k=strlen(c[i])-1;k>0;k--)
	   {
		 if(c[i][k]>'0')
			 break;
		}
		for(j=k;j>=0;j--)
		{
			printf("%c",c[i][j]);
			if(j==0)
				printf("\n");
		}
		free(c[i]);
	}
	free(c);
	}
}
/**
 * ? ? ???????
 * ?    ?????
 * ????: 2010?11?19?
 * ???????????????
*/
int main()
{
	int k, n;		//????n?????????
	cin>>n;
	for ( k =1; k <= n; k++ )	//????
	{
	int a1[201];	//????????????a1??????b1????
	int b1[201];	
	char a[201];		//?????????a??????b????
	char b[201];
	cin>>a>>b;
	int len1 = strlen(a);	//????????????
	int len2 = strlen(b);
	memset(a1,0,sizeof(a1));	//????????0
	memset(b1,0,sizeof(b1));
	int i, j = 0;
	for (i = len1 - 1; i >= 0; i--)
		a1[j++] = a[i] - '0';	//???????????????
		j = 0;
	for (i = len2 - 1; i >= 0; i--)
		b1[j++] = b[i] - '0';
	for (i = 0; i < len1 ; i++)		//????
	{
	if ( a1[i] >= b1[i] )		//????????
	{
		a1[i]= a1[i]- b1[i];
	}
	else
		if ( a1[i] < b1[i] )	//??????????????????
	{
		a1[i]= a1[i] + 10 - b1[i];
		a1[i+1]--;
	}
	}
	i = len1;
	while( a1[i] == 0 )
		i--;			//???????0??
	for(; i >= 0; i--)
	cout << a1[i];		//??????
	cout << endl;
	}
	return 0;
}
void main()
{
	int i,j,k,n;
	char a[100],b[100];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{	scanf("%s%s",a,b);
	for(j=strlen(a)-1,k=strlen(b)-1;k>=0;j--,k--)
	{
		a[j]=a[j]-b[k]+'0';
		if(a[j]<'0')
		{
          a[j]=a[j]+10;
		  a[j-1]=a[j-1]-1;
		}
	}
	k=strlen(a);
   for(j=0;a[j]=='0';j++);
	for(;j<k;j++)
		printf("%c",a[j]);
	printf("\n");
}
}
int main()
{
	int n;
	cin>>n;
	
	while(n--)
	{
	    //?????? ????????
		char num1[101],num2[101];
	    for(int k=0;k!=101;k++)
		    num1[k]=num2[k]='\0';
	    cin>>num1>>num2;
	    
		//???len1 len2??????????????
		int len1=0,len2=0;
	    while(num1[len1++]!='\0'){}
    	while(num2[len2++]!='\0'){}
    	len1--;
	    len2--; 
    	
		//???????????100???? ?????
		for(int k=len1-1;k>=0;k--)
    	{
	    	num1[101+k-len1]=num1[k];
		    num1[k]='\0';
	    }
	    for(int k=len2-1;k>=0;k--)
	    {    
	    	num2[101+k-len2]=num2[k];
	    	num2[k]='\0';
	    }

	    //????
		for(int k=100;num2[k]!='\0';k--)
    	{
	    	int temp=num1[k]-num2[k];   //?temp??????????
	    	if(temp<0)   //????? ??k???10+temp ?k-1????1
	    	{
		    	num1[k-1]--;
		    	num1[k]=10+temp+'0';
	    	}
	    	else   //???k???temp
		    	num1[k]=temp+'0';
    	}
	    
		//????
		int k=0;   //?k??num1??????'0'?'\0'?? ???????
	    while(num1[k]=='\0'||num1[k]=='0')
		    k++;
	    for(;k!=101;k++)
	    	cout<<num1[k];
	    cout<<endl; 
    }
	return 0;
}
int main()
{
	int n;
	scanf("%d",&n);
    int d[100];
	char c[100][100];
	for(int i=0;i<n;i++)
	{
		char a[100]={0};
		char b[100]={0};
		scanf("%s",a);
		scanf("%s",b);
		int m=strlen(a);
		d[i]=strlen(a);
		int o=strlen(b);
		for(int j=m-1;j>m-o-1;j--)
			c[i][j]=a[j]-b[j-m+o]+'0';
		if(m>n)
		{
			for(int t=m-o-1;t>=0;t--)
				c[i][t]=a[t];
		}
		for(int k=m-1;k>=0;k--)
		{
			if(c[i][k]<'0')
			{
				c[i][k]=c[i][k]+10;
				c[i][k-1]=c[i][k-1]-1;
			}	
		}
	}
		for(int h=0;h<n;h++)
		{
			for(int t=0;t<d[h];t++)
		     printf("%c",c[h][t]);
			printf("\n");
		}
}
void main()
{
	char a[101],b[101];
    int n,i,j,c1,c2;
    scanf("%d",&n);
    for(i=1;i<=n;i++)
	{ scanf("%s",a);
	  scanf("%s",b);
	  c1=strlen(a);
	  c2=strlen(b);
	  for(j=c1-1;j>=c1-c2;j--)
	  { if(a[j]<b[j-c1+c2])
	  {a[j]=a[j]+10-b[j-c1+c2]+48;a[j-1]--;} 
	    else a[j]=a[j]-b[j-c1+c2]+48;
	  }
	  printf("%s\n",a);
	}
}
int main()
{
  int n;
  cin>>n;
  int i,j,k;
  char c[n][101];
  int d[n];
  for(j=0;j<n;j++)
  {
     char a[101],b[101];
     cin>>a>>b;
     if(j==n-1);
     else cin.get();
     int sizea,sizeb;
     sizea=strlen(a);
     d[j]=sizea;
     sizeb=strlen(b);
     for(i=sizeb-1;i>=0;i--)
     {
         b[i+sizea-sizeb]=b[i];                   
     }
     for(i=0;i<sizea-sizeb;i++)
     b[i]='0';
     for(i=sizea-1;i>=0;i--)
     {
        if(a[i]>=b[i]) 
        c[j][i]=a[i]-b[i]+'0';
        else if(a[i]<b[i])
        {
            a[i-1]=a[i-1]-1;
            a[i]=a[i]+10;
            c[j][i]=a[i]-b[i]+'0';
        }                   
     }
                  
  } 
  for(i=0;i<n;i++)
  {
     for(j=0;j<n;j++)
     if(c[i][j]!='0')
     break;
     for(k=j;k<d[i];k++)
     cout<<c[i][k];
     cout<<endl;             
  } 
  
  return 0;
}
int main()
{
	int n,s[200],i,j,e,l,k,d[200],h;
	char a[200];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		for(h=0;h<200;h++)
		{
			a[h]=s[h]=d[h]=0;
		}
		scanf("%s",a);
		l=strlen(a);
		for(j=0;j<l;j++)
		{
			s[j]=a[l-j-1]-'0';
		}
		scanf("%s",a);
		k=strlen(a);
		for(j=0;j<k;j++)
		{
			d[j]=a[k-j-1]-'0';
		}
		for(j=0;j<l;j++)
		{
			s[j]=s[j]-d[j];
			if(s[j]<0)
			{
				s[j]=s[j]+10;
				s[j+1]=s[j+1]-1;
			}
		}
		for(j=l-1;j>=0;j--)
		{
			if(s[j]!=0) break;
		}
		for(h=j;h>=0;h--)
		{
			printf("%d",s[h]);
		}
		printf("\n");
	}
	return 0;
}
void main()
{
	int n,i,j,flag=0;
	char m1[100],m2[100],m3[100],m4[100];
	scanf("%d",&n);
	for(i=0;i<=n-1;i++)
	{
		scanf("%s",m1);
		scanf("%s",m2);
		scanf("\n");
		for(j=0;j<=(strlen(m1)-strlen(m2)-1);j++) m3[j]='0';
		m3[j]='\0';
		strcat(m3,m2);
		for(j=strlen(m1)-1;j>=0;j--)
		{
			if (m1[j]<'0')
			{
				m1[j]=m1[j]+10;
				m1[j-1]=m1[j-1]-1;
			}
			if (m1[j]>=m3[j]) m4[j]=m1[j]-m3[j]+'0';
			else 
			{
				m4[j]=m1[j]-m3[j]+10+'0';
				m1[j-1]=m1[j-1]-1;
			}
		}
		for(j=0;j<=strlen(m1)-1;j++)
		{
			if(m4[j]!='0') flag=1;
			if (flag==1) printf("%c",m4[j]);
		}
		printf("\n");
	}
}
void main()
{
	int a[101][101],b[101][101],c[101][101],x[101][101],y[101][101],j,m,n,t,s,r,q;
	scanf("%d",&n);
	int i[101]={0};
	for(r=0;r<n;r++)
	{
		q=getchar();
	    for(i[r]=1;;i[r]++)
		{a[r][i[r]]=getchar();
	    if(a[r][i[r]]=='\n')
		{a[r][i[r]]=0;break;}
		}

	   for(j=1;;j++)
	   {b[r][j]=getchar();
	   if(b[r][j]=='\n')
	   {b[r][j]=0;break;}
	   }
	
	   for(m=1;m<i[r];m++)
		a[r][m]=a[r][m]-48;
	   for(m=1;m<j;m++)
		b[r][m]=b[r][m]-48;

	   for(m=1;m<i[r];m++)
		x[r][m]=a[r][i[r]-m];
	   for(m=1;m<j;m++)
		y[r][m]=b[r][j-m];

	   for(m=i[r];m<101;m++)x[r][m]=0;
	   for(m=j;m<101;m++)y[r][m]=0;
	   for(m=0;m<101;m++)c[r][m]=0;

	   for(m=1;m<i[r];m++)
	   {c[r][m]=(x[r][m]+10-y[r][m])%10;
		x[r][m+1]=x[r][m+1]+(x[r][m]+10-y[r][m])/10-1;
	   }
	}

	printf("\n");
	for(r=0;r<n;r++)
	{
		for(s=0,t=i[r]-1;t>0;t--)
		{if(c[r][t]==0&&s==0)continue;
	    printf("%d",c[r][t]);
	    s=1;
		}
		printf("\n");
	}
}
int main ()
{
	char a[1001],b[1001];

	int i,j,k,n,l1,l2,c[1001],d[1001];
	
	cin >>n;
	
	for (i=0;i<n;i++)
	{		
		cin.get ();
		cin.getline (a,1000);
		l1=strlen (a);
		cin.getline (b,1000);
		l2=strlen (b);
		for (k = 0; k <1001; ++k) c[k] = d[k] = 0;
		int ll1 = l1, ll2 = l2;
		for (j=0;j<l1;j++)
			c[--ll1]=a[j]-'0';
		for (j=0;j<l2;j++)
			d[--ll2]=b[j]-'0';
		for (k=0;k<l1;k++)
		{
			if (c[k]-d[k]<0)
			{
				c[k]=10+c[k]-d[k];
				c[k+1]--;
			}
			else c[k]=c[k]-d[k];
		}
		for (k=l1-1;k>=0;k--)
		{
			if (c[k]!=0)
			{
				j=k;break;
			}
		}
		for (k=j;k>=0;k--)
		{
			cout <<c[k];
		}
		cout <<endl;
	}
	return 0;
}
void main()
{
	int a[101][101];
	int b[101][101];
	char c;
	int i,k,numa,numb,n,j,j0;
	scanf("%d\n",&n);
	
	for(i=0;i<=100;i++)
	{
		for(j=0;j<=100;j++)
		{
			a[i][j]='\0';
			b[i][j]='\0';
		}
	}
	
	for(i=1;i<=n;i++)
	{
		k=1;
		while((c=getchar())!='\n') a[i][k++]=c;
		k=1;
		while((c=getchar())!='\n') b[i][k++]=c;
		getchar();
	}
	
	for(i=1;i<=n;i++)
	{
		for(numa=1;;numa++) if(a[i][numa]=='\0') break;
		for(numb=1;;numb++) if(b[i][numb]=='\0') break;
		numa--;numb--;
	    for(j=0;j<=numa-1&&b[i][numb-j]>='0'&&b[i][numb-j]<='9';j++)
		{
			a[i][numa-j]=a[i][numa-j]-b[i][numb-j];
			if(a[i][numa-j]<0)
			{
				a[i][numa-j]=a[i][numa-j]+10;
				a[i][numa-j-1]=a[i][numa-j-1]-1;
			}
			a[i][numa-j]=a[i][numa-j]+'0';
		}
	}
	
	for(i=1;i<=n;i++)
	{
		for(j0=1;;j0++) if(a[i][j0]!='0') break;
		for(j=j0;a[i][j]!='\0';j++)
		{
			printf("%c",a[i][j]);
		}
		printf("\n");
	}
}
const int base=250;
const int start=5;
int ans[300];
main()
{
void trans(char s[],int num[]);
void plus(int a[],int b[]);
int minus(int a[],int b[]);
void print(int num[]);
int judge(int a[],int b[]);

int a[300],b[300];
char sa[300],sb[300];
int n;
scanf("%d",&n);
for (int i=1;i<=n;i++)
{
getchar();
gets(sa);
gets(sb);
memset(a,0,300*sizeof(int));
memset(b,0,300*sizeof(int));
memset(ans,0,300*sizeof(int));
trans(sa,a);
trans(sb,b);
b[0]=0-b[0];
if (a[0]*b[0]>0)
{
plus(a,b);
ans[0]=a[0];
}
else 
{
int flag=judge(a,b);
if (flag==0) {printf("0\n"); continue;}
if (flag>0)
{minus(a,b);ans[0]=a[0];}
else {minus(b,a);ans[0]=b[0];}
}
print(ans);
}
getchar();getchar();getchar();getchar();
}

void trans(char s[],int num[])
{
int len=strlen(s),b=0;
num[0]=1;
if (s[0]=='-') {len--; b++; num[0]=-1;}
for (int t=0;t<len;t++)
{
num[base-len+t+1]=s[t+b]-'0';
}
num[1]=base-len+1;
}

int judge(int a[],int b[])
{
if (a[1]<b[1]) return 1;
else if (a[1]>b[1]) return -1;
else {
     int t,p=0,floor=a[1]<b[1]?a[1]:b[1];
     for (t=floor;t<=base&&p==0;t++)
     p=a[t]-b[t];
     if (p==0) return 0;
     else return p>0?1:-1;
     }
}

void check(int num[])
{
int p;
for (p=start;num[p]==0&&p<=base;p++);
num[1]=p;
}

void plus(int a[],int b[])
{
int floor=a[1]<b[1]?a[1]:b[1];
for (int t=base;t>=floor;t--)
{
int k=ans[t]+a[t]+b[t];
ans[t]=k%10;
ans[t-1]+=k/10;
}
if (ans[floor-1]!=0) ans[1]=floor-1;
else ans[1]=floor;
}

void minus(int a[],int b[])
{
int floor=a[1]<b[1]?a[1]:b[1];
for (int t=base;t>=floor;t--)
{
int k=ans[t]+a[t]-b[t];
if (k<0) {ans[t-1]-=1; k+=10;}
ans[t]=k%10;
ans[t-1]+=k/10;
}
check(ans);
}

void print(int num[])
{
if (num[0]<0) printf("-");
for (int t=num[1];t<=base;t++)
printf("%d",num[t]);
printf("\n");
}
void main()
{
	int i,j,n,k,k1,k2,x[101],y[101],z[101];
	char a[11][101],b[11][101];
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		for(j=1;j<=100;j++)
		{
			a[i][j]='\0';
			b[i][j]='\0';
		}
	}
	for(i=1;i<=n;i++)
	{
		scanf("%s",&a[i]);
		scanf("%s",&b[i]);
	}
	for(i=1;i<=n;i++)
	{
		for(j=0;j<=100;j++)
		{
			x[j]=0;
			y[j]=0;
			z[j]=0;
		}
		for(j=100;j>=0;j--)
		{
			if(a[i][j]!='\0')
			{
				k1=j+1;
				for(j=j;j>=0;j--)
					a[i][j]=a[i][j]-48;
				if(j==-1)
					break;
			}
		}
		for(j=100;j>=0;j--)
		{
			if(b[i][j]!='\0')
			{
				k2=j+1;
				for(j=j;j>=0;j--)
					b[i][j]=b[i][j]-48;
				if(j==-1)
					break;
			}
		}
		for(j=100;j>=101-k1;j--)
			x[j]=a[i][j-101+k1];
		for(j=100;j>=101-k2;j--)
			y[j]=b[i][j-101+k2];
		for(j=100,k=0;j>=101-k1;j--)
		{
			if(x[j]-k>=y[j])
			{
				z[j]=x[j]-k-y[j];
				k=0;
			}
			if(x[j]-k<y[j])
			{
				z[j]=x[j]+10-k-y[j];
				k=1;
			}
		}
		for(j=0;i<=100;j++)
		{
			if(j==100&&z[j]==0)
				printf("0\n");
			if(z[j]!=0)
			{
				for(j=j;j<=100;j++)
					printf("%d",z[j]);
				if(j==101)
				{
					printf("\n");
					break;
				}
			}
		}
	}
}
int main(){
       char a[20][100],b[20][100];
       char c[20][100];
       int i,len1,len2,d,n,cycle;
       scanf("%d\n",&n);
       for(cycle=0;cycle<n;cycle++)
       {
         gets(a[cycle]);
         gets(b[cycle]);
         scanf("\n");
         len1=strlen(a[cycle]);
         len2=strlen(b[cycle]);
         d=len1-len2;
       
       for(i=len1-1;i>=0;i--){
           if(i>=d){
           c[cycle][i]=a[cycle][i]-b[cycle][i-d]+48;
           if(a[cycle][i]<b[cycle][i-d]){ 
               a[cycle][i-1]=a[cycle][i-1]-1;
               c[cycle][i]+=10;}
           }else c[cycle][i]=a[cycle][i];
         }
       len2=0;d=0;i=0;len1=0;
       }
       int j;
       for(j=0;j<n;j++){
       
           printf("%s\n",c[j]);
       }
       
       
}
int main()
{
	 int k,i,j,m,n;
	 char  str1[100]={'\0'},str2[100]={'\0'},c[100][100]={'\0'};
	 scanf("%d\n",&k);
	 for(i=0;i<k;i++)
	 { gets(str1);gets(str2);getchar();
       m=strlen(str1);n=strlen(str2);
	   for(j=1;j<=n;j++)
	   {if((str1[m-j]-str2[n-j])>=0){str1[m-j]=str1[m-j]-str2[n-j];}
	   else{str1[m-j]=str1[m-j]-str2[n-j]+10;str1[m-j-1]=str1[m-j-1]-1;}
	   str1[m-j]+=48;}
	   strcpy(c[i],str1);
	 }
	 for(i=0;i<k;i++){printf("%s\n",c[i]);}
}
void main()
{
	int n,i,j,l1[100],l2[100];
	char str1[100][100],str2[100][100];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s",str1[i]);
		scanf("%s",str2[i]);
	}
	for(i=0;i<n;i++)
	{
		l1[i]=strlen(str1[i]);
		l2[i]=strlen(str2[i]);
		for(j=1;j<l2[i]+1;j++)
		{
			if(str1[i][l1[i]-j]  >=  str2[i][l2[i]-j])
			str1[i][l1[i]-j] = str1[i][l1[i]-j] - str2[i][l2[i]-j]+48;
			else
			{
				str1[i][l1[i]-j-1]=str1[i][l1[i]-j-1]-1;
				str1[i][l1[i]-j]=str1[i][l1[i]-j]+10-str2[i][l2[i]-j]+48;
			}
		}
	}
	for(i=0;i<n;i++)
	{
		printf("%s\n",str1[i]);
	}
}
char b[101];
void reorder(char a[])
{
	int i, l;
	char temp0;
	l = strlen(a);
	for (i = 0; i <l; i++)
	  b[i] = a[l - i - 1];
}
int main()
{
	char bjs[101][101], js[101][101], temp;
	int i, j, k, p, n, l1, l2, c[101];
	cin >> n;
	for (i = 1; i <= n; i++)
      cin >> bjs[i] >> js[i];
	for (i = 1; i <= n; i++)
	{
		l1 = strlen(bjs[i]);
		l2 = strlen(js[i]);
		reorder(bjs[i]);
		for (j = 0; j < l1; j++)
		  bjs[i][j] = b[j];
		reorder(js[i]);
		for (j = 0; j < l2; j++)
		  js[i][j] = b[j];
		for (j = l2; j < l1; j++)
		  js[i][j] = '0';
		for (j = 0; j < l1; j++)
		{
			if (bjs[i][j] < js[i][j])
			{
				bjs[i][j] += 10;
				bjs[i][j + 1] -= 1;
		    }
		    c[j] = bjs[i][j] - js[i][j];
		}
		for (k = l1 - 1; k >= 0; k--)
		  if (c[k] != 0)
	        break;
		if (k == -1)
	      cout << 0;
	    else 
          for (p = k; p >= 0; p--)
		   	cout << c[p];
	    cout << endl;
    }
	return(0);
}
void main()
{
     int n,i,j,l[20],s[20];
	 char a[20][100],b[20][100],c[20][100];
	 scanf("%d",&n);
	 for(i=0;i<n;i++)
	 {
		 scanf("%s%s",a[i],b[i]);
		 l[i]=strlen(a[i]);
         s[i]=strlen(b[i]);
	 }
     for(i=0;i<n;i++)
	 {
         for(j=l[i]-1;j>=0;j--)
		 {
			     if(s[i]>0)
				 {
				     if(a[i][j]>=b[i][s[i]-1])
					 {				     
						  c[i][j]=a[i][j]-b[i][s[i]-1]+48;
			              s[i]=s[i]-1;
					 }
				     else
					 {
                          c[i][j]=10+a[i][j]-b[i][s[i]-1]+48;
						  a[i][j-1]=a[i][j-1]-1;
						  s[i]=s[i]-1;
					 }
				 }
			     else
				 {
				 c[i][j]=a[i][j];
				 }
			

		 }
	 }
	 
	 for(i=0;i<n;i++)
	 {
		 for(j=0;j<l[i];j++)
		 {
			 printf("%c",c[i][j]);
		 }
		 printf("\n");
	 }
}
int main()
{	
	char a[100][100],b[100][100];
	char c[100][101];
	int i,n;
	int p,q,t;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s",&a[i]);
		scanf("%s",&b[i]);
	}
	//printf("%s,%s\n",a,b);
	for(i=0;i<n;)
	{   
		for(t=0,p=strlen(a[i])-1,q=strlen(b[i])-1;p>=0;p--,q--)
		{
			if(p>=0&&q>=0&&a[i][p]>=b[i][q])	{
				t=0;c[i][p]=a[i][p]-b[i][q]+t;
			}
			else if(p>=0&&q>=0&&a[i][p]<b[i][q])	{
				t=1;
				c[i][p]=a[i][p]+t*10-b[i][q];
				a[i][p-1]=a[i][p-1]-1;
			}
			else if(p>=0&&q<0)	{
				t=0;c[i][p]=a[i][p]-48;
			}
			//printf("%d,%d\n",p,c[i][p]);
			c[i][p]+=48;
		}
		//printf(" %d\n",strlen(a));
		c[i][strlen(a[i])]='\0';
		i++;
	}
	for(i=0;i<n;i++)
	{
		printf("%s\n",c[i]);
	}
	return 0;
}
void main()
{
	char a[100]={""};
	char b[100]={""};
	int n,i,j,k,p;
	int c1,c2;
	scanf("%d",&n);
	for(j=1;j<=n;j++)
	{
		c1=0;
		c2=0;
		scanf("%s",a);
		scanf("%s",b);
		for(;(a[c1]<=58)&&(a[c1]>=48);c1++)
		{}
		for(;(b[c2]<=58)&&(b[c2]>=48);c2++)
		{}
		k=0;
		for(i=c1-c2;i<c1;i++)
		{
			if(a[i]-b[k]>=0)
			{
				a[i]=a[i]-b[k]+48;
			}
			else if(a[i]-b[k]<0)
			{
				for(p=i-1;a[p]==48;p--)
				{
					a[p]=a[p]+9;
				}
				if(a[p]!=48)
				{
					a[p]=a[p]-1;
				}
				else{}
				a[i]=a[i]-b[k]+48+10;
			}
			k++;
		}
		printf("%s\n",a);
	}

}
int main()
{
    int n, i, len1, len2, j, k, char11[101] = {0}, char22[101] = {0}, flag = 0, answer[101] = {0};
    char char1[101], char2[101];
    cin >> n;
    for (i = 1; i <= n; i++)
    {
        cin >> char1 >> char2;
        len1 = strlen(char1);
        len2 = strlen(char2);
        memset(answer,'\0',sizeof(answer));
        memset(char11,'\0',sizeof(char11));
        memset(char22,'\0',sizeof(char22));
        k = 0;
        for (j = len1 - 1; j >= 0; j--)
        {
            char11[k] = char1[j] - '0';
            k++;
        }
        k = 0;
        for (j = len2 - 1; j >= 0; j--)
        {
            char22[k] = char2[j] - '0';
            k++;
        }
        for (j = 0; j < len1; j++)
        {
            if (char11[j] < char22[j])
            {
                char11[j + 1] = char11[j + 1] - 1;
                answer[j] = char11[j] + 10 - char22[j];
            }
            else
            {
                answer[j] = char11[j] - char22[j];
            }
        }
        for (j = len1 - 1; j >= 0; j--)
        {
            if (answer[j] != 0)
            {
                flag = 1;
            }
            if (flag == 1)
            {
                cout << answer[j];
            }
        }
        cout << endl;
    }
    return 0;
}
struct
{char a[200];
char b[200];
int as[200];
int bs[200];
int ad;
int bd;
}num[200];
void main()
{
	int n,i,j,x,y,z[200][200],h=0,k,t;
	scanf("%d\n",&n);
	for(i=0;i<n-1;i++)
	{
		scanf("%s\n%s\n\n",&num[i].a,num[i].b);
		num[i].ad=strlen(num[i].a);num[i].bd=strlen(num[i].b);
	}
	scanf("%s\n%s",&num[n-1].a,&num[n-1].b);
	num[n-1].ad=strlen(num[n-1].a);num[n-1].bd=strlen(num[n-1].b);
	for(i=0;i<n;i++)
	{
		for(j=0;j<num[i].ad;j++)
			num[i].as[j]=num[i].a[j]-48;
		for(k=0;k<num[i].bd;k++)
			num[i].bs[k]=num[i].b[k]-48;
	}
	for(i=0;i<n;i++)
	{
		h=0;
		for(j=num[i].ad-1,k=num[i].bd-1;k>=0;k--,j--)
		{
			if(num[i].as[j]-num[i].bs[k]<0)
			{
				z[i][h]=num[i].as[j]-num[i].bs[k]+10;
				num[i].as[j-1]=num[i].as[j-1]-1;h=h+1;
			}
			if(num[i].as[j]-num[i].bs[k]>=0)
			{
				z[i][h]=num[i].as[j]-num[i].bs[k];
				h=h+1;
			}
		}
			for(;j>=0;j--)
			{
				if(num[i].as[j]>=0)
				{
					z[i][h]=num[i].as[j];
					h=h+1;
				}
				if(num[i].as[j]<0)
				{
					z[i][h]=num[i].as[j]+10;
					num[i].as[j-1]=num[i].as[j-1]-1;
					h=h+1;
				}
			}
		for(t=num[i].ad-1;t>=0;t--)
			printf("%d",z[i][t]);
		printf("\n");
	}
}
//* * * * * * * * * * * * * * * * * * * * * * * * 
//*?????????                           *
//*?????????                           *
//*?????                                   *
//*???2010.11.17                             *
//* * * * * * * * * * * * * * * * * * * * * * * * 


int main()
{
	int n, i = 0, j = 0, k;	//	????n??????????????i,j,k;
	char seline1[101], seline2[101];	//	???????
	unsigned int an1[101], an2[101];	//	???????
	int len1, len2;	//	len1,len2?????????

	cin >> n;	//	??n;
	// cin.ignore();	//	???????
	for (k = 1; k <= n; k++)
	{
		for (j = 0; j < 101; j++)
		{
			seline1[j] = 0;
			seline2[j] = 0;
		}
        cin.ignore();
		cin.getline(seline1, 101);
		cin.getline(seline2, 101);	//	???????
        
		//cout << endl;
		len1 = strlen(seline1);
		len2 = strlen(seline2);	//	?????????

		memset(an1, 0, sizeof(an1));
		memset(an2, 0, sizeof(an2));	//	?????

		j = 0;
		for (i = len1 - 1; i >= 0; i--)
			an1[j++] = seline1[i] - '0';	//	????????????????
		j = 0;
		for (i = len2 - 1; i >= 0; i--)
			an2[j++] = seline2[i] - '0';	//	???
		for (i = 0; i <= len1 - 1; i++)
		{
			if (an1[i] >= an2[i])
				an1[i] -= an2[i];	//	?????????????????????
			else
			{
				an1[i] = an1[i] -an2[i] + 10;	//	???????????
				an2[i + 1]++;
			}
		}
		i = 100;
		while (an1[i] == 0)
			i--;	//	???????0???
		for (; i >= 0; i--)
			cout << an1[i];	//	???????
		cout << endl;	//	?????
	}

	return 0;
}
int num1[101],num2[101];
char char1[101],char2[101];

int main()
{
	int n,i,j;
	cin>>n;
	for (i=1;i<=n;i++)
	{
		for (j=1;j<=100;j++) {num1[j]=0;num2[j]=0;}
		cin>>char1>>char2;
		int len1,len2;
		for (len1=0;char1[len1]!='\0';len1++);
		for (len2=0;char2[len2]!='\0';len2++);

		for (j=1;j<=len1;j++)
			num1[j]=char1[len1-j]-48;
		for (j=1;j<=len2;j++)
			num2[j]=char2[len2-j]-48;

		for (j=1;j<=len1;j++)
			num1[j]=num1[j]-num2[j];

		for (j=1;j<=len1;j++)
		{
			if (num1[j]<0) {num1[j]=num1[j]+10;num1[j+1]--;}
		}
		int flag=0;
		for (j=0;j<len1;j++)
		{
			if (num1[len1-j]!=0)
				flag=1;
				cout<<num1[len1-j];
		}
		if (flag==0) cout<<0;
		if (i!=n) cout<<endl;
	}
	return 0;
}
/*
					? ? ??1000012827_1.cpp
					?    ?????
					?????20101117
					??????????????
**/
int main()
{
	char minuend[101], subtrahend[101];											//????????
	int n, k = 1, c = -1;														//??????n????????c??????????????????
	cin >> n;
	for(k = 1; k <= n; k ++)
	{
		cin.get();																//????
		//????????????????????????a b ????????result????d e????
		int m[100] = {0}, s[100] = {0}, a, b, result[100] = {0}, d = 99, e = 99;
		cin.getline(minuend, 100);												//??????
		cin.getline(subtrahend, 100);
		a = strlen(minuend);													//???????????
		b = strlen(subtrahend);
		for(int i = a - 1; i >= 0; i --)										//???????
		{
			m[d] = minuend[i] - '0';
			d --;
		}
		for(int i = b - 1; i >= 0; i --)
		{
			s[e] = subtrahend[i] - '0';
			e --;
		}
		for(int i = 99; i > 99 - a; i --)										//????????
		{
			if(m[i] >= s[i])
				result[i] = m[i] - s[i];
			else																//????????????????????
			{
				m[i] = m[i] + 10;
				m[i - 1] --;
				result[i] =m[i] - s[i];
			}
		}
		for(int i = 0; i < 100; i ++)
			if(result[i] != 0)													//???????????????
			{
				c = i;
				break;
			}
			if(c == -1)															//?????????
				cout << "0" << endl;
			else																//????????????????????99?
			{
				for(int i = c; i < 99; i ++)
					cout << result[i];
				cout << result[99] << endl;										//?????100?????
			}
	}
		return 0;
	}
void read(char x[])            /* read is used to overturn x[] */
{
	char temp[100];
	int i,k;
	scanf("%s",temp);
	k=strlen(temp);
	x[k]=0;
	for(i=0;i<k;i++)
		x[i]=temp[k-1-i];
}

void main()
{
	char a[100],b[100];
	int i,j,la,lb,k,n;
	scanf("%d",&n);
	for(k=1;k<=n;k++)
	{
		read(a);
		read(b);
		la=strlen(a);
		lb=strlen(b);
		for(i=0;i<lb;i++)
		{
			if(a[i]<b[i])
			{
				a[i]=a[i]+10-b[i]+'0';
				a[i+1]--;
			}
			else
				a[i]=a[i]-b[i]+'0';
		}
		for(i=lb;i<la;i++)
		{
			if(a[i]<'0')
			{
				a[i]=a[i]+10;
				a[i+1]--;
			}
		}
		for(i=0,j=0;i<la;i++)
		{
			if(a[la-1-i]!='0' || j!=0)
			{
			printf("%c",a[la-1-i]);
			j=1;
			}
		}
		if(j==0) printf("0");
		printf("\n");
	}
}