semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int main()
{
    char a[100];
    cin>>a;
    int s=0;
    for (int i=0;i<101;i++)
    {
        if (a[i]=='\0')
        break;
        s++;
    }
    int b[100],c[100];
    for (int i=0;i<s;i++)
     b[i]=a[i]-48;
     if (s==1)
     cout<<0<<endl<<b[0];
    else if (s==2&&(b[0]*10+b[1])<13)
    cout<<0<<endl<<b[0]*10+b[1];
    else
     {
     int k=0;
     int m=0;
     int p=0;
     int q=s;
    for(;;)
    {
           m=b[k]*10+b[k+1];
          c[p]=m/13;
          p++;
          b[0]=m%13;
          for (int j=1;j<q;j++)
            b[j]=b[j+1];
         q--;                     
      if (q==1)
      break;
    } 
    for(;;)
    {
       if (c[0]!=0)
       break;
       else
       {   
           for (int j=0;j<p-1;j++)
          c[j]=c[j+1];
          p--;    
       }
       }
    for (int i=0;i<p;i++)
    cout<<c[i]; 
    cout<<endl; 
    cout<<b[0];
   }          
   return 0;

}
char num[105];
int begin[105]={0},temp=0,len,i;
int main()
{
    cin.getline(num,105);
    len=strlen(num);
    for(i=0; i<len; i++)
        begin[i]=num[i]-'0';
    if(len==1) cout<<"0"<<endl<<begin[0]<<endl;
    else if(len==2)
    {
           temp=begin[0]*10+begin[1];
           cout<<temp/13<<endl;
           cout<<temp%13<<endl;
    }
    else if(len>2)
    {
           temp=begin[0]*10+begin[1];
           if(temp>=13)
           {
                  cout<<temp/13;
                  temp=temp%13;
           }
           for(i=2;i<len;i++)
           {
                  temp=temp*10+begin[i];
                  cout<<temp/13;
                  temp=temp%13;
           }
           cout<<endl<<temp<<endl;
    }

    return 0;
}
int main()
{
    int a,b,i,l,j,x=0,y=0;
    char n[100],s[100];
    scanf("%s",n);
    l=strlen(n);
    for(i=0;i<l;i++)
    {
                   x=y*10+n[i]-'0';
                   y=x%13;
                   s[i]=x/13+'0';
                   }
                   if(l==1)
                   {
                   printf("%d\n",0);
                   printf("%d",y);
                   }
                   else if(l==2)
                   {
                   if(s[1]==0)
                   {
                   printf("%d\n",0);
                   printf("%d",y);
                   }
                   else
                   printf("%c\n%d",s[1],y);
                   }
                   else
                   {
                   if(s[1]=='0')
                   {
                   for(i=2;i<l;i++)
                   {
                   printf("%c",s[i]);
                   }
                   printf("\n%d",y);
                   }
                   else
                   {
                       for(i=1;i<l;i++)
                       {
                       printf("%c",s[i]);
                       }
                       printf("\n%d",y);
                       }
                       }
                       getchar();
                       getchar();
                       }
int main()
{
 char s[1000];
 int m,i,j,l,a[1000],k,b[1000];
 scanf("%s",&s);
 l=strlen(s);
 if(l==1)
 {
  printf("0\n");
  printf("%d\n",s[0]-'0');
 }
 else if(l==2)
 { 
  if((s[0]-'0')*10+(s[1]-'0')<13)
  {
   printf("0\n");
   printf("%d\n",(s[0]-'0')*10+(s[1]-'0'));
  }
  else
  {
   printf("%d\n",((s[0]-'0')*10+(s[1]-'0'))/13);
   printf("%d\n",((s[0]-'0')*10+(s[1]-'0'))%13);
  }
 }
 else
 {
  for(i=0;i<l;i++)
   b[i]=s[i]-'0';
  for(i=0;i<l;i++)
  {
   m=b[i]*10+b[i+1];
   if(m>=13)
   {
    a[i]=m/13;
    b[i+1]=m%13;
   }
   else
   {
    a[i]=0;
    m=m*10+b[i+2];
    i++;
    a[i]=m/13;
    b[i+1]=m%13;   
   }   
  }
  k=b[i-1];
  if(a[0]==0)
  {
   for(i=1;i<l-1;i++)
   printf("%d",a[i]);
   printf("\n%d",k); 
  }
  else
  {
   for(i=0;i<l-1;i++)
   printf("%d",a[i]);
   printf("\n%d",k); 
  }
 }
 getchar();
 getchar();
 getchar();
 getchar();
 return 0;
}
int main(){
	char num[101], quot[101];
	int r = 0, index = 0;

	cin >> num;
	for (int i = 0; num[i] != '\0'; i++){
		r = r * 10 + num[i] - '0';
		if (r < 13){
			if (index != 0)
				quot[index++] = '0';
		}else{
			quot[index++] = r / 13 + '0';
			r = r % 13;
		}
	}
	if (index == 0){
		cout << 0 << endl;
	}else{
		quot[index] = '\0';
		cout << quot << endl;
	}
	cout << r << endl;
	return 0;
}
int num(char x);

