semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int main () 
{
	char a[1001];
	int i , j , k , n , b[1001] , r , s ;
	cin.getline(a,1001);
	for ( i = 0 ; a[i] != '\0' ; i ++ )
	{
		b[i] = a[i] - '0' ;
	}
	if ( i == 1 )
	{
		cout << "0" << endl ;
		cout << b[0] << endl ;
	}
	if ( i == 2 )
	{
		cout << (b[0]*10+b[1])/13 << endl;
		cout << (b[0]*10+b[1])%13 << endl ;
	}
	if ( i != 1 && i != 2 )
	{
		r = b[0] * 10 + b[1] ;
		for ( j = 2 ; j < i ; j ++ )
		{
			s = r * 10 + b[j] ;
			if ( s >= 13 )
			{
				cout << s / 13 ;
				r = s % 13 ;
			}
			else
			{
				if ( s >= 10 || r == 0 )
				{
					cout << "0";
				}
				r = s ;
			} 
			if ( j == i - 1 )
			{
				cout << endl << ( s % 13 ) ;
			}
		}
	}
}
int main()
{
	char num[100];
	cin >> num;
	// division???????????number[i]??num[i],denominator[i]??????
	int division = 0, number[100], denominator[100], dinominator[100], rest = 0, i, j, mark;
	for (i = 0; i < 100; i++)        
	{
		if (num[i] != '\0')  // ??????????????????????
		{
			number[i] = num[i] - '0';
		}
		else
		{
			break;
		} 
	}               // ??????i - 1?
	if (i == 1)
	{
		cout << "0" << endl << number[0];
	}
	else if ((i == 2) && (number[0] == 1) && (number[1] <= 2))
	{
		cout << "0" << endl << number[0] * 10 + number[1];
	}
	
	else
	{
	rest = number[0];
	for (j = 1; j <= i - 1; j++)   // ???????1??????division???99??denominator????
	{
		division = number[j] + rest * 10; 
		denominator[j] = division / 13;
		rest = division % 13;
	}
	for (j = 1; j <= i - 1; j++)
	{
		if (denominator[j] != 0)  //???????????0??
		{
			mark = j;
			break;
		}
	}
	for (j = mark; j <= i - 1; j++)
	{
		cout << denominator[j];
	}
	cout << endl;
	cout << rest;
	}
	return 0;
}
int main()
{
	int i,j,k,l;
	char a[100],b[100],c[100];
	cin>>a;
    l=strlen(a);

    
    for(i=0;i<l;i++)
    {
    	b[i]=a[i]-'0';
    	c[i]=0;
    }
    if(l==1)
    {
    	cout<<0<<endl<<b[0]+48-48;
    	return 0;
    }
    c[l]=0;
    for(i=0;i<l;i++)
    {
    	c[i]=fabs(10*c[i]+b[i]);
    	c[i+1]=fabs(c[i]%13);
    	c[i]=fabs(c[i]/13);
    	
    }
    if(c[1]!=0){c[1]=c[1]+'0';cout<<c[1];}
    if(b[0]==1&&b[1]<3&&l<3) cout<<0;
    for(i=2;i<l;i++)
    {
    	c[i]=c[i]+'0';
    	cout<<c[i];
    }
    cout<<endl;
    cout<<c[l]+48-48;
    return 0;
}
int main()
{
	const int MAX_LEN = 100;
	int num[MAX_LEN + 1], result[MAX_LEN], i, r = 0, flag = 0, k;
	char str[MAX_LEN];
	cin.getline(str, MAX_LEN + 1);
	int nlen = strlen(str);
	memset (num, 0, sizeof(num));
	memset (result, 0, sizeof(result));
	if (nlen == 1)
		cout << '0' << endl << str;
	else if (nlen == 2 && str[0] == '1' && str[1] < '3')
	{
		cout << '0' << endl << str;
	}
	else
	{
		for (i = 0; i < nlen; i++)
		{
			num[i] = str[i] - '0';
		}
		for (i = 0; i < nlen; i++)
		{
			result[i] = (r * 10 + num[i]) / 13;
			r = (r * 10 + num[i]) % 13;
			k = r;
			if (r < 0)
				break;
		}
		for(i = 0; i < nlen; i++)
		{
			if (result[i] == 0 && flag == 0)
				continue;
			else
			{
				flag = 1;
				cout << result[i];
			}
		}
		cout << endl << k;
	}
	return 0;
}
int main()
{
	char num[100];
	int a[99],d,i,j,k,flag = 0;
	cin >> num;
	d = num[0] - '0';
	a[0] = 0;
	for(i = 1; num[i] != '\0'; i++)
	{
		a[i - 1] = (d * 10 + (num [i] - '0')) / 13;
		d = (d * 10 + (num [i] - '0')) % 13;
	}
	for(j = 1; num[j] != '\0'; j++)
	{
		if(a[j - 1] == 0)
			continue;
		else
		{
			cout << a[j - 1];
			flag = 1;
			break;
		}
	}
	if(flag == 1)
	{
		for(k = j; k < i - 1; k++)
		{
			cout << a[k];
		}
		cout << endl;
	}
	else
	{
		cout << a[0] << endl;
	}
	cout << d;
	return 0;
}
//********************************
//*???? ??(12-11) ??13 
//********************************

