semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int main()
{
	char N[101];
	int e=1,len,i,j,n[100],shan[100];
	scanf("%s",&N);
	len=strlen(N);
	
	
	for(i=0;i<len;i++)
	{
		n[i]=N[i]-'0';
	}
	if((n[0]*10+n[1])<13)
	{
		e=2;
	}
	for(i=1;i<len;i++)
	{
		if(n[i-1]==0)
		{
			shan[i]=0;
			continue;
		}
		if((n[i-1]*10+n[i])/13>0)
		{
			shan[i]=(n[i-1]*10+n[i])/13;
			n[i]=(n[i-1]*10+n[i])%13;
		}
		else 
		{
			for(j=0;;j++)
			{
				if((n[i-1]*10+n[i])/13==0)
				{
					n[i]=n[i-1]*10+n[i];
					shan[i]=0;
			        i++;
				}
				else
				{
					break;
				}
			}
				shan[i]=(n[i-1]*10+n[i])/13;
			    n[i]=(n[i-1]*10+n[i])%13;
		}
	}
	for(i=e;i<len-1;i++)
	{
		printf("%d",shan[i]);
	}
	printf("%d\n",shan[len-1]);
	printf("%d",n[len-1]);
	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);
   }
   getchar();
   getchar();
   getchar();
   getchar();
}
int main()
{
    int b,i;
    char a[100];
    gets(a);
    b=(a[0]-'0')*10+a[1]-'0';
    if (((a[1]=='\0')||(b<13))&&(a[2]=='\0'))
    {
        printf("0\n");
        printf("%s",a);
        return 0;
    }
    b=a[0]-'0';
    for (i=0;a[i+1]!='\0';i++)
    {
    b=b*10+a[i+1]-'0';
    if (b>=13)
        {
            a[i]=b/13+'0';
            b=b%13;
        }
    else
    a[i]=0+'0';
    }
    a[i]=0;
    if(a[0]-'0'!=0)
    {
    printf("%s\n",a);
    printf("%d",b);
    }
    else
    {
    printf("%s\n",&a[1]);
    printf("%d",b);
    }

return 0;
}
int main()
{
	int i, j, r = 0;
	char num[100] = {0};
	char result[100] = {0};
	cin >> num;
	for (i = 0; num[i] != 0; i++)
	{
		result[i] = (r * 10 + num[i] - '0') / 13 + '0';
		r = (r * 10 + num[i] - '0') % 13;
	}
    if (num[1] == 0)
	{
		j = 0;
		result[0] = 0 + '0';
	}
	else if (num[0] == '1' && num[1] < '3' && num[2] == 0)
	{
		j = 0;
		result[0] = 0 + '0';
		result[1] = 0;
	}
	else if(result[0] == '0' && result[1] == '0')
	{
		j = 2;
	}
	else 
		j = 1;
	for (i = j; ; i++)
	{
		if (result[i] == 0)
		{
			cout << endl;
			break;
		}
		else 
			cout << result[i];
	}
	cout << r << endl;
	return 0;
}
int l=0;
int shang[100];
char num[100];
int first;
int n;
void count()
{
    if(l==n-1)
    return;
    else if(l!=n-2)
    {
        shang[l]=first/13;
        first=(first-13*shang[l])*10+(num[l+2]-'0');
        l++;
		count();
    }
	else 
	{
		shang[l]=first/13;
		first=first-13*shang[l];
		l++;
		count();
	}
}
int main()
{
    cin>>num;
    n=strlen(num);
	if(n==1)
	  cout<<"0"<<endl<<num;
	else if(n==2)
	{
		first=(num[0]-'0')*10+(num[1]-'0');
		if(first<13)
			cout<<"0"<<endl<<num;
		else 
			{count();
		if(shang[0]==0)
   {
	   for(int j=1;j<n-1;j++)
		   cout<<shang[j];
   }
   else
	{for(int i=0;i<n-1;i++)
    cout<<shang[i];
   }
    cout<<endl;
    cout<<first;
	}
	}
	else
	{
   { first=(num[0]-'0')*10+(num[1]-'0');
    count();
   if(shang[0]==0)
   {
	   for(int j=1;j<n-1;j++)
		   cout<<shang[j];
   }
   else
	{for(int i=0;i<n-1;i++)
    cout<<shang[i];
   }
    cout<<endl;
    cout<<first;
	}
	}
    return 0;
}
//2013.11.19
//zwb

