semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
void main()
{
	int l1[25],l2[25],n,t,w,z,q,i,d,k,j;
	char c1[25][101],c2[25][101],c[101],a[25][101];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s",c1[i]);
	//	gets(c1[i]);????????????????
		l1[i]=strlen(c1[i]);
	//	gets(c2[i]);
		scanf("%s",c2[i]);
		l2[i]=strlen(c2[i]);
		/*if(l1[i]<l2[i]||(l1[i]==l2[i]&&c1[0]<c2[0]))
		{
			strcpy(c,c1);
			strcpy(c1,c2);
			strcpy(c2,c);
			t=l1[i];l1[i]=l2[i];l2[i]=t;
		}*/
		d=l1[i]-l2[i];
		for(w=l2[i];w<l1[i]-1;w++)
			c2[i][w]='0';
		c2[i][l1[i]-1]='\0';
		
		q=0;c2[i][l1[i]]='\0';c2[i][l1[i]-1]='0';
		while(q!=d)
		{
			for (z=l1[i];z>0;z--)
			{
				c2[i][z]=c2[i][z-1];
			}
			c2[i][0]=c2[i][l1[i]];
			q++;
		}
		c2[i][l1[i]]='\0';




		for(k=l1[i];k>=0;k--)
		{
			if(c1[i][k]>=c2[i][k]) a[i][k]=c1[i][k]-c2[i][k]+48;
			if(c1[i][k]<c2[i][k]) 
			{
				a[i][k]=c1[i][k]+10-c2[i][k]+48;
				c1[i][k-1]=c1[i][k-1]-1;
			}
		}
		a[i][l1[i]]='\0';
		
	}
	for(i=0;i<n;i++)
	
		printf("%s\n",a[i]);
}
void main()
{
	int i=0,j=0,d=0,n=0,m=0,s=0,lena[100]={0},lenb[100]={0},c[100][100]={0};
	char a[100][100]={0},b[100][100]={0};
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		scanf("%s\n%s",a[i],b[i]);
		lena[i]=strlen(a[i]);
		lenb[i]=strlen(b[i]);
		for(j=lena[i]-1,s=lenb[i]-1;s>=0;j--,s--)
		{
			if(a[i][j]>=b[i][s])
				c[i][j]=a[i][j]-b[i][s];
			else
			{	
				c[i][j]=a[i][j]+10-b[i][s];
			for(m=j-1;;m--)
			{
			if(a[i][m]!='0')	
			{
				a[i][m]--;break;}
			else
				a[i][m]='9';
			}
			}
		}
		for(m=lena[i]-lenb[i]-1;m>=0;m--)
				c[i][m]=a[i][m];
		for(j=0;j<lena[i];j++)
		{
			if(c[i][j]>=10)c[i][j]=c[i][j]-48;
		}
		for(j=0;j<lena[i];j++)
			if(c[i][j]!=0)break;
		for(j=j;j<lena[i];j++)
			printf("%d",c[i][j]);
		printf("\n");
	}
}
int main(int argc, char* argv[])
{
   int n,bei1[100],jian1[100],cha[100];
   int j,a,b,i;
   char bei[100],jian[100];
   scanf("%d",&n);
	for(j=1;j<=n;j++)
	{
		scanf("%s",bei);
		scanf("%s",jian);
		a=strlen(bei);
		b=strlen(jian);
		for(i=0;i<a;i++)
		{
			bei1[i]=bei[i]-'0';
		}
		for(i=0;i<b;i++)
		{
			jian1[i]=jian[i]-'0';
		}
		for(i=b-1;i>=0;i--)
		{
			jian1[a-b+i]=jian1[i];
		}	
		for(i=0;i<(a-b);i++)
		{
			jian1[i]=0;
		}
		for(i=a-1;i>=0;i--)
		{
			if(bei1[i]>=jian1[i])
			{
				cha[i]=bei1[i]-jian1[i];
			}
			if(bei1[i]<jian1[i])
			{
				cha[i]=bei1[i]+10-jian1[i];
				bei1[i-1]=bei1[i-1]-1;
			}
		}
		if(cha[0]==0) 
		{
			for(i=1;i<a;i++)
			{
			printf("%d",cha[i]);
			}
			printf("\n");
		}
		else
		for(i=0;i<a;i++) printf("%d",cha[i]);
		printf("\n");
		
	}	

   return 0;
}
void main()
{
	char a[100],b[100];
	int c,d,e,f,g,k;
	scanf("%d",&c);
	for(d=0;d<c;d++)
	{
		scanf("%s %s",a,b);
		e=strlen(a);
		k=e;
		f=strlen(b);
		if(e>=f)
		{
			while(f>=0)
				{
					if(a[e]<b[f])
					{
						a[e]=a[e]+10-b[f]+48;
						a[e-1]=a[e-1]-1;
					}
					else
						a[e]=a[e]-b[f]+48;
					f--;
					e--;
				}
		}
		for(g=0;g<k;g++)
			printf("%c",a[g]);
		printf("\n");
	}
}
int main()
{
	int n,i,j,k,a[105]={0},b[105]={0},c[105]={0},l1,l2,l,cha;
	char s1[105],s2[105];

	scanf ("%d",&n);
	for (k=1;k<=n;k++)
	{
	   scanf("%s %s",s1,s2);
       l1=strlen(s1);
       l2=strlen(s2);
       
       for (i=0;i<=l1-1;i++)
	   {
	      a[i]=s1[l1-i-1]-'0';
	   }
	   for (j=0;j<=l2-1;j++)
	   {
	      b[j]=s2[l2-j-1]-'0';
	   }
	   for (i=0;i<=l1-1;i++)
	   {
	     c[i]=a[i]-b[i];
		 if (c[i]<0)
		 {
		   c[i]+=10;
		   a[i+1]-=1;
		 }
	   }
	   while (c[l1]==0&&l1>0)
	   {
	     l1--;
	   }
	   for (i=l1;i>=0;i--)
	   {
	     printf("%d",c[i]);
		 
	   }
	   printf ("\n");
	   for (i=0;i<=104;i++)
	   {
	   a[i]=0;b[i]=0;c[i]=0;
	   }
	}

	return 0;
}
//
//	?????	?????
//	?????	?2??????????
//	?????	?	? ? ? ?? 1000012733 ?
//	?????	2010 ? 11 ? 19 ?
//
int main()
{
	const int max = 100;	//max?????????????100?
	char str1[max], str2[max];	//str1?str2?????????????????????max
	int num1[max], num2[max];	//num1?num2???????????????????????????????
	int n, i, j, k1, k2, l, p, q, len1, len2;	//n??????????????????len1?len2????????????????????????????????????
	cin >> n;			//????????????????????n
	for ( i = 1; i <= n; i ++ )		//????????n?????n?????????
	{
		cin.get();		//??????????????????????????????????????
		cin.getline ( str1, max );	//?????
		cin.getline ( str2, max );	//????
		len1 = strlen ( str1 );		//??????????
		len2 = strlen ( str2 );		//?????????
		memset ( num1, 0, sizeof ( num1 ));		//???num1??
		memset ( num2, 0, sizeof ( num2 ));		//???num2??
		k1 = len1 - 1;		
		for ( j = 0; j < len1; j ++ )
		{
			num1[k1] = str1[j] - '0';
			k1 --;
		}		//????????????????????num1?????????????????num1??????
		k2 = len2 - 1;
		for ( j = 0; j < len2; j ++ )
		{
			num2[k2] = str2[j] - '0';
			k2 --;
		}		//???????????????????num2?????????????????num2??????
		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] --;		//???????????????????????????????????????10????????????????????1
			}
		}
		p = max - 1;
		while ( num1[p] == 0)
		{
			p --;
		}		//?????????????????0????
		for ( q = p; q > 0; q -- )
		{
			cout << num1[q];	//?????????????
		}
		cout << num1[0] << endl;	//?????????????????
	}
	return 0;
}
int main()
{
	int n;
	scanf("%d",&n);
	scanf("\n");
	char ***p;
	int i;
	int j;
	int k;
	p=(char ***)malloc(n*sizeof(char **));
	for(i=0;i<n;i++)
	{
		p[i]=(char **)malloc(2*sizeof(char *));
		for(j=0;j<2;j++)
		{
			p[i][j]=(char *)malloc(100*sizeof(char));
			scanf("%s",p[i][j]);
			if(j==0)
				scanf("\n");
			else if(j==1&&i==n-1)
			{}
			else
			{
				scanf("\n\n");
			}
		}
	}
	int tuiwei;
	for(i=0;i<n;i++)
	{
		int a=strlen(p[i][0]);
		int b=strlen(p[i][1]);
		for(j=a-1,tuiwei=0;j>=0;j--)
		{
			if(j>=a-b)
			{
				k=j-(a-b);
				if(p[i][0][j]>=p[i][1][k]+tuiwei)
				{
					p[i][0][j]=p[i][0][j]-p[i][1][k]-tuiwei+'0';
					tuiwei=0;
				}
				else
				{
					p[i][0][j]=p[i][0][j]+10-p[i][1][k]-tuiwei+'0';
					tuiwei=1;
				}
			}
			else
			{
				if(p[i][0][j]>=tuiwei)
				{
					p[i][0][j]=p[i][0][j]-tuiwei;
					tuiwei=0;
				}
				else
				{
					p[i][0][j]=p[i][0][j]+10-tuiwei;
					tuiwei=1;
				}
			}
		}
	}
	for(i=0;i<n;i++)
	{
		if(i<=n-2)
		printf("%s\n",p[i][0]);
		else
		printf("%s",p[i][0]);
	}
}
int main()
{
    int n, N, a[120], b[120], c[120];
    char a1[120], b1[120], hh;
    
    cin >> N;
    cin.get(hh);
    
    for(n = 0; n < N; n++)
    {
        int i, l, j;
        
        memset(a, 0, sizeof(a));
        memset(b, 0, sizeof(b));
        
        cin.getline(a1, 120);
        l = strlen(a1);
        for(i = 0; i < l; i++)
        {
            a[i] = a1[l - 1 - i] - '0';
        }
        
        cin.getline(b1, 120);
        l = strlen(b1);
        for(i = 0; i < l; i++)
        {
            b[i] = b1[l - 1 - i] - '0';
        }
        
        l = strlen(a1);
        for(i = 0; i < l; i++)
        {
            if(a[i] - b[i] >= 0) c[i] = a[i] - b[i];
            else
            {
                c[i] = a[i] - b[i] + 10;
                j = i + 1;
                while(a[j] == 0)
                {
                    a[j] = 9;
                    j++;
                }
                a[j] = a[j] - 1;
            }
        }
        
        for(i = l - 1; i >= 0; i--) cout << c[i];
        
        cout << endl;
        
        cin.get(hh);
    }

    return 0;
}
void func(char u[],char v[]);
void main()
{
	char u[100][101];
    int n,m;
	scanf("%d",&n);
	for (m=0;m<=2*n-2;m=m+2) 
	{
	    scanf("%s",u[m]);
	    scanf("%s",u[m+1]);
		printf("\n");
	}
    for (m=0;m<=2*n-2;m=m+2) func(u[m],u[m+1]);
}
void func(char u[],char v[])
{
    char w[101]={"0"},copy[101]={'0'};
	int m,n,p,q,i,j,k,t;
	int a[101]={0},b[101]={0},c[101]={0},d[101]={0};
	k=0;m=0;n=0;
	i=strlen(u);
	for (p=i;p>=1;p--) u[p]=u[p-1];
	u[0]=48;
	j=strlen(v);
	for (q=j;q>=1;q--) v[q]=v[q-1];
	v[0]=48;
	for (p=0;p<=i;p++) a[p]=u[p]-48;
	for (q=0;q<=j;q++) b[q]=v[q]-48;
	for (q=1;q<=j;q++) d[q]=9-b[q];
	for (q=j,p=i;q>=0;q=q-1,p=p-1)
	{
		c[p]=(a[p]+d[q]+k)%10;
		k=(a[p]+d[q]+k)/10;
	}
	for (;p>=0;p=p-1)
	{
		c[p]=(a[p]+k)%10;
		k=(a[p]+k)/10;
	}
	for (t=i;t>=1;t=t-1)
	{
		c[t]=(c[t]+1)%10;
		if (c[t]!=0) goto yes;
	}
	c[0]=c[0]+1;
yes:for (t=i-j;t>=0;t=t-1)
	{
		c[t]=c[t]-1;
		if (c[t]!=-1) goto diong;
		else c[t]=9;
	}
diong:for (p=0;p<=i;p++) w[p]=c[p]+48;
		while (w[0]==48) for (p=0;p<=i;p++) w[p]=w[p+1];
        printf("%s\n",w);
}
void main()
{
	char a[20][100];
	char b[20][100];
	int k,l,j,t,p,i,n;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s",a[i]);
		scanf("%s",b[i]);
	}
	for(i=0;i<n;i++)
	{
		t=(int)strlen(a[i]);
		p=(int)strlen(b[i]);
		for(k=t-1,l=p-1;l>=0;k--,l--)
			if(a[i][k]>=b[i][l])
				a[i][k]=a[i][k]-b[i][l];
			else
			{
				a[i][k]=a[i][k]+10-b[i][l];
				a[i][k-1]=a[i][k-1]-1;
			}
		for(j=0;j<(t-p);j++)
			printf("%c",a[i][j]);
		for(j=t-p;j<t;j++)
			printf("%c",a[i][j]+'0');
		printf("\n");
	}
}
char a[105],b[105],c[105];
void minus(int l1,int l2)
{    
     int i,j;
   for(i = 0;i < l2;i ++) 
     {
       if(b[i]>=c[i])
          b[i] -= c[i];
        else
        {
          b[i] = b[i] + 10 - c[i];
          j = i + 1;
          b[j]--;
          while(b[j]<0)
          {
            b[j] += 10;
              j++; 
            b[j]--;  
          }    
        } 
     }
     
}
int main()
{
    int n,i,max,j;
    int l1,l2;
    char m;
   scanf("%d",&n);
   for(i = 1;i <= n;i ++)
      {
           scanf("%s",a);
           l1 = strlen(a); 
           scanf("%c",&m);
           for(j = 0;j < l1;j ++)
              b[l1-j-1] = a[j] - '0';
             memset(a,0,sizeof(a));
           scanf("%s",a);
           scanf("%c",&m);
            l2 = strlen(a); 
           for(j = 0;j < l2;j ++)
              c[l2-j-1] = a[j] - '0';
           minus(l1,l2);  
          while(!b[l1-1])
             l1--;  
        for(j = l1 - 1;j>=0;j --)
           printf("%d",b[j]);   
        printf("\n");
      }
  
   
    return 0;    
}
void main()
{
	int n=20,i,j,x,y,z;
	char **p=(char **)malloc(n*sizeof(char *));
    scanf("%d",&n);
	if(p!=NULL)
	{
		for(i=0;i<20;i++)
			p[i]=(char *)malloc(100*sizeof(char));
		for(i=0;i<2*n;i++)
		{
			scanf("%s",p[i]);
			if(i%2==1)
			{
				x=strlen(p[i-1]);
				y=strlen(p[i]);
				for(j=x-1;j>=0;j--)
				{
					if(j-x+y>=0)
					{
						z=p[i-1][j]-p[i][j-x+y];
						if(z<0)
						{
							p[i-1][j]='9'+1+z;
							p[i-1][j-1]--;
						}
						else p[i-1][j]='0'+z;
					}
					else
					{
						z=p[i-1][j]-'0';
						if(z<0)
						{
							p[i-1][j]='9'+1+z;
							p[i-1][j-1]--;
						}
						else p[i-1][j]='0'+z;
					}
				}
				for(z=0;;z++)
					if(p[i-1][z]!='0')
						break;
				for(j=z;j<x;j++)
					printf("%c",p[i-1][j]);
				printf("\n");
			}
		}
	}
}
int maxlen(int x, int y);
int main()
{
    int N;
        char s1[201], s2[201];
    int a[201], b[201], maxx, l1, l2,i,j;
    N = maxx = l1 = l2 = 0;
    scanf("%d", &N);
    for (int n = 0; n < N; n++) {
        memset(s1, 0, sizeof(s1));
        memset(s2, 0, sizeof(s2));
        memset(a, 0, sizeof(a));
        memset(b, 0, sizeof(b));
        scanf("%s", s1);
        scanf("%s", s2);
        l1 = strlen(s1);
        l2 = strlen(s2);
        maxx = maxlen(l1, l2);
        for ( i = maxx, j = l1 - 1; j>=0; i--, j--)
            a[i] = s1[j] - '0';
        for ( i = maxx, j = l2 - 1; j>=0; i--, j--)
            b[i] = s2[j] - '0';
        for ( i = maxx; i > 0; i--)
        {
            
            if (a[i] <b[i])
            {
                a[i] =a[i]+ 10-b[i];
                a[i-1] --;
            }
			else a[i] -= b[i];
        }
        i = 0;
        while (a[i] == 0)
            i ++;
        for (; i<maxx + 1; i++)
            printf("%d", a[i]);
            printf("\n");
    }
    
    return 0;
}
int maxlen(int x, int y){
    if (x > y)
       return x;
    return y;
}
int str2bigint(char*str,int*a)
{
	int len=(int)strlen(str);
	int i;
	for(i=0;i<len;i++)
	{
		a[len-i-1]=str[i]-'0';
	}
	return len;
}