int main()
{
	char a[105];
	char b[105];
	int i,yu,sh,lin,l;
	cin.getline (a,105);
	l = strlen(a);
	yu = 0;
	for(i = 0; i < l; i++)
	{
		lin = 10 * yu + (a[i] - '0');
		b[i] = lin / 13;
		yu = lin % 13;
	}
	if((l == 1) || ((l == 2) && (a[0] == '1') && (a[1] < '3')))
		cout << "0";
	else
	{
		if(b[1])
		{
			for(i = 1; i < l; i++)
				cout << (int)b[i];
		}
		else
		{
			for(i = 2; i < l; i++)
				cout << (int)b[i];
		}
	}
	cout << endl << yu << endl;
	cin.get();
    cin.get(); //????
	return 0;
}
void main()
{
	char n[100]={0},s[100]={0};
	int nn[100]={0},y=0,len,i;
	scanf("%s",n);
	len=strlen(n);
	for(i=0;i<len;i++)
	{
		nn[i]=n[i]-'0';
	}
	for(i=0;i<len;i++)
	{
		s[i]=nn[i]/13+'0';
		y=nn[i]%13;
		nn[i+1]=nn[i+1]+10*y;
	}
	if(s[0]=='0'&&s[1]==0||s[0]=='0'&&s[1]=='0'&&s[2]==0)
		printf("0");
	else
	{
		if(s[1]!='0')
		i=1;
		else
		i=2;
		for(;i<len;i++)
		{
			printf("%c",s[i]);
		}
	}
	printf("\n");
	printf("%d\n",y);
}
int main()
{
 int b,c,i;
 char a[100];
 scanf("%s",a);
 b=a[0]-'0';
 if(a[1]=='\0'||(a[2]=='\0'&&(a[2]-'0')<3&&(a[0]-'0')==1))
 {
   printf("0");
 }
 for(i=1;a[i]!='\0';i++)
 {
  b=b*10+(a[i]-'0');
  c=b/13;
  b=b%13;
  if(i==1&&c==0)
  {
      continue;
  }
  printf("%d",c);
 }
  printf("\n%d",b);
 return 0;
}
int main()
{
	char a[100];
	int re[100], i = 0, j, k = 0, m = 0, n = 0;
	cin >> a;	
	while (a[i] != 0)
		i ++;	
	for (j = 0; j < i; j ++)
	{
		re[j] = (k * 10 + a[j] - '0')/ 13;    
		m ++;	
		k = (k * 10 + a[j] - '0')% 13;		
	}
	while (re[n] == 0)
		n ++;		
	if (n == m)     
		cout << "0" << endl;   
	else
	{
		for (; n < m; n ++)
			cout << re[n];		   
		cout << endl;		
	}
	cout << k << endl;      
	return 0;
}
int main()
{
	char a[110];
	int b[110];
	cin>>a;
	int len=strlen(a),i=0;
	for(i=0;i<len;i++)
		b[i]=a[i]-'0';
	if(len==1)
	{
		cout<<"0"<<endl<<b[0]<<endl;
		return 0;
	}
	int k=0;
	k=10*b[0]+b[1];
	b[1]=k%13;
	if(k>=13)
	{
		cout<<k/13;
	    
	}
	else if(len==2)
	{
		cout<<"0"<<endl<<k<<endl;
		return 0;
	}
	for(i=1;i<len-1;i++)
	{
		k=b[i]*10+b[i+1];
		cout<<k/13;
		b[i+1]=k%13;
	}
	cout<<endl<<b[i]<<endl;
	return 0;


}
main()
{
      int a[110],b[110],i,j,m,yu,z,qishi;
      char c[110];
      scanf("%s",c); 
      
      for(i=0;c[i]!='\0';i++)
              a[i+1]=c[i]-'0'; 
      m=i;
      
if(m==1)
printf("0\n%d",a[1]);
else{
     if(m==2)
     printf("%d\n%d",(10*a[1]+a[2])/13  , (10*a[1]+a[2])%13 );
     else{
     
      
      
      for(i=1;i<=m-1;i++)
      {
            z=10*a[i]+a[i+1];
            b[i]=z/13;
            a[i+1]=z%13;
      }
      yu=a[i];
      if(b[1]==0) qishi=2;
      else qishi=1;
      for(j=qishi;j<=m-1;j++)
      printf("%d",b[j]);
      printf("\n");
      printf("%d\n",yu);
      
      }}
}
int main()
{

    int a[200];int b[200];int c[200];int i;int m;int n;int r;
    char A[200];
    gets(A);
    n=strlen(A);
    r=A[0]-'0';   
    if(n==1)
    {printf("0");printf("\n");printf("%d",r);}
    
    else
    {
    for(i=0;i<n;i++)
   { a[i]=A[i]-'0';}
    m=a[0]*10+a[1];
    for(i=0;i<n-1;i++)
    {
        
        b[i]=m/13;
        c[i]=m%13;
        m=c[i]*10+a[i+2];
    } 
    if(b[0]==0&&n==2)
    printf("0");
    if(b[0]==0)
    {
    for(i=1;i<n-1;i++)
    printf("%d",b[i]);
    }    
    else
     { 
    for(i=0;i<n-1;i++)
    printf("%d",b[i]);
    }   
    printf("\n"); 
    printf("%d",c[n-2]); 
  }    
    
   
}
int main()
{
	int i,j,l,a;
	char shang[1000],bcs[1000],ys[1000];
	gets(bcs);
	l=strlen(bcs);
    if(l==2){
		a=(bcs[0]-'0')*10+bcs[1]-'0';
		printf("%d\n",a/13);
		printf("%d",a%13);
	}
	if(l==1){
		a=bcs[0]-'0';
		printf("%d\n",0);
		printf("%d",a);
	}
	if(l>2){
	if(bcs[0]=='1'&&bcs[1]<='2'){
		a=(bcs[0]-'0')*100+(bcs[1]-'0')*10+bcs[2]-'0';
for(i=0;i<=l-3;i++){
		     shang[i]=(a/13)+'0';
			 ys[i]=(a%13)+'0';
			 a=((ys[i]-'0')*10+bcs[i+3]-'0');
		}
for(j=0;j<l-2;j++){
	if(j==l-3){
		printf("%c\n",shang[j]);
	}
		else{
			printf("%c",shang[j]);
		}
}
		printf("%c",ys[l-3]);
	}
	else{
		a=((bcs[0]-'0')*10+bcs[1]-'0');
		for(i=0;i<=l-2;i++){
			shang[i]=(a/13)+'0';
			ys[i]=(a%13)+'0';
			a=((ys[i]-'0')*10+bcs[i+2]-'0');
		}
		for(j=0;j<l-1;j++){
	if(j==l-2){
		printf("%c\n",shang[j]);
	}
	else{
		printf("%c",shang[j]);
	}
}
		printf("%c",ys[l-2]);
	}
	}
	return 0;
}
char input[200];
int output[200];
int main(){
	cin >> input;
	memset(output,0,sizeof(output));
	int length  = strlen(input);
	int remainder = 0,i;
	for(i = 0;i < length;i ++){
		remainder *= 10;
		remainder += input[i] - '0';
		if(remainder < 13){
			output[i] = 0;
		}else{
			output[i] = remainder / 13;
			remainder %= 13;
		}
	}
	for(i = 0;i < length;i ++){
		if(output[i] != 0)
			break;
	}
	if(i == length)
		cout << 0;
	else
		for(;i < length;i ++)
			cout << output[i];
	cout << endl << remainder << endl;
	return 0;
}
int main(){
	char a[100],b[100];                    //b[100]??
	int n,m,i,x=0,w;                       //n???
	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);         
			b[i]=n/13+48;
			n=n%13;                        //??????
		}
		b[m+1]=0;
		w=strlen(b);
		if(w<=2)                                              //????????0
		{
			cout<<0<<endl;
			cout<<n<<endl;
		}
		else if(w<=3&&(int)a[0]-49==0&&(int)a[1]-50<=0)       //???????10,11,12,??2??????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()
{
	char x[101];
	int s[101],i,a,n[101],k,y;
	scanf("%s",x);
	for(i=0;x[i]!='\0';i++)
	{
		n[i]=x[i]-48;
	}
	k=i;
	if(k==2&&n[0]==1&&n[1]<3)
	{
		printf("0\n%d",10*n[0]+n[1]);
	}
	else {
		if(k==1)
		printf("0\n%d",n[0]);
    	else 
		{
			if(n[0]>1||(n[0]==1&&n[1]>=3))
			{
	    	a=10*n[0]+n[1];
	    	for(i=1;i<k-1;i++)
			{
			
			s[i-1]=a/13;
			a=10*(a%13)+n[i+1];

			}
		    s[k-2]=a/13;
	    	y=a%13;
	    	for(i=0;i<k-1;i++)
			printf("%d",s[i]);
	    	printf("\n%d",y);

			}
        	else
			{
		    a=100*n[0]+10*n[1]+n[2];
		    for(i=1;i<k-2;i++)
			{
			
			s[i-1]=a/13;
			a=10*(a%13)+n[i+2];

			}
	    	s[k-3]=a/13;
	       	y=a%13;
		    for(i=0;i<k-2;i++)
	   		printf("%d",s[i]);
	    	printf("\n%d",y);

			}
	}}

	return 0;
}
main()
{
	int x,i,t,q;
	char s[102];
	int a[102]={0};
	int b[102]={0};
	scanf("%s",s);
	x=strlen(s);
	for(i=0;i<x;i++)
	{
		a[i]=s[i]-'0';
	}
	if(x==1)
	{
		printf("0\n");
		printf("%d",a[0]);
	}
	else
	{
		t=a[0]*10+a[1];
		for(i=1;i<x;i++)
		{
			b[i-1]=t/13;
			if(i!=x-1)
			{
				t=t%13*10+a[i+1];
			}
			else if(i==x-1)
			q=t%13;
		}
		if(b[0]==0&&b[1]!=0)
		{
			for(i=1;i<x-1;i++)
			{
				printf("%d",b[i]);
			}
			printf("\n");
			printf("%d",q);
		}
		else if(b[0]!=0)
		{
			for(i=0;i<x-1;i++)
			{
				printf("%d",b[i]);
			}
			printf("\n");
			printf("%d",q);
		}
		else if(b[0]==0&&b[1]==0)
		{
			printf("0\n");
			printf("%d",t);
		}
	} 
}
void main()
{
char a[100];
char b[100];
int c[100];
int t,n,i=0,j=0,q,r;
scanf("%s",a);
n=strlen(a);
if (n==2)
{

r=(a[0]-'0')*10+a[1]-'0';
printf("%d\n%d",r/13,r%13);
}
else if(n==1)
{
r=a[0]-'0';
printf("%d\n%d",0,r);
}





else
{


t=a[0]-'0';
for(i=0;i<n-1;i++)
{
t=(a[i+1]-'0')+t*10;
if(t>=13)
	{
	b[i]=t/13+'0';
	c[i]=t%13;
	t=t%13;
	}
else
{	
b[i]='0';
c[i]=t;

}
}
int m;
m=strlen(b);
if(b[0]>'0')
printf("%c",b[0]);
for(i=1;i<m,b[i]>='0';i++)
{
printf("%c",b[i]);
q=i;
}
printf("\n%d",c[q]);
}
}
int main()
{
    char string[101];
    int i;
    scanf("%s",string);
    char a[101];
    int b=string[0]-'0';
    for(i=0;string[i+1]!='\0';i++)
    {
                                  a[i]=(b*10+string[i+1]-'0')/13+'0';
                                  b=(b*10+string[i+1]-'0')%13;
    }
    a[i]='\0';
    if(a[0]=='0')
    {
                 char c[101];
                 strcpy(c,a);
                 for(i=0;c[i+1]!='\0';i++)
                 {a[i]=c[i+1];}
                 a[i]='\0';                         
    } 
    if(string[1]=='\0')
    {
                  a[0]='0';a[1]='\0';b=string[0]-'0';
    }
    if(string[2]=='\0'&&((string[0]-'0')*10+string[1]-'0')<13)
    {
                                                              a[0]='0';
                                                              a[1]='\0';
                                                              b=(string[0]-'0')*10+string[1]-'0';
    }
    printf("%s\n",a);
    printf("%d",b);
    getchar();
    getchar();
}
main()
{
 char num[100];
 scanf("%s",num);
 int con[100];
 int p[100];
 int i,j,a,b,s,k=0,l; 
 for(i=0;num[i]!='\0';i++)
 {
  con[i]=num[i]-'0';                      
                          }     
 if(i==1)
 {
 a=0;
 b=con[0];
 printf("%d",a);
 printf("\n");
 printf("%d",b);
               }
 else
 {
  for(j=0;j<=i-2;j++)
  {
  s=con[j]*10+con[j+1];
  if(s>=13)
  {
  a=s/13;
  b=s%13;
  con[j+1]=b;
  p[k]=a;
  k=k+1;
   }
  else 
  {
   con[j+1]=s;
   b=s;
   if(k==0) 
  {
   continue;         
            }
   else
   {
    p[k]=0;
    k=k+1;
    continue;   
       }   
       }
       }
  if(k==0)
  printf("%d",k);
  else
  {for(l=0;l<=k-1;l++)
  {printf("%d",p[l]);}}
  printf("\n");
  printf("%d",b);      
     }              
 getchar();
 getchar();
 getchar();     
      }
