semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
main()
{
	char a[100],*b;
	int i,c,n;
	scanf("%s",a);
	
	n=strlen(a);
	if(n==1)
		printf("%d\n%s",0,a);
    else if(n==2&&(a[0]-'0')*10+a[1]-'0'<13)
	    printf("%d\n%s",0,a);
	else if((a[0]-'0')*10+a[1]-'0'>=13)
	{
        c=a[0]-'0';
		b=(char *)malloc((n-1)*sizeof(char));
    for(i=0;i<n-1;i++)
	{
		b[i]=(c*10+(a[i+1]-'0'))/13+'0';
		c=(c*10+(a[i+1]-'0'))%13;
	}
	printf("%s\n%d",b,c);
	}
	else
    {
		
		c=(a[0]-'0')*10+a[1]-'0';
		b=(char *)malloc((n-2)*sizeof(char));
    for(i=0;i<n-2;i++)
	{
		b[i]=(c*10+(a[i+2]-'0'))/13+'0';
		c=(c*10+(a[i+2]-'0'))%13;
	}
	printf("%s\n%d",b,c);
	}
}
int main()
{
    char a[100];
    char b[100];
    int n;
    scanf("%s",a);
    n=strlen(a);
    int i,j,sum,mod,k;
    if(n==1)
    {
      mod=a[0]-'0';      
     printf("0\n");     
     printf("%d\n",mod);
    }
    else
    {
    sum=(a[0]-'0')*10+a[1]-'0';
    mod=0;
    k=0;
    j=0;
    if(n==2&sum<=12)
    {
      printf("0\n");     
     printf("%d\n",sum);
     }
     else
     {
          for(i=2;i<=n;i++)
          {
                          k=mod*10+sum;
                           mod=k%13;
                           j=k/13;
                            b[i]=j+'0';
                            if(i==n)
                            break;
                           sum=a[i]-'0';
          }
          if(b[2]=='0')
          {
              for(j=0;j<=n-3;j++)
               b[j]=b[j+3];
               b[n-2]='\0';
           }
           else
           {
           for(j=0;j<=n-2;j++)
           b[j]=b[j+2];
           b[n-1]='\0';
           }
   printf("%s\n",b);     
   printf("%d\n",mod);
}
}
   getchar();
   getchar();
}
main()
{
      char a[150];
      char b [150];
      int i,l,c,d,e,f;
      scanf("%s",a);
      l=strlen(a);
      if (l>2)
      {
      if((a[0]-'0')*10+(a[1]-'0')>=13)
      {
              b[0]=((a[0]-'0')*10+(a[1]-'0'))/13+'0';
              c=(a[0]-'0')*10+(a[1]-'0');
              for(i=1;i<=l-2;i++)
              {
                   d=(b[i-1]-'0')*13;
                   c=(c-d)*10+(a[i+1]-'0');
                   b[i]=c/13+'0';
              }
      b[l-1]='\0';
      f=c-(b[l-2]-'0')*13; 
      printf("%s\n",b);
      printf("%d\n",f);
      }
      else
      {
          b[0]=((a[0]-'0')*100+(a[1]-'0')*10+(a[2]-'0'))/13+'0';
          c=(a[0]-'0')*100+(a[1]-'0')*10+(a[2]-'0');
          for(i=1;i<=l-3;i++)
          {
                    d=(b[i-1]-'0')*13;
                    c=(c-d)*10+(a[i+2]-'0');
                    b[i]=c/13+'0';        
          }
      b[l-2]='\0';
      f=c-(b[l-3]-'0')*13;
      printf("%s\n",b);
      printf("%d\n",f);
      }
      }
      else {if(l==2)
      {
          b[0]=((a[0]-'0')*10+(a[1]-'0'))/13+'0';
          b[1]='\0';
          f=((a[0]-'0')*10+(a[1]-'0'))%13;
          printf("%s\n",b);
          printf("%d\n",f);
          
      }
      else 
      {
          b[0]=(a[0]-'0')/13+'0';
          b[1]='\0';
          f=a[0]-'0';
          printf("%s\n",b);
          printf("%d\n",f);
      }
      }    
      getchar();
      getchar();
}
int main()
{
char n[100];
int a,b[100],c[99],i,j,p,q;
scanf("%s",n);
a=strlen(n);
for(i=0;i<a;i++)
b[i]=n[i]-'0';
if(a==1)
{
printf("0\n");
printf("%d",b[0]);
}
else if(a==2&&10*b[0]+b[1]<13)
{
printf("0\n");
printf("%d",10*b[0]+b[1]);
}
else
{
p=10*b[0]+b[1];
for(i=0;i<a-2;i++)
{
c[i]=(p-p%13)/13;
p=(p%13)*10+b[i+2];
}
c[a-2]=(p-p%13)/13;
q=p%13;
for(i=0;i<a-1;i++)
{
if(i==0&&c[i]==0)
continue;
else if(i==a-2)
printf("%d\n",c[i]);
else
printf("%d",c[i]);
}
printf("%d",q);
}
}
main() 
{
                 char a[101];
                 int b[101];
                 int i,y;
                 int n=0;
                 gets(a);
                 for(i=0;a[i]!='\0';i++)
                 {
                                    n++;
                                    b[i]=a[i]-'0';
                 }
                 for(i=0;i<=n-2;i++)
                 {
                                        b[i+1]=(b[i]%13)*10+b[i+1];
                                        b[i]=b[i]/13;
                 }
                 y=b[n-1]%13;
                 b[n-1]=b[n-1]/13;
                 if (n==1)
                 printf("0");
                 else if((b[1]==0)&&(n>=3))
                 {
                     for(i=2;i<=n-1;i++)
                     {
                                        printf("%d",b[i]);
                     }
                 }
                 else
                 {
                     for(i=1;i<=n-1;i++)
                     {
                                        printf("%d",b[i]);
                     }
                 }
                 printf("\n%d\n",y);
}
//????????13