int main()
{
	char z[105];
	scanf("%s",z);
	int i;
	int mid=num(z[0]);
	int m;
	if((z[2]==0 && num(z[0])*10+num(z[1])<13))
	{
		printf("0\n%d",num(z[0])*10+num(z[1]));
	}
	else if(z[1]==0)
	{
		printf("0\n%d",num(z[0]));
	}
	else
	{
		for(i=1;z[i]!=0;i++)
		{
			mid=mid*10;
			mid += num(z[i]);
			m=0;
			if(i==1 && mid<13)
			{
				continue;
			}
			while(mid>=13)
			{
				m++;
				mid-=13;
			}
			printf("%d",m);
		}
		printf("\n");
		printf("%d",mid);
	}
	return 0;
}

int num(char x)
{
	int a;
	a=(int)x;
	a=a-48;
	return a;
}
main()
{      char a[100],c[100];     
       gets(a);      
int i,b,d,e;     
 if (a[1]=='\0')            
{                
 printf("0\n");                
 printf("%c",a[0]);            
}     
 else if (a[2]=='\0'&&a[0]-'0'==1)     
 {           
 if (a[1]-'0'<3)            
{              
  printf("0\n");             
   printf("%c",a[0]);             
   printf("%c",a[1]);          
  }           
 else          
  {               
 printf("1\n");              
  printf("%d",a[1]-'0'-3);            }      }       else       {            i=0;            b=a[i]-'0';            while (a[i]!='\0')          {         d=b/13;         e=b%13;         b=e*10+(a[i+1]-'0');         c[i]=d+'0';         i++;          }       if (c[1]!='0')       {           i=1;           while (c[i]>='0'&&c[i]<='9')           {               printf("%c",c[i]);               i++;           }       }       else if (c[1]=='0')       {           i=2;           while (c[i]>='0'&&c[i]<='9')           {               printf("%c",c[i]);               i++;           }       }      printf("\n%d",e);      }     getchar();getchar();getchar();getchar();getchar();getchar();getchar();getchar();getchar();}
