semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
/**
 * @file ?????
 * @author ???
 * @date 11-17
 * @description ?????
 */
int main()
{
    int n, i, j, s[101], sa[101], sb[101], la, lb;
    char a[101], b[101] ;
    cin >> n;
    for (j = 1; j <= n; j ++)
    {
        for (i = 0; i <= 100 ; i ++)
        {
            sa[i] = 0; sb[i] = 0 ; s[i] = 0; 
        }
        cin.get();  
        cin.getline(a,101);
        cin.getline(b,101);
        la = strlen(a);
        lb = strlen(b);
        for (i = la-1; i >= 0 ; i --) sa[la-1-i] = a[i] - '0' ;
        for (i = lb-1; i >= 0 ; i --) sb[lb-1-i] = b[i] - '0' ;
        for (i = 0 ; i <= la-1 ; i ++)
        {
            s[i] = s[i] + sa[i] - sb[i] ;
            if (s[i] < 0) { s[i] = s[i] + 10; s[i+1] -- ;}
        }
        for (i = la-1; i >= 0 ; i -- )
        if (s[i] != 0) break;
        while (i >= 0)
        {
             cout << s[i] ;
             i --;
        }
        cout << endl;
    }
    return 0;
}
int main()
{
	int n, len_a, len_b;
	char a[101], b[101];
	int num[101];
	cin >> n;
	for(int i = 1; i <= n; i++)
	{
		cin.get();
		cin.getline(a, 101);
		len_a = strlen(a);
		cin.getline(b, 101);
		len_b = strlen(b);
		memset(num, 0, sizeof(num));
		for(int i = len_a - 1; i >= 0; i--)
			num[len_a - i] = a[i] - '0';
		for(int i = len_b - 1; i >= 0; i--)
		{
			int j = len_b - i, b0 = b[i] - '0';
			if(num[j] >= b0)
				num[j] -= b0;
			else
			{
				num[j + 1]--;
				num[j] = num[j] + 10 - b0;
			}
		}
		int i = 100;
		while(num[i] == 0 && i != 1)
				i--;
		for(int j = i; j >= 1; j--)
			cout << num[j];
		cout << endl;
	}
	return 0;
}
void main()
{
	int n,i,j,k,la,lb,lc;
	char a[110],b[110],c[110]={""};
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		scanf("%s%s",&a,&b);
		la=strlen(a);
		lb=strlen(b);
		for(j=1;j<=lb;j++)
		{
			if(a[la-j]>=b[lb-j]) c[la-j]=a[la-j]-b[lb-j]+48;
			else 
			{
				c[la-j]=a[la-j]+10-b[lb-j]+48;
				a[la-j-1]--;
			}
		}
		for(j=0;j<(la-lb);j++)
			c[j]=a[j];
		lc=strlen(c);
		for(k=0;k<=la-1;k++)
			if (c[k]!='0') break;
		for(j=k;j<=la-1;j++)
		printf("%c",c[j]);
		printf("\n");
	}
}
//********************************
//*????????   **
//*?????? 1300012861 **
//*???2013.11.17  **
//********************************
int main()
{
	int n, i, j, k, max, str1[110], str2[110]; 
	char num1[110], num2[110]; 
	cin >> n; 
	for ( i = 1; i <= n; i++ )
	{
		cin >> num1; 
		int nlen1 = strlen(num1); 
		cin >> num2;
		int nlen2 = strlen(num2);
		memset(str1, 0, sizeof(str1)); 
		memset(str2, 0, sizeof(str2)); 
		j = 0;
		for ( k = nlen1 - 1; k >= 0; k-- )
		{
			str1[j++] = num1[k] - '0'; 
		}
		j = 0; 
		for ( k = nlen2 - 1; k >= 0; k-- )
			str2[j++] = num2[k] - '0';
		for ( j = 0; j < nlen2; j++ )
		{
			str1[j] = str1[j] - str2[j]; 
			if ( str1[j] < 0 )
			{
				str1[j+1]--; 
				str1[j] = 10 + str1[j]; 
			}
		}
		j = nlen1; 
		while ( str1[j] == 0 )
			j--; 
		for ( ; j >= 0; j-- )
			cout << str1[j]; 
		cout << endl; 
	}
	 
	
	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];
		}
		int l;
		for(l=0;l<l1-1;l++)
		{
			if(s3[l]!='0')
			{
				printf("%s",s3+l);
				break;
			}
		}
		if(l==l1-1)
		{
			printf("%c",s3[l1-1]);
		}
	}
	return 0;
}
void main()
{
	char a[101],b[101],c[101];
	int n,i,j,k,p=0,q;
	int len1,len2;
	scanf("%d",&n);
	for(i=0;i<=100;i++)
	{
		c[i]=0;
	}
	for(i=1;i<=n;i++)
	{
		scanf("%s",a);
		scanf("%s",b);
		len1=strlen(a);
		len2=strlen(b);
		for(j=len2-1;j>=0;j--)
		{
			b[j+len1-len2]=b[j];
		}
		for(j=0;j<len1-len2;j++)
		{
			b[j]='0';
		}
		for(k=len1-1;k>=0;k--)
		{
			if(a[k]>=b[k])
				c[k]=a[k]-b[k];
			else if(a[k]<b[k])
			{
				c[k]=a[k]+10-b[k];
				a[k-1]--;
			}
		}
		while(c[p]==0)
		{
			p++;
		}
		for(q=p;q<len1;q++)
		{
			printf("%d",c[q]);
		}
		printf("\n");
	}
}
/*
 * ???: 1000010191_test4_2.cpp
 * ??: ???
 * ????: 2010-12-24
 * ??: ?????
 */