const int chushu=13;  
int main(void)
  {
     char n[101],answer[100];
	 int a=1,b=1,c=1,i=0;
     scanf("%s",n);
	 
	 if(strlen(n)<2)
	 {
		printf("0\n%c",n[0]);
	 }
	 else if(strlen(n)<3)
	 {
         c=10*(n[0]-'0')+(n[1]-'0');
		 printf("%d\n%d",c/chushu,c%chushu);
	 }
	 else
	 {
	 a=(n[0]-'0');
     a=a*10+(n[1]-'0');
		 if(a<chushu)  
					{
						a=a%chushu;
					 for(i=1;n[i+1]!='\0';i++)
							 {
								a=a*10+(n[i+1]-'0');
								answer[i-1]=(a/chushu+'0');
									a=a%chushu;
							 }
					  answer[i-1]='\0'; 
					 }
		 else 
		 {
			 
			 answer[0]=(a/chushu)+'0';
		     a=a%chushu;
			  for(i=1;n[i+1]!='\0';i++)
				{
					a=a*10+(n[i+1]-'0');
					answer[i]=(a/chushu)+'0';
						a=a%chushu;
				 }
			  answer[i]='\0';
		 }
	
		
			 

	 printf("%s\n%d",answer,a);
	 
	 } 
	 return 0;

     
  }