int main()
{
    char a[100];
    int divide[100], mod;
    int len;
    cin >> a;
    len = strlen(a);
    if (len == 1)
    {
        cout << 0 << endl;
        cout << a[0];
    }
    else
    if(len == 2)
    {
        cout << (10 * (a[0] - '0') + (a[1] - '0')) / 13 << endl;
        cout << (10 * (a[0] - '0') + (a[1] - '0')) % 13;
    }
    else
    {
        divide[0] = (10 * (a[0] - '0') + (a[1] - '0')) / 13;
        mod = (10 * (a[0] - '0') + (a[1] - '0')) % 13;
        for (int i = 1; i < len - 1; i++)
        {
            divide[i] = (10 * mod + (a[i + 1] - '0')) / 13;
            mod = (10 * mod + (a[i + 1] - '0')) % 13;
        }
        if (divide[0])
            cout << divide[0];
        for (int i = 1; i < len - 2; i++)
        {
            cout << divide[i];
        }
            cout << divide[len - 2] << endl;
            cout << mod << endl;
    }
    return 0;
}
main()
{
      int i,m,count;
      int a[SIZE],b[SIZE];
      char string[101];
      scanf("%s",string);
      for(i=0;i<=99;i++)
      a[i]=0;
      count=0;
      for(i=0;i<=99;i++)
      {
                        if(string[i]=='\0')
                        break;
                        a[i]=string[i]-48;
                        count++;
      }
      if(count>2)
      {
                  for(i=0;i<=count-2;i++)
                  b[i]=0;
                  for(i=0;i<=count-2;i++)
                  {
                                         b[i]=(a[i]*10+a[i+1])/13;
                                         a[i+1]=(a[i]*10+a[i+1])%13;
                  }
                  m=a[count-1];
                  if(b[0]==0)
                  {
                             for(i=1;i<=count-2;i++)
                             printf("%d",b[i]);
                             printf("\n");
                             printf("%d",m);
                  }
                  if(b[0]!=0)
                  {
                             for(i=0;i<=count-2;i++)
                             printf("%d",b[i]);
                             printf("\n");
                             printf("%d",m);
                  }
      }      
      if(count==1)
      {
                  printf("%d",0);
                  printf("\n");
                  printf("%d",a[0]); 
      }     
      if(count==2)
      {
                  if((a[0]*10+a[1])<13)
                  {
                                        printf("%d",0);
                                        printf("\n");
                                        printf("%d",a[0]*10+a[1]);
                  }
                  if((a[0]*10+a[1])>=13)
                  {
                                       printf("%d",(a[0]*10+a[1])/13);
                                       printf("\n");
                                       printf("%d",(a[0]*10+a[1])%13);
                  }
      }
    
}
main()
{
int c,l,i,d;
int b[100];
char a[100];
scanf("%s",a);
l=strlen(a);
if(l==1)
{
printf("%d\n",0);
printf("%c\n",a[0]);
}
else
{              
for(i=1;i<=l-1;i++)
{
d=10*(a[i-1]-'0')+a[i]-'0';
b[i-1]=d/13;
a[i]=d%13+'0';      
}
c=a[l-1]-'0';
if(l==2)
{
printf("%d\n",b[0]);
printf("%d\n",c);      
}
else
{
if(b[0]==0)
{
for(i=1;i<=l-3;i++)
printf("%d",b[i]);
printf("%d\n",b[l-2]);
printf("%d\n",c);
}
else
{
for(i=1;i<=l-2;i++)
printf("%d",b[i-1]);
printf("%d\n",b[l-2]);
printf("%d\n",c);
}
}
}
getchar();
getchar();           
}
int f(char a)                                       //?????????????? 
{  if(a=='1')  return 1;
   if(a=='2')  return 2;
   if(a=='3')  return 3;
   if(a=='4')  return 4;
   if(a=='5')  return 5;
   if(a=='6')  return 6;
   if(a=='7')  return 7;
   if(a=='8')  return 8;
   if(a=='9')  return 9;
   if(a=='0')  return 0;
}
int main()
{   char a;
    int b;
    int chushu=0;
    int yushu=0;
    int shang;
    int t=0;
    int v=0;
    while(1)                                    
      {                   
                 cin.get(a);                   
                 if(a=='\n')                    //?????? 
                    {   t=1;
                        
                    }
                 b=f(a);                       
                 chushu=10*chushu+b;          //????? 
            
         if(t==1)  break;                     //???? 
         shang=chushu/13;                    //???? 
         yushu=chushu%13;
         chushu=yushu;
         if(shang!=0)   v=v+1; 
         if(v!=0)   cout<<shang;                         //?? 
         
      }
    if(v==0)   cout<<0;
    cout<<endl;
    cout<<yushu;
    return 0;
}
char a[200]={'\0'};
int  b[200]={0},c[200]={0},r[200]={0},q[200]={0};
int len;int lenofr=0;int x=0,y=0;
void devide1(int n)
{
	int i,j;
	
	x=10*y+r[n];
	if(n!=0)cout<<x/13;
	y=x%13;

}
void devide2(int n)
{
	int i,j;
	
	x=10*y+r[n];
	if(n!=0&&n!=1)cout<<x/13;
	y=x%13;

}
int main()
{
	cin>>a;
	len=strlen(a);
	int i,j;
	for(i=0;i<len;i++)
		r[i]=a[i]-'0';

	//cout<<r[0]<<r[1]<<endl;
	if(len==1){cout<<0<<endl;cout<<r[0]<<endl;}
	if(len==2){cout<<(10*r[0]+r[1])/13<<endl;cout<<(10*r[0]+r[1])%13<<endl;}
	if(len>=3){
		if((10*r[0]+r[1])>=13){lenofr=len-1;{for(i=0;i<=lenofr;i++)
			devide1(i);
		cout<<endl;
		cout<<y<<endl;}}
		else {lenofr=len-2;{for(i=0;i<=lenofr+1;i++)
			devide2(i);
		cout<<endl;
		cout<<y<<endl;
		}}
		//cout<<lenofr;
		
	}
	
	
		return 0;
}
int main ()
{
	char in[110]={0};
	cin>>in;
	int num[110]={0},ans[110]={0};
	int lenth = strlen(in);
	for (int i=0;i<lenth;i++)
		num[i]=in[i]-'0';
	int r = num[0];
	for (int i=1;i<lenth;i++){
		ans[i] = (r * 10 + num[i]) / 13;
		r = (r * 10 + num[i]) % 13;
	}
	int s = 0;
	for (int i=0;i<lenth;i++){
		if (ans[i] != 0) {s = i;break;}
	}
	if (lenth<=2 && num[1]+num[0]*10<13){
		cout<<'0'<<endl<<r;
	}
	else {
	for (int i=s;i<lenth;i++)
		cout<<ans[i];
	cout<<endl<<r;
	}
	
	return 0;
}
main()
{
       char N[L];
       scanf("%s",N);
       int i,r=0;
       for(i=0;i<L;i++)
       {
            r=10*r+(N[i]-'0');
            if(i==0)
            ;
            else
            if(i==1&&r/13==0)
            ;
            else
            printf("%d",r/13);
            r=r%13;
            if(N[i+1]=='\0')
            break;
      }
      if(i==0||(i==1&&r>9))
      printf("0");
      printf("\n");
      printf("%d",r);
}
int main()
{
	char a[110]={0}, ans[110]={0};
	int aa[110]={0};
	int i, cal=0, n;
	cin >> a;
	n=strlen(a)-1;
	if (n==0)								//??????????
	{
		cout << 0 << endl;
		cout << a << endl;
		return 0;
	}
	for (i=0; i<=n; i++)
		aa[i]=a[i]-'0';
	i=0;									//??????
	while (i<n)
	{
		cal=aa[i]*10+aa[i+1];				//??????????
		while ((cal<13)&&(i<n-1))
		{
			cal=cal*10+aa[i+2];				//?????13??????
			ans[i]='0';
			i++;
		}
		ans[i]=cal/13+'0';					//????
		aa[i+1]=cal%13;
		i++;
	}
	ans[n]='\0';
	if ((ans[0]=='0')&&(ans[1]>'0'))
	{
		for (i=1; i<n; i++)
			cout << ans[i];					//???????
		cout << endl;
	}
	else
		cout << ans << endl;
	cout << cal%13 << endl;					//????
	return 0;								//main???????0
}
/*
 * 0.cpp
 *
 *  Created on: 2011-12-30
 *      Author: Alfalfa
 */
