semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
char *minus(char *a,char *b)
{
	char *c;
	int m,n;
	int i=0,j=0,k=0;
	m=strlen(a);
	n=strlen(b);
	c=(char *)malloc(sizeof(char)*N);
	k=N-1;
	c[k]=0;
	k--;
	i=m-1;
	for(j=n-1;j>=0;j--){
		if(a[i]>=b[j]){
			c[k]=a[i]-b[j]+'0';
		}
		else{
			c[k]=a[i]-b[j]+10+'0';
			a[i-1]=a[i-1]-1;
		}
		k--;
		i--;
	}
	while(i>=0){
		c[k]=a[i];
		k--;
		i--;
	}
	return c+k+1;

}

void main()
{
	char **s1,**s2,**s3;
	int n=0,i=0;
	scanf("%d",&n);
	s1=(char **)malloc(sizeof(char *)*n);
	s2=(char **)malloc(sizeof(char *)*n);
	s3=(char **)malloc(sizeof(char *)*n);
	while(i<n){
		s1[i]=(char *)malloc(sizeof(char)*N);
		s2[i]=(char *)malloc(sizeof(char)*N);
		scanf("%s",s1[i]);
		scanf("%s",s2[i]);
		printf("\n");
		s3[i]=minus(s1[i],s2[i]);
		i++;
	}
	for(i=0;i<n;i++){
		puts(s3[i]);
	}

}
void main()
{
	int m1,m2,n,k=1,p,i;
	char a[100],b[100],c[100],d[100];
	scanf("%d",&n);
	while(k<=n)
	{
		scanf("%s",a);
		scanf("%s",b);
		k++;
		m1=strlen(a);m2=strlen(b);
		for(i=0;i<=m1;i++)
		a[i]=a[i]-48;
		for(i=0;i<=m2;i++)
			b[i]=b[i]-48;
		p=m1-m2;
		for(i=0;i<m2;i++)   c[i+p]=b[i];
		for(i=0;i<p;i++) c[i] = 0;
		for(i=m1-1;i>=0;i--)
		{
			if(a[i]>=c[i]) d[i]=a[i]-c[i];
			else
			{
			    d[i]=a[i]+10-c[i];   a[i-1]=a[i-1]-1;
			}
		}
		for(i=0;i<m1;i++)
           printf("%d",d[i]);
        printf("\n");
	}
}
void main()
{
int n,i,j,la,lb,m;
char a[1000],b[1000],c[1000];
scanf("%d\n",&n);
 for(i=1;i<=n;i++)
 {
 scanf("%s",a);
 scanf("%s",b);
  la=strlen(a);
  lb=strlen(b);
     for(j=la-1;j>=0;j--)
	 {
		 if(j>=la-lb)
		 {
           if(a[j]>=b[j-la+lb]) c[j]=a[j]-b[j-la+lb]+48;
	       else if(a[j]<b[j-la+lb]) 
		   {
	          c[j]=10+a[j]-b[j-la+lb]+48;
		      a[j-1]=a[j-1]-1;
		   }
		 }
		 else c[j]=a[j];
	 }
	 c[la]=0;
	 for(j=0;j<la;j++)
		 if(c[j]!=48){m=j;break;}
		 for(j=m;j<la;j++)
			 printf("%c",c[j]);
printf("\n");
 }
}
int main() 
{
	char str1[102], str2[102]; 
	int result[102]; 
	int n,i,j,k; 
	scanf("%d", &n);
	for(i = 0; i < n; i++) 
         {
		scanf("%s%s", str1, str2);
		int borrow = 0; 
		int len1 = strlen(str1);
		int len2 = strlen(str2);
		int len;
		len = len1;
		for(j=len2-1; j>=0;j--) 
                  {
			str2[j + len1 - len2] = str2[j];
		}
		for(j=0;j<len1-len2;j++) 
                  {
			str2[j] = '0';
		}
		for(k = len - 1; k >= 0; k--) 
                  {
			int temp = (str1[k] - '0') - (str2[k] - '0') - borrow; 
			if(temp < 0) 
                           {
				borrow = 1;
				result[k] = temp + 10;
			} 
                           else 
                           {
				borrow = 0;
				result[k] = temp;
			}
		}
		int k;
		for(k=0; result[k] == 0; k++);
		for(k=0;k<len; k++) 
                  {
			printf("%d", result[k]);
		}
		printf("\n");
	}
	return 0;
}
void main()
{
	int times,i,j,lena,lenb;
	char a[1000],b[1000],c[2];
	scanf("%d\n",&times);
	for(j = 0;j<times;j++)
	{
		gets(a);
		gets(b);
		gets(c);
		lena = strlen(a);
		lenb = strlen(b);
		for(i = 1;i<=lenb;i++)
			a[lena-i] -= b[lenb-i]-48;
		for(i = lena-1;i>0;i--)
		{
			if(a[i]<'0')
			{
				a[i] += 10;
				a[i-1]--;
			}
		}
		printf("%s\n",a);
	}
}
/*
 * ????BigIntegerSubtraction.cpp
 * ?????????????
 * Created on: 2010-12-25
 * Author: ???
 */
