semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
void main()
{
	int n,i,j,p,q;
	char a[100],b[100],c[100]={0},a1[100],b1[100];
	scanf("%d",&n);
	for(j=1;j<=n;j++)
	{
		scanf("%s%s",a,b);
		strcpy(a1,a);
		strcpy(b1,b);
		p=strlen(a);
		q=strlen(b);
	for(i=100-p;i<=99;i++)
		a1[i]=a[i-100+p];
	for(i=0;i<=99-p;i++)
		a1[i]=0;
    for(i=100-q;i<=99;i++)
		b1[i]=b[i-100+q];
	for(i=100-p;i<=99-q;i++)
		b1[i]='0';
	for(i=0;i<=99-p;i++)
		b1[i]=0;
	for(i=99;i>=100-p;i--)
		if(a1[i]>=b1[i])
			c[i]=a1[i]-b1[i]+48;
		else
		{
			c[i]=10+a1[i]-b1[i]+48;
			a1[i-1]--;
		}
	for(i=100-p;i<=99;i++)
		printf("%c",c[i]);
	printf("\n");
	}
}
void swi(int l,char s[200]){
	int i,t;
	for(i=0;i<l/2;i++){
		t=s[i];
		s[i]=s[l-i-1];
		s[l-i-1]=t;
	}
	return;
}
int main(){
	char m[200],n[200],t[200];
	int n1,i,j,k,lm,ln,q,flag,num;
	scanf("%d",&num);
	for(n1=0;n1<num;n1++){
		scanf("%s %s",m,n);
		flag=0;
		lm=strlen(m);
		ln=strlen(n);
		if(lm<ln)
			flag=1;
		else if(lm==ln&&strcmp(m,n)<0)
			flag=1;
		if(flag){
			strcpy(t,m);
			strcpy(m,n);
			strcpy(n,t);
			q=lm;
			lm=ln;
			ln=q;
			putchar('-');
		}
		swi(lm,m);
		swi(ln,n);
		for(i=0;i<ln;i++){
			if(m[i]>=n[i])
				m[i]-=n[i];
			else{
				m[i]=10+m[i]-n[i];
				for(k=1;!m[i+k];k++);
				for(q=1;q<k;q++)
					m[i+q]=9;
				m[i+q]--;
			}
		}
		for(i=ln;i<lm;i++)
			m[i]-='0';
		for(lm--;!m[lm];lm--);
		swi(lm+1,m);
		for(i=0;i<=lm;i++)
			printf("%d",m[i]);
		if(n1<num-1)
			putchar('\n');
	}
	return 0;
}
void main()
{
	char a[101],b[101],r[100][101];
	int i,j,k,n,c,la,lb;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s %s",a,b);
		la=strlen(a);
		lb=strlen(b);
		c=la-lb;
		r[i][la]='\0';
		for(j=la-1;j>=0;j--)
		{
			if(j>=la-lb)
			{
				if(a[j]>=b[j-c])
					r[i][j]=a[j]-b[j-c]+'0';
				else
				{
					r[i][j]=10+a[j]-b[j-c]+'0';
					k=j-1;
					while(a[k]=='0')
					{
						a[k]='9';
						k--;
					}
					a[k]--;
				}
			}
			else r[i][j]=a[j];
		}
	}
	for(i=0;i<n;i++)
			printf("%s\n",r[i]);
}
/*???1000012904
  ?????????
  ?????
  ???2010?11?19?
*/
int main()
{
	int n;
	cin >> n;//???????
	for(int i = 0; i < n; i++)
	{
		int numa[101], numb[101];//???????numa?????numb
		char stra[101], strb[101];//?????????stra,strb
		int lena, lenb;//???????lena,????lenb
		cin >> stra;
		cin >> strb;
		lena = strlen(stra);
		lenb = strlen(strb);//??????????????
		memset(numa, 0, sizeof(numa));
		memset(numb, 0, sizeof(numb));//?????
		int j = 0, k = 0;
		for(k = lena - 1; k >= 0; k--)
		{
			numa[j++] = stra[k] - '0';
		}//???????????????????numa
		j = 0;
		for(k = lenb - 1; k >= 0; k--)
		{
			numb[j++] = strb[k] - '0';
		}//??????????????????numb
		for(k = 0; k < lena; k++)
		{
			if(numa[k] < numb[k])
			{
				numa[k] = numa[k] + 10;
				numa[k + 1] = numa[k + 1] - 1;
			}//?????????????????????1????10?????1
			numb[k] = numa[k] - numb[k];//????????????????????
		}
		k = lena;
		while(numb[k] == 0)
			k--;
		//???????????????
		for( ;k >= 0; k--)
			cout << numb[k];
		cout << endl;
		cin.get();//???????????
	}
	return 0;
}
int main()
{
	int n, a[100]={0}, b[100]={0}, c[100]={0}, l1, l2, i, j;
	char begin1[101]={0}, begin2[101]={0};
	int compare(int a, int b);
	scanf("%d\n", &n);
	for(i=0;i<n;i++){
		scanf("%s", begin1);
		scanf("%s", begin2);
		if(i!=n-1)
		    scanf("\n");
		l1 = strlen(begin1);
		l2 = strlen(begin2);
		for(j=0;j<compare(l1, l2);j++){
			if(l1>=l2){
			    a[j] = (int)begin1[j]-48;
				if(j<l2)
			        b[j+l1-l2] = (int)begin2[j]-48;
			}
			else{
				if(j<l1)
				    a[j+l2-l1] = (int)begin1[j]-48;
			    b[j] = (int)begin2[j]-48;
			}
		}
		for(j=compare(l1, l2)-1;j>=0;j--){
			if(a[j]-b[j]>=0)
				c[j] = a[j] - b[j];
			else{
				c[j] = 10+a[j]-b[j];
				a[j-1] = a[j-1]-1;
			}
		}
		for(j=0;j<compare(l1, l2);j++){
			printf("%d", c[j]);
			c[j]=0;
			begin1[j]='\0';
			begin2[j]='\0';
			a[j]=0;
			b[j]=0;
		}
		printf("\n");
		
	}
	return 0;
}
int compare(int a, int b){
	if(a>=b)
		return a;
	else
		return b;
}
int main(int argc, char* argv[])
{
	int n;
	scanf("%d\n",&n);
	int i,j,k;
	for(i=0;i<n;i++)
	{
		char str1[105];
		char str2[105];
		int x1[105]={0},x2[105]={0},s[105]={0};
		scanf("%s",str1);
		scanf("%s",str2);
		int a,b;
		a=strlen(str1);
		b=strlen(str2);
		for(j=0;j<a;j++)
		   x1[j]=str1[j]-'0';
		for(j=b-1;j>=0;j--)
		   x2[j+a-b]=str2[j]-'0';
		for(j=0;j<a-b;j++)
			x2[j]=0;
		for(j=a-1;j>=0;j--)
		{
			if(x1[j]<x2[j])
			{
				s[j]=10+x1[j]-x2[j];
				x1[j-1]--;
			}
			else
				s[j]=x1[j]-x2[j];
		}
		for(j=0;j<a;j++)
			printf("%d",s[j]);
		printf("\n");
	}
	return 0;
}
//
//	?????	?????
//	?????	?2??????????
//	?????	?	? ? ? ?? 1000012733 ?
//	?????	2010 ? 11 ? 19 ?
//
int main()
{
	const int max = 100;
	char str1[max], str2[max];
	int num1[max], num2[max];
	int n, i, j, k1, k2, l, p, q, len1, len2;
	cin >> n;			
	for ( i = 1; i <= n; i ++ )
	{
		cin.get();
		memset ( str1, 0, max );
		memset ( str2, 0, max );
		cin.getline ( str1, max );
		cin.getline ( str2, max );
		len1 = strlen ( str1 );
		len2 = strlen ( str2 );
		memset ( num1, 0, sizeof ( num1 ));
		memset ( num2, 0, sizeof ( num2 ));
		k1 = len1 - 1;
		for ( j = 0; j < len1; j ++ )
		{
			num1[k1] = str1[j] - '0';
			k1 --;
		}
		k2 = len2 - 1;
		for ( j = 0; j < len2; j ++ )
		{
			num2[k2] = str2[j] - '0';
			k2 --;
		}
		for ( l = 0; l < len1; l ++ )
		{
			if ( num1[l] >= num2[l] )
			num1[l] = num1[l] - num2[l];
			else 
			{
				num1[l] = num1[l] - num2[l] + 10;
				num1[l + 1] --;
			}
		}
		p = max - 1;
		while ( num1[p] == 0)
		{
			p --;
		}
		for ( q = p; q > 0; q -- )
		{
			cout << num1[q];
		}
		cout << num1[0] << endl;
	}
	return 0;
}
char* minus(char*a,char*b)
{
	int i, j;
	for(i=strlen(a)-1,j=strlen(b)-1;j>=0;i--,j--)
	{
		a[i]-=(b[j]-'0');
		if(a[i]<'0')
		{
			a[i]+=10;
			a[i-1]--;
		}
	}
	return a;
}
int main()
{
	char a[10][100],b[10][100];
	int n;
	scanf("%d",&n);
	int i;
	for(i=0;i<n;i++)
	{
		
		scanf("%s\n%s",a[i],b[i]);
		printf("\n");
	
	}
	for(i=0;i<n;i++)
	printf("%s\n",minus(a[i],b[i]));
	return 0;
}
main()
{
char **pp;

 int n,h,m=100,i,x,y,a=0;
 scanf ("%d",&h);
 n=2*h;
 pp=(char **)malloc(n*sizeof(char *));
 
 for (i=0;i<n;i++)
  pp[i]=(char*)malloc(m*sizeof(char));
 for (i=0;i<h;i++)
   {
    scanf ("%s",pp[2*i]);x=strlen (pp[2*i]);
	scanf ("%s",pp[2*i+1]);y=strlen (pp[2*i+1]);
     for (a=x-1;a>x-y-1;a--)
	 {
	  pp[2*i][a]= pp[2*i][a]-pp[2*i+1][a-x+y]+'0';
	  if (  pp[2*i][a]<'0') 
	  {pp[2*i][a]= pp[2*i][a]+10; pp[2*i][a-1]= pp[2*i][a-1]-1;}

	 }

   }

 printf ("\n");
 for (i=0;i<h;i++)
   printf ("%s\n",pp[2*i]);
 for (i=0;i<n;i++)
   free (pp[i]);
   free (pp);
}
void main()
{
	char a[100],b[100],c[100],r;
	int n,i,j,k,la,lb,t;
	struct
	{
		char result[100];
	}result[50];
	
	scanf("%d",&n);
	for(k=0;k<n;k++)
	{
		scanf("%s%s",a,b);
		la=strlen(a);
		lb=strlen(b);
		for(i=0;i<la/2;i++)
		{
			r=a[i];
			a[i]=a[la-i-1];
			a[la-i-1]=r;
		}
		for(i=0;i<lb/2;i++)
		{
			r=b[i];
			b[i]=b[lb-i-1];
			b[lb-i-1]=r;
		}
	

		for(i=0;i<lb;i++)
		{
			if(a[i]>=b[i])
			{
				t=a[i]-b[i];
			}
			else
			{
				if(a[i+1]==48)
				{
					for(j=0;;j++)
					{
						if(a[i+1+j]==48)
						{
							a[i+1+j]=57;
							continue;
						}
						else 
						{
							a[i+1+j]=a[i+1+j]-1;break;
						}
					}
				}
				else
				{
					a[i+1]=a[i+1]-1;
				}
				t=a[i]+10-b[i];
			}
			c[i]=t+48;
		}
		for(i=lb;i<la;i++)
		{
			c[i]=a[i];
		}
		for(i=0;i<la/2;i++)
		{
			r=c[i];
			c[i]=c[la-i-1];
			c[la-i-1]=r;
		}
		for(i=0;;i++)
		{
			if(c[i]!=48)
			{
				for(j=0;j<la-i;j++)
				{
					result[k].result[j]=c[i+j];
				}
				
				result[k].result[la-i]='\0';
				break;
			}
		}
	}
	for(k=0;k<n;k++)
		printf("%s\n",result[k].result);
}
void subtract(char a[],char b[],char c[])
{int i,carry=0;
 for(i=100;i>=0;i--)
 {if(b[i]+carry>a[i])
	{c[i]=10+a[i]-b[i]-carry+'0';
     carry=1;}
  else
	{c[i]=a[i]-b[i]-carry+'0';
	 carry=0;}
}
}

