semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int main()
{
	char a[101],b[101];
	int ia[101],ib[101];
	int n=0,i=0,j=0,q=0,len1=0,len2=0,t=0,ans[101]={0};
	cin>>n;
	for(t=0;t<n;t++)
	{
		memset(a,0,sizeof(a));
		memset(b,0,sizeof(b));
		memset(ia,0,sizeof(ia));
		memset(ib,0,sizeof(ib));
		memset(ans,0,sizeof(ans));
		cin>>a>>b;
		len1=strlen(a);
		len2=strlen(b);
		int k=0;
		for(i=len1-1;i>=0;i--)
		{
			ia[k]=a[i]-'0';
			k++;
		}
		k=0;
		for(i=len2-1;i>=0;i--)
		{
			ib[k]=b[i]-'0';
			k++;
		}
		
		for(i=0;i<len2;i++)
		{
			if(ia[i]<ib[i])
			{
				if(ia[i+1]!=0)
				{
					ia[i+1]--;
					ia[i]=ia[i]+10;
					ans[i]=ia[i]-ib[i];
				}
				else
				{
			    	for(j=i+2;j<len1;j++)
					{
				    	if(ia[j]!=0)
						{
					    	q=j;
					    	ia[j]--;
					    	break;
						}
					}
		    		for(j=i+1;j<q;j++)
						ia[j]=9;
					ia[i]=ia[i]+10;
					ans[i]=ia[i]-ib[i];
				}
			}
			else
				ans[i]=ia[i]-ib[i];
		}
		int p=0;
		for(i=len1;;i--)
		{
			if(ia[i]!=0)
			{
				p=i;
				break;
			}
		}
		for(i=p;i>=len2;i--)
		{
			ans[i]=ia[i];
		}
		for(i=p;i>=0;i--)
			cout<<ans[i];
		cout<<endl;
	}
	return 0;
}
// ?????.cpp : ??????????????
//
int main()
{
	int n,j,len,len2;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		char A[101],B[101],C[101],D[101];
		cin.getline(D,100);
		cin.getline(A,100);
        cin.getline(B,100);
		len=strlen(A);
for(j=0;2*j<len;j++)
		{
			char k;
			k=A[j];
			A[j]=A[len-j-1];
			A[len-j-1]=k;
		}
		len2=strlen(B);
		for(j=0;2*j<len2;j++)
		{
			char k;
			k=B[j];
			B[j]=B[len2-j-1];
			B[len2-j-1]=k;
		}
	    for(j=len2;j<len;j++)B[j]='0';
		B[j]=0;
		for(j=0;j<len;j++)
		{
			C[j]=(int)A[j]+'0'-(int)B[j];
			if(C[j]<'0')
			{
			A[j+1]--;
			C[j]+=10;
			}
		}
		for(j=len-1;j>0&&C[j]=='0';j--);
		for(;j>=0;j--)cout<<C[j];cout<<endl;
	}
	return 0;
}
void main()
{
	
	char m1[100],m2[100],n1[100],n2[100],sum[100];
	int i,mlen,nlen,t,u;
	scanf("%d",&t);
	for (u=0;u<t;u++)
	{
		for (i=0;i<100;i++)
			sum[i]='\0';
		for (i=0;i<100;i++)
			m1[i]='0';
		for (i=0;i<100;i++)
			n1[i]='0';
		scanf("%s",m1);
		scanf("%s",n1);
		mlen=strlen(m1);
		nlen=strlen(n1);
		for (i=0;i<100;i++)
			m2[i]='0';
		for (i=0;i<100;i++)
			n2[i]='0';
		for (i=0;i<mlen;i++)         /**/
			m2[100-mlen+i]=m1[i];
		for (i=0;i<=nlen;i++)
			n2[100-nlen+i]=n1[i];
		for (i=99;i>=0;i--)
		{
			sum[i]=sum[i]+m2[i]-n2[i]+48;
			if (sum[i]<'0')
			{
				sum[i]=sum[i]+10;
				sum[i-1]=sum[i-1]-1;        /**/
			}
		}
		for (i=0;i<100;i++)
		{
			if ((sum[i]!='0')&&(sum[i]!='\0'))
				break;
		}
		for (i=i;i<100;i++)
			printf("%c",sum[i]);
		printf("\n");
	}
}
void Inverse(char a[])
{
    int len=strlen(a);
    for(int i=0;i<len/2;i++)
    {
        char temp;
        temp=a[i];
        a[i]=a[len-1-i];
        a[len-1-i]=temp;
    }
}
int main()
{
    char a[110],b[110];
    int n;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin.get();
        cin.getline(a,101);
        cin.getline(b,101);
        Inverse(a);
        Inverse(b);
        int j;
        for(j=0;b[j]!='\0';j++)
        {
            if(a[j]>=b[j])
                a[j]=a[j]-b[j]+'0';
            else
            {
                a[j+1]--;
                a[j]=a[j]+10-b[j]+'0';
            }
        }
        while(a[j]<'0'&&a[j]!='\0')
        {
            a[j+1]--;
            a[j]=a[j]+10-b[j]+'0';
        }
        Inverse(a);
        j=0;
        while(a[j]=='0')
            j++;
        while(a[j]!='\0')
          cout<<a[j++];
        cout<<endl;
    }
    return 0;
}
void main()
{
	char a[200]={"\0"},b[200]={"\0"},c;
	int i,j,k,m,n,s,t=0,length;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		scanf("%s",a);
		scanf("%s",b);
        k=strlen(a);
		m=strlen(b);
		length=k-m;
		for(j=k-1;j>=length;j--)
		{
			if(t) a[j]--;
			if(a[j]>=b[j-length])
			{
				a[j]=a[j]-b[j-length]+48;
				t=0;
			}
			else
			{
				a[j]=a[j]+10-b[j-length]+48;
				t=1;
			}
		}
		for(j=length-1;j>=0;j--)
		{
			if(t) a[j]--;
			if(a[j]<48)
			{
				a[j]=a[j]+10;
				t=1;
			}
			else t=0;
		}		
		for(j=0;j<k;j++)
		{
			if(a[j]!=48)
			{
				s=j;
				break;
			}
		}
		if(s>200) printf("0\n");
		else
		{
			for(j=s;j<k;j++)
				printf("%c",a[j]);
			printf("\n");
		}
	}
}
//********************************
//*????????   **
//*?????? 1300012745 **
//*???2013.11.19  **
//********************************
int main()
{
	char stra[102], strb[102];
	int n, num1[102] = {0}, num2[102] = {0}, num[102] = {0}, i, lena, lenb, j, k;
	cin >> n;
	for (i = 1; i <= n; i++)
	{
		cin.get();
		cin.getline(stra,102);
		cin.getline(strb,102);
		lena = strlen(stra);
		lenb = strlen(strb);
		memset(num1,0,sizeof(num1));
		memset(num2,0,sizeof(num2));
		memset(num,0,sizeof(num));
		k = 0;
		for (j = lena - 1; j >= 0; j--)
		{
			num1[k++] = stra[j] - '0';
		}
		k = 0;
		for (j = lenb - 1; j >= 0; j--)
		{
			num2[k++] = strb[j] - '0';
		}
		for (j = 0; j < 102; j++)
		{
			num1[j]-=num2[j];
			if (num1[j] < 0)
			{
				num1[j]+=10;
				num1[j + 1]--;
			}
		}
		j = lena;
		while (num1[j] == 0)
			j--;
		for (k = j; k >= 0; k--)
			cout << num1[k];
		cout << endl;
	}
	return 0;
}
int main()
{
    char num1[100], num2[100], num3[100];
    int i, j, n, len1, len2;
    cin>>n;
    for(i=0;i<n;i++)
    {
        cin>>num1;
        cin>>num2;
        len1 = strlen(num1);
        len2 = strlen(num2);
        num3[len1]='\0';
        for(j=(len1-1);j>=len1-len2;j--)
        {
            if(num1[j]>=num2[j-len1+len2])
            {                            
                num3[j]=num1[j]-num2[j-len1+len2]+48;
            }
            else
            {
                num3[j]=58-(num2[j-len1+len2]-num1[j]);
                num1[j-1]=num1[j-1]-1;
            }
        }
        for(j=(len1-len2-1);j>=0;j--)
        {
            num3[j]=num1[j];
        }
        cout<<num3<<endl;
    }
    return 0;
}
int main()
{
    char c[101],d[101],e[101],f[101];
    int a,b,h,n,i,j,m,o;

    int tmp;

    scanf("%d",&n);
    for(i=1;i<=n;i++)
    {
        scanf("%s\n%s",&c,&d);
        a=strlen(d);
        b=strlen(c);
        for(o=0;o<a;o++) f[o]=d[a-o-1];        
        for(j=0;j<b;j++) e[j]=c[b-j-1];
        for(m = 0; m < a; m++)
        {
            if(e[m]<f[m]) 
            {
                e[m]=e[m]+10 - f[m] + '0';
                tmp = m;
                while(e[++tmp] < '1') 
                    e[tmp] = '9';
                e[tmp]--;
            }
            else  e[m]=e[m]-f[m] + '0';
        }
        for(h = b-1; h > 0; h--) {
            if (e[h] != '0') {
                break;
            }
        }
        for(; h >= 0; h--) 
            printf("%d",e[h] - '0');

        printf("\n");
    } 
    return 0;
}
void main()
{
	char str1[100],str2[100];int n,i,j,k,p;
	int a[100],b[100];
	int yidegeshu,erdegeshu;
	scanf("%d",&n);
	for(p=0;p<=n-1;p++)
	{
		scanf("%s",str1);
		scanf("%s",str2);
		yidegeshu=strlen(str1);
		erdegeshu=strlen(str2);
		for(i=0;i<=yidegeshu-1;i++)
			a[i]=str1[yidegeshu-i-1]-48;
		for(i=0;i<=erdegeshu-1;i++)
			b[i]=str2[erdegeshu-i-1]-48;
		for(j=erdegeshu;j<=yidegeshu-1;j++)
			b[j]=0;
	for(i=0;i<=yidegeshu-1;i++)
	{
		if(a[i]>=b[i])
		{a[i]=a[i]-b[i];}
		else if(a[i]<b[i])
		{
			a[i]=a[i]+10;
		    a[i+1]=a[i+1]-1;
			a[i]=a[i]-b[i];
		}
	}
	for(k=yidegeshu-1;k>=0;k--)
	{	printf("%d",a[k]);}
	printf("\n");
	}
}
int main(int argc, char* argv[])
{
	int n,i,j,k,a,b,carry;
	char str1[100],str2[100],str3[100]={'\0'};
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		
		a=strlen(str3);
		for(j=0;j<a;j++)
		{
			str3[j]='\0';
		}
		scanf("%s",&str1);
		scanf("%s",&str2);
	
	    a=strlen(str1);
	    b=strlen(str2);
		carry=0;
		for(j=a-1,k=b-1;j>a-b-1;j--,k--)
		{
           str3[j]=str1[j]-str2[k]+'0'-carry;
		   if(str3[j]-'0'<0)
		   {
			   carry=1;
			   str3[j]+=10;
		   }
		   else
			   carry=0;
        }
		for(j=a-b-1;j>=0;j--)
		{
			str3[j]=str1[j]-carry;
			if(str3[j]-'0'<0)
		   {
			   carry=1;
			   str3[j]+=10;
		   }
			else
				carry=0;
		}
		if(str3[0]=='0')
		{
			for(j=0;j<a;j++)
			{
				str3[j]=str3[j+1];
			}
		}
		printf("%s",str3);
		if(i!=n-1)
			printf("\n");
	}
	return 0;
}
void main()
{int n,d,e,i,k,carry=0;
char a[101]={0},b[101]={0},c[101]={0};
char *p1=a,*p2=b;
void move(char *p,int m);
scanf("%d",&n);
for(i=0;i<=n-1;i++)
{gets(a);
gets(a);
gets(b);
d=strlen(a);
e=strlen(b);
move(p1,d);
move(p2,e);
for(k=99-d+1;k<=99-e;k++)
b[k]='0';
for(k=99;k>=99-d+1;k--)
{
 b[k]=b[k]-'0';
  a[k]=a[k]-'0';
if(carry+b[k]>a[k])
    {c[k]=a[k]-b[k]+10-carry;
     carry=1;}
  else
    {c[k]=a[k]-b[k]-carry;
      carry=0;}    
    c[k]=c[k]+'0';
 }
for(k=0;k<=99;k++)
  {if(c[k]!=0)
    printf("%c",c[k]);}
printf("\n");
 for(k=0;k<=100;k++)
  c[k]=0; 
carry=0;  
}}
 void move(char *p,int m)
{ int h;
  *(p+100)=0;
  for(h=99;h>=99-m+1;h--)
  *(p+h)=*(p+h-100+m);
  for(h=0;h<=99-m;h++)
  *(p+h)=0;
}
void main()
{
    int n,i,c,d,j,k,x,y;
    char a[101],b[101],s[101];
    scanf("%d",&n);
    for(i=1;i<=n;i++)
    {
    	scanf("%s%s",a,b);
    	c=strlen(a);
    	d=strlen(b);
    	for(j=c-1,k=d-1;k>=0;k--,j--)
    	s[j]=a[j]-b[k]+48;
    	for(x=0;x<c-d;x++)
    	s[x]=a[x];
    	for(y=c-1;y>=0;y--)
    	if(s[y]>=48&&s[y]<=57)
    	s[y]=s[y];
    	else
    	{
    		s[y]=s[y]+10;
    		s[y-1]=s[y-1]-1;
    	}
    	for(x=0;x<=c-1;x++)
    	printf("%c",s[x]);
    	printf("\n\n");
    }
    	
    	
    	
    	
    	
    
    
}
main()
{
	int i,n,k,m,m1;
	int a[100],b[100]={0},c[100];
	char str1[100],str2[100];
	scanf("%d",&n);
	
	for(k=1;k<=n;k++)
	{
		scanf("%s%s",str1,str2);
	    for(i=0;str1[i]!='\0';i++);
		m=i;
        for(i=1;i<=m;i++) 
			a[i]=str1[m-i]-48;
		for(i=0;str2[i]!='\0';i++);
		m1=i;
		for(i=1;i<=m1;i++) 
			b[i]=str2[m1-i]-48;
		for(i=1;i<=m;i++)
		{
			if(a[i]<b[i]) c[i]=a[i]-b[i]+10,a[i+1]=a[i+1]-1;
			else c[i]=a[i]-b[i];
		}
		
		if(c[m]==0) for(i=m-1;i>0;i--) printf("%d",c[i]);
		else for(i=m;i>0;i--) printf("%d",c[i]);
		printf("\n");
		for(i=1;i<=100;i++) b[i]=0;
	}

}
int main()
{
  int n,i,p,q,t,j;
  scanf("%d",&n);
   scanf("\n");
  char a[100],b[100],c[100];
  for(i=0;i<=99;i++)
{
a[i]='\0';
}
 for(i=0;i<=99;i++)
{
b[i]='\0';
}
  for(i=1;i<=n;i++)
  {
    gets(a);
    gets(b);
    scanf("\n");
    p=strlen(a);
    q=strlen(b);
    for(t=1;t<=q;t++)
     {
      if(a[p-t]>=b[q-t])
      c[p-t]=a[p-t]-b[q-t]+48;
      else
    {
      c[p-t]=a[p-t]+58-b[q-t];
      a[p-t-1]=a[p-t-1]-1;
     }
     }
     for(t=0;t<=p-q-1;t++)
     {
      c[t]=a[t];
      }
    for(j=0;j<=p-1;j++)
     {
       printf("%c",c[j]);
     }
printf("\n");
  }
return 0;
}
int main()
{
    int n;
    int i,j;
    char a[101];
    char b[101];
    int a1[101];
    int b1[101]={0};
    int c[101]={0};
    scanf("%d",&n);
    int length1,length2,length;
    for(j=1;j<=n;j++)
    {
       for(i=0;i<=100;i++)
       {
           a1[i]=b1[i]=c[i]=0;
       }
        scanf("%s%s",a,b);
         length1=strlen(a);
         length2=strlen(b);
        if(length1>length2)
         {length=length1;}
         else
         {length=length2;}
         for(i=0;i<length1;i++)
         {
             a1[i]=a[length1-i-1]-'0';
         }
         for(i=0;i<length2;i++)
         {
             b1[i]=b[length2-i-1]-'0';
         }
          for(i=0;i<length;i++)
         {
             c[i]+=a1[i]-b1[i];
             while(c[i]<0)
             {
                 c[i]=c[i]+10;
                 c[i+1]--;
             }
        }
         for(i=0;i<length;i++)
         {
             printf("%d",c[length-i-1]);
         }
         printf("\n");
    }
    return 0;
}
main()
{
  char a[100],b[100],c[30][100];
  int n,i,j,m1,m2;

  scanf("%d\n",&n);
 
  for(i=0;i<n;i++)
  {
    gets(a);
	gets(b);
	if(i!=n-1) getchar();

	m1=strlen(a);
    m2=strlen(b);
	for(j=m2-1;j>=0;j--) 
		b[j+m1-m2]=b[j];
	for(j=0;j<m1-m2;j++) 
		b[j]='0';

	for(j=m1-1;j>=0;j--)
	{
		if(a[j]<b[j]) {c[i][j]=a[j]+10-b[j];a[j-1]--;}
		else c[i][j]=a[j]-b[j];
	}
	c[i][m1]=10;
  }

  for(i=0;i<n;i++)
  {
	  for(j=0;c[i][j]<10;j++)
	     printf("%d",c[i][j]);
	  printf("\n");
  }
  
}
int main ()
{
	int n , i , j , k,num1[101]={0},num2[101]={0},res[101]={0} ;
	cin >> n ;
	cin.get();
	char str1[101] , str2[101] ;
	for (i = 0 ;i < n ;i++)
	{
		memset(num1 , 0 , sizeof(num1)) ;
		memset(num2 , 0 , sizeof(num2)) ;
		memset(res , 0 , sizeof(res)) ;
		cin.getline(str1,101) ;
		cin.getline(str2,101) ;
		cin.get() ;
		for (j = 0 ; j < strlen(str2) ; j++ )
			num2[j] = str2[strlen(str2)-j-1]-'0' ;
		for (j = 0 ; j < strlen(str1) ; j++ )
			num1[j] = str1[strlen(str1)-j-1]-'0' ;
		for(k = 0 ; k < strlen(str1) ; k++)
		{
			if(num1[k]-num2[k]<0)
			{
				res[k]=num1[k]-num2[k]+10;
				num1[k+1]-- ;
			}
			else res[k]=num1[k]-num2[k] ;
		}
		for(k = strlen(str1)-1  ; k >= 0 ; k--)
		{
			if(res[k]==0) 
				continue ;
			break ;
		}
		while (k >=0 )
		{
			cout << res[k];
			k-- ;
		}
		cout << endl;
	}
	return 0 ;
}
void main()
{
 char a[100][100],b[100][100],eat;
 int i,ca,cb,n,j;
 scanf("%d",&n);
 for(j=0;j<n;j++)
  {
   scanf("%s",a[j]);
   scanf("%s",b[j]);
   
    
  }
 
 for(j=0;j<n;j++)
  {
   for(i=0;a[j][i]!='\0';i++)
    a[j][i]=a[j][i]-'1'+1;
   ca=i-1;
   for(i=0;b[j][i]!='\0';i++)
    b[j][i]=b[j][i]-'1'+1;
   cb=i-1;
   
for(i=ca;i-ca+cb>=0;i--)
    {
     if(a[j][i]<b[j][i-ca+cb])
      {
       a[j][i-1]-=1;
       a[j][i]=a[j][i]+10-b[j][i-ca+cb];
      }
     else
      a[j][i]=a[j][i]-b[j][i-ca+cb];
    }
   for(i=ca;i>=1;i--)
    if(a[j][i]==-1)
    {
     a[j][i]=9;
     a[j][i-1]-=1;
    }
   for(i=0;i<=ca;i++)
    a[j][i]=a[j][i]-1+'1';
   printf("%s\n",a[j]);
  }
}
//********************************
//*????????  **
//*????? 1300012845 **
//*???2013.11.15  **
//********************************
int main ()
{
	int n, i, j, k, u=1;
	int l1, l2, flag=0;
	char str1[102] = {0}, str2[102] = {0};
	int out[102]={0};
	int num1[103]={0}, num2[103]={0};
	cin >> n;
	for ( k = 1; k <= n; k++ )
	{
		flag = 0;//????????
		cin >> str1 >> str2;
		l1 = strlen(str1);
		l2 = strlen(str2);
		u=1;
		memset(out,0,102);//??????
		for ( i = 0; i <= l1-1; i++ )
			num1[i+1] = str1[i] - '0';//????????
		for ( i = 0; i <= l2-1; i++ )
			num2[i+1] = str2[i] - '0';//????????
		while ( u <= l1 && u <= l2)
		{
			out [u] = num1[l1 - u + 1] - num2 [l2 - u + 1];//?????????????
			u++;
		}
		for ( u= l1; u >= l2+1; u-- )
			out[u] = num1[l1 - u + 1];//??????????????
		for ( i =1; i <= l1-1; i++ )
		{
			if ( out [i] <0 )//???????+10???
				out[i+1]+=-1, out[i]+=10;
		}
		for ( u = l1; u >=1 ; u-- )
		{
			if ( out[u] != 0)
				flag = 1;//????????????????
			if( flag ) cout << out[u] ;
			if ( u==0)
				break;
		}
		cout << endl;
	}
	return 0;
}
void main()
{
	char s1[102],s2[102];
	int p,i,j,m,n,len1,t,len2;

	scanf("%d\n",&m);
	for (t=1;t<=m;t++)
	{
	gets(s1);
	gets(s2);
	if (t<m) getchar();
	len1=strlen(s1);
	len2=strlen(s2);
    p=0;
	for (i=len2-1;i>=0;i--)
	{
		if (s1[len1+i-len2]-p<s2[i]) { s1[len1+i-len2]=s1[len1+i-len2]+10-p-s2[i]+48;p=1;}
		else {s1[len1+i-len2]=s1[len1+i-len2]-p-s2[i]+48;p=0;}
	}
	i=1;
	while (p==1)
	{
		if (s1[len1-i-len2]=='0') {s1[len1-i-len2]+=9;i++;}
		else {s1[len1-i-len2]=s1[len1-i-len2]-1;p=0;}
	}
	i=0;
	p=1;
	while (p==1)
	{
		if (s1[i]=='0') i++;
		else p=0;
	}
	for (j=i;j<=len1-1;j++)
    	putchar(s1[j]);
	putchar('\n');
    }	
	
	
}
void main()
{
	int a[101],b[101],c[101]={0},n,i,j,k,len1,len2;
	char sa[101],sb[101];
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		scanf("%s",sa);
		scanf("%s",sb);
		len1=strlen(sa);
		len2=strlen(sb);
		for(j=0;j<101;j++)
		{
			a[j]=0;
			b[j]=0;
		}
		for(j=len1-1,k=0;j>=0;j--,k++)
		{
			a[k]=sa[j]-'0';
		}
		for(j=len2-1,k=0;j>=0;j--,k++)
		{
			b[k]=sb[j]-'0';
		}
		for(j=0;j<=len1-1;j++)
		{
			if(a[j]>=b[j])
			{
				c[j]=a[j]-b[j];
			}
			if(a[j]<b[j])
			{
				a[j+1]-=1;
				c[j]=a[j]+10-b[j];
			}
		}
		for(j=len1-1;j>=0;j--)
		{
			printf("%d",c[j]);
		}
		printf("\n");
	}
}
void main()
{
	char a[100][102],b[100][102],c[100][102];
	int n,i,j,m,k,l;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s",a[i]);
		scanf("%s",b[i]);
		k=strlen(a[i]);
		m=strlen(b[i]);
		for(j=k-1;j>=k-m;j--)
		{
			if(a[i][j]<b[i][j+m-k]) 
			{
				c[i][j]=a[i][j]+58-b[i][j+m-k];
				a[i][j-1]--;
			}
			else c[i][j]=a[i][j]+48-b[i][j+m-k];
		}
		for(j=0;j<k-m;j++)
		{
			if(a[i][j]>='0') c[i][j]=a[i][j];
			else c[i][j]=a[i][j]+10;
		}
		c[i][k]='\0';
		for(j=0;j<k;j++)
		{
			if(c[i][j]!='0') break;
		}
		if(a[i][0]=='0')
		{
			for(j=0;j<k;j++) c[i][j]=c[i][j+1];
		}
	}
	for(i=0;i<n;i++) puts(c[i]);
}
void printnum(int a[])
{
	int i;
	for(i = a[0];i > 0; --i) printf("%d", a[i]);
	printf("\n");
}