int main ()
{
	char a[102];
	int b[102] = {0}, ans[102] = {0};
	int i, j, r, len, flag = 0;
	cin.getline(a,100);
	len = strlen(a);

	for(i = 0; i < len; i++)
	{
		b[i+1] = a[i] - '0';
	}

	if(a[1] == '\0')
	{
		cout << "0" << endl;
		cout << b[1] << endl;
	}
	else if(a[1] != '\0' && a[2] == '\0' && b[1] * 10 + b[2] < 13)
	{
		cout << "0" << endl;
		cout << b[1] * 10 + b[2]<< endl;
	}
	else
	{
		ans[1] = (b[1] * 10 + b[2]) / 13;
		r = (b[1] * 10 + b[2]) % 13;

		for(i = 2; i < len; i++)
		{
			ans[i] = (r * 10 + b[i+1]) / 13;
			r = (r * 10 + b[i+1]) % 13;
		}
		
		for(i = 1; i < len; i++)
		{
			if(ans[1] == 0 && flag == 0)
			{
				flag = 1;
				continue;
			}
			cout << ans[i];
		}
		cout << endl;
		cout << r << endl;
	}
	return 0;
}
int main()
{
	char a[100];
	int b[100],c,j;
	gets(a);
	if(strlen(a)==1) 
	{
		b[0]=0;
		c=a[0]-'0';
		printf("%d\n%d",b[0],c);	
	}
    else if(strlen(a)==2&&((a[0]-'0')*10+a[1]-'0')<13) 
	{
		b[0]=0;
		c=(a[0]-'0')*10+a[1]-'0';
		printf("%d\n%d",b[0],c);	
	}
	else
	{
		c=((a[0]-'0')*10+a[1]-'0')%13;
		b[0]=(int)(((a[0]-'0')*10+a[1]-'0')/13);
		for(int i=2;i<strlen(a);i++)
		{
			b[i-1]=(int)((c*10+a[i]-'0')/13);
			c=(c*10+a[i]-'0')%13;
		}
		if(b[0]==0) j=1;
		else j=0;
		for(;j<strlen(a)-1;j++) printf("%d",b[j]);
		printf("\n%d",c);
	}
	return 0;	
}
int main(){
	char a[100],b[100];
	int n,m,i,x=0,w;
	while(cin>>a){
		n=a[0]-48;
		b[0]=48;
		m=strlen(a);

		for(i=1;i<m;i++){
			n=n*10+((int)a[i]-48);
			if(n<13){
				b[i]=48;
			}
			else{
				b[i]=n/13+48;
				n=n%13;
			}
		}
		b[m+1]=0;
		w=strlen(b);
		if(w<=2){
			cout<<0<<endl;
			cout<<n<<endl;
		}
		else if(w<=3&&(int)a[0]-49==0&&(int)a[1]-50<=0){
			cout<<0<<endl;
			cout<<n<<endl;
		}
		else{
		if(b[0]-48==0)x=1;
		if(b[1]-48==0)x=2;
		for(i=x;i<m;i++){
			cout<<b[i];
		}
		cout<<endl;
		cout<<n<<endl;
	}}
	return 0;
}
int main()
{
int len,i,t,y,k,x; 
char a[101];
gets(a);
len=strlen(a);
int s[len],w[len];
for(i=0;i<len;i++)
{
s[i]=a[i]-'0';
w[i]=0;
}

if(len==1)
 {
          printf("0\n");
          printf("%d",s[0]);
 }
 
else if(len==2&&(10*s[0]+s[1])<13)
 {
          printf("0\n");
          printf("%d",s[0]*10+s[1]);
 }

else
{
for(i=0,k=0;i<len-1;i++)
{
t=10*s[i]+s[i+1];

if(t<13) 
 {
         w[k]=0;
         k++;
         s[i+1]=t;
 }
else
 {
 y=t%13;
 if(y!=0)
   {
        x=(t-y)/13;
        w[k]=x;
        k++;
        s[i+1]=y;
              
   }
  else
   {
        x=t/13;
        w[k]=x;
        k++;
        s[i+1]=0;      
              
   } 
 }
}
for(i=0;i<k;i++) 
if(w[i]!=0){x=i;break;}
for(i=x;i<k;i++)
printf("%d",w[i]);
printf("\n%d",s[len-1]);
}                    
}
main()
{
	char a[101]={0};
	char b[101]={0};
	char yu;
	int i;
	int l;
	int d;
	int f;
	scanf("%s",a);
	l=strlen(a);
	if(l==2)
	{
		d=((a[0]-'0')*10+(a[1]-'0'))/13;
		f=((a[0]-'0')*10+(a[1]-'0'))%13;
		printf("%d\n",d);
		printf("%d",f);
	}
	else
	{
		if(l==1)
		{
			d=0;
			f=a[0]-'0';
			printf("%d\n",d);
		printf("%d",f);
		}
		else{
	if(((a[0]-'0')*10+(a[1]-'0'))>=13)
	{
	for(i=0;i<l-1;i++)
	{
		b[i]=((a[i]-'0')*10+(a[i+1]-'0'))/13+'0';
		yu=((a[i]-'0')*10+(a[i+1]-'0'))%13+'0';
		a[i+1]=yu;

	}
	printf("%s\n",b);
	printf("%d",yu-'0');
	}
	else
	{
		b[0]=((a[0]-'0')*100+(a[1]-'0')*10+a[2]-'0')/13+'0';
		yu=((a[0]-'0')*100+(a[1]-'0')*10+a[2]-'0')%13+'0';
		a[2]=yu;
		for(i=1;i<l-2;i++)
	{
		b[i]=((a[i+1]-'0')*10+(a[i+2]-'0'))/13+'0';
		yu=((a[i+1]-'0')*10+(a[i+2]-'0'))%13+'0';
		a[i+2]=yu;

	}
	printf("%s\n",b);
	printf("%d",yu-'0');
	}
		}
	}
}
char n[101];
int a[101];
int fig=0,l;
void calculate()
{
	int i,j;
	int yu=0;
	for (i=1;i<l;i++)
	{
		fig=fig*10+((int)n[i]-'0');
		a[i]=fig/13;
		fig=fig-13*a[i];
	}
	for (i=1;i<l;i++)
	{
		if (a[i]!=0) 
		{ j=i; break;}
	}
	for (i=j;i<l;i++) 
	{
		cout<<a[i];
	}
	cout<<endl; cout<<fig<<endl;
}
int main()
{
	memset(n,'\0',sizeof(n));
	memset(a,0,sizeof(a));
	cin>>n;
	l=strlen(n);
	fig=((int)n[0]-'0');
	if ((l==2&&(fig*10+(int)n[1]-'0')<13)||(l==1))
	{
		cout<<"0"<<endl<<n<<endl;
	}
	else
	{
		calculate();
	}
	return 0;
}
main()
{
      char a[100];
      char b[100];
      scanf("%s",a);
      int t=a[0]-48;
      int i,j;
      j=0;
      for(int k=0;k<100;k++)
      b[k]='\0';
     for(i=1;a[i]!='\0';i++)
     {
             t=t*10+(a[i]-48);
             if(t/13>=0)
             {b[j]=(t/13+48); 
             j++;}
             t=t%13;
            
             }
            if(a[1]!='\0')
            { 
                           if(b[0]=='0'&&b[1]!='\0')
                            for(int k=1;b[k-1]!='\0';k++)
                            b[k-1]=b[k];
                          printf("%s\n",b);
                           printf("%d",t) ;}
              else
              {printf("0\n");
              printf("%c",a[0]);}

      }