void align(char a[])
{int len,jump,m;
 len=strlen(a);
 jump=101-len;
for(m=len;m>=0;m--)
 {a[m+jump]=a[m];
  a[m]='0';}
}

void main()
{int i,x,y,z,m;
scanf("%d",&m);
while(m>0)
{char e[101],f[101],g[101];
 for(i=0;i<101;i++)
 e[i]=f[i]=g[i]='0';
 scanf("%s",e);
 scanf("%s",f);
 x=strlen(e);
 y=strlen(f);
 align(e);
 align(f);
 subtract(e,f,g);
 z=100-x;
 while(z<=99&&g[z]=='0')
 z++;
 for(i=z;i<=100;i++)
 printf("%c",g[i]);
 printf("\n");
 m=m-1;
 getchar();
}
}
//*****************************
//*?????? 1300012809   **
//*???2013.11.16          **
//*????????          **
//*****************************
int main()
{
	int n, i, j, k, changdu1, changdu2, jieguo[1005];
	char jianshu[1005], beijianshu[1005];
	char zhongjian[1005];
	cin >> n;
	cin.get();
	for (k=0; k<n; k++)
	{
		if (k!=0) cin.get();
		cin.getline(beijianshu,1001);
		cin.getline(jianshu,1001);
	    changdu1 = strlen(beijianshu);
	    changdu2 = strlen(jianshu);
	    for (i=0; i<changdu1; i++)	zhongjian[i] = beijianshu[i];
	    for (i=0; i<changdu1; i++)     
		{ 
		    beijianshu[i] = zhongjian[changdu1-1-i];
	     	if (beijianshu[i]==' ')  beijianshu[i]='0' ;
		}
	    for (i=0; i<changdu2; i++)		zhongjian[i] = jianshu[i];
	    for (i=0; i<changdu2; i++)     
		{ 
	     	jianshu[i] = zhongjian[changdu2-1-i];
	    	if (jianshu[i]==' ')  jianshu[i]='0' ;
		}
	    //?????
     	for (i=0; i<changdu2; i++)
		{
		   if (beijianshu[i]<jianshu[i])
		   {
		    	jieguo[i] = 10 - jianshu[i] + beijianshu[i];
		    	if (beijianshu[i+1] != '0') beijianshu[i+1] -= 1 ;
		    	else 
				{ 
			    	j=i;
			     	while(beijianshu[j+1]=='0')
					{
			     		beijianshu[j+1] = '9' ;
			    		j = j + 1 ;
					}
			    	beijianshu[j+1] -= 1 ;
				}
		   }
	    	else
			{
		    	jieguo[i] = beijianshu[i] - jianshu[i] ;
		
			}
		}
	    for (i=changdu2; i<changdu1; i++)
	    	jieguo[i]=beijianshu[i] - '0' ;
	    if (beijianshu[changdu1-1]=='0') changdu1 -= 1;
	    for (i=changdu1-1; i>=0; i--) cout << jieguo[i] ;
	    cout << endl;
	}
	return 0;
}
void main(){
	int n,i,j,al,bl,t;
	char a[100],b[100],out[100];
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{int anum[100];
	int bnum[100];

		scanf("%s",a);
		scanf("%s",b);
        al=strlen(a);
		bl=strlen(b);
		for(j=0;j<al;j++)
			anum[al-1-j]=a[j]-'0';
        for(j=0;j<bl;j++)
			bnum[bl-1-j]=b[j]-'0';
		for(j=0;j<bl;j++)
			anum[j]=anum[j]-bnum[j];
		for(j=0;j<bl;j++)
		{
			if(anum[j]<0)
			{
				anum[j]=anum[j]+10;
				anum[j+1]=anum[j+1]-1;
			}
		}
		if(anum[al-1]==0)
		{
		{for(j=0;j<al-1;j++)
		out[j]=anum[al-2-j]+'0';
		};
		out[al-1]='\0';
		}
		if(anum[al-1]>0)
		{
			for(j=0;j<al;j++)
				out[j]=anum[al-1-j]+'0';
			out[al]='\0';
		}
		printf("%s\n",out);
	}
}
/*?????*/ 