void print_bigint(int*a,int len)
{
	int k=len-1;
	int i;
	while(a[k]==0&&k>0)
	{
		k--;
	}
	for(i=k;i>=0;i--)
	{
		printf("%d",a[i]);
	}
}

int sub_bigint(int*a,int alen,int*b,int blen,int*c)
{
	int i;
	for(i=0;i<alen;i++)
	{
		c[i]=a[i];
		if(i<blen) c[i]-=b[i];
	}

	for(i=0;i<alen;i++)
	{
		if(c[i]<0)
		{
			c[i+1]--;
			c[i]+=10;
		}
	}
	return c[alen-1]?alen:(alen-1);
}


int main(int argc, char* argv[])
{
	char s1[MAX],s2[MAX];
	int a[MAX],b[MAX],c[MAX];
	int alen,blen,clen;
	int i,n;

	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s%s",s1,s2);
		alen=str2bigint(s1,a);
		blen=str2bigint(s2,b);
		clen=sub_bigint(a,alen,b,blen,c);
		print_bigint(c,clen);
		printf("\n");
	}
	return 0;
}
void main()
{
	void minus(char x[],char y[]);
	char a[100][100],b[100][100];
	int i,j,n;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
		{
			scanf("%s",a[i]);
			scanf("%s",b[i]);
		}
		printf("\n");
	for(i=1;i<=n;i++)
		
	minus(a[i],b[i]);
}
	void minus(char x[],char y[])
	{
		int i,j,c,d;
		char min[1000];
		c=strlen(x);
		d=strlen(y);
		for(i=c-1,j=d-1;i>=c-d+1;i--,j--)
		{
			if(x[i]>=y[j])
			{
				min[i]=x[i]-y[j]+48;
			}
			else if(x[i]<y[j])
			{
				min[i]=x[i]+10-y[j]+48;
				x[i-1]=x[i-1]-1;
			}
		}
		if(x[c-d]>=y[0])
		{
			min[c-d]=x[c-d]-y[0]+48;
			for(i=0;i<=c-d-1;i++)
				printf("%c",x[i]);
			for(i=c-d;i<=c-1;i++)
			{
				if(min[i]==0)printf("0");
				else printf("%c",min[i]);
			}
		}
		else
		{
			min[c-d]=x[c-d]+10-y[0]+48;
			x[c-d-1]=x[c-d-1]-1;
			for(i=0;i<=c-d-1;i++)
				printf("%c",x[i]);
			for(i=c-d;i<=c-1;i++)
			{
				if(min[i]==0)printf("0");
				else printf("%c",min[i]);
			}
		}
		printf("\n");
	}
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--;
	 for (j=l;j>=0;j--)
		 printf("%d",a[j]);
	 if (l==-1) printf("0\n"); else printf("\n");
  }
}
void main()
{
	int m,k,i,j,e,d[10][100],t;
	char a[10][100],b[10][100];
	scanf("%d\n",&m);
	for(i=0;i<m;i++)
	{
		gets(a[i]);
		gets(b[i]);
		scanf("\n");
	}
		for(i=0;i<m;i++)
		{
			k=strlen(a[i]);
			t=strlen(b[i]);
			for(j=0;j<100;j++)
			{
				if(a[i][j]!='\0')
					a[i][j]=a[i][j]-48;
				if(b[i][j]!='\0')
					b[i][j]=b[i][j]-48;
			}
			for(j=k;j>=k-t;j--)
				b[i][j]=b[i][j-k+t];
			for(j=k-t-1;j>=0;j--)
				b[i][j]='\0';
			e=0;
			for(j=k-1;j>=0;j--)
			{
				if(a[i][j]-b[i][j]+e<0)
				{
					d[i][j]=10+a[i][j]-b[i][j]+e;
					e=-1;
				}
				else
				{
					d[i][j]=a[i][j]-b[i][j]+e;
					e=0;
				}
			}
			
			if(d[i][0]==0)
			{
				for(j=1;j<k;j++)
					printf("%d",d[i][j]);
			}
				else
				{
					for(j=0;j<k;j++)
						printf("%d",d[i][j]);
				}
				printf("\n");
			}
		}