void getnum(int a[])
{
	int i;
	char str[100];

	for(i = 0;i <100;++ i) a[i] = 0;
	scanf("%s", str);
	a[0] = strlen(str);
	for(i = a[0]-1;i >= 0;-- i)
		a[ a[0]-i ] = str[i]-'0';
}

void getdif(int c[], int a[], int b[])
{
	int i;

	if(a[0] > b[0]) c[0] = a[0];
    else c[0] = b[0];

	c[1] = 0;
  for(i = 1;i <= c[0];++ i)
  { 
	if(c[i] + a[i] - b[i] < 0)
	{
		c[i+1] = -1;
		c[i] += a[i] - b[i] + 10;
	}
	else
	{
		c[i+1] = 0;
		c[i] += a[i] - b[i];
	}
  }
	while(c[ c[0] ] == 0) -- c[0];
  
}

void main()
{
	int a[100], b[100],c[100],n;

	scanf("%d",&n);
   for(;n != 0;-- n)
   {	getnum(a);
        getnum(b);
        getdif(c, a, b);
	   printnum(c);
   }
}
void subtr(char a[101],char b[101])
{
	int c[101];
	int i,k,d=0;
	for(i=0;i<=100;i++)
	{
		a[i]=a[i]-'0';
		b[i]=b[i]-'0';
	}
	for(i=100;i>=0;i--)
	{
		if ((a[i]-b[i])<0)
		{
			a[i-1]=a[i-1]-1;
			c[i]=a[i]+10-b[i];
		}
		else
		{
			c[i]=a[i]-b[i];
		}
	}
	for(k=0;k<100;k++)
		{
			if (c[k]==0)
				d++;
			else break;
		}
		for(k=d;k<101;k++)
			printf("%d",c[k]);
        printf("\n");
		
}
	