int main()
{
	int i, j;
	int a, t = 0,b=0;
	char s[100];
	char result[100];
	gets(s);
	a = strlen(s);
	for (i = 0; i < 100; i++)
	{
		result[i] = '\0';
	}
	for (i = 0; i < a; i++)
	{
		t = t * 10 + (s[i] - '0');
		result[i] = t / 13 + '0';
		t = t % 13;
	}
	i = 0;
	for (i = 0; i < a; i++)
	{
		b = b + result[i]-'0';
	}
	if (b == 0)
		printf("0\n");
	else
	{
		i = 0;
		while (i < a)
		{
			if (result[i] == '0')
				i++;
			else
				break;
		}
		for (; i < a; i++)
		{
			printf("%c", result[i]);
		}
		printf("\n");
	}
	printf("%d",t);
}
int main()
{
    char a[101];
    char b[101];
    int c,d,e,i,u,v,w,x,y;
    int n=0;
    scanf("%s",a);
    while(a[n])
    n=n+1;
    if(n>=3)
    {
        u=a[0]-'0';
        v=a[1]-'0';
        w=u*10+v;
        if(w<=12)
        {
            u=3;
            v=a[1]-'0';
            w=a[2]-'0';
            v=100+v*10+w;
        }
        else
        {
            u=2;
            v=a[0]-'0';
            w=a[1]-'0';
            v=v*10+w;
        }
        x=v/13;
        y=v%13;
        b[0]=x+'0';
        e=0;
        for(i=u;i<=n-1;i++)
        {
            c=a[i]-'0';
            d=y*10+c;
            x=d/13;
            y=d%13;
            e=i-u+1;
            b[e]=x+'0';
        }
        b[e+1]='\0';
        printf("%s\n",b);
        printf("%d\n",y);
    }
    else
    {
        c=a[0]-'0';
        if(n==2)
        {
            d=a[1]-'0';
            e=c*10+d;
        }
        else
        {
            e=c;
        }
        x=e/13;
        y=e%13;
        printf("%d\n",x);
        printf("%d\n",y);
    }

    return 0;
}
void main()
{
	int i,n=1;
	for(i=1;i<=n;i++)
	{
		int i;
		char n1[110],n2[110],n[110];
		scanf("%s",n1);
		strcpy(n2,"13");
		int l1=strlen(n1),l2=strlen(n2);
		if(l1<l2)
		{
			printf("0\n");
			printf("%s",n1);
		}
		else
		{
			for(i=l2;i<=l1-1;i++)
			{
				n2[i]='0';	
			}
			n2[i]='\0';
			for(i=0;i<=l1-l2;i++)
			{
				n[i]='0';
			}
			n[i]='\0';
			for(i=0;i<=l1-l2;i++)
			{
				int u;
				char temp[110];
				strcpy(temp,n1);
				for(u=0;;)
				{
					int k;
					for(k=l1-1;k>=1;k--)
					{
						if(temp[k]-n2[k]>=0)
							temp[k]=temp[k]-n2[k]+'0';
						else
						{
							temp[k]=temp[k]-n2[k]+'0'+10;
							temp[k-1]--;
						}
					}
					temp[0]=temp[0]-n2[k]+'0';
					if(temp[0]>='0')
						strcpy(n1,temp);
					else
						break;
					u++;
				}
				n[i]=n[i]+u;
				for(u=l1-2;u>=0;u--)
				{
					n2[u+1]=n2[u];
				}
				n2[0]='0';
			}
			int l=0;
			for(i=0;i<=l1-l2;i++)
				if(n[i]!='0')
				{
					l=1;
					break;
				}
			for(;i<=l1-l2;i++)
				printf("%c",n[i]);
			if(l==0)
				printf("0");
			printf("\n");
			l=0;
			for(i=0;i<=l1-1;i++)
				if(n1[i]!='0')
				{
					l=1;
					break;
				}
			for(;i<=l1-1;i++)
				printf("%c",n1[i]);
			if(l==0)
				printf("0");
		}
	}
}
int main(){
	char zxc[101];
	int i,j,t,k;
	int l;int s[100];
	gets(zxc);
	t=0;l=strlen(zxc);
k=0;	
	for(i=0;i<(l-1);i++){
		if(i==0){
			k=(zxc[i]-'0')*10+(zxc[i+1]-'0');
		}else{
		k=t*10+(zxc[i+1]-'0');
		}
		s[i]=k/13;
		t=k%13;
	
	}
	for(j=0;j<i;j++){
		if(j==0&&s[j]==0){
			continue;
		}
		printf("%d",s[j]);
	}
if(k<=12&&(i==1||i==0)){
printf("0");
if(k==0){
t=zxc[0]-'0';
}
}
	printf("\n");
	printf("%d",t);
return 0;
}
main()
{
      int n,i,k,l,a[100];
      char s[100];
      scanf("%s",&s);
      n=0;
      while(s[n]!='\0') n++;
      for(i=0;i<=n-1;i++) a[i]=s[i]-'0';
      for(i=0;i<=n-2;i++) 
      {
              a[i+1]=a[i+1]+(a[i]%13)*10;
              a[i]=a[i]/13;
              }
      k=a[n-1]%13;
      a[n-1]=a[n-1]/13;
      l=0;
      while((a[l]==0)&&(l<n-1)) l++;
      for(i=l;i<=n-1;i++) printf("%d",a[i]);
      printf("\n");
      printf("%d",k);
      //getchar();
      //getchar();
      }