int main() {
	char a[101], out[100];
	memset(out,100,'/');
	cin>>a;
	int len=strlen(a), temp, mod;
	temp=10*(a[0]-'0') + a[1]-'0';
	if(temp<13&&len<=2) len=1;
	for(int i=0; i<len-1; i++){
		out[i]=temp/13+'0';
		mod=temp%13;
		temp=temp%13*10+(a[i+2]-'0');
	}
	int flag=0;
	if(len==1)
		cout<<0<<endl<<a;
	else {
		for(int i=0; i<len-1; i++){
			if(out[i]!='0') flag=1;
			if(flag) cout<<out[i];
		}
		cout<<endl<<mod;
	}
}
int main()
{
	char str[101];
	cin.getline(str, 101);
	int num[101];
	int   i, j;
	for (i = 0; i < strlen(str); i ++)
		num[i]  = str[i] - '0';
	int num1[100];
	memset(num1, 0, sizeof(num1));
	for (i = 0; i < strlen(str)-1; i ++)
	{
		num1[i] = (num[i] * 10 + num[i + 1]) / 13;
		num[i + 1]  = (num[i] * 10 + num[i + 1]) % 13;
	}
	j = 0;
	if (num1[j] == 0)
		j = 1;
	for (; j < i ; j ++)
		cout << num1[j];
	if (strlen(str) <= 2 && num1[0] == 0)
		cout << 0;
	cout << endl;
	cout << num[strlen(str) - 1]<< endl;
	return 0;
}
int main()
{
	char s[100];
	int m = 0, n, a[100] = {0}, b = 0, i;
	cin >> s;
	n = strlen(s);
	if(n == 1)
	{
		m = s[0] - '0';
		cout << "0" << endl << m << endl;
	}
	else
	{
	  if(n == 2)
	  {
		  m = (s[0] - '0') * 10 + s[1] - '0';
		  b = m / 13;
		  m = m % 13;
		  cout << b << endl << m << endl;
	  }
	  else
	  {
		m = s[0] - '0';
	   for(i = 1; i < n; i++)
	   {
		   m = m * 10 +  s[i] - '0';
		   b = m / 13;
		   m = m % 13;
		   a[i - 1] = b;
	   }
	   n --;
	   if(a[0] == 0)
		   i = 1;
	   else i = 0;
	   for(; i < n; i++)
	   {
		   cout << a[i];
	   }
	   cout << endl << m;
	  }
	}
	return 0;
}
int main()
{
    int count1=0;
    char a[1000];
    scanf("%s",a);
    int b[1000],c[1000];
    int i,j,k;
    for(i=0;a[i]!='\0';i++)
    {
        b[i]=a[i]-'0';
        count1++;
    }
    if(count1==1)
    {
        printf("0\n");
        printf("%d",b[0]);
    }
    else
    {
        int d;
        int count=0;
        if((b[0]*10+b[1])>=13)
        {
            d=b[0];
            for(j=1;a[j]!='\0';j++)
            {
                c[j-1]=(d*10+b[j])/13;
                d=d*10+b[j]-c[j-1]*13;
                count++;
            }
            c[j]='\0';
            for(k=0;k<=count-1;k++)
            {
                printf("%d",c[k]);
            }
            printf("\n");
            printf("%d",d);
        }
        else
        {
            d=b[0]*10+b[1];
            for(j=2;a[j]!='\0';j++)
            {
                c[j-2]=(d*10+b[j])/13;
                d=d*10+b[j]-c[j-2]*13;
                count++;
            }
            c[j]='\0';
            if(count==0)
            {
                printf("0\n");
            }
            else
            {
                for(k=0;k<=count-1;k++)
                {
                    printf("%d",c[k]);
                }
                printf("\n");
            }
            printf("%d",d);
        }
    }
}
int main()
{
	char number[100];
	char result[100];
	int a=0,b=0,lenght=0,flag=0;
	scanf("%s",number);
	lenght=strlen(number);
	b=number[0]-'0';
	for(int i=0;i<lenght-1;i++)
	{
		a=b*10+(number[i+1]-'0');
		result[i]=a/13+'0';
		b=a%13;
	}
	if(lenght==1)
	{
		result[0]='0';
		result[1]='\0';
	}
	else
	{
		result[lenght-1]='\0';
		for(int i=0;result[i]!='\0';i++)
			if(result[i]!='0'&&result[i]!='\0')
			{
				flag=i;
				break;
			}
	}
	printf("%s\n%d\n",result+flag,b);
	return 0;
}
main()
{
  int i,j,k,l;
  int c[100],b[100],d[100];
  char a[100];
  scanf ("%s",a);
  l=strlen(a);
  for (i=0;i<l-1;i++)
  {
   b[i]=0;
  }
  
  for (i=0;i<l;i++)
  {
   c[i]=a[i]-'0';   
  }
  
  if (l==1)
  {
    printf("0\n");
    printf("%d",c[0]);
  }
  else
  {
      k=10*c[0]+c[1];
      if (l==2&& k<13)
       {
        printf("%d\n",0);
        printf("%d",k);
       }
       else
        {
         for (i=0;i<l-1;i++)
         {
          c[i+1]=10*(c[i])+c[i+1];
          b[i]=c[i+1]/13;
          c[i+1]=c[i+1]%13; 
         }

        if (b[0]==0)
       {
          for (i=0;i<l-2;i++)
        {
            d[i]=b[i+1];
            printf("%d",d[i]);
        }
      }
     else
      for (i=0;i<l-1;i++)
       {
        printf("%d",b[i]);
       }
      printf ("\n");
      printf ("%d",c[l-1]);
   }
}


}