semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int main()
{
	int N,i,l1,l2,loop,t,s;
	char n1[410],n2[410];
	int a[410],b[410],c[410];
	int num(char c);
	scanf("%d",&N);
	for(loop=1;loop<=N;loop++)
	{
		scanf("%s",n1);
		scanf("%s",n2);
		memset(a,0,410*sizeof(int));
		memset(b,0,410*sizeof(int));
		t=0;
		s=0;
		l1=strlen(n1);
		l2=strlen(n2);
		for(i=0;i<=l1-1;i++)
			a[i]=num(n1[l1-1-i]);
		for(i=0;i<=l2-1;i++)
			b[i]=num(n2[l2-1-i]);
		for(i=0;i<410;i++)
			if(a[i]-b[i]-t>=0)
			{
				c[i]=a[i]-b[i]-t;
				t=0;
			}
			else
			{
				c[i]=a[i]-b[i]-t+10;
				t=1;
			}
		for(i=409;i>=0;i--)
		{
			if(c[i]!=0)
				s=1;
			if(s==1)
				printf("%d",c[i]);
		}
		if(s==0)
			printf("0");
		printf("\n");
	}
	return 0;
}

int num(char c)
{
	return c-'0';
}
void main()
{int n,i,l,al,bl;
char a[101],b[101];
scanf("%d",&n);
l=n;
while(l>0)
{scanf("%s",&a);
 scanf("%s",&b);
 al=strlen(a);
 bl=strlen(b);
 for(i=100;i>=101-al;i--)
	 a[i]=a[i-101+al]-48;
 for(i=100;i>=101-bl;i--)
	 b[i]=b[i-101+bl]-48;
 for(i=0;i<=100-al;i++)
	 a[i]=0;
 for(i=0;i<=100-bl;i++)
	 b[i]=0;
 for(i=100;i>=101-al;i--)
	{a[i]=a[i]-b[i];
		if(a[i]<0)
		{a[i]=a[i]+10;
		 a[i-1]=a[i-1]-1;
		}
	}
 if(a[101-al]!=0)
	 printf("%d",a[101-al]);
 for(i=102-al;i<=100;i++)
 printf("%d",a[i]);
 printf("\n");
 l--;
}
}
int main()
{
    char str1[100][100],str2[100][100],str3[100][100];
	char s[100][100];
	int n,i,j,k,a1[100],a2[100];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		gets(str3[i]);
		gets(str1[i]);
		gets(str2[i]);
	}
	for(i=0;i<n;i++)
	{
		a1[i]=strlen(str1[i]);
		a2[i]=strlen(str2[i]);
	}
	for(i=0;i<n;i++)
	{
		s[i][a1[i]]='\0';
        for(j=a2[i]-1;j>=0;j--)
		{
		   if(str1[i][j+a1[i]-a2[i]]>=str2[i][j])
			   s[i][j+a1[i]-a2[i]]=str1[i][j+a1[i]-a2[i]]-str2[i][j]+48;
		   else
		   {  s[i][j+a1[i]-a2[i]]=str1[i][j+a1[i]-a2[i]]-str2[i][j]+58;
		      str1[i][j+a1[i]-a2[i]-1]=str1[i][j+a1[i]-a2[i]-1]-1;
		   }
		}
	    for(k=0;k<a1[i]-a2[i];k++)
			s[i][k]=str1[i][k];
	}
	for(i=0;i<n;i++)
		printf("%s\n",s[i]);
}
void main()
{
	char str1[100],str2[100];
	int count,k,i,j,l1,l2,m,N;
	scanf("%d",&N);
	for(i=1;i<=N;i++)
	{
		scanf("%s",str1);
		scanf("%s",str2);
		count=0;
		l1=strlen(str1);
		l2=strlen(str2);
		j=l1-1;
        for(k=l2-1;k>=0;k--)
		{
			if(str1[j]>=str2[k])
				str1[j]=str1[j]-str2[k]+48;
			else
			{
				str1[j]=str1[j]+58-str2[k];
				for(m=j-1;m>=0;m--)
				{
					if(str1[m]!='0')
					{
						str1[m]--;
						break;
					}
					else
					   str1[m]='9';
				}
			}
			j--;
		}
       for(k=0;str1[k]!='\0';k++)
	   {
		   if(str1[k]=='0')
			   count++;
                     else
                       break;
	   }
	   for(k=count;str1[k]!='\0';k++)
	   {
		   printf("%c",str1[k]);
	   }
	   printf("\n");
	   }
}
int main()
{
    void align(char a[]);
    void substract(char a[],char b[],char c[]);
    char a[101],b[101],c[101];
    int i,j,t,n;
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
                    getchar();
                    gets(a);
                    gets(b);
                    align(a);
                    align(b);
                    substract(a,b,c);
                    for(j=0;j<100;j++)if(c[j]!='0'){t=j;break;}
                    for(j=0;j<100-t;j++)c[j]=c[j+t];
                    c[100-t]='\0';
                    puts(c);
}
                    
}
void align(char a[])
{
     int jump,m;
a[100]='\0';
jump=100-strlen(a);
for(m=100-jump;m>0;m--)
a[m+jump-1]=a[m-1];
for(m=0;m<jump;m++)
a[m]='0';
}
void substract(char a[],char b[],char c[])
{
               int i,carry=0;
               for(i=99;i>=0;i--)
               {
                                 if(carry+b[i]>a[i]){c[i]=a[i]+10-(b[i]+carry)+'0';carry=1;}
                                 else{c[i]=a[i]-(b[i]+carry)+'0';carry=0;}
               }
}
char m[20][100],n[20][100],a[20][100];
int lm[20],ln[20];
void minus(int k,int x,int r)
{
	int s;
	if (x>=101-lm[k]) 
	{ s=m[k][x]-n[k][x]+r;		  
	      if (s>=0) r=0;
	      else
		  {
			 r=-1;
			 s=s+10;
		  }
		  minus(k,x-1,r);
		  a[k][x-101+lm[k]]=s+48;
		}
}