int main()
{
	int n,i;
	char s1[101],s2[101];
	int result[101];
	cin>>n;
	int n1,n2,hand,j;
	while(n--)
	{
		cin>>s1>>s2;
		n1=strlen(s1);
		n2=strlen(s2);
		hand=0;
		for(i=n2-1;i>=0;i--)
		{
			result[hand]=s1[n1-n2+i]-s2[i];//???
			if(result[hand]<0)
			{
				result[hand]=result[hand]+10;
				j=n1-n2+i-1;
				while(--s1[j]<48)//??
				{
					s1[j]=s1[j]+10;
					j--;
				}
			}
			hand++;
		}
		for(i=0;i<n1-n2;i++)
		    if(s1[i]!='0') break;
		for(;i<n1-n2;i++) cout<<(int)s1[i]-48;
		for(i=hand-1;i>=0;i--) cout<<result[i];
		cout<<endl;
	}
	return 0;
}
int main()
{
	int n,i,j,k,m,g,h,temp;
	char a[1000]={'0'},b[1000]={'0'};
	int c[1000],d[1000]={0},f[1000];
	scanf("%d",&n);
	while(n>0)
	{
	    memset(a,'0',sizeof(a));
        memset(b,'0',sizeof(b));
        for(m=0;m<1000;m++)
		    {
		        f[m]=0;
		        c[m]=0;
		        d[m]=0;
		    }
		scanf("%s",a);
		scanf("%s",b);
	    j=strlen(a);
		k=strlen(b);
		for(m=0;m<j;m++)
			c[m]=a[m]-'0';
		for(m=0;m<k;m++)
			d[m+j-k]=b[m]-'0';
        for(m=j-1;m>=0;m--)
			if(c[m]>=d[m])
				f[m]=c[m]-d[m];
			else
			{
				c[m]+=10;
				c[m-1]-=1;
                f[m]=c[m]-d[m];
			}
		for(m=0;m<j;m++)
		{
			if(f[m]!=0)
			{
			    g=m;
			    break;
			}

		}
		for(m=g;m<j-1;m++)
			printf("%d",f[m]);
		printf("%d\n",f[j-1]);
        n--;
	}

	return 0;

}
void main()
{
	int n,i,j,an,bn,c[100];
	char a[100],b[100];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{	
		scanf("%s",a);
		scanf("%s",b);
		an=strlen(a);
		bn=strlen(b);
		for(j=0;j<an;j++)
		{
			if(j<an-bn)
				c[j]=a[j]-48;
			else
				if(a[j]>=b[j+bn-an])
					c[j]=a[j]-b[j+bn-an];
				else
				{
					c[j]=a[j]+10-b[j+bn-an];
					if(c[j-1]!=0)
					{
						c[j-1]=c[j-1]-1;
					}
					else
						if(c[j-2]!=0)
						{
							c[j-1]=9;
							c[j-2]=c[j-2]-1;
						}
						else
							if(c[j-3]!=0)
					{
						c[j-1]=9;
						c[j-2]=9;
						c[j-3]=c[j-3]-1;
					}
				}
		}
		for(j=0;j<an;j++)
		{
			printf("%d",c[j]);
			if(j==an-1)
				printf("\n");
		}
	}
}
void main()
{
	int i,t,j,n,len_a,len_b,len_e,temp;
	char a[101],b[101],c[101],d[101],e[101],f[101];
	scanf("%d\n",&n);
	for(j=0;j<n;j++)
	{   
		gets(a);
		gets(b);
		len_a=strlen(a);
		len_b=strlen(b);
		for(i=0;i<len_a/2;i++)
		{
		  temp=a[i];
		  a[i]=a[len_a-i-1];
		  a[len_a-i-1]=temp;
		}
		for(i=0;i<len_b/2;i++)
		{
		  temp=b[i];
		  b[i]=b[len_b-i-1];
		  b[len_b-i-1]=temp;
		}
		for(i=len_b;i<len_a;i++)
		 b[i]='0';
	    for(i=0;i<len_a;i++)
		{
			   
			  t=a[i]-b[i];
		       if(t<0)
			   {
			        t=t+10;
					a[i+1]=a[i+1]-1;
				}
		        a[i]=t-1+'1';
		}
	    for(i=len_a-1;i>=0;i--)
		{
		 if(a[i]!='0')break;
		 else len_a--;
        }
		a[len_a]='\0';
		for(i=0;i<len_a/2;i++)
		{
		  temp=a[i];
		  a[i]=a[len_a-i-1];
		  a[len_a-i-1]=temp;
		}
		puts(a);
		gets(a);
	}
}
void f(int aa[], int bb[],int c[],int t);