main()
{	int n,i,j,k,p,q,x;
	char a[20][2][100];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{	for(j=0;j<2;j++)
		scanf("%s",a[i][j]);
		printf("\n");
	}
	for(i=0;i<n;i++)
	{	p=strlen(a[i][0]);
		q=strlen(a[i][1]);
		for(j=0;j<q;j++)
		{	x=a[i][0][p-j-1]-a[i][1][q-j-1];
			if(x<0){x=x+10;a[i][0][p-j-2]--;}
			a[i][0][p-j-1]=x+48;
		}
		for(k=0;k<p;k++)
			printf("%c",a[i][0][k]);
		if(i<n-1) printf("\n");
	}
}
void minus(char a[],char b[],char result[]);
void main()
{
	int n,i;
	char a[max][max],b[max][max];
    char result[max][max];
	scanf("%d\n",&n);
	for(i=1;i<=n;i++)
	{
		scanf("%s\n%s\n\n",a[i],b[i]);
		minus(a[i],b[i],result[i]);       
        printf("%s\n",result[i]);
	}
}

void minus(char a[],char b[],char result[])
{ 
	int la,lb,lresult;
    int flag=0;
    int t=0;
    int s,c=0;
    int i;
    char temp1;
    la=strlen(a)-1;
    lb=strlen(b)-1;
    while(la >= 0)
	{
        if(lb < 0)
		{
			s=a[la--]-48;
		}
        else 
		{
			s=a[la--]-b[lb--];
		}
        result[t++]=s-c+48;
        if(result[t-1] < 48) 
		{
			result[t-1]+=10;
			c=1;
		}
        else c=0;
	}
	while(result[t] == 0) t--;
    while(result[t] == '0')
	{
		result[t]=0;t--;
	} 
	lresult=t;
	for(i=0;i <= lresult/2;i++)
	{
        temp1=result[i];
        result[i]=result[lresult-i];
        result[lresult-i]=temp1;
    }
}
int main(int argc, char *argv[])
{
	char a[100]={'0'},b[100]={'0'};
	int n,i,la,lb,k,sub[101]={0},p;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		for(k=1;k<=100;k++){
			sub[k]=0;
		}
		scanf("%s",a);scanf("%s",b);
		la=strlen(a);lb=strlen(b);
		for(k=1;k<=lb;k++){
			if(a[la-k]>=b[lb-k])sub[k]=a[la-k]-b[lb-k];
			else{
				sub[k]=a[la-k]+10-b[lb-k];
				a[la-(k+1)]=a[la-(k+1)]-1;
			}
		}
		for(k=lb+1;k<=la;k++){
			sub[k]=a[la-k]-48;
		}
		printf("\n");
		for(k=100;k>0;k--){
			if(sub[k]!=0){
				p=k;
				break;
			}
		}
		for(k=p;k>0;k--){
			printf("%d",sub[k]);
		}
	}
	return 0;
}
struct num
{
   char	a[100];
   char b[100];
};
void main()
{
	void f(char num1[100],char num2[100]);
	int n,i;
	struct num num[10];
	scanf("%d",&n);
	for(i=0;i<=n-1;i++)
	{
		scanf("%s",num[i].a);
		scanf("%s",num[i].b);
		printf("\n");
	}
	for(i=0;i<=n-1;i++)
	{
		f(num[i].a,num[i].b);
		printf("\n");
	}
	printf("\n");
}
void f(char num1[100],char num2[100])
{
	int n1,n2,j,k;
	char c[100];
	n1=strlen(num1);
	n2=strlen(num2);
	for(j=n1-1;j>=n1-n2;j--)
	{
		if(num1[j]>=num2[j-n1+n2])
			c[j]=num1[j]-num2[j-n1+n2]+48;
		else
		{
			c[j]=num1[j]-num2[j-n1+n2]+58;
			num1[j-1]=num1[j-1]-1;
		}
	}
	for(k=0;k<=n1-n2-1;k++)
	{
		c[k]=num1[k];
	}
	for(k=0;k<=n1-1;k++)
	{
		printf("%c",c[k]);
	}
}
void exchange(int num[],char str[]);
void calculate(int num1[],int num2[]);