int main()
{
	int n;
	char a[100],b[100];
	char d[100],e[100];
	int f[100];
	int i,j,k;
	int p,q;
	memset(a,0,sizeof(a));
	memset(b,0,sizeof(b));
	memset(f,0,sizeof(f));
	memset(d,0,sizeof(d));
	memset(e,0,sizeof(e));
	cin>>n;
	gets(a);
	for(k=1;k<=n;k++)
	{
		memset(a,0,sizeof(a));
			memset(b,0,sizeof(b));
			memset(f,0,sizeof(f));
			memset(d,0,sizeof(d));
			memset(e,0,sizeof(e));
		cin>>a;
		cin>>b;
		p=strlen(a);
		q=strlen(b);
		for(j=0;j<p;j++)
			d[j]=a[p-1-j];
		for(j=0;j<q;j++)
			e[j]=b[q-1-j];
		for(i=0;i<q;i++)
		{
			if(d[i]>=e[i])
               f[i]=d[i]-e[i];
			else
			{
				f[i]=10+d[i]-e[i];
				d[i+1]=d[i+1]-1;
			}

		}
		for(;i<p;i++)
			f[i]=d[i]-'0';
		for(i=99;i>=0;i--)
		{
			if(f[i]!=0)
				break;


		}
		for(;i>=0;i--)
			cout<<f[i];
        cout<<endl;


	}
	return 0;

}
void main()
{
	int a[100],b[100],n,l,m,i,j;
	char c[101],d[101];
	scanf("%d",&n);
	while(n--)
	{
		scanf("%s%s",c,d);
		l=strlen(c);
		m=strlen(d);
		for(i=0;i<l;i++)
			a[i]=c[i]-'0';
		for(j=0;j<m;j++)
			b[j+l-m]=d[j]-'0';
		for(i=l-1;i>=l-m;i--)
		{
			a[i]=a[i]-b[i];
			if(a[i]<0)
			{
				a[i]+=10;
				a[i-1]--;
			}
		}
		while(a[i]<0&&i>0)
		{
			a[i]+=10;
			i--;
			a[i]--;
		}
		for(j=0;j<l;j++)
			if(a[j]!=0)
				break;
		for(i=j;i<l;i++)
			printf("%d",a[i]);
		printf("\n");
	}

}
void calc()
{ 	const int MAX_LEN = 200;
	int an1[MAX_LEN]; int an2[MAX_LEN];
	char seLine1[MAX_LEN + 1]; char seLine2[MAX_LEN + 1];
	//cout << "please input two integers" << endl;
	cin >> seLine1;
	cin >> seLine2;
	int nLen1 = strlen(seLine1);
	int nLen2 = strlen(seLine2);
	memset(an1, 0, sizeof(an1));
	memset(an2, 0, sizeof(an2));
	int i, j=0;
	for (i = nLen1-1;  i>=0; i--)
		an1[j++] = seLine1[i] - '0';
	j=0;
	for (i = nLen2-1; i>=0;i--)
		an2[j++] = seLine2[i] - '0';
	for (i = 0; i < nLen1 ;i++)
	{
	    //printf("%d\n", an1[i]);
		an1[i] -= an2[i];
		if(an1[i] < 0)
		{
			an1[i] +=10;
			an1[i + 1]--;
		}
	}
	i = nLen1 - 1;
	while(i > 0 && an1[i]==0) i--;
	//printf("%d\n", i);
	for(;i >= 0; i--)
		cout << an1[i];
	cout << endl;
}