void input(int k)
{
	int i,j;
	scanf("%s",m[k]);
	scanf("%s",n[k]);
	lm[k]=strlen(m[k]);
	ln[k]=strlen(n[k]);
	j=100;
	for (i=lm[k]-1;i>=0;i--)
	{
		m[k][j]=m[k][i]-48;
		m[k][i]=0;
		j--;
	}
	j=100;
	for (i=ln[k]-1;i>=0;i--)
	{
		n[k][j]=n[k][i]-48;
		n[k][i]=0;
		j--;
	}
}

void main()
{
	int i,s;
	scanf("%d",&s);
	for (i=1;i<=s;i++)
	{
		input(i);
		if(i<s)getchar();
		minus(i,100,0);
	}
	for (i=1;i<=s;i++)
		printf("%s\n",a[i]);
}
//********************************
//*?????                   **
//*????? 1300012848        **
//*???2013.11.16             **
//********************************
int main()
{
	const int MAX_LEN = 200;
	int n, i, j, k, nlen1, nlen2, jinwei[MAX_LEN+1] = {0};
	int num1[MAX_LEN+1], num2[MAX_LEN];
	char str1[MAX_LEN+1], str2[MAX_LEN+1];
	cin >> n;
	for (k = 1; k <= n; k++)
	{
		cin >> str1 >> str2;
		nlen1 = strlen(str1);
		nlen2 = strlen(str2);
		memset(num1,0,sizeof(num1));
		memset(num2,0,sizeof(num2));
		j = 0;
		for (i = nlen1 -1; i >= 0; i--)
		{	
			num1[j] = str1[i] - '0';
			j++;
		}
		j = 0;
		for (i = nlen2 -1; i >= 0; i--)
		{	
			num2[j] = str2[i] - '0';
			j++;
		}
		for (i = 0; i < MAX_LEN; i++)
		{
			num1[i] -= num2[i];
			if (num1[i] < 0)
			{
				num1[i] += 10;
				num1[i+1]--;
			}
		}
		i = MAX_LEN;
		while (num1[i] == 0)
			i--;
		for (; i >= 0; i--)
			cout << num1[i];
		cout << endl;
	}
	return 0;
}
void main()
{char str1[200],str2[200];
int zhe1[200],zhe2[200];
memset(zhe1,0,sizeof(zhe1));
memset(zhe2,0,sizeof(zhe2));
int cases;
scanf("%d",&cases);
while(cases>0)
{   int n1,n2,i,j,k;
	scanf("%s%s",str1,str2);
	n1=strlen(str1);n2=strlen(str2);
	for(i=0;i<n1;i++)
		zhe1[i]=str1[i]-'0';
	for(i=0;i<n1;i++)
		zhe2[i]=str2[i]-'0';
for(j=n1-1,k=n2-1;j>=0,k>=0;j--,k--)
{if(zhe1[j]>=zhe2[k]) zhe1[j]-=zhe2[k];
else { zhe1[j]=10+zhe1[j]-zhe2[k];
zhe1[j-1]--;}
}
for(i=0;i<n1;i++)
{if(zhe1[i]!=0) break;}
for(j=i;j<n1;j++) printf("%d",zhe1[j]);
printf("\n");
cases--;
}
}
//********************************
//*????????   **
//*?????? 1300012713 **
//*???2013.11.15  **
//********************************
int main() 
{ 
	char a[105], b[105];
	int n;
	cin >> n;
	for(int m = 1; m <= n; m++)
	{
	    cin >> a;
	    cin >> b;
		int aa[105] = {0}, bb[105] = {0};
	    int aline = strlen(a), bline = strlen(b);
		for(int i = 1; i <= aline; i++)
		{
			aa[aline-i+1] = a[i-1] - '0';
		}
	    for (int j = 1; j <= bline; j++)
		{
		    bb[bline-j+1] = b[j-1]-'0';
		}
	    for(int k = 1; k <= aline; k++)
		{
		    if(aa[k] >= bb[k]) aa[k] = aa[k] - bb[k];
		    else
			{
			    aa[k] = aa[k] - bb[k] + 10;
			    aa[k+1] = aa[k+1] - 1;
			}
		}
	    for(int l = aline;l >= 1; l--)
		{
		    if(aa[l] == 0 && l == aline)
			    continue;
		    cout << aa[l];
		}
		if(m!=n) cout << "\n";
	}
	cin.get();
	return 0;
}
int main()
{
	int a[100];
	char s1[100],s2[100];
	int n;
	scanf("%d", &n);
	int i;
	for (i=0;i<n;i++)
	{
        scanf("%s%s",s1,s2);
		int j=strlen(s1);
		int k=strlen(s2);
		int w,e;
		for (w=0;w<100;w++) a[w]=0;
		for (w=j,e=k;w>0;w--,e--)
		{
			if (e>0) a[w-1]=s1[w-1]-s2[e-1];
			else a[w-1]=s1[w-1]-'0';
			if (a[w-1]<0)
            {
                         s1[w-2]=s1[w-2]-1;
                         a[w-1]+=10;
            }
		}
		for (w=0;a[w]==0;w++);
		for (;w<j;w++) printf("%d",a[w]);
printf("\n");
	}
	return 0;
}
int main()
{
	char a[101], b[101];
	int na[101], nb[101];
	int la, lb, i, n, j;

	cin >> n;
	for(j = 1; j <= n; j++)
	{

		cin >> a >> b;
		la = strlen(a);
		lb = strlen(b);

		memset(na, 0, sizeof(na));
		memset(nb, 0, sizeof(nb));

		for(i = 0; i < la; i++)
		{
			na[i] = a[la - i - 1] - '0';
		}
		for(i = 0; i < lb; i++)
		{
			nb[i] = b[lb - i - 1] - '0';
		}

		for(i = 0; a[i] != '\0'; i++)
		{
			if(na[i] < nb[i])
			{
				na[i + 1] --;
				na[i] = 10 + na[i] - nb[i];
			}
			else 
				na[i] = na[i] - nb[i];
		}

		for(i = i - 1; i >= 0; i--)
			cout << na[i];
			cout << endl;

	}

	return 0;
}
void minus(char a[100],char b[100])
{
	int i,k,m,n;
	char c[100];
	m=strlen(a);
	n=strlen(b);
	for(i=m-1;i>m-n-1;i--)
	{
		if(a[i]=='/') 
		{
			a[i]='9';
			a[i-1]=a[i-1]+'0'-'1';
		}
		if(a[i]>=b[i-m+n]) c[i]=a[i]-b[i-m+n]+'0';
		if(a[i]<b[i-m+n])
		{
			c[i]=a[i]-b[i-m+n]+':';
			a[i-1]=a[i-1]+'0'-'1';
		}
	}
	for(i=m-n-1;i>=0;i--)
	{
		if(a[i]=='/')
		{
			a[i]='9';
			a[i-1]=a[i-1]+'0'-'1';
		}
		c[i]=a[i];
	}
	for(i=0;;i++)
	{
		k=i;
		if(c[i]!='0')break;
	}
	for(i=k;i<m;i++)
		printf("%c",c[i]);
	printf("\n");
}
void main()
{
	int j,i;
	char a[10][100],b[10][100];
	scanf("%d",&j);
	for(i=0;i<j-1;i++)
	{
		scanf("%s",a[i]);
		scanf("%s",b[i]);
		printf("\n");
	}
	scanf("%s",a[j-1]);
	scanf("%s",b[j-1]);
	for(i=0;i<j;i++)
		minus(a[i],b[i]);
}
void main()
{
     int n,i,j,x,y;
     char a[100],b[100],c[100],d;
     scanf("%d",&n);
     for(i=0;i<n;i++)
     {
      scanf("%s %s",a,b);
 
      x=strlen(a);y=strlen(b);
      for(j=0;j<=(x/2)-1;j++)
        {d=a[j];a[j]=a[x-1-j];a[x-1-j]=d;}
      for(j=0;j<=(y/2)-1;j++)
        {d=b[j];b[j]=b[y-1-j];b[y-1-j]=d;}
  
      for(j=0;j<y;j++)
        {
          if(a[j]>=b[j]) c[j]=a[j]-b[j]+48;
          else {c[j]=a[j]+10-b[j]+48;a[j+1]=a[j+1]-1;}
        }
      for(j=y;j<x;j++) 
         c[j]=a[j];
      for(j=x;j<100;j++)
         c[j]=0;
      for(j=0;j<=(x/2)-1;j++)
        {d=c[j];c[j]=c[x-1-j];c[x-1-j]=d;}
      for(j=0;j<strlen(c);j++)
        if(c[j]!='0') break;
      for(;j<strlen(c);j++)
       printf("%c",c[j]);
      printf("\n");
     }
}
int main()
{
	int n , m , len1 , len2 , i = 0 , j = 0 ;

	char jian[ 1001 ] , bjian[ 1001 ] ;

	int jn[ 1001 ] , bj[ 1001 ] ;
		
	cin >> n ;

	for( m = 1 ; m <= n ; m ++ )
	{
		cin >> bjian >> jian ;

		len1 = strlen( bjian ) ;
		len2 = strlen( jian ) ;
		
		memset( jn , 0 , sizeof( jian ) ) ;
		memset( bj , 0 , sizeof( bjian ) ) ;

		//cout << bjian << endl << jian << endl ;

		j = 0 ;

		//???????????????
		for( i = len1 - 1 ; i >= 0 ; i -- )
			bj[ j ++ ] = bjian[ i ] - '0' ;

		j = 0 ;

		//???????????????
		for( i = len2 - 1 ; i >= 0 ; i -- )
			jn[ j ++ ] = jian[ i ] - '0' ;

		if( strcmp( bjian , jian ) != 0)
		{

			//????
			for( i = 0 ; i <= len1 ; i ++ )
			{
				bj[ i ] = bj[ i ] - jn[ i ] ;

				if( bj[ i ] < 0 )
				{
					bj[ i + 1 ] -- ;
					bj[ i ] += 10 ;
				}
			}

			i = len1 ;

			//???????0??
			while( bj[ i ] == 0 ) 
				i -- ;

			for( ; i >= 0 ; i -- )
				cout << bj[ i ] ;

			cout << endl ;
		}

		else
			cout << '0' << endl ;
	}

	return 0 ;
}
void main()
{
	char a[100],b[100];
	int n,al,bl,i,j;
	scanf("%d",&n);
	for(j=0;j<n;j++)
	{
		scanf("%s",a);
		scanf("%s",b);
		al=strlen(a);
		bl=strlen(b);
		for(i=0;i<bl;i++)
		{
			if(a[al-1-i]<b[bl-1-i])
			{
				a[al-1-i]=a[al-1-i]+10-b[bl-1-i];
				a[al-2-i]=a[al-2-i]-1;
			}
			else a[al-1-i]=a[al-1-i]-b[bl-1-i];
		}
		for(i=0;i<al-bl;i++)
			printf("%c",a[i]);
		for(i=al-bl;i<al;i++)
			printf("%d",a[i]);
		printf("\n\n");
	}
}
void c(char a[],int h,char b[],int k)
{
	int i,j,w=0,y=0;
	char c[252];
	for(i=h-1,j=k-1;i>=0;i--,j--)
	{
		if(j>=0)
		{
		c[i+1]=a[i]+48-b[j];
		if(c[i+1]<48)
		{
			c[i+1]=c[i+1]+10;
			a[i-1]=a[i-1]-1;
		}
		}
		else
		{
			if(a[i]<48)
			{c[i+1]=a[i]+10;
			a[i-1]=a[i-1]-1;}
			else
			c[i+1]=a[i];}
	}
	
	for(i=1;i<h+1;i++)
	{
        if(c[i]!='0')
		{w=1;y++;}
        if(h+1==2||y!=0)
		{printf("%c",c[i]);}}
	printf("\n");
	
	
}