int d[20][101]={0};
main()
{
	int i,n,lens1,lens2,r=0,h=0,w1,w2;
	int t[20];
	scanf("%d",&n);
    
	for (i=0;i<n;i++)
	{
		char a[101],b[101];
	    int aa[101],bb[101],c[101]={0};
      scanf("%s",a);
      scanf("%s",b);
	  lens1=strlen(a);
	  lens2=strlen(b);
	  t[i]=(lens1>lens2)?lens1:lens2;
	  
	  for (r=0;r<strlen(a);r++)
		  aa[r+101-strlen(a)]=a[r]-'0';
	  for (r=0;r<strlen(b);r++)
		  bb[r+101-strlen(b)]=b[r]-'0';
	  for (r=101-t[i];r<101-t[i]+(lens1-lens2);r++)
		  bb[r]=0;
	  
	  
	  f(aa,bb,c,t[i]);
	  
	  for (r=100;r>=101-t[i];r--)
		  d[h][r]=c[r];
	  h++;
     
	  printf("\n");
	}

	for (r=0;r<h;r++)
	{
		for (w1=101-t[r];w1<=100;w1++)
			if (w1!=0) 
			break;
		
		for (w2=w1;w2<=100;w2++)
			printf("%d",d[r][w2]);
		    printf("\n");
	}
	printf("\n");

}