int main()
{
  char a[100],d[100],f[100];
  int n,i,j,l,k;
  int b[100],c[100];
  scanf("%s",a);
  j=strlen(a);
  for(i=0;i<j;i++)
  b[i]=a[i]-'0';
  if(j<3&&b[0]*10+b[1]<13)
    { 
     printf("0\n");
     printf("%d",b[0]*10+b[1]);
     }
     else if(j==1)
     {
          printf("0\n");
          printf("%d",b[0]);
     }
   else
 { for(i=0;i<j;i++)
 {
       c[i]=b[i]/13;
       if(c[i]==0)
       b[i+1]=b[i]*10+b[i+1];     
       else
       b[i+1]=(b[i]-13*c[i])*10+b[i+1];
       d[i]=c[i]+'0';
       k=b[i]-13*c[i];
 }
 d[j]='\0';
 j=strlen(d);
 if(d[1]=='0')
 { 
 for(i=0;i<(j-2);i++)
 {
                   d[i]=d[i+2];
 }
 d[j-2]='\0';
 
 }
 else
 {
     for(i=0;i<(j-1);i++)
     {
                       d[i]=d[i+1];
                       }
                       d[j-1]='\0';
 }
  printf("%s\n",d);
   printf("%d",k);
 }
  getchar();getchar(); 
}
int main()
{
	int u;
	char a[101];
	for (u=0;u<100;u++)
		a[u]='\0';
	scanf ("%s",a);
	char shang[101];
	for (u=0;u<100;u++)
		shang[u]='\0';
	int yu=0;
	int i,j;
	if (strlen(a)==1)
	{
		shang[0]='0';
		yu=a[0]-'0';
	}
	else if (strlen(a)==2)
	{
		shang[0]=((a[0]-'0')*10+(a[1]-'0'))/13+'0';
		yu=((a[0]-'0')*10+(a[1]-'0'))%13;
	}
	else if ((a[0]-'0')*10+(a[1]-'0')<13)
	{
		shang[0]=((a[0]-'0')*100+(a[1]-'0')*10+(a[2]-'0')+yu)/13+'0';
		yu=((a[0]-'0')*100+(a[1]-'0')*10+(a[2]-'0')+yu)%13;
		for (i=1;i+2<strlen(a);i++)
		{
			shang[i]=((a[i+2]-'0')+yu*10)/13+'0';
			yu=((a[i+2]-'0')+yu*10)%13;
		}
	}
	else
	{
		yu=a[0]-'0';
		for (i=0;i+1<strlen(a);i++)
		{
			shang[i]=(a[i+1]-'0'+yu*10)/13+'0';
			yu=(a[i+1]-'0'+yu*10)%13;
		}
	}
	printf ("%s\n%d\n",shang,yu);
}
//********************************
//*?????13                 **
//*??????                 **
//*???2012.11.10             **
//*******************************/