int main()
{
char a[100];
int b[100],i,j,m,n,l;
scanf("%s",&a);
l=strlen(a);
if(a[0]=='1'&&a[1]<'3')
 {
 b[0]=0;
 b[1]=0;
 a[1]=10+a[1]-'0'+'0';
 }
else
 {
 b[0]=0;
 b[1]=((a[0]-'0')*10+a[1]-'0')/13;
 a[1]=(a[0]-'0')*10+a[1]-'0'-b[1]*13+'0';
 } 
for(i=1;i<l-1;i++)
 {
  b[i+1]=((a[i]-'0')*10+a[i+1]-'0')/13;
  a[i+1]=(a[i]-'0')*10+a[i+1]-'0'-b[i+1]*13+'0';
 }
if(l>=3)
 {if(b[1]==0)
  {
   for(i=2;i<l;i++)
  printf("%d",b[i]);
  }
 else
  {
  for(i=1;i<l;i++)
  printf("%d",b[i]);
  }
 }
else 
 {
  if(l==1)
  {
  printf("0");
  }
  else if(l==2)
  {
  if((a[0]-'0')*10+a[1]-'0'<13 )
   {
   printf("0");
   }
  else printf("%d",b[1]);
  }
 }
if(a[l-1]>'9')
 {
 printf("\n1%c",a[l-1]-10);
 }
else
  printf("\n%c",a[l-1]);

}
main()
{
	int num[101]={0},digit,ans[100],left,head,tail,answer_isnt_zero=0;
	for (int i=0;i<100;i++)
		ans[i]=-1;
	char ch[101];
	scanf("%s",ch);
	digit=strlen(ch);
	for (int i=0;i<digit;i++)
		num[i]=(int)ch[i]-48;
	for (int i=0;i<digit;i++){
		ans[i]=num[i]/13;
		num[i+1]+=(num[i]%13)*10;
	}
	for (tail=99;ans[tail]==-1;tail--)
		;	
	for (head=0;ans[head]==0;head++)
		;
	for (int i=head;i<=tail;i++){
		printf("%1d",ans[i]);
		answer_isnt_zero=1;
	}
	if (!answer_isnt_zero)
		printf("0");
	printf("\n");
	printf("%d\n",num[digit]/10);
}
int main()
{ char a[101];
int l,bc,s,ys;
gets(a);
l=strlen(a);
if(l==1){
         bc=(a[0]-'0');
        printf("0\n%d",bc);
        }
if(l==2){
 bc=(a[0]-'0')*10+a[1]-'0';
 s=bc/13;
 ys=bc%13;
         printf("%d",s);
         printf("\n%d",ys);
        }
if(l>2){
 bc=(a[0]-'0')*10+a[1]-'0';
 if(bc>13){
         s=bc/13;
          ys=bc%13;
          printf("%d",s);
          a[0]=ys/10+'0';
          a[1]=ys%10+'0';
           }
for(int i=1;i<l-1;i++){
        bc=(a[i-1]-'0')*100+(a[i]-'0')*10+a[i+1]-'0';
        s=bc/13;
        ys=bc%13;
        printf("%d",s);
        a[i]=ys/10+'0';
        a[i+1]=ys%10+'0';        
        }
printf("\n%d",ys);
}


    return 0;
}
int main()
{
	int res[102]={0},chan[102],len,i,j,n,k;
	char c[102];
	cin.getline(c,101);
	len=strlen(c);
	for(i=0;i<len;i++)
	{
		chan[i]=c[i]-'0';
	}
	for(i=1;i<len;i++)
	{
		chan[i]+=10*chan[i-1];
		if(chan[i]>=13)
		{
			res[i]=chan[i]/13;
			chan[i]=chan[i]%13;
		}
	}
	i=0;
	while(res[i]==0) i++;
		if(len-i>=1)
	{
			for(;i<len;i++)
	{
		cout<<res[i];
	}
	}
	else cout<<'0';
	cout<<endl<<chan[len-1];
	return 0;
}
main()
{
      char z[NUM]={'\0'};
      char y[NUM]={'\0'};
      int count=0,i=0,shu=0,j;
      scanf("%s",z);
      for(;;count++)/*???????*/ 
      {     if(z[count]=='\0') break;
            i=shu*10+(z[count]-'0');/*i=the two number*/
            shu=i%13;
            j=i/13;
            y[count]=j+'0';
      }
      count=0;
      j=0;
      for(;y[count]!='\0';count++)
      {    
            if(j==0)
               { 
                    if(y[count]=='0')
                       continue;
                    else
                       {
                                j=1;
                                printf("%c",y[count]);
                                continue;
                       }
               }
            printf("%c",y[count]);
      }
     if(j==0)
     printf("%c",y[0]);
      printf("\n%d",shu);
      
}
main()
{
      char a[100];
      scanf("%s",a);
      char b[100]={0};
      int i,n,c,d;
      n=strlen(a);
      if(n==1)
         printf("0\n%c\n",a[0]);
      else if(n==2&&(a[0]-'0')*10+a[1]-'0'<13)
         printf("0\n%c%c\n",a[0],a[1]);
      else
      {
      c=(a[0]-'0')*10+(a[1]-'0');
      b[0]='0';
      for(i=1;i<n;i++)
      {
          b[i]=c/13+'0';
          d=c-c/13*13;
          if(a[i+1]=='\0')
              break;
          else 
              c=10*d+a[i+1]-'0';
      }
      
      int j,k;
      for(j=0;j<n;j++)
      {
          if(b[j]!='0')
             break;
      }
      for(k=j;k<n;k++)
         printf("%c",b[k]);
      printf("\n");
      printf("%d\n",d);
      }
      }