int main()
{
    int n;
    cin >> n;
    while (n --)
        calc();
}
void main()
{
	char a[101],b[101];
	int i,j,t=0,A,B,k,n;
	scanf("%d",&n);
	for(k=1;k<=n;k++){t=0;
	scanf("%s",a);
	scanf("%s",b);
	for(i=0;i<=100;i++)
	{
		if(a[i]==0)break;
		else a[i]=a[i]-'0';
	}A=i-1;
	for(i=0;i<=100;i++)
	{
		if(b[i]==0)break;
		else b[i]=b[i]-'0';
	}B=i-1;
	for(i=B;i>=0;i--)
	{
		if(a[A-B+i]>=b[i])a[A-B+i]=a[A-B+i]-b[i];
		else {a[A-B+i]=a[A-B+i]-b[i]+10;a[A-B+i-1]=a[A-B+i-1]-1;}
	}
	for(j=0;j<=A;j++)
	{
		if(a[j]!=0)break;
		else t++;
	}

	if(t==0)for(i=0;i<=A;i++){if(i==A)printf("%d\n",a[i]);else printf("%d",a[i]);}
	else for(i=0;i<=A-t;i++){if(i==A-t)printf("%d\n",a[i+t]);else printf("%d",a[i]);}
	}
}
int main()
{
int a[100],b[100],temp;
int n=0;
n=getchar()-48;
while ((temp=getchar())!=10) n=n*10+temp-48;
int i=0,j;
int ca=0,cb=0;
for(int k=1;k<=n;k++)
{
        ca=0;cb=0;
while ((temp=getchar())!=10) {a[ca]=temp-48;ca++;}
ca--;
while ((temp=getchar())!=10) {b[cb]=temp-48;cb++;}
cb--;
for(i=cb;i>=0;i--) {a[ca-cb+i]-=b[i];}
for(i=ca;i>=1;i--) if(a[i]<0) {a[i]+=10;a[i-1]-=1;}
i=0;
while(a[i]==0) i++;
for(j=i;j<=ca;j++) cout<<a[j]; cout<<"\n";
if(k!=n) temp=getchar();
}


}
void main()
{
	char a[100][100],b[100][100],c[100][100]={'\0'},enter;
	int i,j,k,n,m,len1,len2;
	scanf("%d",&n);
	scanf("%s%s",a[0],b[0]);
	for(i=1;i<n;i++)
	{
		scanf("%s%s",a[i],b[i]);
	}
	for(i=0;i<n;i++)
	{
		len1=strlen(a[i]);
		len2=strlen(b[i]);
		for(j=0;j<len1;j++)
			c[i][j]='0';
		for(j=0;j<len2;j++)
		{		
			c[i][j+len1-len2]=b[i][j];
		}
		for(j=len1-1;j>=0;j--)
		{
			if(c[i][j]<=a[i][j])a[i][j]=a[i][j]-c[i][j]+'0';
			else 
			{
				a[i][j]=a[i][j]-c[i][j]+'0'+10;
				a[i][j-1]--;
			}
		}
		printf("%s\n",a[i]);
	}
}
int minus(char str2[]);
int main()
{
	int n,k;
	char str2[100][100]={'\0'};	
	scanf("%d",&n);
	for(k=0;k<n;k++)
		minus(str2[k]);
	for(k=0;k<n;k++)
		printf("%s\n",str2[k]);
	


return 0;
}