int main()
{
    int h,k,n,i;
	char a[251],b[251];
    scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s%s\n",a,b);
	    h=strlen(a);
     	k=strlen(b);
	    if(h>=k)
		  c(a,h,b,k);
	    else if(k>h)
		  c(b,k,a,h);
	}
	return 0;

}
void main()
{
	int i,j,n,k,l;
	char c[200][100],s[200][200];
	int a[200][100],b[200][200],d[200][200],x[200],y[200];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s%s",c[i],s[i]);
		x[i]=strlen(c[i]);
		y[i]=strlen(s[i]);
	}
	for(i=0;i<n;i++)
	for(j=0;j<x[i];j++)
	{
		a[i][j]=c[i][j]-48;
		d[i][j]=a[i][j];
	}
	for(i=0;i<n;i++)
	{
		for(j=0;j<y[i];j++)
		b[i][j]=s[i][j]-48;
	}
	for(i=0;i<n;i++)
	{
		k=x[i]-1;
		l=y[i]-1;
		for(j=k;j>=k-l;j--)
			d[i][j]=a[i][j]-b[i][l-k+j];
	}
	for(i=0;i<n;i++)
	for(j=x[i]-1;j>=0;j--)
	{
		if(d[i][j]<0)
		{
			d[i][j]=d[i][j]+10;
			d[i][j-1]=d[i][j-1]-1;
		}
		else continue;
	}
	for(i=0;i<n;i++)
	{
		for(j=0;j<x[i];j++)
		printf("%d",d[i][j]);
		printf("\n");
	}
}
int main()
{
	int n,i,l,m,j,k,p,q=0;
	char a[100][100],b[100][100],c[100],d[100],e[100];
	scanf("%d\n",&n);
	for(i=0;i<=n-2;i++)
	{
		gets(a[i]);
		gets(b[i]);
        scanf("\n");

	}
	gets(a[n-1]);
	gets(b[n-1]);
	for(i=0;i<=n-1;i++)
	{
		l=strlen(a[i]);
		m=strlen(b[i]);
		strcpy(c,b[i]);
		for(j=0;j<=l-1;j++)
		{
			if(j<=l-m-1)
				b[i][j]='0';
			if(j>l-m-1)
				b[i][j]=c[j-l+m];
		}
		for(j=l-1;j>=0;j--)
		{
			if(a[i][j]<b[i][j])
			{
				d[j]=a[i][j]-b[i][j]+10+48;
				q=0;
			    for(p=1;;p++)
				{   
					if(a[i][j-p]=='0')
					{
						q=q+1;
						a[i][j-p]='9';
					}
					if(a[i][j-p]!='0')
						break;
				}
				a[i][j-q-1]=a[i][j-q-1]-1;

			}
			if(a[i][j]>=b[i][j])
				d[j]=a[i][j]-b[i][j]+48;
		}
        for(j=0;j<=l-1;j++)
          if(d[j]!='0')
		  {
			  k=j;
			  break;
		  }
		  for(j=k;j<=l-1;j++)
			  printf("%c",d[j]);
		  if(i!=n-1)
		  printf("\n");
          for(j=0;j<=99;j++)
			  d[j]='0';
	}
	return 0;
}
void j(char a[],char b[])
{
	int i,m,n;
	m=strlen(a);
	n=strlen(b);
	for(i=m-1;i>=m-n;i--)
	{
		a[i]=a[i]-b[i-m+n]+48;
	}
	for(i=m-1;i>=0;i--)
	{
		if(a[i]<48)
		{
			a[i]=a[i]+10;
			a[i-1]=a[i-1]-1;
		}
	}
    printf("%s\n",a);
}