int main ()
{
	char a[100];
	int b[100], s[100] = {0};
	int n, i, flag = 0;
	cin >> a;
	n = strlen(a);
	for ( i = 0; i < n; i++)
		b[i] = a[i] - '0';
	for ( i = 1;  i < n; i++)
	{
		s[i] = (10 * b[i - 1] + b[i]) / 13; 
		b[i] = (10 * b[i - 1] + b[i]) % 13;
	}
	if (s[1] != 0)
	{
		cout << s[1];
		flag = 1;
	}
	for ( i = 2; i < n; i++)
	{
		cout << s[i];
		flag = 1;
	}
	if (flag == 0)
		cout << 0;
	cout << endl;
	cout << b[n - 1] << endl; 
	return 0;
}
int main()
{
	char a[101];
	int b[100];
	
	int i,x,s;
	scanf("%s",a);
	s=strlen(a);
if(((s==2)&&(a[0]>48))||(s>2))
{
	if((a[0]==49)&&(a[1]<52)&&(s>2))
	{
		x=(a[0]-48)*100+(a[1]-48)*10+a[2]-48;
		b[0]=x/13;
        x=x%13;
        for(i=3;a[i]!='\0';i++)
		{
			x=10*x+(a[i]-48);
			
			b[i-2]=x/13;
            x=x%13;
		}
		for(i=0;i<s-2;i++)
		{
			printf("%d",b[i]);
		}
		printf("\n%d",x);
	}
    if(((a[0]-48)*10+a[1]-48)>12)
	{
		x=(a[0]-48)*10+a[1]-48;
		
		b[0]=x/13;
        x=x%13;
		for(i=2;i<s;i++)
		{
			x=10*x+a[i]-48;
			
			b[i-1]=x/13;
            x=x%13;
		}
		for(i=0;i<s-1;i++)
		{
			printf("%d",b[i]);
		}
		
		printf("\n%d",x);
	}
}
if(s==1)
{
printf("0\n");
printf("%d",(a[0]-48));
}
if((s==2)&&(a[0]==49)&&(a[1]<51))
{
   printf("0\n");
   printf("%d",(a[0]-48)*10+a[1]-48);
}
return 0;
}
int main()
{
	char m[104];
	scanf("%s",m);
	int len=strlen(m);
	char m2[103];
	int f=0,F=0;
	if(len==2)
	{
		if(m[0]-'0'==1&&m[1]-'0'<=2)
		{
			cout<<0<<endl;
			cout<<10+m[1]-'0'<<endl;
		}
	}
	if(len==1)
	{
		cout<<0<<endl;
		cout<<m[0]-'0'<<endl;
		return 0;
	}
	for(int i=0;i<len;i++)
	{
		int a;
		a=f*10+m[i]-'0';
		f=a%13;
		if(a/13==0&&F==0)
		{}
		else if(i==len-1)
		{
			F++;
			cout<<a/13;
			cout<<endl;
			cout<<a%13;
		}
		else
		{
			F++;
			cout<<a/13;
		}
		
	}
	return 0;
}
void main()
{
    int result[100],length,num[101]={0},i,k,small,large,not_zero;
    for(i=0;i<100;i++)
    {
         result[i]=-1;
    }
    char c[101];
    scanf("%s",c);
    length=strlen(c);
    for(i=0;i<length;i++)
    {
         num[i]=(int)c[i]-'0';
    }
    for(i=0;i<length;i++)
   {
        result[i]=num[i]/13;
        num[i+1]=num[i+1]+(num[i]%13)*10;
   }
   for(i=0;i<100;i++)
   {
       if(result[i]!=0)
       {
           small=i;
           break;
       }
   }
   for(i=99;i>=0;i--)
  {
       if(result[i]!=-1)
       {
           large=i;
           break;
       }
  }
   for(i=small;i<=large;i++)
   { 
      printf("%d",result[i]);
      not_zero=1;
   }
   if(not_zero==1)
   {
       printf("\n");
       printf("%d\n",num[length]/10);
   }
   else
   {
       printf("0\n");
       printf("%s",c);
   }
}
main()
{
    char n[102],r[102];
    int b[102],m,i;
    scanf("%s",n);
    if(n[1]=='\0') printf("0\n%s",n);


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

    else
    {

    b[0]=10*(n[0]-'0')+n[1]-'0';

    for(i=0;i<=strlen(n)-2;i++)
    {
        r[i]=(b[i]/13)+'0';
        m=b[i]%13;
        b[i+1]=n[i+2]+m*10-'0';
    }

    r[strlen(n)-1]='\0';

     if(r[0]=='0')
        {
            for(i=1;i<=strlen(n)-2;i++)
            {
            printf("%c",r[i]);
            }
         printf("\n%d",m);  
        }
    else
    {
    printf("%s\n",r);
    printf("%d",m);
    }
   }
}

getchar();getchar();getchar();getchar();getchar();getchar();getchar();getchar();getchar();getchar();
}
int main()
{
    char s[101];
	int i,k;
	gets(s);
	k=(int)(s[0]-'0');
	for(i=1;i<strlen(s);i++)
	{
		k=k*10+(int)(s[i]-'0');
		if(i==1&&(k/13)!=0)
		{
		    printf("%d",k/13);
		}
		if(strlen(s)==2&&i==1&&(k/13)==0)
			printf("0");
		if(i!=1)
			printf("%d",k/13);
		k=k%13;
		if(i==strlen(s)-1)
		{
			printf("\n%d",k);
		}
	}
	if(strlen(s)==1)
		printf("0\n%d",k);
	return 0;
}
int main(){
    char asd[300],zxc[300];
	int n=0,m=0,i,j,k;
	scanf("%s",asd);
	int len=strlen(asd);
	m=asd[0]-48;
	for(i=1;i<len;i++)
	{
		n=10*m+asd[i]-48;
		zxc[i-1]=n/13+48;
		m=n%13;
	}
	zxc[len-1]='\0';
	for(i=0;i<len-1;i++)
	{
		if(zxc[i]!='0')
			break;
		else
		{
			for(j=0;j<len-1;j++)
			{
				zxc[j]=zxc[j+1];
			}
		}
	}
	if(zxc[0]=='\0')
	{
		zxc[0]='0';
		zxc[1]='\0';
	}
	printf("%s\n%d\n",zxc,m);
	return 0;
}
//**********???????13*******************
//**********???????*********************
//**********?????2012?11?9?************
//**********???1200062701******************