int minus(char str2[])
{
	int len1,len2,i;
	char str[2][100]={'\0'};
	scanf("%s%s",str[0],str[1]);
	len1=strlen(str[0]);
	len2=strlen(str[1]);
	for(i=len1-1;i>=len1-len2;i--)
	{
		if(str[0][i]>=str[1][i-len1+len2])
		{
			str[0][i]=str[0][i]-str[1][i-len1+len2]+48;
		
		}
		else
		{
			str[0][i-1]=str[0][i-1]-1;
			str[0][i]=str[0][i]-str[1][i-len1+len2]+58;
		}
	}
	for(i=0;i<len1;i++)
	{str2[i]=str[0][i];}
	return 0;


}
void main()
{
	char a[200],b[200];
	int n,i,k,p,q;
	int g=0;//????
	int cn;
	char c[200];
    scanf("%d",&n);
	for(k=0;k<n;k++)
	{
		scanf("%s %s",a,b);
	    p=strlen(a);
		q=strlen(b);
		for(i=0;i<=q;i++)
		{
			b[p-i]=b[q-i];
		}
		for(i=i;i<=p;i++)
		{
			b[p-i]='0';
		}
		for(i=p-1;i>=0;i--)
	{
		if((a[i]-g)>=b[i])
		{
			cn=a[i]-'0'-b[i]+'0'-g;
			g=0;
			c[i]=cn+'0';
		}
		else
		{
			cn=a[i]-b[i]-g+10;
			g=1;
			c[i]=cn+'0';
		}

	}
	for(i=0;i<p;i++)
	{
		if(c[i]!='0')
		{
			printf("%c",c[i]);
			break;
		}

	}
	for(i=i+1;i<p;i++)
	{
		printf("%c",c[i]);
	}
	printf("\n");
	}
}
int main()
{
	int n;
	char a[108];
	char b[108];
	char c[108];
	int i, j, k;
	int la, lb;
	int bit;

	cin >> n;

	for(k = 0; k < n; k ++)
	{
		cin >> a >> b;

		bit = 0;
	
		la = strlen(a);
		lb = strlen(b);

		for(i = la - 1; i >= la - lb; i --)
		{
			if(a[i] - b[i - la + lb] - bit >= 0)
			{
				c[i] = a[i] - b[i - la + lb] - bit + '0';
				bit = 0;
			}
			else
			{
				c[i] = a[i] - b[i - la + lb] - bit + 10 + '0';
				bit = 1;
			}
		}

		c[la - lb - 1] = a[la - lb - 1] - bit;

		for(i = 0; i < la - lb - 1; i ++)
			c[i] = a[i];

		c[la] = '\0';

		cout << c << endl;
		
	}


	return 0;
}
int main()
{	int i,j,k;
	char a[101]={'\0'},b[101]={'\0'},c[101]={'\0'};
	int m[100]={0},n[100]={0},ans[100]={0},counter;
	cin>>k;
	for(counter=0;counter<k;counter++)
	{
		gets(a);
		gets(a);
//		puts(a);
		gets(b);
//		puts(b);
		for(j=0;a[j]!='\0';j++)
		{
			m[j]=a[j]-48;
		}
		int m_c=j-1;  
		for(j=0;b[j]!='\0';j++)
		{
			n[j]=b[j]-48;
		}
		int n_c=j-1;													//??????????????m_c+1?n_c+1?????????
		for(i=0;i<=m_c;i++)								//??m?n?????????????????????????????
		{
			if(i<=n_c)
			{
				if(m[m_c-i]>=n[n_c-i])
					ans[i]=m[m_c-i]-n[n_c-i];
				else { ans[i]=m[m_c-i]+10-n[n_c-i]; m[m_c-i-1]=m[m_c-i-1]-1;}
			}
			else
			{
				ans[i]=m[m_c-i];
			}
		}
		for(i=0;i<=m_c;i++)
		{
			cout<<ans[m_c-i];
		} cout<<'\n';


	}



}
void main()
{
	int n,i,c,j,k,m;
    char a[100][100],b[100][100],d[100][100];
    scanf("%d",&n);
    for(i=1;i<=n;i++)
    scanf("%s %s",a[i],b[i]);
    for(i=1;i<=n;i++)
	{
		c=strlen(a[i])-strlen(b[i]);
		for(j=strlen(b[i]);j>=0;j--)
			b[i][j+c]=b[i][j];
    		for(k=0;k<c;k++)
			b[i][k]='0';

    }
    for(i=1;i<=n;i++)
	{
        for(m=(strlen(a[i])-1);m>=0;m--)
		{
			if(a[i][m]>=b[i][m])
				d[i][m]=a[i][m]-b[i][m]+48;
            if(a[i][m]<b[i][m])
			{
				d[i][m]=a[i][m]-b[i][m]+58;
			    a[i][m-1]=a[i][m-1]-1;
			}
		}
		d[i][strlen(a[i])]='\0';
	}


    for(i=1;i<=n;i++)
		printf("%s\n",d[i]);
}
void main()
{
	int l1[25],l2[25],n,w,z,q,i,d,k,j;
/*	int t;
	char c[101]
*/	char c1[25][101],c2[25][101],a[25][101];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s",c1[i]);
		l1[i]=strlen(c1[i]);
		scanf("%s",c2[i]);
		l2[i]=strlen(c2[i]);

		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]-1;k>=0;k--)
		{
			if(c1[i][k]>=c2[i][k]) 
				a[i][k]=c1[i][k]-c2[i][k]+48;
			else 
			{
				a[i][k]=c1[i][k]+10-c2[i][k]+48;
				c1[i][k-1]=c1[i][k-1]-1;
			}
		}
		
	}
	for(i=0;i<n;i++)
	{
		for(j=0;j<l1[i];j++)
			printf("%c",a[i][j]);
		printf("\n");
	}
}
void main()
{
	int n,i,j,a[101][101],len1[101],len2;
	char str1[101],str2[101],str3[101],Tempstr2[101]; 
    scanf("%d\n",&n);
	for(j=0;j<n;j++)
	{
		gets(str1);
		gets(str2);
		if(j!=n-1)
			gets(str3);
		len1[j]=strlen(str1);
		len2=strlen(str2);
		for(i=0;i<len1[j]-len2;i++)
			Tempstr2[i]='0';
		for(;i<len1[j];i++)
			Tempstr2[i]=str2[i-(len1[j]-len2)];
		for(i=0;i<len1[j];i++)
			a[j][i]=str1[i]-Tempstr2[i];
		for(i=len1[j]-1;i>=0;i--){
			if(a[j][i]<0){
				a[j][i]+=10;
				a[j][i-1]-=1;
			}
		}
	}
    for(j=0;j<n;j++){
		for(i=0;i<len1[j];i++)
			if(a[j][i]!=0)
				break;
		for(;i<len1[j];i++)
			printf("%d",a[j][i]);
		printf("\n");
	}
}
//****************************************************** 
//* ? ? ?   ?? ? ? ? ?                        *
//* ? ?      ?? ? ?                              *
//* ? ? ? ??2010 ? 11 ? 17 ?                   * 
//* ? ?      ?1000010185                            *
//****************************************************** 
int main()
{
	char aa[101], bb[101]; //?????????
	int a[101], b[101], c[101];
	int n, la, lb;
	cin >> n;
	for (int i = 0; i < n; i ++)
	{
		cin >> aa >> bb;
		la = strlen(aa);
		lb = strlen(bb);
		for (int j = 0; j < la; j ++) //???????????
			a[j] = aa[j] - 48;
		for (int j = 0; j < lb; j ++)
			b[j] = bb[j] - 48;
		for (int j = 1; j <= lb; j ++) //????????????
			c[la - j] = a[la - j] - b[lb - j];
		for (int j = 0; j < la - lb; j ++) //b?????????0??????
			c[j] = a[j];
		for (int j = la - 1; j > 0; j --) //??????0??????10??????1(????
			if (c[j] < 0)
			{
				c[j] += 10;
				c[j - 1] -= 1;
			}
		int k;
		for (int j = 0; j < la; j ++) //???????0??
			if (c[j] != 0)
			{
				k = j;
				break;
			}
		for (int j = k; j < la; j ++) //????
			cout << c[j];
		cout << endl;
	}
	return 0;
}
//**************************
//*????????       **
//*??????           **
//*???20131114         **
//**************************
int main ()
{
	int n ,i , j ,k ,nLen1 ,nLen2 ,num1 ,num2;
	int a[101] ,b[101] ,c[101];
	char str1[101], str2[101];
	cin >> n;
	for(i = 1; i <= n ;i++)
	{
		memset(str1,0,sizeof(str1));
		memset(str2,0,sizeof(str2));
		memset(a,0,sizeof(a));
		memset(b,0,sizeof(b));
		memset(c,0,sizeof(c));
		nLen1 = 0; 
		nLen2 = 0;
		num1 = 0;
		num2 = 0;
		cin >> str1 >> str2;
		nLen1 = strlen(str1);
		nLen2 = strlen(str2);
		for(j = nLen1 - 1; j >= 0; j--)
			a[num1++] = str1[j] - '0';
		for(k = nLen2 - 1; k >= 0; k--)
			b[num2++] = str2[k] - '0';
		for(int t = 0; t <= nLen2 - 1; t++)
		{
			if(a[t] >= b[t])
				c[t] = a[t] - b[t]; 
			else
			{
				c[t] = a[t] - b[t] + 10;
				a[t+1] -= 1;
			}
		}
		for(int q = nLen2; q <= nLen1 - 1; q++)
			c[q] = a[q];
		for(int l = nLen1 - 1; l >= 0; l--)
			cout << c[l];
		cout << endl;
	}





	
	return 0;
}
void main()
{
   char str1[100],str2[100],c;
   int n,k,t,i,j,a,q;
   
   scanf("%d",&n);
   
   for(i=1;i<=n;i++)
   { scanf("\n");
      for(j=0;(c=getchar())!='\n';j++)
      str1[j]=c;
    j--;
    for(k=0;(c=getchar())!='\n';k++)
      str2[k]=c;
    k--;
    for(t=j;t>=0;t--)
      {
        if(t>=j-k) 
        str2[t]=str2[t-j+k];
        
        else str2[t]='0';
      }
     for(a=j;a>=0;a--)
     
      {
       if(str2[a]>str1[a])
        {
         str2[a]=str1[a]+10-str2[a]+'0';
         str1[a-1]=str1[a-1]-1;
        }
       else 
       str2[a]=str1[a]-str2[a]+'0';
      }
     for(q=0;q<=j;q++)
        printf("%c",str2[q]);
      printf("\n");
    }
 }