void main()
{
	int i,n;
	char a[20][100],b[20][100],c;
    scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s",a[i]);
		scanf("%s",b[i]);
		c=getchar();
	}
	for(i=0;i<n;i++)
	{
		j(a[i],b[i]);
	}
}
int main()
{
	char a[101],b[101],c[101],d[101];
	int n,i,j,n1,n2,k,m,t;
	scanf("%d",&n);
	for(j=0;j<n;j++)
	{
		memset(c,0,sizeof(c));
		scanf("%s%s",a,b);
		n1=strlen(a);
		n2=strlen(b);
		for (i=0;i<n1;i++)
		{
			a[i]-='0';
		}
		for (i=0;i<n2;i++)
		{
			b[i]-='0';
		}
		if(n1-n2!=0)
		{
			for(i=0;i<(n1-n2);i++)
				d[i]=0;
		}
		for(i=n1-n2,k=0;i<n1 || k<n2;i++,k++)
			d[i]=b[k];
		for(i=1;i<=n1;i++)
		{
			if(a[n1-i]>=d[n1-i])
				c[n1-i]=a[n1-i]-d[n1-i];
			else
			{
				c[n1-i]=a[n1-i]+10-d[n1-i];
				if(a[n1-1-i]==0)
				{
					t=i;
					do
					{
						a[n1-1-i]=a[n1-1-i]+9;
						i++;
					}while(a[n1-1-i]==0);
					a[n1-1-i]--;
					i=t;
				}
				else
					a[n1-1-i]--;
			}
		}
		i=0;
		while(c[i]==0 && i<n1)
		{
			i++;
		}
		if (i==n1)
		{
			printf("0\n");
			continue;
		}
		m=i;
		for(i=m;i<n1;i++)
			printf("%d",c[i]);
		printf("\n");
	}
	return 0;
}
//*********************************
//* ?????????           ** 
//* ?????? 1300012948      ** 
//* ???2013.11.15             ** 
//*********************************
int main()
{
    int n, len1, len2, k, m, g, e[101] = {0};
    char a[101], b[101];
    cin >> n; // n??? 
    for(int i = 1; i <= n; i++)
    {
            int c[101] = {0}; // ?????????0 
            int d[101] = {0}; 
            cin.get(); // ???? 
            k = 0;
            m = 0;
            cin.getline(a, 101); // ???????????????????????????? 
            cin.getline(b, 101);
            len1 = strlen(a);
            len2 = strlen(b);
            for(int j = len1 - 1; j >= 0; j--) // ?????????????????????????????????????? 
            {
                    c[k++] = a[j] - '0';
            }
            for(int l = len2 - 1; l >= 0; l--)
            {
                    d[m++] = b[l] - '0';
            }
            for(int f = 0; f <= len1 - 1; f++) // ??????????????? 
            {
                    if(c[f] >= d[f]) // ?????????????????????????? 
                    {
                            e[f] = c[f] - d[f];
                    }
                    else // ??,?????????????????????????,???????????? 
                    {
                        e[f] = c[f] + 10 - d[f];
                        c[f + 1]--;
                    }
            }
            g = len1 - 1;
            while(e[g] == 0) // ???????0 
            {
                       g--;
            }
            for( ; g >= 0; g--) // ?????0???????? 
            {
                 cout << e[g];
            }
            cout << endl;
    }
    return 0;
}
int main(){
	int m,y,n,l;
	char a[100],b[100];
	int aa[100],bb[100],c[100];
	cin>>y;
	for(int i=1;i<=y;i++){
		cin>>a;
		cin>>b;
		for(int r=0;r<100;r++){
			aa[r]=0;bb[r]=0;c[r]=0;
		}
        m=strlen(a);
        n=strlen(b);
        for(int i=0;i<m;i++)
        	aa[m-1-i]=a[i]-'0';
        for(int j=0;j<n;j++)
        	bb[n-1-j]=b[j]-'0';
        int carry=0;
        for(int k=0;k<m;k++){
        	c[k]=carry+aa[k]-bb[k];
        	if(c[k]<0){
        		c[k]+=10;
        		carry=-1;
        	}
        	else
        		carry=0;
        }
        for(l=m-1;l>=0;l--)
        	if(c[l]!=0)break;
        if(l==-1)cout<<"0"<<endl;
        else{
        	for(int x=l;x>=0;x--)
        		cout<<c[x];
            cout<<endl;
        }
}
	return 0;
}
main()
{
	int N,i,j,k,l[100]={0};
	char a[100][100],b[100];
	scanf("%d",&N);
	for (i=0;i<2*N;i++)
	{
		scanf("%s",a[i]);
	}
	for(j=0;j<2*N;j++)
	{for(i=0;a[j][i]!='\0';i++) l[j]++;}
	for(i=0;i<N;i++)
	{	
		for(j=0;j<=99;j++) b[j]='\0';
		for(j=0;j<=l[2*i+1];j++)
		{
			b[l[2*i]-l[2*i+1]+j]=a[2*i+1][j];
		}
		for(j=0;j<=99;j++) a[2*i+1][j]=b[j];
	}
	for(j=0;j<N;j++)
	{
		for(i=(l[2*j]-1);i>=0;i--) 
		{	if(a[2*j][i]<'0') {a[2*j][i]='9';a[2*j][i-1]--;}
			if (a[2*j+1][i]=='\0') ;
			else if (a[2*j][i]>=a[2*j+1][i])  a[2*j][i]=a[2*j][i]-a[2*j+1][i]+'0';
			else if (a[2*j][i]<a[2*j+1][i]) 
			{a[2*j][i]=a[2*j][i]-a[2*j+1][i]+10+'0';a[2*j][i-1]--;}
		}
	}
	for(j=0;j<N;j++) 
	{
		k=0;
		for(i=0;i<l[2*j];i++)
		{	
			if((a[2*j][i]!='0')||(k==1))
		{
			k=1;
			printf("%c",a[2*j][i]);
		}
		}
		if(k==0) printf("0");
	printf("\n");
	}
}
void subtract(char a[100], char b[100])
{
	int re[100];
	int lena,lenb,i,j,m=0;
	lena=strlen(a);
	lenb=strlen(b);

	
	for(i=0;i<lena;i++)
		re[i]=a[i]-48;
	for(i=lena-1,j=lenb-1;j>=0;i--,j--)
	{
		re[i]=re[i]+48-b[j];
		if(re[i]<0)
		{
			re[i-1]--;
			re[i]+=10;
		}
	}

	for(i=0;i<lena;i++)
	{
		if(m==0&&re[i]==0)continue;
		else {printf("%d",re[i]);m=1;}
	}

	printf("\n");
}