int main()
{
	int yushu, sum = 0, beishu = 1E7, weishu = 0;
	double shenyu;
	char a[100];
	memset(a, '@', sizeof( a ));                   //???????
	cin >> a;
	for(int h = 0; h < 100; h++)
	{
		if((a[h] <= '9') && (a[h] >= '0'))
		{
			weishu++;                              //????
		}
	}
	shenyu = weishu;
	if(weishu < 8)                                 //???int???????????~
	{
		beishu = pow(10, (shenyu - 1));            
		for(int i = 0; i < weishu; i++)
		{
			sum += (a[i] - '0') * beishu;
			beishu = beishu / 10;
			shenyu--;
		}
		cout << sum / 13 << endl << sum % 13;
	}
	else                                           //??int??????????
	{
		for(int i = 0; i < 8; i++)
		{
			sum += (a[i] - '0') * beishu;
			beishu = beishu / 10;
			shenyu--;
		}
		cout << sum / 13;
		yushu = sum % 13;
		for(int j = 8; j < 96; j += 8)
		{
			if(shenyu < 9)						   //?????????
			{
				break;
			}
			beishu = 1E7;
			sum = yushu * 1E8;
			for(int l = 0; l < 8; l++)
			{
				sum += (a[l + j] - '0') * beishu;
				beishu = beishu / 10;
				shenyu--;
				if((l == 0) && (sum / 1E7 < 13))   //?????????????0
				{
					cout << "0";
				}
				if((l == 1) && (sum / 1E6 < 13))
				{
					cout << "0";
				}
			}
			cout << sum / 13;
			yushu = sum % 13;
		}
		beishu = pow (10, shenyu - 1); 
		sum = yushu * pow(10, shenyu);
		for(shenyu; shenyu >= 1; shenyu--)          //???????
		{ 
			sum +=  (a[weishu - (int)shenyu] - '0') * beishu;
			beishu = beishu / 10;
			if((weishu - (int)shenyu == 0) && (sum / 1E7 < 13))
			{
				cout << "0";
			}
			if((weishu - (int)shenyu == 1) && (sum / 1E6 < 13))
			{
				cout << "0";
			}
		}
		cout << sum / 13 << endl;
		yushu = sum % 13;
		cout << yushu;
	}
	return 0;
}
//************************************
//*   ??13                         *
//*   ??????                   *
//*   ?????2011?12?17?       *
//************************************