int main()
{
	int n;
	cin>>n;
	for (int k=1;k<=n;k++)
	{
		//??
		char sa[101],sb[101];
		cin>>sa>>sb;
		//??
		int la=strlen(sa),lb=strlen(sb);
		//??
		int a[101]={0},b[101]={0};
		for (int i=1;i<=la;i++)
			a[i]=sa[la-i]-'0';
		for (int i=1;i<=lb;i++)
			b[i]=sb[lb-i]-'0';
		//??
		for (int i=1;i<=la;i++)
		{
			a[i]-=b[i];
			if (a[i]<0)
			{
				a[i]+=10;
				a[i+1]--;
			}
		}
		//??
		while (a[la]==0) la--;
		for (int i=la;i>0;i--) cout<<a[i];
		cout<<endl;
	}
	return 0;
}
//********************************
//*????????    **
//*?????? 1300012855 **
//*???2013.11.13  **
//********************************

int main(void)
{
	int n; // ???
	char ac[101], bc[101]; // ??????
	int a[101], b[101]; // ??????
	int al, bl; // ???????
	cin >> n;
	for(int i = 1; i <= n ; i++)
	{
		cin >> ac >> bc;
		al = strlen(ac);
		bl = strlen(bc);
		for(int j = al - 1; j >= 0; j--) // ????
		{
			a[j] = ac[al - j - 1] - '0';
		}
		for(int j = bl - 1; j >= 0; j--) // ????
		{
			b[j] = bc[bl - j - 1] - '0';
		}
		for(int j = 0; j < bl; j++) // ???
		{
			a[j] -= b[j]; // ??
			if(a[j] < 0) // ?????????
			{
				a[j] += 10;
				a[j + 1]--;
			}
		}
		int x;
		for(x = al - 1; a[x] == 0; x--); // ???????
		for(; x >= 0; x--)
		{
			cout << a[x]; // ????
		}
		cout << endl;
	}
	return 0;
}
int main()
{
	int i,n,j,x,y,k;
	char a[101],b[101],c[101],d[101],e[101];
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		scanf("%s",a);
		scanf("%s",b);
		x=strlen(a);
		y=strlen(b);
		for(j=x-1,k=0;j>=0;j--,k++)
			c[k]=a[j];
		for(j=y-1,k=0;j>=0;k++,j--)
			d[k]=b[j];
		for(j=0;j<x;j++)
		{
			if(j<y)
			{
				if(c[j]<d[j]) {e[j]=c[j]+58-d[j];c[j+1]=c[j+1]-1;}
			    else e[j]=c[j]-d[j]+48;
			}
			else e[j]=c[j];
		}
		for(j=x-1;j>=0;j--) printf("%c",e[j]);
		printf("\n");
	}
	return 0;
}
int main() {
	int n;
	scanf("%d",&n);
	while(n--) {
		char t1[1000],t2[1000];
		int num1[1000]={0},num2[1000]={0};
		scanf("%s",&t1);
		scanf("%s",&t2);
	int i;
	int k=0;
	  for(i=strlen(t1)-1;i>=0;i--){
		  num1[k]=t1[i]-'0';
		  k++;
	  }
	  k=0;


	  for(i=strlen(t2)-1;i>=0;i--){
		  num2[k]=t2[i]-'0';
		  k++;
	  }

	  for(i=0;i<strlen(t1);i++){
		  num1[i]=num1[i]-num2[i];
		  if(num1[i]<0) {
			  num1[i]=num1[i]+10;
			  num1[i+1]--;
		  }
	  }
	  int check=0;
  for(i=strlen(t1)-1;num1[i]==0;i--);
  for(;i>=0;i--){
	  printf("%d",num1[i]);
	  check=1;
  }
  printf("\n");

  if ((check==0)&&(i==-1)) printf("%d",0);
	}
	return 0;
}
int main()
{
	char str1[101], str2[101], kongge[101];
	int num1[101] , num2[101], result[101] ;
	int len1, len2, i, j, n;
	cin >> n;
	cin.get();
	for(i = 1; i <= n; i++)
	{
		memset(str1, 0, 101);
		memset(str2, 0, 101);
		memset(num1, 0, 101);
		memset(num2, 0, 101);
		memset(result, 0, 101);
		cin.getline(str1, 101);
		len1 = strlen(str1);
		for(j =  0; j < len1 ; j++ )
			num1[j] = str1[j] - '0';
		cin.getline(str2, 101);
		len2 = strlen(str2);
		for(j = 0; j < len2; j++ )
			num2[len1 - 1 - j] = str2[len2 - 1 - j] - '0';
		for(j = len1 - 1; j >= len1 - len2; j-- )
		{
			if(num1[j] >= num2[j])
				num1[j] = num1[j] - num2[j];
			else
			{
				num1[j] = 10 + num1[j] - num2[j];
//				if(num1[j - 1] > 0)
					num1[j - 1] = num1[j - 1] - 1 ;
/*				else
				{
					int t = j - 1;
					while(num1[t] == 0)
					{
						num1[t] = 9;
						t--;
					}
					num1[t] = num1[t] - 1;
				}*/
			}
		}
		j = 0;
		while(num1[j] == 0)
			j++;
		for(; j < len1; j++)
			cout << num1[j];
		cout << endl;
		cin.getline(kongge, 101);
	}
	return 0;
}
main()
{
	char s[500],t[500],result[10][500];
	int n,i,j,k,m=0;
	scanf("%d\n",&n);
	for(i=0;i<n;i++)
	{
		gets(s);
		gets(t);
		k=strlen(s)-1;
		for(j=strlen(t)-1;j>=0;j--)
		{
			if(s[k]>=t[j]){

				s[k]=s[k]-t[j]+'0';
				k--;
			}
			else if(s[k]<t[j])
			{
				s[k-1]--;
				s[k]=s[k]+10-t[j]+'0';
				k--;
			}
		}
		strcpy(result[m++],s);
	if(i!=n-1)	scanf("\n");
	}
	for(i=0;i<m;i++)
	{
		for(j=0;result[i][j]!='\0';j++)
		{
			if(result[i][j]!='0')
				break;
		}
		if(result[i][j]=='\0')
			printf("0");
		else
			for(k=j;result[i][k]!='\0';k++)
		{
			printf("%c",result[i][k]);
		}
		printf("\n");
	}
}
int main()
{
	int n,i,j,a[100],b[100],length1,length2;
	char s1[100],s2[100];
	scanf("%d",&n);
	while(n--)
	{
		scanf("%s",s1);
		scanf("%s",s2);
		length1=strlen(s1);
		length2=strlen(s2);
		for(i=0;i<100;i++)
		{
			a[i]=0;
			b[i]=0;
		}
		for(i=0;i<length1;i++)
			a[length1-1-i]=s1[i]-'0';
		for(i=0;i<length2;i++)
			b[length2-1-i]=s2[i]-'0';
		for(i=0;i<length1;i++)
		{
			a[i]-=b[i];
			if(a[i]<0)
			{
				a[i+1]--;
				a[i]+=10;
			}
		}
		for(i=length1-1;i>=0;i--)
			if(a[i]!=0) 
			{j=i;break;}
		for(i=j;i>=0;i--)
			printf("%d",a[i]);
		printf("\n");
	}
	return 0;
}
int bigint1(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 bigint2(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 bigint3(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[300],s2[300];
	int a[300],b[300],c[300];
	int alen,blen,clen;
	int i,n;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s%s",s1,s2);
		alen=bigint1(s1,a);
		blen=bigint1(s2,b);
		clen=bigint3(a,alen,b,blen,c);
		bigint2(c,clen);
		printf("\n");
	}
	return 0;
}
void main()
{
  int a[105]={0},b[105]={0},d[105]={0};
  int i,j,k,n;
  char c[105]="";
  scanf("%d\n",&n);
  for (i=1;i<=n;i++)
  {
    gets(c);
    k=strlen(c);
    for (j=0;j<k;j++)
      a[j]=c[k-j-1]-'0';
    for (j=k;j<105;j++) a[j]=0;
    gets(c);
    k=strlen(c);
    for (j=0;j<k;j++)
      b[j]=c[k-j-1]-'0';
    for (j=k;j<105;j++) b[j]=0;
    //printf("%d %d%d%d%d%s ",k,b[1],b[2],b[3],b[4],c);
    gets(c);
    for (j=0;j<=102;j++) d[j]=0;
    for (j=0;j<=102;j++)
      {
        d[j]=d[j]+a[j]-b[j];
        if (d[j]<0) {d[j]=d[j]+10;d[j+1]=d[j+1]-1;}
        //k=j,k=d[j];
      }
    j=101;
    while (d[j]==0) {j--;}
    while (j>=0) {printf("%d",d[j]); j--;}
    printf("\n");
  } 
}
int leap(int *p,int n)
{                                                                                
    if(n==0) return -1;                                                          
    if((*p)!=0) return 0;
    else return leap(p+1,n-1)+1;
}
int main()
{
    int n,i;
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
                    char a[100],b[100];
                    int j,k=0,f=0,c[100]={0};
                    scanf("%s %s",a,b);
                    int len1=strlen(a),len2=strlen(b);
                    if(len1<len2) f=-1;
                    else if(len1==len2)
                         for(j=0;j<len1;j++)
                              if(a[j]<b[j]) 
                              {
                                           f=-1;
                                           break;
                              }
                    if(f==-1)
                    {
                             printf("-");
                             char s[100];
                             strcpy(s,a);
                             strcpy(a,b);
                             strcpy(b,s);
                             int len=len1;
                             len1=len2;
                             len2=len;
                    }                        
                    for(j=len2-1;j>=0;j--)
                                          b[j+len1-len2]=b[j];
                    for(j=len1-len2-1;j>=0;j--)
                                               b[j]='0';
                    for(j=len1-1;j>=0;j--)
                    {
                                          c[j]=a[j]-b[j]-k;
                                          if(c[j]<0)
                                          {
                                                    c[j]+=10;
                                                    k=1;
                                          }
                                          else k=0;
                    }
                    j=leap(c,len1);
                    if(j==-1) printf("0");
                    else
                        for( ;j<len1;j++)
                                         printf("%d",c[j]);
                    printf("\n");
    }
    return 0; 
}
void calculate(int);
int main()
{
	int n,i;
	scanf("%d",&n);
	for(i=0;i<n;i++)
		calculate(n-i==1?0:1);
	return 0;
}
void calculate(int isblank)
{
	char large[101],small[101],dif[101];
	int large_len,small_len,digit_L,digit_S,digit_dif;
	char *p_L,*p_S,*p_dif;
	scanf("%s",large);
	scanf("%s",small);
	large_len=strlen(large);
	p_L=large+large_len-1;
	small_len=strlen(small);
	p_S=small+small_len-1;
	p_dif=dif+large_len-1;
	*(p_dif+1)=0;
	while(p_S-small+1)
	{
		digit_L=*p_L-'0';
		digit_S=*p_S-'0';
		digit_dif=digit_L-digit_S;
		if(digit_dif<0)
		{
			digit_dif+=10;
			(*(p_L-1))--;
		}
		*p_dif=digit_dif+'0';
		p_L--;
		p_S--;
		p_dif--;
	}
	while(p_L>=large)
	{
		*p_dif=*p_L;
		if(*p_L<'0')
		{
			*p_dif+=10;
			(*(p_L-1))--;
		}
		p_L--;
		p_dif--;
	}
	do
		p_dif++;
	while(*p_dif=='0');
	if(*p_dif)
		puts(p_dif);
	else
		printf("0\n");
	if(isblank)
		gets(dif);
}
int main()
{
    int n,i,j,an[100][102]={0},bn[100][102]={0};
    char a[100][102]={0},b[100][102]={0};
    scanf("%d\n",&n);
    for(i=0;i<n;i++)
    {
        int k=0;
        gets(a[i]);
        gets(b[i]);
        scanf("\n");
        for(j=strlen(a[i])-1;j>=0;j--)
            an[i][k++]=a[i][j]-'0';
     //   for(j=0;j<strlen(a[i]);j++)
       //     printf("%d",an[i][j]);
        //printf("\n");
        k=0;
        for(j=strlen(b[i])-1;j>=0;j--)
            bn[i][k++]=b[i][j]-'0';
        // for(j=0;i<strlen(b[i]);j++)
        //   printf("%d",bn[i][j]);
        // printf("\n");
        for(j=0;j<strlen(a[i]);j++)
        {
            an[i][j]=an[i][j]-bn[i][j];
            if(an[i][j]<0)
            {
                an[i][j]+=10;
                an[i][j+1]--;
            }
        }
        
        
    }
    int notzero=0;
    for(i=0;i<n;i++)
    {
        for(j=strlen(a[i])-1;j>=0;j--)
        {
            if(an[i][j]==0&&notzero==0)
                continue;
            else {printf("%d",an[i][j]); notzero++;}
        }
        printf("\n");
    }
    return 0;
}
int main()
{   
	int n,i;
	cin >> n;
	
	for( i=0;i<n;i++)
	{
		char a1[100],a2[100];
		cin >> a1 >> a2;
		cin.get();
	    int l1=strlen(a1), l2=strlen(a2);


		int b1[100],b2[100],i,j;
		memset( b1 ,0 ,sizeof(b1) );
		memset( b2 ,0 ,sizeof(b2) );
		j=0;
		for( i=l1-1;i>=0;i--)
			b1[j++]=a1[i]-'0';
		j=0;
		for( i=l2-1;i>=0;i--)
			b2[j++]=a2[i]-'0';

		for(i=0;i<l1;i++)              //??
		{
			b1[i]=b1[i]-b2[i];
			if(b1[i]<0)
			{
					b1[i]+=10;
					b1[i+1]--;
			}
		}
		
		i=99;
		while( b1[i] ==0 )
		{
			i--;
			if( i==0 )
				break;
		}

		while(i>=0)
			cout << b1[i--];
	
		cout << endl;
	}
	return 0;
}
char a[100];
void fuc(char *num0,int n)//??j-1?
{
	if(num0[n]>'0') num0[n]=num0[n]-1;
	else {
		num0[n]='9';
		fuc(num0,n-1);
	}

}
void minus(char num0[],char num1[])
{
	int last[2],i,j,k;
	last[0]=strlen(num0)-1;//??????
	last[1]=strlen(num1)-1;
	a[last[0]+1]='\0';
	for (i=last[1],j=last[0];j>=0;i--,j--)
	{
		if(i>=0)
		{
			if(num0[j]-num1[i]>=0) a[j]=num0[j]-num1[i]+'0';
			else {a[j]=num0[j]-num1[i]+'0'+10;fuc(num0,j-1);}
		}
		else a[j]=num0[j];

	}
	if (a[0]=='0')
		for(i=0;;i++)
		{
			if(a[i]=='0') continue;
			else {
				j=i;
				for (k=j;k<=last[0]+1;k++)
					a[k-j]=a[k];
				break;
			}

		}


}
void main()
{
	int n,i;
	char num[3][100];
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		scanf("%s %s",num[0],num[1]);
		minus(num[0],num[1]);
		printf("%s\n",a);
	}
}
int main()
{
	char a[100][100], b[100][100];
	int s[100][100]={0};
	int c=0;
	int p=0;
	int i, j;
	int k;
	int n;
	cin >> n;
	for ( i=0; i<n; i++ )
		cin >> a[i] >> b[i];
	for ( k=0; k<n; k++ )
	{
		c=0;
		p=0;
		for ( i=strlen(a[k])-1, j=strlen(b[k])-1; j >= 0; i--, j-- )
		{
			s[k][c] += a[k][i]-'0'-(b[k][j]-'0');
			if ( s[k][c]<0 )
			{
				s[k][c] += 10;
				s[k][c+1]--;
			}
			c++;
		}
		for ( ; i >= 0; i-- )
		{
			s[k][c] += a[k][i]-'0';
			if ( s[k][c]<0 )
			{
				s[k][c] += 10;
				s[k][c+1]--;
			}
			c++;
		}
		for ( i=100; i >= 0; i-- )
			if ( s[k][i] == 0 && p == 0 )
				continue;
			else
			{
				p=1;
				cout << s[k][i];
			}
		if ( p == 0 )
			cout << "0";
		cout << endl;
	}
	return 0;
}
int main()
{
	int n,i,j,x,y;
	char a[100],b[100];
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		scanf("%s",a);
		scanf("%s",b);
		x=strlen(a);
		y=strlen(b);
		for(j=y-1;j>=0;j--)
		{
			if(a[x-y+j]<b[j])
			{
				a[x-y+j]=a[x-y+j]+10-b[j]+48;
				a[x-y+j-1]-=1;
			}
			else
				a[x-y+j]=a[x-y+j]-b[j]+48;
		}
		printf("%s\n",a);
	}
	return 0;
}
int main()
{
    int n,time,i,j,len1,len2;
    char a[200],b[200];
    scanf("%d",&n);
    for(time=0;time<n;time++)
    {
        scanf("%s",a);
        scanf("%s",b);
        len1=strlen(a);
        len2=strlen(b);
        j=0;
        for(i=0;i<len1;i++)
        {
            if(i<len2)
                a[len1-i-1]-=(b[len2-i-1]-'0');
            if(a[len1-i-1]<'0')
                a[len1-i-2]-=1;
        }
        j=0;
        for(i=0;a[i]!=0;i++)
        {
            if(a[i]!='0')j=1;
            if(j)printf("%c",(a[i]>='0'?a[i]:a[i]+10));
        }
        printf("\n");
    }
    return 0;
}
int s1[MAX];
int s2[MAX];
char num1[MAX];
char num2[MAX];
int Minus(int maxx, int * s1, int *s2)
{
	int i;
	int largest = 0;
	for(i=0;i<maxx;i++)
	{
		s1[i]-=s2[i];
		if(s1[i]<0)
		{s1[i] += 10;
		s1[i+1] --; //jiewei
		}
		if(s1[i])
			largest = i;
	}
	return largest;
}