main()
{



	int n,i,k;
	char inp[100][100];

	scanf("%d",&n);
	k=3*n;
//	printf("k=%d\n",k);
	for(i=0;i<k;i++)
	{
//		printf("i=%d\n",i);
		gets(inp[i]);
//		printf("i=%d\n",i);
	}
//	printf("len=%d\n",strlen(inp[0]));
//	printf("str=%s\n",inp[3]);

	for(i=0;i<n;i++)
		subtract(inp[3*i+1],inp[3*i+2]);

}
int main()
{long int d,n,i,j,l1,l2,a1[10000],a2[10000];
char str1[10000],qq,str2[10000];
	scanf("%d\n",&n);
	for (i=1;i<=n;i++)
	{
		gets(str1);
	gets(str2);
	scanf("%c",&qq);
    l1=strlen(str1);
l2=strlen(str2);
for(j=0;j<=l1-1;j++)a1[j]=str1[j]-48;

for(j=0;j<=l2-1;j++)a2[j]=str2[j]-48;

j=1;d=0;
while(l2>=j)
{
	a1[l1-j]=a1[l1-j]-a2[l2-j]-d;
    if (a1[l1-j]<0){a1[l1-j]=a1[l1-j]+10;d=1;}else d=0;
j=j+1;
}
if (l1-j>=0)a1[l1-j]=a1[l1-j]-d;
for (j=0;j<=l1-1;j++)printf("%d",a1[j]);
printf("\n");
	}
}
void main()
{
	long n;
	char str1[LENGTH+1], str2[LENGTH+1], ln[LENGTH+1];
	int a[LENGTH+1], b[LENGTH+1], len1, len2;
	long h, i, t;

	scanf("%d\n", &n);
	for (h=1;h<=n;h++)
	{
		gets(str1);
		gets(str2);
		if (h<n) gets(ln);
		len1=strlen(str1);
		len2=strlen(str2);
		for (i=0;i<=LENGTH;i++)
		{
			a[i]=0;
			b[i]=0;
		}
		for (i=0;i<len1;i++)
			a[LENGTH-i]=str1[len1-i-1]-'0';
		for (i=0;i<len2;i++)
			b[LENGTH-i]=str2[len2-i-1]-'0';
		for (i=0;i<=LENGTH;i++)
			a[i]-=b[i];
		for (i=LENGTH;i>0;i--)
		{
			if (a[i]<0)
			{
				a[i]+=10;
				a[i-1]--;
			}
		}
		t=0;
		while (a[t]==0)
			t++;
		for (i=t;i<=LENGTH;i++)
			printf("%d", a[i]);
		if (h<n) printf("\n");
	}
}
void main()
{
	char a[100],b[100],c[100],r[100],str[100],substr[100];
	int i,j,m1,m2,n,k,t;
	scanf("%d",&n);
	for(k=1;k<=n;k++)
	{
		str[0]='\0';
		substr[0]='\0';
		scanf("%s",str);
		scanf("%s",substr);
		m1=strlen(str);
		m2=strlen(substr);
		for(i=0,j=m1-1;i<m1;i++,j--)
			a[i]=str[j];
		a[i]='\0';
		for(i=0,j=m2-1;i<m2;i++,j--)
			b[i]=substr[j];
		if(m1>m2)
			for(i=m2;i<m1;i++)
				b[i]='0';
		b[i]='\0';
		for(i=0;i<m1;i++)
		{
			if(a[i]>=b[i])
				c[i]=a[i]-b[i]+48;
			else
			{
				c[i]=a[i]+10-b[i]+48;
				a[i+1]--;
			}
		}
		for(i=m1-1;c[i]=='0';i--);
		c[i+1]='\0';
		t=strlen(c);
		for(i=0,j=t-1;i<t;i++,j--)
			r[i]=c[j];
		r[i]='\0';
		puts(r);
	}

}
void main()
{
	int i,j,n,len1,len2;
	int t[101];  /*????*/
	char s1[30][101],s2[30][101];
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		scanf("%s",s1[i]);
		scanf("%s",s2[i]);
    	printf("\n");
	}                              /*??????*/

	for(i=1;i<=n;i++)
	{                          
		len1=strlen(s1[i]);
		len2=strlen(s2[i]);
			for(j=0;j<=len2-1;j++)
			{
				if(s1[i][len1-j-1]<s2[i][len2-j-1])   /*??????*/
				{
					s1[i][len1-j-2]=s1[i][len1-j-2]-'1'+48; /*s1??????*/
					t[j]=s1[i][len1-j-1]-s2[i][len2-j-1]+10;
				}
				else
				{
					t[j]=s1[i][len1-j-1]-s2[i][len2-j-1];
				}
			}
			for(j=len2;j<=len1-1;j++)
			{
				t[j]=s1[i][len1-j-1]-48;
			}
		for(j=(len1-1);j>=0;j--)   /*???????*/
		{
			printf("%d",t[j]);
		}
		printf("\n");
	}
}
/*
 * dazhengshujianfa.cpp
 *
 *  Created on: 2010-11-17
 *      Author: Administrator
 */