int main()
{
	int yu, i, j, n, p;
	char num[200], shang[200];
	cin.get(num, 200);//?????
	n = strlen(num);//????????
	yu = 0;//????
	p = 200;//?????????0???
	for(i = 0; i < n; i ++)
	{
		shang[i] = (yu * 10 + num[i] - '0') / 13 + '0';
		yu = (yu * 10 + num[i] - '0') % 13;
	}//??????????
	for(i = 0; i < n; i ++)
	{
		if(shang[i] != '0')
		{
			p = i;
			break;
		}
	}//???????????0???
	if(p == 200)
		cout << "0";//???0,???0
	else
	{
		for(j = i; j < n; j ++)
			cout << shang[j];
	}
	cout << endl << yu << endl;//??????
	return 0;
}
main()
{
   int a[100],b[100],i,j=0,k,l,S,p,q;
   char str1[100];
   scanf("%s",str1);
   l=strlen(str1);
   
   for(i=0;i<=l-1;i++)
   {
          a[i]=str1[i]-'0';             
   }
     p=a[0];
   if(l>=2) 
{
            for(i=0;i<=l-2;i++)
   {
          S=p*10+a[i+1];
          p=S/13;
          q=S%13;
          b[j]=S/13;
          j++;
          p=q;
   }
   if(b[0]==0&&l>2)
   { 
     for(k=1;k<=j-1;k++)
     printf("%d",b[k]);
     printf("\n");
     printf("%d\n",q);        
   }
   if(b[0]==0&&l==2)
   {
      printf("%d\n",b[0]);
      printf("%d\n",q);            
   }
   if(b[0]!=0)
   { 
     for(k=0;k<=j-1;k++) 
     printf("%d",b[k]);
     printf("\n");
     printf("%d\n",q);
   }
}
      if(l<2)
      {
         printf("0\n");
         printf("%d\n",a[0]);    
      }
      
  
}
int main(){
	char s[110];
	int sz[110],ys,i,l,szsh[110];
	memset(sz,0,sizeof(sz));
	
	scanf("%s",s);
	l=strlen(s);
	for(i=0;i<l;i++){
		sz[i]=s[i]-'0'+0;

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

	else {if(sz[0]*10+sz[1]<13){
		szsh[2]=(sz[0]*100+sz[1]*10+sz[2])/13;
		ys=(sz[0]*100+sz[1]*10+sz[2])%13;
		
		for(i=3;i<l;i++){
			if(ys<2&&sz[i]<=2){
				szsh[i]=0;
				szsh[i+1]=(ys*100+sz[i]*10+sz[i+1])/13;
				ys=(ys*100+sz[i]*10+sz[i+1])%13;
				i++;
			}
			else{
				szsh[i]=(ys*10+sz[i])/13;
				ys=(ys*10+sz[i])%13;

			}


		}
		for(i=2;i<l;i++){
			printf("%d",szsh[i]);
		}
		printf("\n%d\n",ys);
		


	}

	else{
		szsh[1]=(sz[0]*10+sz[1])/13;
		ys=(sz[0]*10+sz[1])%13;
		
		for(i=2;i<l;i++){
			if(ys<2&&sz[i]<=2){
				szsh[i]=0;
				szsh[i+1]=(ys*100+sz[i]*10+sz[i+1])/13;
				ys=(ys*100+sz[i]*10+sz[i+1])%13;
				i++;
			}
			else{
				szsh[i]=(ys*10+sz[i])/13;
				ys=(ys*10+sz[i])%13;

			}


		}

		
			for(i=1;i<l;i++){
			printf("%d",szsh[i]);
		}
		printf("\n%d\n",ys);	
		
	}
	}
	}
	return 0;	
}
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[0]=='0'&&c[1]!='0')
       {
           i=1;
           while (c[i]>='0'&&c[i]<='9')
           {
               printf("%c",c[i]);
               i++;
           }
       }
       else if (c[0]=='0'&&c[1]=='0')
       {
           i=2;
           while (c[i]>='0'&&c[i]<='9')
           {
               printf("%c",c[i]);
               i++;
           }
       }
       else
       {
           i=0;
           while (c[i]>='0'&&c[i]<='9')
           {
               printf("%c",c[i]);
               i++;
           }
       }
      printf("\n%d",e);
      }
}
void qu(char *);
int main()
{
char a[110],b[110];
gets(a);
int a1,i,yu=0;
a1=strlen(a);
for(i=0;i<a1;i++)
{
yu=a[i]-'0'+yu*10;
b[i]=yu/13+'0';
yu=yu%13;
}
b[a1]='\0';
qu(b);
puts(b);
printf("%d",yu);
return 0;
}
void qu(char *b)
{
int i;
while(b[0]=='0')
{
	int b1=strlen(b);
	for(i=0;i<b1;i++)
	{
		b[i]=b[i+1];
	}
}
if(b[0]=='\0')
{b[0]='0';
b[1]='\0';}

}
int sn(char s)
{
    char *p;
    p=&s;
    return atoi(p);
}
int yu=0;
void chufa(char *p1,char*p2)
{
     int l1=strlen(p1);
     if(l1==1)
     {
              p2[0]='0';
              yu=sn(p1[0]);
     }
     for(int i=0;i<l1-1;i++)
     {
             int flg=0;
             if(i==0) flg=1;
             int temp=0;
             temp=(flg*10*sn(p1[i])+sn(p1[i+1])+yu*10)%13;
             p2[i]='0'+(flg*10*sn(p1[i])+sn(p1[i+1])+yu*10-temp)/13;
             yu=temp;
     }
}
main()
{
      char s[100];
      gets(s);
      int len=strlen(s);
      char shang[len-1];
      chufa(s,shang);
      for(int i=0;;i++)
      {
              if(i==0&&shang[i]=='0')
              if(len==1||len==2)
              printf("%c",shang[i]);
              else continue;
              else if(i!=len-1) printf("%c",shang[i]);
              if(i==len-1)
              break;
              
      }
      printf("\n%d",yu);
          
}
main()
{
      int i,j,n,t;
      char c[100],d[100];
      int b[100],a[100];
     gets (c);
     
      //n=strlen("c");
      for(i=0;c[i]!='\0';i++)
     {
         a[i]=c[i]-'0';           
      } 
      //printf("%d",i);
     if(i==1){printf("0");printf("\n%d",a[0]);  }
      else
      {
     for(j=0;j<i-1;j++)
     {
        b[j]=(10*a[j]+a[j+1])/13; 
        a[j+1]=(10*a[j]+a[j+1])%13;
          // printf("\n%d",b[j]);             
     } 
  for(n=0;n<j;n++)
     {
       d[n]=b[n]+'0';
                   
     }
    // printf("%d\n",n);
     d[n]='\0';
     if(d[0]=='0')
     {
           if(d[1]=='\0')
           {printf("%c",d[0]);}
            else
            {
             for(t=1;d[t]!='\0';t++)
              {
      
                    printf("%c",d[t]);           
                   }          
            }
            }   
     else
     {
     for(t=0;d[t]!='\0';t++)
     {
      
        printf("%c",d[t]);           
     }                    
     }
     printf("\n%d",a[j]); 
}   
     
getchar();  
 getchar();     
 getchar();    
  getchar();  
 getchar();     
 getchar();
  }