int main()
{
	int n;
	scanf("%d",&n);
	while(n--)
	{
		scanf("%s",num1);
		scanf("%s",num2);
		int i,j;
		memset(s1,0,sizeof(s1));
		memset(s2,0,sizeof(s2));
		int n1=strlen(num1);
		for(j=0,i=n1-1;i>=0;i--)
			s1[j++]=num1[i]-'0';
		int n2=strlen(num2);
		for(j=0,i=n2-1;i>=0;i--)
			s2[j++]=num2[i]-'0';
		int largest = Minus(MAX,s1,s2);
		for(i=largest;i>=0;i--)
			printf("%d",s1[i]);
		printf("\n");
	}
	return 0;
}
void main()
{
	char a[101],b[101];
    int n,c,d,p,i,j=0,t;
	scanf("%d",&n);
	for(p=1;p<=n;p++)
	{
		scanf("%s%s",a,b);
        c=strlen(a);
	    d=strlen(b);
	    for(i=1;i<=d;i++)
		{
			if(b[d-i]<=a[c-i])
				a[c-i]=a[c-i]-b[d-i]+48;
			else 
			{
				a[c-i]=a[c-i]-b[d-i]+58;
				if(a[c-1-i]>48)
					a[c-1-i]--;
				else
				{
					t=i;
					while(a[c-1-t]==48)
					{
						a[c-1-t]=9+48;
						t++;
					}
					a[c-1-t]--;
				}
			}
		}
	    while(a[j]==48)
			j++;
		for(;j<c;j++)
			printf("%c",a[j]);
		j=0;
		printf("\n");
	}
}
main()
{
	int i,k,r,N;
	int a1[250],b1[250],c[250];
	char a[250],b[250];
    scanf("%d",&N);
   	for (i=1;i<=N;i++)
	{
		
	    for (k=0;k<250;k++)
		{
			a[k]=0;
			b[k]=0;
			a1[k]=0;
			b1[k]=0;
			c[k]=0;
     	}
		scanf("%s%s",a,b);
		for (k=249;k>=0;k--)
		if  (a[k]>='0'&&a[k]<='9')
				a1[k+250-strlen(a)]=a[k]-'0';
		for (k=249;k>=0;k--)
		if  (b[k]>='0'&&b[k]<='9')
				b1[k+250-strlen(b)]=b[k]-'0';
		/*for (k=0;k<250;k++)
			printf("%d",a1[k]);
		printf("\n");
        for (k=0;k<250;k++)
			printf("%d",b1[k]);
		printf("\n");*/
		for (k=249;k>=0;k--)
		{
			if (a1[k]<b1[k])
			{
				a1[k]+=10;
			    a1[k-1]--;
			}
			c[k]=a1[k]-b1[k];
		}
		r=0;
        while(c[r]<=0&&r<250)
			r++;
		if (r==250)
			printf("0");
        for (k=r;k<250;k++)
        printf("%d",c[k]);
		printf("\n");
	}
	
}
void main()
{
	char a[101],b[101];
	int c[100],d[100];
	int i,l1,l2,n,j;
	scanf("%d",&n);
	while(n--)
	{
		scanf("%s%s",a,b);
		l1=strlen(a);
		l2=strlen(b);
		//printf("%d,%d\n",l1,l2);
		for(i=0;i<l1;i++)
		c[i]=a[l1-i-1]-'0';
		for(i=0;i<l2;i++)
		d[i]=b[l2-i-1]-'0';
		
		for(i=0;i<l2;i++)
		{
			c[i]-=d[i];
			if(c[i]<0)
			{
				c[i]+=10;
				c[i+1]--;	
			}	
		}
		for(i=l1-1;i>=0;i--)
		if(c[i]!=0) break;
		for(j=i;j>=0;j--)
		printf("%d",c[j]);
		printf("\n");
	}
		
}
int leap(int *p,int n)
{                                                                               
    if(n==0) return -1;                                                          
    if((*p)!=0) return 0;
    else return leap(p+1,n-1)+1;
}
int main()
{
    int n,i;
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
                    char a[100],b[100];
                    int j,k=0,f=0,c[100]={0};
                    scanf("%s %s",a,b);
                    int len1=strlen(a),len2=strlen(b);                                          
                    for(j=len2-1;j>=0;j--)
                                          b[j+len1-len2]=b[j];
                    for(j=len1-len2-1;j>=0;j--)
                                               b[j]='0';
                    for(j=len1-1;j>=0;j--)
                    {
                                          c[j]=a[j]-b[j]-k;
                                          if(c[j]<0)
                                          {
                                                    c[j]+=10;
                                                    k=1;
                                          }
                                          else k=0;
                    }
                    j=leap(c,len1);
                    if(j==-1) printf("0");
                    else
                        for( ;j<len1;j++)
                                         printf("%d",c[j]);
                    printf("\n");
    }
    return 0; 
}
int main()
{
      char a[100],b[100];
      int c[100],d[100],i,j,k,l,n;
      scanf("%d",&n);
      for(l=0;l<n;l++)
      {
                      scanf("%s\n",a);
                      scanf("%s",b);
                      memset(c,0,sizeof(c));
                      memset(d,0,sizeof(d));
                      int n1=strlen(a);
                      j=0;
                      for(i=n1-1;i>=0;i--)  c[j++]=a[i]-'0';
                      int n2=strlen(b);
                      j=0;
                      for(i=n2-1;i>=0;i--)  d[j++]=b[i]-'0';
                      for(i=0;i<100;i++)
                      {
                                        c[i]=c[i]-d[i];
                                        if(c[i]<0)
                                        {
                                                  c[i]=c[i]+10;
                                                  c[i+1]--;
                                        }
                      }
                      k=99;
                      while(c[k]==0&&k>0) k--;
                      for(i=k;i>=0;i--) printf("%d",c[i]);
                      printf("\n");
      }
      return 0;
}
int main()
{
	int n;
	cin>>n;
	for(int i=0;i<=n-1;i++)
	{
		char a[101],b[101];
		cin>>a>>b;
		int c=strlen(a);
		int d=strlen(b);
		int e[100],f[100];
		int h=0,j=0;
		for(int g=c-1;g>=0;g--)
		{
			e[h]=a[g]-'0';
			h++;
		}//????????
		for(int g=d-1;g>=0;g--)
		{
			f[j]=b[g]-'0';
			j++;
		}
		for(int g=d;g<100;g++)
			f[g]=0;//?????????????????0
		int l[100]={0};
		for(int k=0;k<=c-1;k++)
		{
			if(e[k]>=f[k])
			{
				l[k]=e[k]-f[k];
			}
			else
			{
				l[k]=e[k]+10-f[k];
				e[k+1]=e[k+1]-1;//????????????????????????
			}
		}
		int t=99;
		while(l[t]==0)//?????????
			t--;
		for(;t>=0;t--)
			cout<<l[t];
		cout<<endl;
	}
	
	
	return 0;
	
	
}
int main()
{
	int n,i,j,m,l,d;
	char a[100],b[100];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s",a);
		scanf("%s",b);
		m=strlen(a);
		l=strlen(b);
		d=l;
		for(j=m-1;j>m-d-1;j--)
		{
			if(a[j]>=b[l-1])
			{
				a[j]=a[j]-b[l-1]+48;
				l--;
			}
			else
			{
				a[j]=a[j]+10-b[l-1]+48;
				a[j-1]=a[j-1]-1;
				l--;
			}
		}
		j=0;
		while(a[j]==0)
			j++;
		for(;j<m;j++)
			printf("%c",a[j]);
	 	printf("\n"); 
	}
	return 0;
}
void f(void);
void main()
{
 int n,i;
 scanf("%d",&n);
 for (i=0;i<n;i++)
	 f();
}
void f()
{
 int i,x,y,n=0;
 char a[101]={""},b[101]={""};
 scanf("%s%s",a,b);
 x=strlen(a);
 y=strlen(b);
 for (i=0;i<=y-1;i++)
	 if (a[x-1-i]>=b[y-1-i]) a[x-1-i]=a[x-1-i]-b[y-1-i]+48;
	 else {a[x-2-i]=a[x-2-i]-1;a[x-1-i]=a[x-1-i]-b[y-1-i]+10+48;}
 while(a[n]=='0')
 { n++;}
 for (i=n;i<=x-1;i++)
	 printf("%c",a[i]);
 printf("\n");
}