void main ()
{
	int l,k,i,j;
        int l1[20],l2[20];
	char m;
	char a[20][101],b[20][101];
	char c[101],d[101];
	     
	scanf("%d",&l);
        for(i=1;i<=l;i++)
	{
		for(j=1;j<=100;j++)
		{
			a[i][j]='\0';
			b[i][j]='\0';
		}
	}
	for(i=1;i<=l;i++)
	{
		scanf("%s",&a[i]);
		scanf("%s",&b[i]);
	}
	for(i=1;i<=l;i++)
        { 
          l1[i]=0;
          l2[i]=0;
          for(j=0;j<100;j++)
           {
             if(a[i][j]!='\0')
             l1[i]=l1[i]+1;
            }
          for(j=0;j<100;j++)
           {
           if(b[i][j]!='\0')
             l2[i]=l2[i]+1;
           }
	}
		
	
	
	for(i=1;i<=l;i++)
	{
		for(j=0;j<100;j++)
		{	
			c[j]=a[i][j];
			d[j]=b[i][j];
		}
		for(k=100;k>=(101-l1[i]);k--)
		{
			c[k]=c[k-(101-l1[i])];
		}
		
		for(k=0;k<(101-l1[i]);k++)
			c[k]='0';

		for(k=100;k>=(101-l2[i]);k--)
		{
			d[k]=d[k-(101-l2[i])];
		}
		for(k=0;k<(101-l2[i]);k++)
			d[k]='0';
		

		subtr(c,d);
	}
}
int main()
{
    int n,times=0;
    cin>>n;
    while(true)
    {

    char ch1[100],ch2[100],ch3[100];
    char temp;
    memset(ch1,0,100);
    memset(ch2,0,100);
    memset(ch3,0,100);
    cin>>ch1;
    cin>>ch2;
    int len1=strlen(ch1);
    int len2=strlen(ch2);
    for(int i=0;i<=len1/2-1;i++)
    {
        temp=ch1[i];
        ch1[i]=ch1[len1-i-1];
        ch1[len1-i-1]=temp;
    }
    for(int i=0;i<=len2/2-1;i++)
    {
        temp=ch2[i];
        ch2[i]=ch2[len2-i-1];
        ch2[len2-i-1]=temp;
    }
    for(int i=len2;i<=len1-1;i++)
    ch2[i]='0';
    for(int i=0;i<=len1-1;i++)
    ch3[i]=ch1[i]-ch2[i]+48;
    for(int i=1;i<=len1;i++)
    {
        for(int j=0;j<=len1-1;j++)
        {
            if(ch3[j]<'0')
            {
                ch3[j]+=10;
                ch3[j+1]-=1;
            }
        }
    }

    if(ch3[len1-1]=='0')
    {
        for(int i=len1-2;i>=0;i--)
        cout<<ch3[i];
    }
    else
    {
        for(int i=len1-1;i>=0;i--)
        cout<<ch3[i];
    }
    cout<<endl;
    cin.get();
    times++;
    if(times==n)break;

}
    return 0;
}
void sub(char a[100],char b[100])
{
	int l1,l2,i,j,k;
	l1=strlen(a);
	l2=strlen(b);
	for(i=l1-1,j=l2-1;j>=0;i--,j--)
	{
		if(a[i]>b[j])
			a[i]=a[i]-b[j]+48;
		else if(a[i]==b[j])
			a[i]='0';
		else
		{
			a[i]=a[i]-b[j]+58;
			for(k=i-1;a[k]=='0';k--)
				a[k]='9';
			a[k]=a[k]-1;
		}
	}
    if(a[0]=='0')
	{
		for(i=1;i<l1;i++)
			printf("%c",a[i]);
		printf("\n");
	}
	else
		printf("%s\n",a);
}