int main ()
{
	int i,n,j,k,m;
	char a[103],c[103],d[2];
	scanf("%s",a);
	n=strlen(a);
	if(n==1)
		printf("0\n%c",a[0]);
	else if(n==2&&((a[0]-48)*10+a[1]-48<13))
	{
		printf("0\n");
		printf("%c%c",a[0],a[1]);
	}
	else if((n>3)||(n==2&&((a[0]-48)*10+a[1]-48>13)))
	{
		for(i=0;i<n-1;i++)
		{
			if (i==0)
			{
				m=a[i]-48;
				c[i]='0';
			}
			k=m*10+(a[i+1]-48);
			if (k>=13)
			{
				c[i+1]=k/13+48;
				m=k%13;
			}
			else
			{
				c[i+1]='0';
				m=k;
			}
		}
		if(m>9)
		{
			d[0]='1';
			d[1]=m-10+48;
		}
		else
		{
			d[0]=m+48;
			d[1]='\0';
		}
		for(i=0;i<n;i++)
		{
			if (c[i]!='0')
			{
				j=i;
				break;
			}
		}
		for(i=j;i<n;i++)
			printf("%c",c[i]);
		printf("\n");
		puts(d);
	}
	return 0;
}
int main()
{
	char bei[100];
	char shang[100]={0};
	int i,j,n;
	scanf("%s",bei);
	n=strlen(bei);
	if(n==1)
	{	
		printf("0\n");
		printf("%c",bei[0]);
	}
	else if (((bei[0]-'0')*10+bei[1]-'0')<13 && bei[2]==0)
	{
		printf("0\n");
		for (i=0;i<2;i++)
		printf("%c",bei[i]);
	}
	else
	{
	for (i=0;i<n-1;i++)
	{
		shang[i]=((bei[i]-'0')*10+bei[i+1]-'0')/13+'0';
		bei[i+1]=((bei[i]-'0')*10+bei[i+1]-'0')%13+'0';
	}
	if (shang[0]!='0')
		printf("%c",shang[0]);
	for (i=1;shang[i]!=0;i++)
		printf("%c",shang[i]);
	printf("\n");
	if (bei[n-1]>='0' && bei[n-1]<='9')
		printf("%d",bei[n-1]-'0');
	else printf("%d",bei[n-1]-'0');
	}
	return 0;
}
int main()
{
	char mun[100];
	int i, len, mod = 0, flag = 0;
	cin >> mun;
	len = strlen(mun);
	for (i = 0; i < len; i++)
	{
		mod = mod * 10 + mun[i] - '0';
		if (flag == 0 && (mod / 13) == 0)
			continue;
		else
		{
			cout << mod / 13;
			flag = 1;
		}
		mod = mod % 13;
	}
	if (flag == 0)
		cout << 0;
	cout << endl << mod << endl;
	return 0;
}
main()
{
 int m,n,i,j=0,x=0,y,b[101],d[101];
 char a[101],c[101];
 scanf("%s",a);
 n=strlen(a);
 
   for(i=0;i<n;i++)
   {
      b[i]=a[i]-'0'; 
   } 
   
    for(i=0,j=0;i<n-1;i++)
    {
      while( b[i]<13 && i<n-2 )
      {  
        d[i]=0;    
        b[i+1]=10*b[i]+b[i+1];
        i++;        
       }        
        d[i]=b[i]/13;               
        b[i+1]=b[i]%13*10+b[i+1];  
    } 
             
    d[n-1]=b[n-1]/13; 
    y=b[n-1]%13;
    
   for (i=0;i<=n-1;i++)
   {
    x+=d[i];
   }
    
    if( x==0)
    printf("%d",x);
    else
   {
     for (i=0,j=0;i<=n-1;i++,j++)
      {
        if (d[i]!=0)
        break;    
      } 
     for(m=j;m<=n-1; m++)
     printf("%d",d[m]);
    }
    
  printf("\n");
  printf("%d",y);
    
 }