int main()
{
	char a[100];
	int i, j, r=0, z1, len, b[100]={1};
	cin.getline(a,100);
	len=strlen(a);
	
	if(len==1)
	{
		cout << "0" << endl;
		cout << a[0]-'0' <<endl;
	}
	if(len==2)
	{
		cout<<((a[0]-'0')*10+(a[1]-'0'))/13<<endl;
		cout<<((a[0]-'0')*10+(a[1]-'0'))%13<<endl;
		
	}
	if(len>=3)
	{
		r=a[0]-'0';
	for(i=1; a[i]!=0; i++ )
	{
		z1=r*10+(a[i]-'0');
		b[i-1]=z1/13;
		r=z1%13;
	}

	if(b[0]==0)
	{
		for(j=1; j<i-1; j++ )		cout<<b[j];
	}
	else
	{
		for(j=0; j<i-1; j++ )		cout<<b[j];
	}
		cout<<"\n"<<r;
	}
	return 0;
	}
int ans[110];
int num[110];
int sig=0;
void devide(int a, int b,int tag)
{
	ans[sig]=(num[a]*10+num[b])/13;
	num[b]=(num[a]*10+num[b])%13;
	sig++;
	if(b==tag-1)
	{
		if(sig==1)cout<<ans[0]<<endl;
		else{
		int flag=0;
		for(int i = 0 ; i < sig ; i++)
		{
			if(ans[i]!=0)flag=1;
			if(i!=sig-1 && flag!=0 )cout<<ans[i];
			else if(i==sig-1 && flag!=0) cout<<ans[i]<<endl;
		}
		}
		cout<<num[b]<<endl;
		return;
	}
	else devide(b,b+1,tag);
}
int main()
{
	int tag=0;
	char str[110];
	char x;
	x=getchar();
	while(x!='\n' && x!=' ')
	{
		str[tag]=x;
		tag++;
		x=getchar();
	}
	for(int i = 0 ; i < tag ; i++)num[i]=str[i]-'0';
	if(tag==1)
	{
		cout<<"0"<<endl;
		cout<<num[0]<<endl;
	}
	else devide(0,1,tag);
	return 0;
}
int main()
{
	char sz[101];
	gets(sz);
	int n,yushu=0,shang,m;
	n=strlen(sz);
	for(int i=0;i<n;i++)
	{
		m=yushu*10+ (sz[i]-'0');
		shang=m/13;
		yushu=m%13;
		if(n>2&& i<2&& shang==0)
		{
			printf("");
		}
		else if(n==2 && i==0)
		{
			printf("");
		}
		else
		{
			printf("%d",shang);
		}
	}
	printf("\n%d",yushu);
}
int main()
{
  char a[100]={'\0'};
  int i,j,k,t,m,b[100]={0},c[100];
  cin>>a;
  for(i=0;i<100;i++)
   if(a[i]=='\0') break;
   k=i;
   for(i=0;i<k;i++)
    b[i]=a[i]-'0'; //for(i=0;i<k;i++)cout<<b[i];cout<<endl;
    if(k>1){
    m=b[0]*10+b[1];
    if(m<13&&k==2)cout<<"0"<<endl<<m;
     else{
   for(i=2;i<=k;i++)
     { 
       c[i]=m/13;t=m%13;
       m=(m-c[i]*13)*10+b[i];
     }
    for(j=0;j<4;j++)
    if(c[j]!=0)break;
     for(i=j;i<=k;i++)
      cout<<c[i];cout<<endl;
      cout<<t;}
      }
      else cout<<"0"<<endl<<b[0];
    
      return 0;
  }