void main()
{
	int n,i,l[2],k;
  char a[100][100],b[100][100];
  scanf("%d",&n);
  for (i=0;i<n;i++)
  {
	  scanf("%s %s",a[i],b[i]);
	  if (i-n+1) printf("\n");
  }
  for (i=0;i<n;i++)
  {
	  l[0]=strlen(a[i]);
	  l[1]=strlen(b[i]);
	  for (k=1;k<l[1]+1;k++)
	  {
		  a[i][l[0]-k]=48+(int)a[i][l[0]-k]-(int)b[i][l[1]-k];
		  if(a[i][l[0]-k]<48){a[i][l[0]-k]+=10;a[i][l[0]-k-1]=(int)a[i][l[0]-k-1]-1;}
	  }
	  for(k=0;k<strlen(a[i]);k++) if(a[i][0]!=48) printf("%c",a[i][k]);else {printf("%c",a[i][k+1]);if (k==strlen(a[i])-2) break;}
	  printf("\n");
  }
}
int main()
{
 int n,i=0,j=0,c=0,l,k=0;
 scanf("%d" ,&n);
 char *** ppp;
 ppp=(char ***)malloc(n*sizeof(char **));
 for(i=0;i<n;i++)
 {
  ppp[i]=(char **)malloc(2*sizeof(char *));
  for(j=0;j<2;j++)
  {
   ppp[i][j]=(char *)malloc(101*sizeof(char));
  }
 }
 for(i=0;i<n;i++)
 {
  for(j=0;j<2;j++)
  {
   scanf("%s" ,ppp[i][j]);
   l=strlen(ppp[i][j]);
   for(k=0;k<=l;k++)              //???
   {
    ppp[i][j][100-k]=ppp[i][j][l-k];
   }
   for(k=0;k<100-l;k++)
   {
    ppp[i][j][k]='0';
   }
  }
 }
 for(i=0;i<n;i++)
 {
  for(k=99;k>=1;k--)                   
  {
   //ppp[i][0][k-1] = ppp[i][0][k-1]-1;
         c=ppp[i][0][k]-ppp[i][1][k];
   //printf("%d\n" ,c);
   if(c>=0) 
    ppp[i][0][k]=c+'0';
   else
   {
    ppp[i][0][k]=c+'0'+10;
    ppp[i][0][k-1]--;
   }
  
  }
  for(k=0;k<100;k++)
  {
   if(ppp[i][0][k]>'0')
   {
    c=k;
    break;
   }
  }
  for(k=c;k<100;k++)
  {
   printf("%c" ,ppp[i][0][k]);      //?0?
  }
  printf("\n");
 }
 for(i=0;i<n;i++)
 {
  for(j=0;j<2;j++)
  {
   free(ppp[i][j]);
  }
  free(ppp[i]);
 }
 free(ppp);
}
void main()
{
	int n,j[100][2],i,a[100][100]={0},b,c[100][100]={0},d,p,q,r;
	char e[100][100],f[100][100];
	scanf("%d",&n);
    for (i=0;i<n;i++)
	{
		scanf("%s",&e[i]);
        scanf("%s",&f[i]);
	}
	for (i=0;i<n;i++)
	{
		j[i][0]=strlen(e[i]);
		j[i][1]=strlen(f[i]);
		for (p=0;p<j[i][0];p++)
             a[i][p]=e[i][j[i][0]-p-1]-48;
        for (p=0;p<j[i][1];p++)
             c[i][p]=f[i][j[i][1]-p-1]-48;
	}
	for (i=0;i<n;i++)
	{
		for(d=0;d<j[i][0];d++)
		{
			if (a[i][d]>=c[i][d])
				a[i][d]-=c[i][d];
			else
			{
				a[i][d]=a[i][d]-c[i][d]+10;
				a[i][d+1]--;
			}
		}
	}
	for (i=0;i<n;i++)
	{
		for(d=j[i][0]-1,r=0;d>=0;d--)
		{
		    if (a[i][d]!=0)
				r++;
			if (r!=0)
			printf("%d",a[i][d]);	
		}
		printf("\n");
	}
}
main()
{char a[200]={'\0'},b[200]={'\0'};
int time,r,i,s,t,u;
scanf("%d",&time);
for(r=1;r<=time;r++)
{
    scanf("%s\n%s",a,b);
	t=strlen(b);
	u=strlen(a);
    for(i=t-1;i>=0;i--)
		b[i+u-t]=b[i];
    for(i=0;i<u-t;i++)
		b[i]='0';
    for(i=u-1;i>=0;i--)
    {if(a[i]>=b[i])a[i]=a[i]-b[i]+'0';
     else {a[i]=a[i]-b[i]+'0'+10;a[i-1]--;}
    }
    s=0;
    for(i=0;i<u;i++)
    {if(a[i]=='0')s++;
     else break;}
    for(i=s;i<u;i++)
        printf("%c",a[i]);
printf("\n");
}
}
int main()
{
	int  i, j, n, k, lena, lenb, pos; 
	               
	char a[101], b[101];
	cin >> n;
	for(k = 1; k <= n; k++)
	{
		cin.get();
		if(i >= 2)
			cout << endl;
		cin.getline(a, 101);		
		cin.getline(b, 101);
		lena = strlen(a);
		lenb = strlen(b);
		int numa[100]={0};
		int numb[100]={0};
		j = 0;
		for(i = lena - 1; i >= 0; i--)		
			numa[j++] = a[i] - '0';						
		j = 0;
		for(i = lenb - 1; i >= 0; i--)				
			numb[j++] = b[i] - '0';			
		for(i = 0; i < lena; i++)
		{
			numa[i] = numa[i] - numb[i];			
			if(numa[i] < 0)
			{
				numa[i] += 10;
				numa[i + 1]--;
			}
		}
		i = lena - 1;
		while(numa[i] != 0)
		{	
			pos = i;
			break;
		}
		for(i = pos; i >= 0; i--)
			cout << numa[i];
		cout << endl;
	}
	return 0;
}
void main()
{

       int n,k,c;
       char string[500][300];
	     int  i,d1,d2,d;
          char str[2][300];
		  	char t[10];
       scanf("%d",&n);
 
 for (k=0;k<n;k++)
       {
			

			 	gets(t);          //??????????gets(t)???????????????
               for (i=0;i<2;i++)
               {
                       gets(str[i]);
                       
               }
              
                d1=strlen(str[0]);
                d2=strlen(str[1]);
			 
                d=d1-d2;
                for (i=0;i<d2;i++)    //???????d2???d1
       str[1][d1-1-i]= str[1][d2-1-i];

		
        for (i=0;i<d;i++)
                str[1][i]='0';
        str[1][d1]='\0';

 
	    c=0;
		for (i=d1-1;i>=0;i--) {         //??????????????????????????????
			int k1 = (int)(str[0][i]-'0');  //?????????????????
			int k2 = (int)(str[1][i]-'0');
			if ((k1-c)<(k2)) {
				string[k][i]= (char)((k1 +10 - c - k2) + 48);
				c=1;
			}else {
				string[k][i]=  (char)((k1 - c - k2) + 48);
				c=0;
			}
		}
          string[k][d1]='\0';
 

       }

   for (k=0;k<n;k++)

    printf("%s\n",string[k]);
}
int main ()
{
	int n,i,c[100][100],j,l1,l2,k;
	char l;
	scanf("%d",&n);
	char a[100][100],b[100][100];
	for(i=0;i<n;i++)
	{
		scanf("%s%s",&a[i],&b[i]);
		l1=strlen(a[i]);
		l2=strlen(b[i]);		
		for(j=l1-1;j>=l1-l2;j--)
		{
            if(a[i][j]>=b[i][j-l1+l2])
			{
				c[i][j]=a[i][j]-b[i][j-l1+l2];
			}
			else
			{
				c[i][j]=a[i][j]+10-b[i][j-l1+l2];
				a[i][j-1]=a[i][j-1]-1;
            }
		}
	    for(j=l1-l2-1;j>=0;j--)
		{
			if(a[i][j]==47)
			{
				a[i][j]=a[i][j]+10;
				a[i][j-1]=a[i][j-1]-1;
			}
		}
		for(j=0;j<l1-l2;j++)
		{
			
			printf("%d",a[i][j]-48);
		}
        for(j=l1-l2;j<l1-1;j++)
		{
			printf("%d",c[i][j]);
		}
		printf("%d\n",c[i][l1-1]);
	}
	return 0;
}
void main()
{
	char a[1000][100],b[1000][100],c[1000][100]={""};
	int n,i,j;
	int r[1000],l[1000];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s%s",a[i],b[i]);
		printf("\n");
	    l[i]=strlen(a[i]);
	    r[i]=strlen(b[i]);
    	for(j=0;j<r[i];j++)
		{
			b[i][l[i]-j-1]=b[i][r[i]-j-1];
		}
		for(j=0;j<l[i]-r[i];j++)
			b[i][j]='0';
		for(j=l[i]-1;j>=0;j--)
		{
			c[i][j]=a[i][j]-b[i][j];
			if(c[i][j]<0)
			{
				a[i][j-1]--;
				c[i][j]=c[i][j]+10;
			}
			c[i][j]=c[i][j]+48;
		}
	}
	for(i=0;i<n;i++)
		printf("%s\n",c[i]);
}
//***********************************
//*???Nov 13, 2013 - ????? **
//*?????? 1300012719         **
//*???2013.11.16                **
//***********************************
int main()
{
	int a[101], b[101], n, i, j, t, lena, start;
	char cha[101], chb[101];               //a[],b[]???????????,cha,chb????a,b??????,n?????,t???????????,lena??????,start??????????0????
	cin >> n;                              //??????n???????
	cin.get();
	for (i = 1; i <= n; i++)
	{
	    cin.getline(cha,100);              //??????,??a?b?????,???a????a,b????
		cin.getline(chb,100);
		lena = strlen(cha);
		t = lena - strlen(chb);
		for (j = 0; j < lena; j++)         //??b??????a???,???a,b??lena??????????????,??b[]???????,??????
		{
			a[j] = cha[j] - '0';
			b[j] = chb[j] - '0';
		}
		for (j = lena - 1; j >= t; j--)    //????????b?a?????,?a??t+1???lena??b??????lena-t???????
		{
			a[j] = a[j] - b[j - t];        //a??j???b??j-t?,??b[]????????????
			if (a[j] < 0)                  //?????????????????????10
			{
				a[j] = a[j] + 10;
				a[j - 1]--;
			}
		}
		for (j = 0; j < 101; j++)
		{
			if (a[j])
			{
				start = j;                 //????????????????0???
				break;
			}
		}
		for (j = start; j < lena; j++)     //????????a??
			cout << a[j];
		cout << endl;
		cin.get();                         //???????
	}
	return 0;
}
int main()
{
	int n,i;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		char s1[101],s2[101]={'0'},s3[101]={'\0'};
		scanf("%s",s1);
		scanf("%s",s2);
		printf("\n");
		int l1,l2,j,u=0;
		l1=strlen(s1);
		l2=strlen(s2);
		for(j=1;j<=l2;j++)
		{
			int x,y,z;
			x=s1[l1-j]-'0';
			y=s2[l2-j]-'0';
			if(x+u>=y)
			{
				z=x-y+u;
				u=0;
			}
			else
			{
				z=10+x-y+u;
				u=-1;
			}
			s3[l1-j]=z+'0';
		}
		if(l1>l2)
		{
			int k,l;
			k=s1[l1-l2-1]-'0';
			s3[l1-l2-1]=k+u+'0';
			for(l=0;l<l1-l2-1;l++)
				s3[l]=s1[l];
		}
		printf("%s",s3);
	}
	return 0;
}
int main(int argc, char *argv[])
{
  char a[1000]={'\0'},b[1000]={'\0'},c[1000]={'\0'};
  int n,i,j,m,k;
  scanf("%d",&n);
  for(i=0;i<n;i++)
  {  
        for(j=0;j<1000;j++)
        {
          c[j]='\0';
          a[j]='\0';
          b[j]='\0';
        }
         scanf("%s",a);
         scanf("%s",b);
         for(j=0;j<1000;j++)
         {
              if(a[j]=='\0')
              {
                   m=j;
                   break;
              }
         }
         for(j=0;j<1000;j++)
         {
              if(b[j]=='\0')
              {
                   k=j;
                   break;
              }
         }
        for(j=0;j<=k-1;j++)
        {
              c[j]=a[m-j-1]-b[k-j-1]+'0';
        }
        for(j=k;j<m;j++)
        c[j]=a[m-j-1];
        for(j=0;j<1000;j++)
        {
              if(c[j]<'0')
              {
                        c[j]=c[j]+10;
                        c[j+1]=c[j+1]-1;
              }
        }
        for(j=m;j>=0;j--)
        {
             if(c[j]>='1'&&c[j]<='9')
             break;
        }
        for(j=j;j>=0;j--)
        printf("%c",c[j]);
        printf("\n");
  }	
  return 0;
}
struct minus
{
	char a[N];
	char b[N];
};
int main()
{
	struct minus c[N];
	int n,i;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s",c[i].a);
		scanf("%s",c[i].b);
		printf("\n");
	}
	for(i=0;i<n;i++)
	{
		int k1,k2,j,k;
		char str[N],d;
		k1=strlen(c[i].a);
		k2=strlen(c[i].b);
		for(j=k1-1,k=k2-1;j>=k1-k2,k>=0;j--,k--)
		{
			d=c[i].a[j]-c[i].b[k]+'0';
			if(d>='0')
				str[j]=d;
			else
			{
				str[j]=10+d;
				c[i].a[j-1]=c[i].a[j-1]-1;
			}
		}
		//printf("%c",c[i].a[k1-k2-1]);
		for(j=0;j<k1-k2;j++)
		{
			str[j]=c[i].a[j];
		}
		str[k1]='\0';
		printf("%s",str);
		printf("\n");
	}
	return 0;
}