int main(){
	int n,i,j,lenth1,lenth2,carry;
	carry=0;
	cin>>n;
	char a[101],b[101],c[101];
	for(i=1;i<=n;i++){
		carry=0;
		cin>>a;
		cin>>b;
		lenth1=strlen(a);
		lenth2=strlen(b);
		for(j=lenth2;j<lenth1;j++){
			b[j]='0';
		}
		strcpy(c,a);
		for(j=1;j<=lenth2;j++){
            c[lenth1-j]=a[lenth1-j]-b[lenth2-j]-carry+'0';
			if(c[lenth1-j]-'0'<0){
				carry=1;
				c[lenth1-j]+=10;
			}
			else  carry=0;
		}
		if(lenth1>lenth2){
			if(carry==1){
				c[lenth1-lenth2-1]-=1;
			}
		}
		if(c[0]=='0')  c[0]='\0';
		for(j=0;j<lenth1;j++){
			cout<<c[j];
		}
		cout<<endl;
	}
	return 0;
}
int main()
{
	int n,i,j;
	char str1[101],str2[101];
	cin>>n;
	while(n>0)
	{
		int anlen1[100]={0,},anlen2[100]={0,};
		cin>>str1>>str2;
		int len1 = strlen(str1);
		int len2 = strlen(str2);
		j=0;
		for(i = len1-1;i >= 0;i--)
			anlen1[j++] = str1[i] - '0';
		j=0;
		for(i = len2-1;i >= 0;i--)
			anlen2[j++] = str2[i] - '0';
		for(i = 0;i < len1;i++)
		{
			if(anlen1[i] >= anlen2[i])
				anlen1[i] -= anlen2[i];
			else
			{
				anlen1[i] = anlen1[i] - anlen2[i] + 10;
				anlen1[i+1]--;
			}
		}
		i = len1-1;
		while(anlen1[i] == 0) i--;
		for(;i >= 0;i--)
			cout<<anlen1[i];
		cout<<endl;
		n--;
	}
return 0;
}
int main()
{
 int i, j ,m, n;
 scanf ("%d", &n);
 for (m=0; m<n; m++)
 {
  char a[SIZE+1]={0}, b[SIZE+1]={0};
  char carry=0;
  char a_str[SIZE+1], b_str[SIZE+1];
  char ab_minus[SIZE+1] = {0};
  int big = 0;
  scanf ("%s", a_str);
  scanf ("%s", b_str);
  for (i = strlen(a_str), j = SIZE ; i>=0 ; i--, j--)
   a[j] = a_str[i] - '0';
  for (i = strlen(b_str), j = SIZE ; i>=0 ; i--, j--)
   b[j] = b_str[i] - '0';
  for (i = SIZE-1; i>= 0; i--)
  {
   if (a[i] - carry < b[i])
   {
    a[i]+=10;
    ab_minus[i] = a[i] - b[i] - carry;
    carry = 1;
   }
   else
   {
    ab_minus[i] = a[i] - b[i] - carry;
    carry = 0;
   }
  }
  for (i=0; i < SIZE-1 && ab_minus[i] == 0; i++);
  for (; i < SIZE; i++)
   printf ("%c", ab_minus[i] + '0');
  printf ("\n");
  }
  return 0;
}
void main()
{
 int n,i,j,k,x,la[100],lb[100];
 char a[100][100],b[100][100],c[100][100];
 scanf("%d\n",&n);  
 for(i=0;i<n;i++)
 {
  scanf("%s",a[i]);
  scanf("%s",b[i]);
  printf("\n");
 }
 for(i=0;i<n;i++)
 {
  la[i]=strlen(a[i]);
  lb[i]=strlen(b[i]);
 }
 for(i=0;i<n;i++)
 {
  for(j=la[i]-1,k=lb[i]-1;j>(la[i]-lb[i]),k>=0;j--,k--)
  {
   if(a[i][j]<b[i][k]) 
   {c[i][j]=58+a[i][j]-b[i][k];a[i][j-1]=a[i][j-1]-1;}
   else c[i][j]=a[i][j]-b[i][k]+48;
  }
  for(j=0;j<la[i]-lb[i];j++)
  c[i][j]=a[i][j];
 }
 for(x=0;x<n;x++)
 printf("%s\n",c[x]);
}
int main()
{
	int n,i,len1,len2,j;
	char x[100]={0};
	char y[100]={0};
	char z[100]={0};
	scanf("%d",&n);
	for(j=0;j<n;j++)
	{
		scanf ("%s",x);
	    scanf ("%s",y);
        len2=strlen(y);
		len1=strlen(x);
		z[0]=x[len1-1]+10-y[len2-1]+48;
		for(i=1;i<len2;i++)
		z[i]=x[len1-1-i]-1+10-y[len2-1-i]+48;
		for(i=len2;i<len1;i++)
			z[i]=x[len1-1-i]+10-1;
		for(i=0;i<len1;i++)
		{if(z[i]>57)
		{z[i+1]=z[i+1]+1;
		z[i]=z[i]-10;
		}
		}
		for(i=len1-1;i>=0;i--)
			printf("%d",z[i]-48);
		printf("\n");
	}
	return 0;

}