// ??13
// ??? 1100012820
// 20111102
//******************
int main()
{
	char num[100] = {""};
	int ans[100] = {0};
	cin >> num;
	int i, j = 0;
	int yushu = num[0] - '0';
	for (i = 1; i < strlen(num); i++)
	{
		if ((yushu * 10 + (num[i] - '0')) > 12)
		{
			ans[i - 1] = (yushu * 10 + (num[i] - '0')) / 13;
			yushu = (yushu * 10 + (num[i] - '0')) % 13;
		}
		else
		{
			ans[i - 1] = 0;
			yushu = (yushu * 10 + (num[i] - '0'));
		}
		j++;
	}
	if ((ans[0] == 0) && (j <= 1)) cout << "0" << endl;
	else 
	{
		if (ans[0] == 0) i = 1;
		else i = 0;
		for (; i < j; i++)
			cout << ans[i];
		cout << endl;
	}
	cout << yushu << endl;
	return 0;
}
main()
{
  char s[100];
  int i,j=0,a=0;
  gets(s);
  for(i=0;s[i]!='\0';i++)
  {
    a=a*10+s[i]-'0';
    if(j!=0||a/13!=0)
    {
      s[j]='0'+a/13;
      a=a%13;
      j++;
    }
  }
  s[j]=0;
  if(j>0) printf("%s\n%d",s,a);
  else printf("0\n%d",a);
}
int main()
{
	char dividend[100], quotient[100];
	int remainder, i;
	cin >> dividend;
	remainder = dividend[0] - '0';
	quotient[0] = '0';
	quotient[1] = '\0';
	for (i = 1; dividend[i] != '\0'; i++)
	{
		quotient[i - 1] = (remainder * 10 + (int)(dividend[i] - '0')) / 13 + '0';
		remainder = (remainder * 10 + (int)(dividend[i] - '0')) % 13;
	}
	if (quotient[1] != '\0') 
	    quotient[i - 1] = '\0';
	if (quotient[0] == '0' && quotient[1] != '\0')
		cout << quotient + 1 << endl;
	else
		cout << quotient << endl;
	cout << remainder;
	return 0;
}
int main() {
	char s[200];
	char s1[200];
	int i, j;
	int len;
	int m;
	int n;
	scanf("%s", s);
	len = strlen(s);
	m = 0;
	for(i=0, j=0; i<len; i++) {
		m = m*10 + s[i] - '0';
		if(m >= 13) {
			s1[j] = m/13 + '0';
			m = m%13;
			j++;
		} else {
			if(j != 0) {
				s1[j] = '0';
				j++;
			}
		}
	}
	if(j == 0) {
		s1[0] = '0';
		j=1;
	}
	s1[j] = '\0';
	printf("%s\n%d\n", s1, m);
	return 0;
}
main()
{char a[100],b[100];
int t,i,x,cd;
scanf("%s",a);
cd=strlen(a);
for(i=0;i<cd;i++)
      a[i]-='0';
      
      if(cd==1)
      printf("0\n%d",a[0]);
      else if(cd==2&&10*a[0]+a[1]<13)
      printf("0\n%d",10*a[0]+a[1]);
      else
      {
for(i=0;i<=cd-2;i++)
{
   x=a[i]*10+a[i+1];
   b[i]=x/13;
   a[i+1]=x-b[i]*13;
 }
   if(b[0]!=0)
   printf("%d",b[0]);
   for(i=1;i<=cd-2;i++)
   printf("%d",b[i]);
   printf("\n%d",a[i]);
   }
}
int main()
{
	char dzs[100];
	char xdzs[100];
	gets(dzs);
	int N;
	N=strlen(dzs);
	if(N==1){
		printf("0\n%c",dzs[0]);
	}else{
	int n;
	int i;
	n=(dzs[0]-'0')*10+(dzs[1]-'0');
	int a,b;
	a=n/13;
	b=n%13;
	if(N==2&&n<13){
		printf("0\n%d",n);
	}else{
	if(a==0){
		xdzs[0]=' ';
	}
	else if(a!=0){
		xdzs[0]='0'+a;
	}
	
	for(i=2;i<N;i++){
		n=b*10+(dzs[i]-'0');
		a=n/13;
		b=n%13;
		xdzs[i-1]='0'+a;
	}
	for(i=0;i<N-2;i++){
		if(xdzs[i]!=' '){
			printf("%c",xdzs[i]);
		}
	}
	printf("%c\n",xdzs[N-2]);
	printf("%d", b);
	}
	}
	return 0;
}
int main()
{
    char a[100];
    int n[100],b[100],c,i,j,t;
    scanf("%s",a);
    for(t=0;a[t]!='\0';t++)
    {
        n[t]=a[t]-'0';
    }

    c=n[0];
    for(i=0;i<t-1;i++)
    {
        b[i]=(c*10+n[i+1])/13;
        c=c*10+n[i+1]-13*b[i];
    }
    if(b[0]==0&&t!=1&&t!=2)
    {
        for(j=1;j<t-1;j++)
        {
            printf("%d",b[j]);
        }
    }
    else if(t==1)
    {
        printf("0");
    }
    else if((10*n[0]+n[1])<13)
    {
        printf("0");
    }
    else
    {
        for(j=0;j<t-1;j++)
        {
            printf("%d",b[j]);
        }
    }
    printf("\n%d",c);
}
int main()
{
    char s[101];
    int a[100]={0},b[100]={0},c,i;
    scanf("%s",s);
    c=strlen(s);
    for(i=0;i<c;i++) a[i]=s[i]-'0';
    for(i=0;i<c-1;i++)
    {
        b[i]=(a[i]*10+a[i+1])/13;
        a[i+1]=(a[i]*10+a[i+1])%13;            
    }
    if(c>2)
    {
        if(b[0]!=0) printf("%d",b[0]);
        for(i=1;i<c-1;i++)  printf("%d",b[i]);
        printf("\n");
        printf("%d",a[c-1]);
    }
    else
    {
        printf("%d",b[0]);
        printf("\n");
        printf("%d",a[c-1]);
    }
       
}
int main()
{int i,n,k;
char a[100];
cin.getline(a,100);
n=strlen(a);
int b[n];
for(i=0;i<n;i++)
b[i]=a[i]-48;
if(n==1)
cout<<0<<endl<<b[0];
else if(n==2&&(b[0]*10+b[1]<13))
{cout<<0<<endl<<b[0]<<b[1];}
else {for(i=0;i<n-1;i++)
{k=(b[i]*10+b[i+1])/13;
if(!((k==0)&&(i==0)))
cout<<k;
b[i+1]=b[i]*10+b[i+1]-13*k;}
cout<<endl<<b[n-1];}
return 0;
}
main ()
{
char a[100];
gets (a);
char b[99];
int x,y,j;
  if (strlen(a)==1)
  
{  
           printf ("%d\n%d",0,a[0]-48);
           }
           else
           {
for (j=0;j<strlen (a)-1;j++)
   {
     x=(a[j]-48)*10+(a[j+1]-48);
    b[j]=x/13;
    if (j!=0||b[j]!=0||strlen (a)==2)
    printf ("%d",b[j]);
     a[j+1]=x%13+48;
     }
     printf ("\n");
     printf ("%d",a[j]-48);
     }
getchar ();
getchar ();
     }