void main()
{
	char a[100],b[100];
	int n,m;
	scanf("%d",&n);
	for(m=1;m<=n;m++)
	{
		if(m>1)
			printf("\n");
		scanf("%s%s",a,b);
		sub(a,b);
	}
}
int main ()
{
	int n,k;
	cin>>n;
	cin.get();
	for (k=0;k<n;k++)
	{
		char s1[10000],s2[10000];                            
		int a1[10000]={0},a2[10000]={0};                     
		int l1,l2;                                          
		int d[10000]={0};                                    
		cin.getline(s1,10000);
		cin.getline(s2,10000);
		l1=strlen(s1);
		l2=strlen(s2);
		int i,j=0;
		for (i=l1-1;i>=0;i--)
		{
			a1[j]=s1[i]-'0';
			j++;
		}
		j=0;
		for (i=l2-1;i>=0;i--)
		{
			a2[j]=s2[i]-'0';
			j++;
		}
		/*for (i=0;i<l1;i++)
		cout<<a1[i];
		cout<<endl;
		for (i=0;i<l2;i++)
		cout<<a2[i];
		cout<<endl;*/
		for (i=0;i<l1;i++)
		{
			//cout<<d[i]<<' ';
			d[i]+=a1[i]-a2[i];
			if (d[i]<0)
			{
				d[i]+=10;
				d[i+1]-=1;
			}
		}
		//cout<<endl;
		/*for (i=0;i<l1;i++)
		cout<<d[i];
		cout<<endl;*/
		int q=0;
		for (i=l1-1;i>=0;i--)
		{
			if ((d[i]==0) && (q==0))
				continue;
			cout<<d[i];
			q=1;
		}
		cout<<endl;
		if (k==n-1)
			return 0;
		cin.get();                                  
	}
	return 0;
}
char szline1[maxlen];
char szline2[maxlen];
int an1[maxlen];
int an2[maxlen];
int main()
{
	int n;
	cin >> n;
	while (n --)
	{
		cin.get();
		cin.getline(szline1, maxlen);
		cin.getline(szline2, maxlen);
		int len1 = strlen(szline1);
		int len2 = strlen(szline2);
		memset(an1, 0, sizeof(an1));
		memset(an2, 0, sizeof(an2));
		for (int i = len1 - 1, j = 0; i >= 0; i --)
			an1[j ++] = szline1[i] - '0';
		for (int i = len2 - 1, j = 0; i >= 0; i --)
			an2[j ++] = szline2[i] - '0';
		int begin = 0;
		for (int i = 0; i < maxlen; i ++)
		{
			an1[i] -= an2[i];
			if (an1[i] < 0)
			{
				an1[i] += 10;
				an1[i + 1] --;
			}
			if (an1[i])
				begin = i;
		}
		for (int i = begin; i >= 0; i --)
			cout << an1[i];
		cout << endl;
	}
	return 0;
}
int main()
{
    int a[110]={0},i,j,n,l1,l2,e,b[110]={0};
    char s[110],s1[110];
    scanf("%d\n",&n);
    for (i=1;i<=n;i++)
    {
      gets(s);l1=strlen(s);
      gets(s1);l2=strlen(s1);
      for (j=l1;j>0;j--)
        a[l1-j+1]=s[j-1]-48;
      for (j=l2;j>0;j--)
        b[l2-j+1]=s1[j-1]-48;
      e=0;
      for (j=1;j<=l1;j++)
      {
       a[j]=a[j]-e;
       if (a[j]<b[j]) e=1;else e=0;
       b[j]=a[j]+e*10-b[j];
        }
       while (b[l1]==0&&l1>0) l1=l1-1;
       for (j=l1;j>0;j--) {printf("%d",b[j]);b[j]=0;}
       printf("\n");
       if (i<n)scanf("\n");
}
  }