int main()
{
    char a[101];
    gets(a);
    if(((a[0]-'0')*10+a[1]-'0')<13&&a[2]=='\0')
    {printf("0\n");puts(a);}
    else
{
    char b[101];
    int x=a[0]-'0';
    int i;
    for(i=0;a[i+1]!='\0';i++)
    {
            b[i]=(x*10+a[i+1]-'0')/13+'0';
            x=(x*10+a[i+1]-'0')%13;
    }
    b[i]='\0';
    if(b[0]=='\0') printf("0\n");
    else if(b[0]=='0') 
    {
                  for(i=0;b[i]!='\0';i++) 
                  b[i]=b[i+1];
                  b[i]='\0';
                  puts(b);
    }                        
    else
    puts(b);
    printf("%d",x);
}
    getchar();getchar();getchar();
}
int main()
{
    char in[101];
    int shan[100];
    int a=0,yu=0,n=0;
    cin>>in;
    if(strlen(in)==1 || (strlen(in)==2&&in[0]=='1'&&in[1]<'3'))   cout<<'0'<<endl<<in<<endl;
    else
    {
    yu=in[0]-'0';
    for(int i=1;in[i]!=0;i++)
       {
           a=yu*10+(in[i]-'0');
           shan[i-1]=a/13;
           yu=a-shan[i-1]*13;
           n++;
       }
    if(shan[0]==0)
      for(int i=1;i<n;i++)
         cout<<shan[i];
    else for(int i=0;i<n;i++)
            cout<<shan[i];
    cout<<endl;
    cout<<yu<<endl;
    }
    return 0;
}
int main()
{
	char a[101] ;
	int i, j = 0, b, s[100], y ;
	cin.getline(a, 100) ;
	while(a[j] != '\0')
	{
		j++ ;
	}
	if(j == 1)
	{
		y = (a[0] - '0') % 13 ;
		s[0] = 0;
		cout << s[0] << '\n' << y << endl ;
	}
	else
	{
		y = ((a[0] - '0') * 10 + (a[1] - '0')) % 13 ;
		s[0] = ((a[0] - '0') * 10 + (a[1] - '0')) / 13 ;
		for(i = 1 ; i < j - 1 ; i++)
		{
			b = y * 10 + (a[i+1] - '0') ;
			s[i] = b / 13 ;
			y = b % 13 ;
		}
		if(j <= 2)
			cout << s[0] << endl;
		if(s[0] != 0 )
		{
			if(j > 2)
				cout << s[0] ;
		}
		for(i = 1 ; i < j - 1 ; i++)
		{
			if(i == j - 2)
				cout << s[i] << endl ;
			else
				cout << s[i] ;
		}
		cout << y << endl ;
	}
	
	return 0 ;
}
int main()
{
	char N[101];
	cin.getline(N, 101);
	int l = strlen(N);
	int quo[101], num[101], i, j = 0, r = 0;
	for(i = 0; i < l; i++)
		num[i] = N[i] - '0';
	for(i = 0; i < l; i++)
	{
		quo[i] = (r * 10 + num[i]) / 13;
		r = (r * 10 + num[i]) % 13;
	}
	int t = 0, temp;
	while(quo[t] == 0) 
	{
		t++;
		temp = t;
	}
	if(temp == l) cout << "0";
	else
	{
		for(; t < l; t++) cout << quo[t];
		
	}
	cout << endl;
	cout << r << endl;
	return 0;
}
int main()
{
	char a[100];
	int i, j, k, s, c[100] = {0}, b[100] = {0}, x = 0, t, u;
	cin >> a;
	s = strlen(a);
	for ( i = 0; a[i] != '\0'; i++ )
	{
		c[i] = a[i] - '0';
	}
    for ( j = 0; j <= s - 1; j++ )
	{
		x = x * 10 + c[j];
        t = x / 13;
		b[j] = t;
		x = x % 13;
	}
	i = 0;
	while ( b[i] == 0 )
	{
		if ((b[2] == 0) && ( b[1] == 0))
		{
			i = 0;
			break;
		}
		else
			i++;
	}
	for ( k = i; k <= s - 1; k++)
		if ( i == 0)
		{
			cout << 0;
			break;
		}
		else
			cout << b[k];
	cout<<endl<< x;
	return 0;
}
int main()
{
	char a[110];
	int n,i,j,b[110],c[110],sum = 0;
	cin >> a;
	//memset(b,0,sizeof(b) );
	n = strlen(a);
	if (n == 1)  {cout << '0' << endl;cout << a[0];return 0;}
	
	if (n>=2){
	for ( i = 0; i < n; i ++)
	{
		b[i] = a[i] - '0';
	}
	if (n == 2 && ( b[0]*10 + b[1] ) < 13)  {sum = b[0]*10+b[1];cout << '0' <<endl;cout <<  sum<<endl;return 0;}
	sum = b[0]*10 + b[1] ;
	j = 0;
	if (sum > 12)  {c[j] = sum / 13;j ++ ;sum = sum % 13;}
	if (n > 1){
	for ( i = 2; i < n; i ++)
	{
		sum = sum * 10 + b[i];
		
			c[j] = sum / 13;
			sum = sum % 13;
			j ++;
			//cout <<c[j-1] << ' '<< sum <<endl;
		
	}
	for (i = 0 ; i < j; i ++)  cout << c[i];
	cout << endl;
	cout << sum;
	}
		}
	return 0;
}
int change(char a,char b){
	return 10*(a-'0')+(b-'0');
	}//??????? 