int main ()
{
	char str[100];
	int lenS, i, answer[100], devided[100];
	int left;
	while ( cin >> str )
	{
		lenS = strlen(str);
		if ( lenS == 1 )
		{
			cout << 0 << endl;
			cout << str[0] << endl;
		}
		else if ( lenS == 2 && str[0] == '1' && str[1] < '3' )
		{
			cout << 0 << endl;
			cout << str[0] << str[1] << endl;
		}
		else
		{
			for ( i = 0; i < lenS; i ++ )
				devided[i] = str[i] - '0';
			if ( str[0] == '1' && str[1] < '3' )
			{
				answer[0] = ( devided[0] * 100 + devided[1] * 10 + devided[2] ) / 13;
				left = ( devided[0] * 100 + devided[1] * 10 + devided[2] ) % 13;
				cout << answer[0];
				for ( i = 1; i < lenS - 2; i ++ )
				{
					answer[i] = ( left * 10 + devided[i+2] ) / 13;
					left = ( left * 10 + devided[i+2] ) % 13;
					cout << answer[i];
				}
				cout << endl;
				cout << left << endl;
			}
			else
			{
				left = devided[0];
				for ( i = 0; i < lenS - 1; i ++ )
				{
					answer[i] = ( left * 10 + devided[i+1] ) / 13;
					left = ( left * 10 + devided[i+1] ) % 13;
				}
				if ( answer[0] != 0 )
					cout << answer[0];
				for ( i = 1; i < lenS - 1; i ++ )
					cout << answer[i];
				cout << endl;
				cout << left << endl;
			}
		}
	}
	return 0;
}