int main()
{
	char a[101],s[101],p;
	int i,j,len,sh;
	scanf("%s",a);
	len=strlen(a);
	for(i=0;i<=len-1;i++) s[i]='0';
	if(a[0]=='1'&&a[1]=='0') i=2;
    else i=1;
	while(i<len)
	{
		if(i>=2) p=a[i-2];
		else p='0';
		while((int)(s[i]-'0')*13<=(int)(p-'0')*100+(int)(a[i-1]-'0')*10+(int)(a[i]-'0'))
		{
			s[i]++;						
		}
		if(s[i]>'0') s[i]--;
			sh=(int)(s[i]-'0')*13;
			a[i]=a[i]-sh%10;
			if(a[i]<'0')
			{
				a[i-1]--;
				a[i]=a[i]+10;
			}
			a[i-1]=a[i-1]-((sh%100)/10);
			if(a[i-1]<'0')
			{
				a[i-2]--;
				a[i-1]=a[i-1]+10;
			}
			if(i>=2) a[i-2]-=sh/100;
			i++;
	}
	i=0;
	while(s[i]=='0'&&i<len-1) i++;
	for(j=i;j<=len-1;j++)
	{
		printf("%c",s[j]);
	}
	printf("\n");
	i=0;
	while(a[i]=='0'&&i<len-1) i++;
    for(j=i;j<=len-1;j++)
	{
		printf("%c",a[j]);
	}
	return 0;
}
main()
{
   char a[100];
   int b,c,d,i;
   scanf("%s",a);
   if((a[1]=='\0')||((a[2]=='\0')&&(a[0]=='1')&&(a[1]<'3')))printf("0\n%s",a);
   else
   {                                                                                                             
     if((a[0]=='1')&&(a[1]<'3'))
     {
       b=(a[0]-'0')*100+(a[1]-'0')*10+(a[2]-'0');
       i=2;
    }
     else
     {
       b=(a[0]-'0')*10+(a[1]-'0');
       i=1;
      }
   while(a[i]!='\0')
   {
      c=b/13;
      printf("%d",c);
      d=b%13;
      i++;
      b=d*10+a[i]-'0';
    }
      printf("\n%d",d);
   }
}
int main()
{
	int n,m,l,p,q,i;
	char s[110]={'\0'},x[110]={'\0'};
	scanf("%s",s);
	l=strlen(s);m=s[0]-'0';
	for(i=0;i<l-1;i++)
	{
		m=m*10+s[i+1]-'0';
		x[i]=(m/13)+'0';m=m%13;
	}
	if(x[0]=='0')
	{
		for(i=0;i<l;i++)
		{
			x[i]=x[i+1];
		}
	}
	if(x[0]=='\0')
	{
		x[0]='0';
	}
	printf("%s\n%d\n",x,m);	
}
main()
{
    char a[100];
    char b[100];
    int i,length,n;
    gets(a);
    length=strlen(a);
    if((length==1)||((length==2)&&(a[0]=='1')&&(a[1]<'3')))
    {
        printf("0\n");
        puts(a);
    }
    else
    {


                                                               //the main part of calculation


        if(((a[0]=='1')&&(a[1]<'3'))!=0)
        {
            for(i=0;i<length-1;i++)
        {
            b[i]=(10*(a[i]-'0')+a[i+1]-'0')/13+'0';
            a[i+1]=(10*(a[i]-'0')+a[i+1]-'0')-13*(b[i]-'0')+'0';
        }
            for(i=1;i<length-1;i++)
            {
                printf("%c",b[i]);

            }
            printf("\n%d",a[length-1]-'0');                //don't print zero( b[0]=0)

        }
        else
        {
           for(i=0;i<length-1;i++)
        {
            b[i]=(10*(a[i]-'0')+a[i+1]-'0')/13+'0';
            a[i+1]=(10*(a[i]-'0')+a[i+1]-'0')-13*(b[i]-'0')+'0';
        }
            for(i=0;i<length-1;i++)
            {
                printf("%c",b[i]);
            }
            printf("\n%d",a[length-1]-'0');                //normally print

        }


    }
}
int main()
{
	int sz1[200],sz2[200],i,t,n,carry=0;
	char zfc[200]={0};
	scanf("%s",zfc);
	for(i=0;zfc[i]!=0;i++)
	{
		sz1[i]=zfc[i]-'0';
	}
    n=i;
	for(i=0;i<n;i++)
	{
        sz2[i]=(sz1[i]+carry)/13;
		t=(sz1[i]+carry)%13;
		carry=10*t;
	}
	for(i=0;i<n;i++)
	{
		if(sz2[i]!=0)
		{
			for(t=i;t<n;t++)
			{
				printf("%d",sz2[t]);
			}
			break;
		}
	}
	if(i==n)
	{
		printf("0");
	}
	printf("\n");
	printf("%d",carry/10);
	return 0;
}
int main()
{
	char a[max],shang[max];
	int yu,i,j,n;
	gets(a);
	n=strlen(a);
	if(n==1)
	{
		printf("0\n");
		printf("%d",a[0]-'0');
		return 0;
	}
	if(n==2)
	{
		if(((a[0]-'0')*10+a[1]-'0')<13)
		{
			printf("0\n");
			printf("%s",a);
		}
		else
		{
			printf("%d\n",((a[0]-'0')*10+a[1]-'0')/13);
			printf("%d",((a[0]-'0')*10+a[1]-'0')%13);
		}
	}
	else
	{
		yu=(a[0]-'0')*10+a[1]-'0';
		if(yu<13)
		{
		    yu=yu*10+a[2]-'0';
		    shang[0]=yu/13;
		    yu=yu%13;
		for(i=3;i<n;i++)
		{
            yu=yu*10+a[i]-'0';
			shang[i-2]=yu/13;
			yu=yu%13;  
        }
        for(i=0;i<n-2;i++)
        printf("%d",shang[i]);
        printf("\n");
        printf("%d",yu);
        }
		
		if(yu>=13)
		{
			shang[0]=yu/13;
			yu=yu%13;
			for(i=2;i<n;i++)
		{
            yu=yu*10+a[i]-'0';
			shang[i-1]=yu/13;
			yu=yu%13;  
        }
        for(i=0;i<n-1;i++)
        printf("%d",shang[i]);
        printf("\n");
        printf("%d",yu);
		}
	}
	return 0;
}
//****************************************
//*??: ??13                         **
//*????? 1100012816                **
//*???2011.11.8                      **
//****************************************
int main()//???
{//?????
	int i,c,t,flag = 0,a[101] = {0},b[101] = {0};//????
	char num[101];//????????
	cin.getline(num,101);//????
	c = strlen(num);//???????
	for(i = 0;i < c;i++)
	{
		a[i] = num[i] - '0';//?????????????
	}
	for(i = 0;i < c;i++)//??????????13?????
	{
		t = b[i] + a[i];
		b[i] = t/13;
		b[i+1]+=(t % 13) * 10;//?????????????????13???????10
	}
	for(i = 0;i < c-1;i++)
	{
		if(b[i] != 0 || (b[i] == 0 && flag == 1))
		{
			flag = 1;
			cout << b[i];//???????????????
		}
		if(flag == 0)
			continue;
	}
	cout << b[c-1] << endl << b[c]/10 << endl;//?????????
	return 0;
}//?????
int main(){
	char ZFC[105];
	int SZ[105];
	int n;
	int e=0,s=0;
	gets(ZFC);
	n=strlen(ZFC);
	for(int i=0;i<n;i++)
	{
		SZ[i]=ZFC[i]-48;
	}
	int a=SZ[0];
	for(int j=0;j<n-1;j++)
	{
		e=10*a+SZ[j+1];
		s=e/13;
		a=e%13;
		if(j==0&&s==0)
		{
			continue;
		}
		if(j<n-2)
		{
			printf("%d",s);
		}
		else if(j==n-2)
		{
			printf("%d\n",s);
			printf("%d\n",a);
		}
	}

	if(n==1)
	{
	printf("0\n");
	printf("%d\n",SZ[0]);	
	}
	if(n==2&&SZ[0]*10+SZ[1]<13)
	{
	printf("0\n");
	printf("%d\n",SZ[0]*10+SZ[1]);	
	}
	//scanf("%d",&n);
	return 0;
}
main()
{
     char N[100];
     int sh[100]={0},i;
     gets(N);
     int n=strlen(N);
     int y=N[0]-'0'; 
     for(i=1;i<n;i++)
     {
         sh[i]=(y*10+N[i]-'0')/13;
         y=(y*10+N[i]-'0')%13;
     }
     if(sh[1]==0&&sh[2]==0) printf("0");
     else
     {
         int j=1;
         if(sh[j]==0) j++;
         for(;j<n;j++)
             printf("%d",sh[j]);
     }
     printf("\n%d\n",y);
}
//*******************************************************
//* file: 3.cpp
//* description: ??13
//* author: ?? 1200012858
//* date: 2012-11-18
//*******************************************************
int main ()
{
	char num[100] = {""};
	int a[101];
	memset(a, -1, sizeof(a)); // ??????-1
	int i, j, k, r = 0, count = 0;
	cin >> num;
	for (i = 0; num[i] != 0; i++)
	{
		 a[i] = (r * 10 + num[i] - '0') / 13;
		 r = (r * 10 + num[i] - '0') % 13;
	}
	if(a[1] == -1)
		cout << 0;
	if (a[0] == 0 && a[1] == 0 && a[2] == -1)
		cout << 0;
	for (k = 0; ; k++)
	{
		if (a[k] != 0) break;
	}
	for (j = k; j < i; j++)
	{
		cout << a[j];
	}
	cout << endl;
	cout << r << endl;
	return 0;
}
main(){
char num[100],ans[100];
int i,j,k,t;
char s;
for(i=0;i<100;i++){
ans[i]='\0';
}
scanf("%s",num);
for(i=0;num[i]!='\0';i++){
}
if(i<=1)
printf("0\n%s",num);
else{
j=(num[0]-'0')*10+num[1]-'0';
if((i==2)&&(j<=13))
printf("0\n%s",num);
else{
for(j=0;j<i-2;j++){
k=(num[j]-'0')*10+num[j+1]-'0';
num[j+1]=k%13+'0';
k=k/13;
s=k+'0';
ans[j]=s;
}
k=(num[i-2]-'0')*10+num[i-1]-'0';
t=k%13;
k=k/13;
s=k+'0';
ans[j]=s;
if(ans[0]=='0')
{
for(j=0;j<100;j++){
ans[j]=ans[j+1];
}
}
printf("%s\n%d",ans,t);
}
}
}
int main()
{
    int l,i,j,c,d,e;
    int b[100];
    char a[100];
    scanf("%s",a);
    l=strlen(a);
    for (i=0;i<l;i++)
    {
        a[i]=a[i]-48;
    }
    if(l==1 || (l==2&&a[0]*10+a[1]<13))
    {
        d=0;
        if (l==2)
        e=a[0]*10+a[1];
        else
        e=a[0];
        printf ("%d\n",d);
        printf ("%d",e);
    }
   
    else
    {
    for (j=0,i=0;j<l-1 ;j++)
    { 
        b[j]=(a[i]*10+a[i+1])/13;
        a[i+1]=(a[i]*10+a[i+1])%13;
        c=a[i+1];
        i=i+1;
    }
    if (b[0]==0)
    {
        for (j=1;j<l-1;j++)
        printf ("%d",b[j]);
    }
    else
    {
        for (j=0;j<l-1;j++)
        printf ("%d",b[j]);
    }
    printf ("\n");
    printf ("%d",c);
    }
    getchar();getchar();getchar();
}
main()
{
    char a[101],q[101];
    int i=0,rem=0,d=0,b[101];
    scanf("%s",a);
    if(a[1]=='\0') printf("0\n%c",a[0]);
    else if(((a[0]-'0')*10+a[1]-'0'<13)&&a[2]=='\0')
    printf("0\n%s",a);
    else{
    b[0]=10*(a[0]-'0')+a[1]-'0';
    for(i=0;i<=strlen(a)-2;i++)
    {
        q[i]=(b[i]/13)+'0';
        rem=b[i]%13;
   /*     printf("%c,%d\n",q[i],b[i]);        */
        b[i+1]=a[i+2]+rem*10-'0';
        }
     q[strlen(a)-1]='\0';
     if(q[0]=='0')
        {
            for(i=0;q[i]!='\0';i++)
            {
                  q[i]=q[i+1];
                  }
        }
    printf("%s\n",q);
    printf("%d",rem);}
}
main()
{
      int i,j,k,l,m,n,tem;
      char num[100],res[100];for(i=0;i<100;i++)res[i]='\0';
      gets(num);
      tem=num[0]-'0';
      res[0]='0';
      l=strlen(num);
      for(i=1;i<l;i++)
      {
                      tem=tem*10+(num[i]-'0');
                      res[i-1]=tem/13+'0';
                      tem=tem%13;
      }
      if(strlen(res)!=1&&res[0]=='0')
      {
                                     for(i=0;i<l;i++)
                                     res[i]=res[i+1];
      }
      printf("%s\n",res);
      printf("%d",tem);
}
int main()
{
	char num[200];
	int i, count = 0, mod = 0, div[200];
	cin >> num;
	for (i = 0; num[i] != '\0'; i++)
	{
		count++;
		div[i] = (num[i] - 48 + mod) / 13;
		mod = (num[i] - 48 + mod) % 13;
		mod *= 10;
	}
	for (i = 0; i < count; i++)
	{
		if (div[i] != 0)
		{
			for (int j = i; j < count; j++)
			{
				cout << div[j];
			}
			cout << endl << mod / 10 << endl;
			return 0;
		}
		if (i == count - 1)
		{
			cout << 0 << endl;
			cout << mod / 10 << endl;
		}
	}
	return 0;
}
char s[1000];
int i ,len,sum,p;
int flag;
void main()
{
	scanf("%s",s);
	len = strlen(s);
	sum = 0 ; flag = 1;
	for (i = 0; i < len ; ++i)
	{
		sum =(sum*10+s[i]-'0');
		p = sum/13;
		sum = sum%13;
		if (!p && flag) continue;
		flag = 0;
		printf("%d",p);
	}
	if (flag) printf("%d",0);
	printf("\n");
	printf("%d\n",sum);
}
main()
{
      char a[101];
      int b[101],s,m,n,c=0,i,p,q=1,sum=0;
      scanf("%s",a);
      for(i=0;a[i]!='\0';i++)
      c++;
      c++;
      for(i=0;i<c-1;i++)
      b[i]=a[i]-'0';
      if(c>=10)
      {s=100*b[0]+10*b[1]+b[2];
      m=s/13;
      n=s%13;
      printf("%d",m);i=3;
      do{
               s=100*b[i]+10*b[i+1]+b[2+i];
               m=(n*1000+s)/13;
               n=(n*1000+s)%13;
               if(m>99)
               printf("%d",m);
               else if(m>9)
               printf("0%d",m);
               else
               printf("00%d",m);
               i=i+3;}while(i+3<=c-1);
               if(i==c-3)
               {s=n*100+10*b[c-3]+b[c-2];
               m=s/13;
               n=s%13;
               if(m>9)
               printf("%d\n%d",m,n);
               else
               printf("0%d\n%d",m,n);}
               if(i==c-2)
               {
                         s=10*n+b[c-2];
                         m=s/13;
                         n=s%13;
                         printf("%d\n%d",m,n);
                         }
                         if(i==c-1)
                         {
                                 printf("\n%d",n);}}
                                 else
                                { for(i=c-2;i>=0;i--)
                                 {
                                                    p=b[i]*q;
                                                    q=q*10;
                                                    sum=sum+p;}
                                                    printf("%d\n%d",sum/13,sum%13);}
                                                   
                                                                  }