void main()
{
	int num1[100]={0},num2[100]={0},n,i,j;
	char str1[100]={""},str2[100]={""};
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
	scanf("%s%s",str1,str2);
	exchange(num1,str1);
	exchange(num2,str2);
	calculate(num1,num2);
	for(j=0;j<=99;j++)
	{
		num1[j]=0;
		num2[j]=0;
		str1[j]=' ';
		str2[j]=' ';
	}
	}
}

void exchange(int num[],char str[])
{
	int i,j=99,n=0;
	while(str[n]>=48&&str[n]<=58)
	{
		n+=1;
	}
	n-=1;
	for(i=n,j=99;i>=0;i--,j--)
	{
		num[j]=str[i]-48;
	}
}

void calculate(int num1[],int num2[])
{
	int i,n=0;
	int num3[100]={0};
	for(i=99;i>=0;i--)
	{
		num3[i]=num1[i]-num2[i];
		if(num3[i]<0)
		{
			num3[i]+=10;
			num1[i-1]-=1;
		}
	}

	while(num3[n]==0)
	{
		n+=1;
	}
	for(i=n;i<=99;i++)
	{
		printf("%d",num3[i]);
	}
	printf("\n");
}
void main()
{
	int n,i,j,p,l,k,q;
	char s1[100][100],s2[100][100],a[100],t[100];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s%s",s1[i],s2[i]);
	}

	for(i=0;i<n;i++)
	{	
        l=0;
		p=strlen(s1[i]);
        q=strlen(s2[i]);
        for(j=p-q-1;j<p;j++)
		{t[l++]=s1[i][j];}
		for(j=q;j>=1;j--)
		{
		    if(t[j]>=s2[i][j-1])
			     a[j]=(t[j]-s2[i][j-1]);
		    else
			{
			    a[j]=(t[j]+10-s2[i][j-1]);
				t[j-1]=t[j-1]-1;
			}
		}
			a[0]=t[0]-'0';
			for(k=0;k<p-1-q;k++)
			{
					printf("%c",s1[i][k]);
			}
			for(k=0;k<=q;k++)
			{
				printf("%d",a[k]);
			}
			printf("\n");
		}
}
void main()
{
    int changa,changb,n,i,j,k=0,c[20][100]={'\0'};
    char a[20][100]={'\0'},b[20][100]={'\0'},d[20][100]={'\0'};
    scanf("%d",&n);
    for (i=0;i<n;i++)
    {
        scanf("%s",a[i]);
        scanf("%s",b[i]);
        changa=strlen(a[i]);
        changb=strlen(b[i]);
        for(j=changa-changb;j<changa;j++)
        {
            d[i][j]=b[i][j-changa+changb];
        }    
        
        for(j=0;j<changa-changb;j++)
        {d[i][j]='0';}
                 
        for(j=changa-1;j>0;j--)
        {
            if (a[i][j]<48)
            { 
             a[i][j]=a[i][j]+10;
             a[i][j-1]=a[i][j-1]-1;
            }
            
            if(a[i][j]<d[i][j])
            {
            	a[i][j-1]=a[i][j-1]-1;            	
            	c[i][j]=(int)10+a[i][j]-d[i][j];
            }
            
            else
            {   
                c[i][j]=(int)a[i][j]-d[i][j];
            }              
        }  
        
        
        c[i][0]=(int)a[i][0]-d[i][0];
            
        for(j=0;j<changa;j++)
        {	if(c[i][j]!=0)
        	break;        	
        }
        
        for(k=j;k<changa;k++)
        printf("%d",c[i][k]);
        printf("\n");
      
    }
    
}
void main()
{
	char c[100][105];
	int i,j,j1,j2,n,len1,len2;
	scanf("%d",&n);
    for(i=0;i<2*n;i=i+2)
	{
		scanf("%s%s",c[i],c[i+1]);
	}
	for(i=0;i<2*n;i=i+2)
	{
		len1=strlen(c[i]),len2=strlen(c[i+1]);
		for(j1=len1-1,j2=len2-1;j2>=0;j1--,j2--)
		{
			if(c[i][j1]>=c[i+1][j2])
				c[i][j1]=c[i][j1]-c[i+1][j2]+48;
			else 
			{
				c[i][j1]=c[i][j1]+58-c[i+1][j2];
				c[i][j1-1]=c[i][j1-1]-1;
			}
		}
		for(j=0;j<len1;j++)
		    printf("%c",c[i][j]);
		printf("\n");
	}
}
int main()
{
	int n,i,j,k,lena,lenb,x,y,tag=1;
	char a[1000]={0},b[1000]={0},c[1000]={0};
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		scanf("%s",a);
        scanf("%s",b);
	    lena=strlen(a);
		lenb=strlen(b);
		k=lenb;

        for(j=lena,k=lenb;j>=0;j--,k--)
		{

			if(k<0)
			{
				c[j]=a[j];



			}
			else
			{
			  if(a[j]>=b[k])
			  {
				c[j]=a[j]-b[k]+'0';

			  }
			  else
			  {
				a[j]=a[j]+10;
				a[j-1]--;
				c[j]=a[j]-b[k]+'0';
			  }
			}
		}
		for(x=0;x<lena;x++)
		{
			if(c[x]!=0)
			{

				for(y=x;y<lena;y++)
					printf("%c",c[y]);
				printf("\n");
			;
				tag=0;
				break;
			}


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

	return 0;
}
//****************************************************** 
//* ? ? ?   ??????                            *
//* ? ?      ????                                *
//* ? ? ? ??2010 ? 11 ? 17 ?                   * 
//* ? ?      ?1000012758                            *
//****************************************************** 
int main()
{
	int n, a[3][100] = {0}, size, m;
	char temp[101];
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		memset(a,0,sizeof(a));
		//Input & Convert
		for(int j = 0; j < 2; j++)
		{
			m = 99;
			do{
				cin.getline(temp,101);
			}while(temp[0] == '\0');
			size = strlen(temp);
			for (int k = size - 1; k >= 0; k--)
				a[j][m--] = temp[k] - 48;
		}
		//Minus
		for (int j = 99; j >= 0; j--)
		{
			a[2][j] = a[0][j] - a[1][j];
			if (a[2][j] < 0)
			{
				a[0][j - 1]--;
				a[2][j] += 10;
			}
		}
		//Output
		m = 0;
		for(int j = 0; j < 100; j++)
		{
			if (a[2][j])
				m = 1;
			if (m)
				cout << a[2][j];
		}
		cout << endl;
	}
	return 0;
}
main()
{int n,g;
scanf("%d",&n);
for(g=0;g<n;g++)
{
char a[1000];
char b[1000],c[1000];
memset(c,'0',sizeof(c));
scanf("%s %s",a,b);
int l1,l2;
l1=strlen(a);
l2=strlen(b);
int l;
if(l1>l2)
  l=l1;
else l=l2;
//printf("%d\n",l);
   int i;
   for(i=l;i>l-l1;i--)
{
a[i]=a[i-(l-l1+1)];

}
//printf("%c\n",a[l]);
for(i=l;i>l-l2;i--)
b[i]=b[i-(l-l2+1)];
//printf("%c\n",b[l]);
for(i=0;i<=l-l1;i++)
{
a[i]='0';
} 
//printf("%c\n",a[l-l1]);
for(i=0;i<=l-l2;i++)
{
b[i]='0';
}
//printf("%c\n",b[l-l2+1]);
int flag=0; 
for(i=l;i>0;i--)
{int sum=0;
  if(flag==1)
   sum=a[i]-b[i]-1;
  if(flag==0)
  sum=a[i]-b[i];
  if(sum<0)
    {c[i]=sum+'0'+10; flag=1;}
  else
   {c[i]=sum+'0';flag=0;}
  }
 //printf("%c %c %c %c\n",c[l],c[3],c[2],c[1]);

int flag1=0;
//printf("%c\n",c[0]);
int t;
for(i=0;i<=l;i++)
{
                 if(c[i]!='0')
                  {t=i;break;}
                  
                  }
                  for(i=t;i<=l;i++)
                               printf("%c",c[i]);
                               printf("\n");
/*if(flag)
{
for(i=0;i<=l;i++)
   printf("%c",c[i]);
}
else
{for(i=1;i<=l;i++)
printf("%c",c[i]);
}*/



}

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

}