void f(int aa[],int bb[],int c[],int t)
{
	int i;
    
	for (i=100;i>=101-t;i--)
	 c[i]=aa[i]-bb[i];
	  
	for (i=100;i>=101-t;i--)
	 if (c[i]<0)
	  {c[i]=c[i]+10;
	   c[i-1]--;
	  }
	
	 return;
}
void checkit(char a[101])
{
	int i,n;
	n=strlen(a);
	for(i=0;i<n;i++)
	{
		a[i]=a[i+1];
	}
	if(a[0]=='0')checkit(a);
}

void doit(char a[101],char b[101])
{
	int x,y,i,m;
	x=strlen(a);
	y=strlen(b);
	for(i=0;i<y;i++)
	{
		m=a[x-1-i]-b[y-1-i]+48;
		if(m<48)
		{
			a[x-2-i]=a[x-2-i]-1;
			m=m+10;
		}
		a[x-1-i]=m;
	}
	if(a[0]=='0')checkit(a);
}

void main()
{
	char a[20][101],b[20][101];
	int n,i;
	scanf("%d",&n);
	scanf("%s",a[0]);
	scanf("%s",b[0]);
	for(i=1;i<n;i++)
	{
		getchar();
		scanf("%s",a[i]);
		scanf("%s",b[i]);
	}
	for(i=0;i<n;i++)
	{
		doit(a[i],b[i]);
		printf("%s\n",a[i]);
	}
}
int main()
{
	char c[101], d[101];
	int i[101] = {0}, j[101] = {0}, tmp, flag;
	int n;
	cin >> n;
	for (int m = 0; m < n; m++)
	{
		for (int k = 0; k < 101; k++)
	{
		c[k] = d[k] = '0';
		i[k] = j[k] = 0;
	}
	cin >> c >> d;
	for (int k = strlen(c) - 1; k >= 0; k--)
	{
		i[k] = c[k] - '0';
	}
	for (int k = strlen(d) - 1; k >= 0; k--)
	{
		j[k + strlen(c) - strlen(d)] = d[k] - '0';
	}
	for (int l = strlen(c) - 1; l >= 0; l--)
	{
		tmp = i[l] - j[l];
		if (tmp < 0)
		{
			tmp += 10;
			i[l - 1]--;
		}
		i[l] = tmp;
	}
	for (int k = 0; k < strlen(c); k++)
	{
		if (i[k] > 0)
		{
			flag = k;
			break;
		}
	}
	for (int k = flag; k < strlen(c); k++)
	{
		cout << i[k];
	}
	cout << endl;
	}
	return 0;
}
void f(char a[],char b[],char * p)
{
     int m,n;
     m=strlen(a);
     n=strlen(b);
     for (int i=0;i<m;i++)
     {
         if (b[n-1-i]-a[m-1-i]>=0)
         p[n-1-i]=b[n-1-i]-a[m-1-i]+'0';
         else
         {
             p[n-1-i]=b[n-1-i]-a[m-1-i]+'0'+10;
             b[n-2-i]--;
         }
     }
     p[n]=0;
for(int i=0;i<n-m;i++)
            p[i]=b[i];
     if(p[0]=='0'&&p[1]!=0)
     {
                  for(int i=0;i<n+1;i++)
                  p[i]=p[i+1];
     }
     
}
int main()
{
    int n,i;
    scanf ("%d",&n);
    getchar();
    for(i = 0;i<n;i++)
    {
    char a[101];
    char b[101];
    char c[101];
    gets(a);
    gets(b);
    f(b,a,c);
    printf("%s\n",c);
    getchar();
    }
}
int main()
{
	int n=0;
	cin>>n;
	cin.get();
	int i,j,k;
	int l1,l2;
	char x[201];
    char y[201];
	int a[201],b[201];
	for(k=0;k<n-1;k++)
	{
		
		memset(a,0,sizeof(a));
		memset(b,0,sizeof(b));	
		memset(x,0,sizeof(x));
		memset(y,0,sizeof(y));
		cin.getline(x,201);
		cin.getline(y,201);
		cin.get();
	    l1=strlen(x);
		l2=strlen(y);
		//  cout<<x<<endl;
		//  cout<<y<<endl;
		for(i=0,j=l1-1;i<l1;i++,j--)
		{
			a[j]=x[i]-'0';
		}
		for(i=0,j=l2-1;i<l2;i++,j--)
		{
			b[j]=y[i]-'0';
		}
		for(i=0;i<l2;i++)
		{
			a[i]=a[i]-b[i];
			if(a[i]<0)
			{
				a[i]=a[i]+10;
				a[i+1]=a[i+1]-1;
			}
		}
		for(i=200;i>=0;i--)
		{
			if(a[i]!=0)
			break;
		}
		for(i=i;i>=0;i--)
		{
			cout<<a[i];
		}
		cout<<endl;
	}
	    memset(a,0,sizeof(a));
		memset(b,0,sizeof(b));	
		memset(x,0,sizeof(x));
		memset(y,0,sizeof(y));
		cin.getline(x,201);
		cin.getline(y,201);
	    l1=strlen(x);
		l2=strlen(y);
		//  cout<<x<<endl;
		//  cout<<y<<endl;
		for(i=0,j=l1-1;i<l1;i++,j--)
		{
			a[j]=x[i]-'0';
		}
		for(i=0,j=l2-1;i<l2;i++,j--)
		{
			b[j]=y[i]-'0';
		}
		for(i=0;i<l2;i++)
		{
			a[i]=a[i]-b[i];
			if(a[i]<0)
			{
				a[i]=a[i]+10;
				a[i+1]=a[i+1]-1;
			}
		}
		for(i=200;i>=0;i--)
		{
			if(a[i]!=0)
			break;
		}
		for(i=i;i>=0;i--)
		{
			cout<<a[i];
		}
		cout<<endl;

	return 0;
}
void main()
{
	int n,i,j,x,y,k,t,c[101],ii;
	scanf("%d",&n);
	for(ii=1;ii<=n;ii++)
	{
	char a[101],b[101];
	scanf("%s",a);
	scanf("%s",b);
	x=strlen(a);
	y=strlen(b);
	for(j=y-1,k=x-1;j>=0;j--,k--)
	{
		if(a[k]>=b[j])
			c[k]=a[k]-b[j];
		else
		{
			c[k]=a[k]+10-b[j];
			a[k-1]=a[k-1]-1;
		}
	}
	for(i=0;i<=x-y-1;i++)
		c[i]=a[i]-'0';
	for(j=0;j<x;j++)
	{
		if(c[j]!=0)
		{
			t=j;
			break;
		}
	}
	for(i=t;i<x;i++)
		printf("%d",c[i]);
	printf("\n");
	}
}
void main()
{
	char a[101],b[101];
	int m,p,n,i,j,q,s,t;
	scanf("%d",&m);
	for(t=0;t<m;t++)
	{
	    scanf("%s\n%s",a,b);
		p=strlen(a);
		n=strlen(b);
		j=p-1;
		for(q=n-1;q>=0;q--)
		{
			if(a[j]<b[q])
			{
				a[j]=a[j]+10-b[q]+'0';
				a[j-1]=a[j-1]-1;
			}
			else a[j]=a[j]-b[q]+'0';
			j--;
		}
        s=0;
		for(i=0;i<p;i++)
		{
			if(a[i]!=0)
			{
				printf("%c",a[i]);
				s=1;
			}
			else if(s!=0)printf("%c",a[i]);
		}
		printf("\n");
	}
}
void main(){
	char s1[100],s2[100],s[100];
	int a[100],b[100],c[100];
	int i,j,k,n,u,v,m;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s",s1);
		scanf("%s",s2);
		j=0;
		while(s1[j]!='\0'){
			a[j]=s1[j]-'0';
			j++;
		}
		k=0;
		while(s2[k]!='\0'){
			b[k]=s2[k]-'0';
			k++;
		}
		u=0;
		m=0;
		
		while(k>0){
			c[u]=a[j-1]-b[k-1]-m;
			
			if(c[u]<0)
				m=1;
			else
				m=0;
			c[u]=c[u]+10*m;
			j--;k--;u++;

		}		
		while(m==1 || j>0){//
			c[u]=a[j-1]-m;
			if(c[u]<0)
				m=1;
			else
				m=0;
			c[u]=c[u]+10*m;
			j--;u++;
		}//
		
		for(v=0;v<u;v++){
			s[v]=c[v]+'0';
		}
		while(s[u-1]=='0'){
			u--;
		}
		while(u>0){
			printf("%c",s[u-1]);		
			u--;
		}		
		printf("\n");
	}
}
void main()
{
	int n,a,b,c,d,i,j;
	char num[101][101];
	scanf("%d",&n);
	for(i=0;i<(2*n);i++)
		scanf("%s",num[i]);
	a=0;
	b=0;
	for(i=0;i<(2*n-1);i=i+2)
	{
		a=strlen(num[i]);
		b=strlen(num[i+1]);
		for(j=b;j>=0;j--)
			num[i+1][a-b+j]=num[i+1][j];
		for(j=0;j<a-b;j++)
			num[i+1][j]='0';
			c=0;
			d=0;
		for(j=a-1;j>=0;j--)
		{
			c=(10+num[i][j]-'0')-(num[i+1][j]-'0')-d;
			num[i][j]=c%10+'0';
			if(c<10) d=1;
			else d=0;
		}
		printf("%s\n",num[i]);

	}

}
void main()
{
	char a[101],b[101],d;
	int n,i,j,k=102,l,f=0;

	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		scanf("%s",a);
		scanf("%s",b);
		
		l=strlen(a)-strlen(b);
		for(j=strlen(a)-1;j>=l;j--)
		{
			if(f)
				a[j]--;
			if(a[j]>=b[j-l])
			{
				a[j]=a[j]-b[j-l]+'0';
				f=0;
			}
			else
			{
				a[j]=a[j]+10-b[j-l]+'0';
				f=1;
			}
		}
		for(j=l-1;j>=0;j--)
		{
			if(f)
				a[j]--;
			if(a[j]<'0')
			{
				a[j]=a[j]+10;
				f=1;
			}
			else
				f=0;
		}
		for(j=0;j<strlen(a);j++)
		{
			if(a[j]!='0')
			{
				k=j;
				break;
			}
		}
		if(k==102)
			printf("0\n");
		else
		{
			for(j=k;j<strlen(a);j++)
				printf("%c",a[j]);
			printf("\n");
			scanf("%c",&d);
		}
		
	}
}
/*
 * 004.cpp
 * name:?????
 *  Created on: 2011-12-25
 *      Author: 11029
 */