char temp[100]={"\0"};
int main()
{
	int len;
	int i;
	int a[105]={0};
	int num;
	char c[105]={"\0"};
	cin>>c;
	len=strlen(c);
	for (i=0;i<105;i++)
		a[i]=c[i]-'0';
	if (len<2)
	{
		cout<<'0'<<endl<<a[0]<<endl;
		return 0;
	}
	else 
	{
		num=a[0]*10+a[1];
		if (num>13)
			cout<<num/13;
		else if (len==2)
			cout<<'0'<<endl;
		a[1]=num%13;
		for (i=1;i<len-1;++i)
		{
			num=a[i]*10+a[i+1];
			a[i+1]=num%13;
			cout<<num/13;
		}
		cout<<endl;
		cout<<a[i]<<endl;
	}
return 0;	
}
// ??13.cpp : ??????????????
//


int main()
{
	char num[100];
	memset (num,'0',100);
	int x = 0,i,j,k,r = 0,result[100];
	cin >> num;
	for (i = 0;num[i] != '\0';i++)
	{
		result[i] =(num[i] + r * 10 - '0' - (num[i] + r * 10 - '0') % 13) / 13;
		r = (num[i] - '0' + r * 10) % 13;
	}
	for (j = 0;j<= i - 1;j++)
	{
		if (result[j] != 0)
		{
			x=1;
			for (k = j;k <= i - 1;k++)
			{
				cout << result[k];
			}
			break;
		}
	}
	if (x == 0)
	{
		cout << "0";
	}
	cout << endl;
	cout << r;
	return 0;
}
int main()
{
	char a[101];
	int i;
	int l;
	int num[101]={-1};//?????????
	int num1[101]={0};//????
	cin.getline(a,101);
	l=strlen(a);		//???????
	for(i=0;i<l;i++)
	{num[i]=(int)a[i]-'0';
	}
	if(l==1)			//????
		cout<<0<<endl<<num[0]<<endl;
	else if(l==2&&10*num[0]+num[1]<13)
		cout<<0<<endl<<10*num[0]+num[1]<<endl;
	else				//????
	{
	for(i=0;i<l-1;i++)
	{	
		num1[i]=(10*num[i]+num[i+1])/13;
		num[i+1]=(10*num[i]+num[i+1])%13;
	}
	if(num1[0]!=0)
		cout<<num1[0];
	for(i=1;i<l-1;i++)
	cout<<num1[i];
	cout<<endl;
	cout<<num[l-1]<<endl;}
	cin.get();
	return 0;
}
int main()
{
 char v[103];
 int c[106],shang[106],yu[106];
 int a,b;
 scanf("%s",v);
 if(strlen(v)==1) {printf("%d",0);printf("\n%d",v[0]-48);}
 else if(strlen(v)==2){c[0]=v[0]-48;c[1]=v[1]-48;a=(10*c[0]+c[1])/13;b=(10*c[0]+c[1])%13 ;  printf("%d",a);printf("\n%d",b);}
 else if(strlen(v)>=3) {for(int i=0;i<=strlen(v)-1;i++)
  {
    c[i]=v[i]-48;  
        
  }
 for(int j=0;j<strlen(v)-1;j++)
 {
   shang[j]=(10*c[j]+c[j+1])/13;
   yu[j]=(10*c[j]+c[j+1])%13;
   c[j+1]=yu[j];
   
 }
 

 if(shang[0]==0){printf("%d",shang[1]);}
  else {printf("%d",shang[0]);printf("%d",shang[1]);}
 for(int k=2;k<strlen(v)-1;k++)
 {
  
   printf("%d",shang[k]);
  
 } 
printf("\n%d",yu[strlen(v)-2]); }
int y; scanf("%d",&y);
return 0;    
}
main()
{
  char x[100],y[100]={'\0'};
  int  i,a,b,c,d;
  scanf("%s",x);
    if(x[1]=='\0')
    y[0]='0';
   c=x[0]-'0';
  for(i=1;x[i]!='\0';i++)
  {
      a=x[i]-'0';
      b=c*10+a;
      if(b>=13)
      {
          c=b%13;
          d=b/13;
          y[i-1]='0'+d;       
      }   
      else
      {    
           c=b;
           y[i-1]='0';
      }             
  } 
  if(y[0]=='0' && x[1]!='\0' && x[2]!='\0')
  {
    for(i=0;y[i]!='\0';i++)
    y[i]=y[i+1];             
  }  
  printf("%s\n%d",y,c); 

}
main()
{
      int i,chu,yu=0,count=0,shang[100],count2=0;
      char a[100];
      gets(a);
      for(i=0;i<100;i++)
      {
                        chu=yu*10+(int)(a[i]-'0');
                        shang[i]=chu/13;
                        count2++;
                        yu=chu%13;
                        if(a[i+1]=='\0')break;
      }
      if(count2==1 || count2==2){count=count2-1;}
      else if(shang[1]==0)count=2;
      else count=1;            
      for(i=count;i<count2;i++)
      {
                               printf("%d",shang[i]);
      }
      printf("\n%d",yu);
}
int main()
{
	char str[100],str2[100];
gets(str);
int len=strlen(str);
int temp=0;
int i,j=0;
for(i=0;i<len;i++)
{
	if(i==0)
		temp=str[i]-'0';
	else if(i==1&&(temp*10+str[i]-'0')<13)
		temp=(temp*10+str[i]-'0')%13;
	else
	{str2[j]=(temp*10+str[i]-'0')/13+'0';
	temp=(temp*10+str[i]-'0')%13;
	j++;}
}
if(j==0)printf("0\n%d",temp);
else {str2[j]=0; 
printf("%s\n%d",str2,temp);}
return(0);}