int main()
{
	int n,len1,len2;
	char a[100],b[100],t;
	cin>>n;
	for(int i=0;i<n;i++){
		memset(a,'0',100);
		memset(b,'0',100);
		cin>>a>>b;
		len1=strlen(a);
		len2=strlen(b);
		for(int j=0;j<len1-j;j++){
			t=a[j];
			a[j]=a[len1-j-1];
			a[len1-j-1]=t;
		}
		for(int j=0;j<len2-j;j++){
			t=b[j];
			b[j]=b[len2-j-1];
			b[len2-j-1]=t;
		}
		for(int j=0;j<len2;j++)
			if(a[j]>=b[j]) a[j]=a[j]-b[j]+'0';
			else {
				a[j+1]--;
				a[j]=a[j]+10-b[j]+'0';
			}
		if(a[len1-1]!='0') cout<<a[len1-1];
		for(int j=len1-2;j>=0;j--)
			cout<<a[j];
		cout<<endl;
	}
}
void main()
{
	int n,i,j,len,tlen,t=0;
	char num1[100][200];
	char num2[100][200];
	char temp[100];
	scanf("%d",&n);
	for(i=0;i<n;i++)
		scanf("%s %s",num1[i],num2[i]);
	for(i=0;i<n;i++)
	{
		strcpy(temp,num2[i]);
		t=0;
		tlen=strlen(num1[i])-strlen(num2[i]);
		for(j=0;j<tlen;j++)
			num2[i][j]='0';
		num2[i][j]=0;
		strcat(num2[i],temp);
		len=strlen(num1[i]);
		for(j=len-1;j>=0;j--)
		{
			if(num1[i][j]+t-num2[i][j]>=0){
				num1[i][j]=num1[i][j]+t-num2[i][j]+48;
				t=0;}
			else {num1[i][j]=num1[i][j]+t-num2[i][j]+58;
			t=-1;}
		}

		if(i!=n-1)
		printf("%s\n",num1[i]);
		else printf("%s",num1[i]);
	}

}
void xj(char x[],char a[])
{
	int i,j;
	char z[100]={0},y[100];
	for(i=0;i<100;i++)
		y[i]='0';
	for(i=0;i<strlen(a);i++)
		y[i+strlen(x)-strlen(a)]=a[i];
	for(i=strlen(x)-1;i>=0;i--)
	{z[i]=x[i]+10-y[i];
	 if(i-1>=0)
	 x[i-1]+=z[i]/10-1;
	 z[i]=z[i]%10+48;
	}
	for(i=0;i<strlen(x);i++)
		if(z[i]!='0')break;
	for(j=i;j<strlen(x);j++)
		putchar(z[j]);
	putchar('\n');
}
void main()
{
	int n,i;
	char a[100],b[100];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{scanf("%s",a);
	 scanf("%s",b);
	 xj(a,b);
	}
}