int main(){
	char a[101],b[101];
	int la,lb,i,n;
	cin>>n;
	getchar();
	while (n--)
	{
		cin.getline(a,101);
		cin.getline(b,101);
		la=strlen(a);
		lb=strlen(b);
		for (i=lb-1;i>=0;i--)
		{
			a[i+la-lb]-=(b[i]-'0');
			if (a[i+la-lb]<'0')
			{
				a[i+la-lb]+=10;
				a[i+la-lb-1]--;
			}
		}
		cout<<a<<endl;
		getchar();
	}
}
//***************************
//*????????          **
//*??????             **
//*???2013.11.15         **
//***************************
int main()
{ 
	int n;
	cin>>n;
	for(int k=1;k<=n;k++)
	{
	const int MAX_LEN = 200;
    unsigned num1[MAX_LEN+1];
	unsigned num2[MAX_LEN];
    char str1[MAX_LEN + 1];
	char str2[MAX_LEN + 1];
	cin.get();
    cin.getline(str1, MAX_LEN + 1); 
    cin.getline(str2, MAX_LEN + 1);
    int nLen1 = strlen(str1);
    int nLen2 = strlen(str2);
    memset(num1, 0, sizeof(num1)); 
    memset(num2, 0, sizeof(num2));
    int i, j = 0;
    for (i = nLen1 - 1; i >= 0; i--)
	num1[j++] = str1[i] - '0';                 //???????????????
    j = 0;
    for (i = nLen2 - 1; i >= 0; i--)
    num2[j++] = str2[i] - '0';
    for (i = 0; i < MAX_LEN; i++)
    { 
       num1[i] -= num2[i];                     //???????????
       if(num1[i] >= 10)                       //????????
       {
          num1[i] += 10; 
		  num1[i + 1]--;                       //????
       }
     }
     i = MAX_LEN;
    while (num1[i]==0) 
		i--;                                   //???????0??
    for (; i >= 0; i--)
    cout << num1[i];                           //??????
    cout << endl;
	}
    return 0;
}
char a[100];
char b[100];
int l,m,n,i,j,temp;
void main()
{
  scanf("%d",&n);
  for (i=1;i<=n;i++)
  {
	  scanf("%s%s",a,b);
	  l=strlen(a)-1;
	  m=strlen(b)-1;
      for (j=0;j<=(l-1)/2;j++)
	  {temp=a[j];a[j]=a[l-j];a[l-j]=temp;}
	  for (j=0;j<=(m-1)/2;j++)
	  {temp=b[j];b[j]=b[m-j];b[m-j]=temp;}
      for (j=m+1;j<=l;j++)
		 b[j]='0';
	  for (j=0;j<=l;j++)
		  if (a[j]<b[j])
		  { 
			  a[j+1]--;
			  a[j]=10+a[j]-b[j];
		  } 
		  else a[j]=a[j]-b[j];
	 while (a[l]==0 && l>=0) l--;
	 for (j=l;j>=0;j--)
		 printf("%d",a[j]);
	 if (l==-1) printf("0\n"); else printf("\n");
  }
}
int main(int argc, char* argv[])
{
   int n,i,l1,l2,j,k,s=1;
   char a[100],b[100],c[100];
   scanf("%d",&n);
 for(i=0;i<n;i++){
	 scanf("%s%s",a,b);

  for(l1=strlen(a)-1,l2=strlen(b)-1,j=0;l2>=0;l1--,l2--)
  {
	  c[j]=a[l1]-b[l2];
      j++;
  }
  for(l1=strlen(a)-strlen(b)-1;l1>=0;l1--)
  {
	  c[j]=a[l1]-48;
      j++;
  }
  for(k=0;k<j;k++)
  {
	  if(c[k]<0)
  {
		  c[k]=10+c[k];
          c[k+1]--;
  }
  }
  for(k=j-1;k>=0;k--){
	  if(c[k]!=0){
		  for(l2=k;l2>0;l2--)
      printf("%d",c[l2]);
      printf("%d\n",c[0]);
      break;
  }
  }
  for(l1=j-1;l1>=0;l1--)
  {
	  if(c[l1]!=0)
  {
		  s=1;
   break;
  }
  else
	  s=0;
  }
  if(s==0)
	  printf("0\n");
 }
	return 0;
}
void main()
{
	char str1[100],str2[100],str3[100];
	int a,b,i,j,n,c=1;

	scanf("%d",&n);
	while(c<=n)
	{
	scanf("%s",str1);
	scanf("%s",str2);
	a=strlen(str1);
	b=strlen(str2);

	for(i=a-1,j=b-1;i>=a-b;i--,j--)
	{
		if(str1[i]>=str2[j])
			str3[i]=str1[i]-str2[j]+'0';
		else
		{
			str3[i]=str1[i]-str2[j]+10+'0';
			str1[i-1]=str1[i-1]-1;
		}
	}

	for(i=a-b-1;i>=0;i--)
		str3[i]=str1[i];
    for(i=0;i<a;i++)
	{
		if(str3[i]!='0')
			break;
	}
	for(j=i;j<a;j++)
		printf("%c",str3[j]);
         printf("\n");
         c++;
	}
}
int main()
{
	int n;
	cin>>n;
	while(n--)
	{
		getchar();
		char a[260]={0},b[260]={0},c[260]={0};
		cin.getline(a,255);
		cin.getline(b,255);
		int a1[260]={0},b1[260]={0},c1[260]={0},i=0,na,nb;
		while(a[++i]!=0)
			;
		na=i;
		while(i-->0)
			a1[251-na+i]=a[i]-'0';
		while(b[++i]!=0)
			;
		nb=i;
		while(i-->0)
			b1[251-nb+i]=b[i]-'0';
		for(i=255;i>0;i--)
		{
			c1[i]+=a1[i]-b1[i];
			if(c1[i]<0)
			{
				c1[i]+=10;
				c1[i-1]-=1;
			}
		}
		for(i=0;c1[i]==0&&i<255;i++)
			;
		if(i==255)
			cout<<"0";
		else
			for(;i<251;i++)
				cout<<c1[i];
		cout<<endl;
	}
	return 0;
}