int shang(int x){
	for(int i=0;i<10;i++){
		if(i*13<=x && x<(i+1)*13)return i;
		}
	}//?????? 
void coutt(int b[],int num){
	for(int i=0;i<num;i++){
		cout<<b[i];
		}
		cout<<endl;
	}//???? 
int main(){ 
		char a[102]={'\0'};
		int c[102]={0};
		cin>>a;
		if(strlen(a)==1)cout<<0<<endl<<a[0]-'0';
		else if(strlen(a)==2 && change(a[0],a[1])<13)cout<<0<<endl<<change(a[0],a[1]);//????? 
		else{	
			int x=change(a[0],a[1]),yushu=0;
		    if(x<13){//?????13 
		    	x=x*10+a[2]-'0';
			    for(int i=0;i<strlen(a)-2;i++){
				    c[i]=shang(x);
				    if(i!=strlen(a)-3)x=(x-c[i]*13)*10+(a[i+3]-'0');
				    else yushu=x-c[i]*13;
				    }
				    coutt(c,strlen(a)-2);
			    }
			else {//???????13 
				for(int i=0;i<strlen(a)-1;i++){
					c[i]=shang(x);
					if(i!=strlen(a)-2)x=(x-c[i]*13)*10+(a[i+2]-'0');
					else yushu=x-c[i]*13;
					}
					coutt(c,strlen(a)-1);
				}
				cout<<yushu<<endl;
			}
		
		return 0;
	}