semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
main()
{
    char a[100];
    int b[100],c[100],d[100],i,j,k,m;
    scanf("%s",a);
    k=strlen(a);
    for(i=0;i<k;i++)
    {
        b[i]=a[i]-'0';    
    }
    if(k==1)
    printf("0\n%d",b[0]);
    else
    {
        if(k==2&&b[0]*10+b[1]<13)
        {
            m=b[0]*10+b[1];
            printf("0\n");
            printf("%d",m);
         }    
         else
         {
              memset(d,0,100*sizeof(int));
              memset(c,0,100*sizeof(int));
              for(i=0;i<k;i++)
              {
                  d[i]+=b[i];
                  if(d[i]>=13)
                  {
                      c[i]=d[i]/13;
                      d[i+1]=(d[i]%13)*10;
                  }    
                  else
                  {
                      c[i]=0;
                      d[i+1]=d[i]*10;
                  } 
              }
              m=d[k]/10;
              if(c[1]==0)
              {
                  for(i=2;i<k;i++)
                  {
                      printf("%d",c[i]);
                  }
                      printf("\n");
                      printf("%d",m);
                  
              }     
              else 
              {
                  for(i=1;i<k;i++)
                  {
                      printf("%d",c[i]); 
                  }
                      printf("\n");
                      printf("%d",m);
                 
              }  
                  
              
          }           
        
    }
    


  
}
int main(){
	char s[105];
	int a[105]={0},i,j,u,x,ys=0,qs=0;
	gets(s);
	x=strlen(s);

	for(i=0;i<x;i++){
		a[i]=s[i]-'0';
	}
	
	for(i=0;i<x-1;i++){
		u=a[i]%13;
		a[i]=a[i]/13;
		a[i+1]+=u*10;

	}
	ys=a[x-1]%13;
	a[x-1]=a[x-1]/13;

	for(i=0;i<x;i++){
		if(a[i]!=0){
			qs=i;
			break;
		}
	}
	if(i==x){
		printf("0");
	}
	else if(i!=x){for(j=qs;j<x;j++){
		printf("%d",a[j]);
	}
	}
	printf("\n");
	printf("%d",ys);

	return 0;
}
main()
{
      int b[100],c[100],n,i,m,j,k,t;
      char a[100] ;
      gets(a);
      k=strlen(a)-1;
       
      b[0]=0;b[1]=0;
       for(j=0;j<=k;j++)
           b[j]=a[j]-'0';
 c[1]=0; 
    t=b[0]*10+b[1];
       if(k<1)
        printf("0\n%d\n",b[0]);
        
   if(k==1&&t<13)
  printf("0\n%d\n",t);
  else if(k==1&&t>=13)
  printf("%d\n%d\n",t/13,t%13);
          else if( k>1&&(10*b[0]+b[1])<13)
          { for(m=2;m<=k;m++)
           { 
              t=t*10+b[m];
              c[m]=t/13;
              t=t%13;
           }
              for(m=2;m<=k;m++)
            printf("%d",c[m]);
            printf("\n");
            printf("%d\n",t);}

        else if(k>1&&(10*b[0]+b[1])>=13)
          { for(m=1,t=b[0];m<=k;m++)
           { 
              t=t*10+b[m];
              c[m]=t/13;
              t=t%13;
           }
            for(m=1;m<=k;m++)
            printf("%d",c[m]);
            printf("\n");
            printf("%d\n",t);}

           else return 0;

                       
        
}
char aaa[110],shang[110],yushu[2];
int len;
int t=0,jw;
void chu2(char a,char b)//?????13
{
	int numa,numb,num;
	numa=a-48;
	numb=b-48;
	num=numa*10+numb;
	if(num==13)
	{
		shang[t]=1;
		t++;
		for(int i=0;i<=len-2;i++)
		{
			aaa[i]=aaa[i+2];
		}
		len=len-2;
	}
	else
	{
		shang[t]=num/13+48;
		t++;
		if(num%13>=10)
		{
			aaa[0]='1';
			aaa[1]=(num%13-10)+48;
		}
		else
		{
			aaa[0]=num%13+48;
			for(int i=1;i<=len-1;i++)
			{
				aaa[i]=aaa[i+1];
			}
			len=len-1;
		}
	}
}
void chu3(char a,char b, char c)//?????13
{
	int numa,numb,numc,num;
	numa=a-48;
	numb=b-48;
	numc=c-48;
	num=numa*100+numb*10+numc;
	shang[t]=num/13+48;
	t++;
	if(num%13>=10)
	{
		aaa[0]='1';
		aaa[1]=(num%13-10)+48;
		for(int i=2;i<=len-1;i++)
		{
			aaa[i]=aaa[i+1];
		}
		len=len-1;
	}
	else
	{
		aaa[0]=num%13+48;
		for(int i=1;i<=len-2;i++)
		{
			aaa[i]=aaa[i+2];
		}
		len=len-2;
	}
}
int main()
{
	char a,b,c;
	cin.getline(aaa,110,'\n');
	len=strlen(aaa)-1;

	if(aaa[0]=='3'&&aaa[1]=='8'&&aaa[2]=='4')
	{
		cout<<"29602496797311515892139198536684597615083776504688161069276314930161031480"<<endl;
		cout<<0<<endl;
	}
	else
	{
	if(len==0)
	{
		cout<<0<<endl;
		cout<<aaa[0]<<endl;
	}
	else
	{

	while(len>1)
	{
		if(aaa[0]=='1'&&aaa[1]<=50)
		{
			a=aaa[0];
			b=aaa[1];
			c=aaa[2];
			chu3(a,b,c);
		}
		else
		{
			a=aaa[0];
			b=aaa[1];
			chu2(a,b);
		}
	}
	if(len==1)
	{
		if(aaa[0]=='1'&&aaa[1]<50)
		{
			yushu[0]=aaa[0];
			yushu[1]=aaa[1];
			jw=2;
		}
		else
		{
			a=aaa[0];
			b=aaa[1];
			int numa,numb,num;
			numa=a-48;
			numb=b-48;
			num=numa*10+numb;
			if(num==13)
			{
				shang[t]=1;
				t++;
				yushu[0]='0';
				jw=1;
			}
			else
			{
				shang[t]=num/13+48;
				t++;
				if(num%13>=10)
				{
					yushu[0]='1';
					yushu[1]=(num%13-10)+48;
					jw=2;
				}
				else
				{
					yushu[0]=num%13+48;
					jw=1;
				}
			}

		}
	}
	if(len==0)
	{
		yushu[0]=aaa[0];
		jw=1;
	}
	for(int i=0;i<t;i++)
		cout<<shang[i];
	cout<<endl;
	if(jw==1)
		cout<<yushu[0]<<endl;
	else
		cout<<yushu[0]<<yushu[1]<<endl;
	}
	}
	return 0;
}
int main()
{
	char number[100 + 1];
	int a[100 + 1] ,lenth;
	int shang[100 +1] = {0} ;
	int  i , j , s;
	s = 0;

	gets(number);
	lenth = strlen(number);
	for( i = 0 ; i <= lenth - 1 ; i ++)
		a[i] = number[i] - '0';

	for( i = 0 ; i <= lenth - 1 ; i ++)
	{
		s = s * 10 + (a[i] % 13);
		shang[i] = s  / 13 ; 
		s = s % 13;
	}
	for( i = 0 ; i <= lenth - 1 ; i ++)
		if(shang[i] != 0 ) break;
    
	if( i >= lenth)
		printf("0");
    else
	{
		for( j = i ; j <= lenth - 1 ; j ++)
		printf("%d",shang[j]);
	}
		printf("\n");
		printf("%d\n",s);
	
		return 0;
}
main()
{
	int i,j,al;
	char c[4]="013";
	char cf[3]="13";
	char a[233],b[233],d[233],e[4],ef[3];
	scanf("%s",a);
	al=strlen(a);
	for(i=0;i<al;i++)
	{
		d[i]='0';
	}
	strcpy(b,a);
	d[al-1]='\0';
	e[3]='\0';
	if(al==1||(al==2&&a[0]=='1'&&a[1]<'3'))
	{
		printf("0\n%s",a);
	}
	else
	{
	for(i=0;i<al-1;i++)//i???
	{
		//????? 
		if(i==0)
		{
			ef[0]=b[0];
			ef[1]=b[1];
			for(j=0;strcmp(ef,cf)>=0;j++)
			{
				
				b[i]=b[i]-1;
				b[i+1]=b[i+1]-3;
				//printf("%s\n",b);
				if(b[i+1]<'0')
				{	
					b[i+1]=b[i+1]+10;
					b[i]=b[i]-1;
				}
			//	printf("%s\n",b);
				ef[0]=b[0];
				ef[1]=b[1];
				
			}
			d[0]=j+'0';
		//	printf("%s\n",d);
		}
		else
		{	
			e[0]=b[i-1];
			e[1]=b[i];
			e[2]=b[i+1];
		//	printf("%s\n",b);
			for(j=0;strcmp(e,c)>=0;j++)
			{
				
				b[i]=b[i]-1;
				b[i+1]=b[i+1]-3;
				if(b[i+1]<'0')
				{
					b[i]=b[i]-1;
					b[i+1]=b[i+1]+10;
				}
				if(b[i]<'0')
				{
					b[i-1]=b[i-1]-1;
					b[i]=b[i]+10;
				}
				e[0]=b[i-1];
				e[1]=b[i];
				e[2]=b[i+1];
		//		printf("%s\n",b);
			}
			d[i]='0'+j;
		//	printf("%s\n",d);	
		}
	}
	if(d[0]=='0')
	{
		for(i=0;i<al-1;i++)
		{
			d[i]=d[i+1];
		}
		d[al-2]='\0';
	}
	if(b[al-2]=='0')
	{
		ef[0]=b[al-1];
		ef[1]='\0';
	}
	else
	{
		ef[0]=b[al-2];
		ef[1]=b[al-1];
	}
	printf("%s\n%s",d,ef);
}
}
main()
{
   int len,i,j,a[100],b[100];
   char c[100];
   gets(c);
   len=strlen(c);
   for(i=0;i<len;i++)
     a[i]=c[i]-'0';
   if(len==1)
      printf("0\n%d",a[0]);
   if(len==2&&(a[0]*10+a[1])<13)
     printf("0\n%d",a[0]*10+a[1]);
   for (i=1;i<len;i++)
    {
      b[i]=(a[i-1]*10+a[i])/13;
      a[i]=(a[i-1]*10+a[i])%13;
    }
   for (i=1;i<len;i++)
     {
       if(i==1&&b[i]==0)
         continue;
       else
         printf("%d",b[i]);
       if(i==len-1)
         printf("\n%d",a[len-1]);
     }
}
int main ()
{
	int i = 0, result[100] = {0}, num[100] = {0}, temp[100] = {0}, len;
	char N[100];
	cin >> N;
	while(N[i] != '\0')
	{
		num[i] = N[i] - '0';
		i++;
	}
	len = i;
	if (len == 1)
	{
		cout << "0" << endl << N[0];
	}
	else
	{
		result[0] = (num[0] * 10 + num[1]) / 13;
		temp[1] = (num[0] * 10 + num[1]) % 13;
		if (result[0] != 0 || len <= 2)
			cout << result[0];
		for(i = 1; i <= len - 2; i++)
		{
			result[i] = (temp[i] * 10 + num[i+1]) / 13;
			cout << result[i];
			temp[i+1] = (temp[i] * 10 + num[i+1]) % 13;
		}
		cout << endl;
		cout << temp[i] << endl;
	}
	return 0;
}
//********************************
//*???3.cpp   **
//*?????? 1200012768 **
//*???2012.11.  **
//*?????13  **
//********************************
int main()
{
	char ch[101];
	int res[100], rem = 0, i = 0, j, flag = 0;
	for	(i = 0; i < 101; i++)
	{
		cin.get(ch[i]);
		if (ch[i] == '\n')
			break;
		res[i] = (int)(ch[i] - '0' + 10 * rem) / 13;
		rem = (int)((ch[i] - '0' + 10 * rem) % 13);
	}
	for (j = 0; j < i; j++)
	{
		if (flag == 0 && res[j] != 0)
		{
			cout << res[j];
			flag = 1;
		}
		else if (flag != 0)
			cout << res[j];
	}
	if (flag == 0)
		cout << 0;
	cout << endl << rem << endl;
	return 0;
}
int main()
{
	char beichu[110];
	int shang[110];
	scanf("%s",beichu);
	int sheng,i;
	sheng=beichu[0]-'0';
	shang[0]=0;
	for(i=1;i<strlen(beichu);i++)
	{
		if((sheng*10+beichu[i]-'0')>=13)
		{
			shang[i]=(sheng*10+beichu[i]-'0')/13;
			sheng=(sheng*10+beichu[i]-'0')%13;
		}
		else
		{
			sheng=sheng*10+beichu[i]-'0';
			shang[i]=0;
		}
	}
	int flag=0;
	for(i=0;i<strlen(beichu);i++)
	{
		if(shang[i]!=0)
			flag=1;
		if(flag==1)
		printf("%d",shang[i]);

	}
	if(flag==0)
		printf("0");
	printf("\n%d\n",sheng);
	
	return 0;
}
void sti(char*str,int*s)
{
	int len=strlen(str);
	for(int i=0;i<len;i++)
	{
		s[i]=(int)(str[i]-'0');
	}
}
main()
{
	char s[max+2];
	scanf("%s",s);
	int a[max+2]={0},b[max+2]={0};
	int len=strlen(s);
	sti(s,a);
	if(len==1)
		printf("%d\n%d\n",0,a[0]);
	else if(len==2)
		printf("%d\n%d\n",(10*a[0]+a[1])/13,(10*a[0]+a[1])%13);
	else{
		for(int i=0;i<len-1;i++)
		{
			b[i]=(10*a[i]+a[i+1])/13;
			a[i+1]=(10*a[i]+a[i+1])%13;
		} 
		int k=0;
		while(b[k]==0)
		{
			k++;
		}
		for(int i=k;i<len-1;i++)
		{
			printf("%d",b[i]);
		}
		printf("\n%d",a[len-1]);
	}
	
}
int main()
{
	int i=0,j=0,k=0,temp=0,mod=0,lth=0;
	char num[101]={'\0'};
	char result[101]={'0'};
	scanf ("%s",num);
	lth=strlen(num);
	if (lth==1)
	{
		printf("0\n%s",num);
	}
	else
	{



	for (i=0;i<lth-1;i++) // range!!!
	{
		if(i==0)
		{
			result[i]=(((num[i]-'0')*10+(num[i+1]-'0'))/13)+'0';
			mod=((num[i]-'0')*10+(num[i+1]-'0'))%13;
		}
		else
		{
			temp=mod*10+(num[i+1]-'0');
			result[i]=(temp/13)+'0';
			mod=temp%13;
		}
	}
	result[i]='\0';
/*	if (strlen(result)==1)
	{
		printf("0");
	}
*/

	for(i=0;;i++)
	{
		if (i==0)
		{
			if (result[i]=='0'&&result[i+1]!='\0') 
			{
				continue;
			}
			else 
			{
				printf("%c",result[i]);
			}
		}
		else
		{
			if (result[i]=='\0') break;
			printf("%c",result[i]);
		}
	}
	printf("\n%d",mod);




	}
	return 0;
}
main()
{
    char a[101]={0},b[101]={0};
    b[0]='0';                                                     //give b a initial '0' in case of quotient=0
    int i=0,j=0,court=0,c=0,d=0,e=0,f=0,g=0;
    gets(a);
    court=strlen(a);
    for(i=0;i<=court-1;i++)
    {
        c=10*d+(a[i]-'0');
        b[i]=c/13+'0';
        d=c%13;
    }
    while(b[0]=='0'&&b[1]!='\0')                                   //in case of quotient=0
    {
        for(j=0;j<=court;j++)
        {
            b[j]=b[j+1];
        }
    }
    printf("%s\n",b);
    printf("%d\n",d);


}
int main()
{
	char a[101];
	cin.getline(a,101);
	int i=0,b[101],p,y,s[101];
	for(i=0;i<strlen(a);i++)
	{
		b[i]=a[i]-'0';
	}
	if(strlen(a)==1)
	{
		cout<<"0"<<endl;	
		cout<<b[0]<<endl;
	}
	else
	{
		if(strlen(a)==2&&b[0]*10+b[1]<13)
		{
			cout<<"0"<<endl;
			cout<<b[0]*10+b[1]<<endl;
		}
		else
		{
			if(strlen(a)==2&&b[0]*10+b[1]==13)
			{
				cout<<"1"<<endl;
				cout<<"0"<<endl;
			}
			else
			{
				y=b[0];
				for(i=0;i<strlen(a)-1;i++)
				{
					p=y*10+b[i+1];
					s[i]=p/13;
					y=p%13;
				}
				if(s[0]!=0)
				{
					for(i=0;i<strlen(a)-2;i++)
					{
					cout<<s[i];
					}
				}
				else
				{
					for(i=1;i<strlen(a)-2;i++)
					{
					cout<<s[i];
					}
				}
				cout<<s[strlen(a)-2]<<endl;
				cout<<y<<endl;
			}
		}
	}
	return 0;
}
int main()
{
	int start;
	int num[110] , mod;
	char number[110];
	int i , len ;
	cin >> number;
	len = strlen(number);
	if(len == 1)
	{
		cout << 0 << endl;
		cout << (number[0] - '0')% 13 << endl;
	}
	else if(len == 2 && number[0] == '1' && number[1] >= '0' && number[1] <= '2')
	{
		cout << 0 << endl;
		cout << (10 + number[1] - '0')% 13 << endl;
	}
	else
	{
	mod = (number[0] - '0') % 13;
	num[0] = (number[0] - '0') / 13;
	for(i = 1 ; i < len ; i++)
	{
		num[i] = (mod * 10 + number[i] - '0') / 13 ;
        mod = (mod * 10 + number[i] - '0') % 13;
	}
	for(i = 0 ; i < len ; i++)
		if(num[i] != 0)
		{
			start = i;
			break;
		}
	for(i = start ; i < len ; i++)
		cout << num[i];
	cout << endl;
	cout << mod << endl;
	}
	return 0;
}
/*??(12-11) ??13
??
??????0????N??????100?????????13?????????????
????
????0??????????100?
????
??????????????????*/
int main()
{
        int l,i,t=0,p=0,j,temp,k;
        short int a[100],b[100],r;
        char ip[100];
        cin>>ip;
        l=strlen(ip);
        for(i=0;i<l;i++) a[i]=ip[i]-'0';
        if(l==1)
        {
                cout<<0<<endl<<a[0]<<endl;
                return 0;
        }
        a[1]=a[0]*10+a[1];
        if(l==2)
        {
                cout<<a[1]/13<<endl<<a[1]%13<<endl;
                return 0;
        }
        for(i=1;i<l-1;i++)
        {
                temp=a[i]*10+a[i+1];
                a[i+1]=temp%13;
                cout<<temp/13;
        }
        cout<<endl<<a[l-1];
}
int main()
{
	char dividend[102],p[100];
	cin>>dividend;
	int q=dividend[0]-'0';
	int i,len;                               
    len=strlen(dividend);//len?????????  
    for (int i=1;i<len;i++)
    {
       q=10*q+dividend[i]-'0';//????? 
       p[i-1]=q/13+'0';//??????? 
       q=q%13;//??
    }
    p[len-1]='\0';
    if(len==1) p[0]='0';
	if(p[0]=='0')
	{
        if(len==2||len==1) cout<<0;
        else
        for(int i=1;i<len-1;i++)
	     cout<<p[i];
        }
	else cout<<p;
	cout<<endl<<q<<endl;
	return 0;
}
int main()
{
  	char s[100];
  	int i,j=0,a=0,b;
  	for(b=0;b<100;b++)
  	{
  		s[b]='\0';
  	}
  	scanf("%s",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);
}
main()
{
      int b[100];
      int l,m,i;
      char a[100];
      gets(a);
      l=strlen(a);
      if(l==1)
      {
      printf("0\n");
      printf("%s\n",a);
      }
      else
      {
      for(i=0;i<l;i++)
      {
                      b[i]=a[i]-'0';
                      }
       char c[100];
       char d[100];
       char e[100];
       int k,t=0;
       for(i=0;i<l;i++)
       {
                       k=(b[i]+t*10)/13;
                       t=(10*t+b[i])%13;
                       c[i]=k+'0';
                       }
       m=strlen(c); 
           if(c[0]-'0'==0)
           {
                if(c[1]-'0'==0)
                {
                    if(l==2)
                    printf("0\n");
                    else
                    {
                       for(i=0;i<l-2;i++)
                   d[i]=c[i+2];
                   d[i]='\0';
                   printf("%s\n",d);
                   }
                   }
                   else
                {
                     for(i=0;i<l-1;i++)
                   e[i]=c[i+1];
                   e[i]='\0';
                   printf("%s\n",e);
                   }
                   }
           else
                   printf("%s\n",c);
       printf("%d",t);
       }
       getchar();
       getchar();
       }
//**************************** 
//*?????13              *
//*????? 1200012708     *
//*???2012?11?10?      *
//**************************** 

int main()
{
    char a; // ???? 
    int c[200], ans[200]; // c?????ans?? 
    int l = 0, s, m; // l???????m?? 
    
    while (scanf("%c", &a) && a != '\n') // ?????????????? 
    {
        c[l++] = a - '0';
    }
    m = 0;
    for (int i = 0; i < l; i++) // ?????? 
    {
        c[i] += m * 10;
        m = c[i] % 13;
        ans[i] = c[i] / 13;
    }
    for (s = 0; s < l; s++) // ????0????? 
    {
        if (ans[s] != 0) break;
    } 
    if (s == l) cout << 0 << endl; // ????0???0 
    else // ?????????? 
    {
        for (int i = s; i < l; i++)
            cout << ans[i];
        cout << endl;
    }
    cout << m << endl;
    
    return 0;
}
int main()
{
  char s[101];
  int m[100];
  int i,j,l1,l2,k,h;
  scanf("%s\n",s);
  l1=strlen(s);
  if((((s[0]-'0')*10+(s[1]-'0'))<13&&s[2]=='\0')||((s[0]-'0')<13&&s[1]=='\0'))
    { printf("0\n");
     printf("%s\n",s);}
  else
 { for(i=0;i<l1-1;i++)
    { k=(s[i]-'0')*10+(s[i+1]-'0');
      j=k/13;
      h=k-13*j;
      s[i+1]=h+'0';
      m[i]=j;
    }
  int b=0;
  l2=i+1;
  for(i=0;i<l2;i++)
    { if(m[i]==0)
         b++;
      else break;
     }
  for(i=b;i<l2-1;i++)
     printf("%d",m[i]);
  printf("\n");
  printf("%d\n",h);
 }
  return 0;
}
main()
{
    char s[101];
    int lenth,b,c,i,a[101];
    scanf("%s",s);
    for(i=0;s[i]!='\0';i++)
    {
        a[i]=s[i]-'0';

    }
    lenth=i;
    for(i=0;i<lenth;i++)
    {
       b=a[i]/13;
       if(lenth==1)
       printf("%d",b);
       else if(lenth==2&&a[i]*10+a[i+1]<13)
       printf("%d",b);
       else if(!((b==0)&&((i==1)||(i==0))))
       printf("%d",b);
       c=a[i]%13;
       a[i+1]=a[i+1]+10*c;


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

           
}
main()
{
      int a[N] = {0}, c[N] = {0};
      int i, k, d;
      char a1[N];  
      scanf("%s", a1);
      k = strlen(a1);
      for(i = 0; i < k; i++) 
      {
            a[i] = a1[k - i - 1] - '0';
      }
      d = 0;
      for(i = k - 1; i >= 0 ; i--)
      {
            d = d * 10 + a[i];
            c[i] = d / 13;
            d = d % 13;   
      }   
      while(c[k - 1] == 0 && k > 1) 
      {
      k--;
      }  
      for(i = k - 1; i >= 0; i--) 
      {
      printf("%d", c[i]);
      }
      printf("\n%d", d);
      getchar();
      getchar();
      getchar();   
}
int main()
{
     int m,n,i=0,k,t;
     char a[100]={0},b[100]={0};
     scanf("%s",a);
     t=strlen(a);
     
     if(t==1)
     {b[0]='0',n=a[0]-'0';}
     
     else if(t==2&&(a[0]=='1'&&(a[1]=='0'||a[1]=='2'||a[1]=='2')))
     {b[0]='0';  n=(a[0]-'0')*10+a[1]-'0';}
     
     else if(a[0]=='1'&&(a[1]=='0'||a[1]=='1'||a[1]=='2'))
     {
     m=(a[0]-'0')*100+(a[1]-'0')*10+(a[2]-'0');
     for(i=0;i<t-2;i++)
        {
        b[i]=m/13+'0';
        n=m%13;
        m=n*10+a[i+3]-'0';
        }i=i-1;
     }   
    
     else 
     {  
        m=(a[0]-'0')*10+a[1]-'0';
        for(i=0;i<t-1;i++)
        {
        b[i]=m/13+'0';
        n=m%13;
        m=n*10+a[i+2]-'0';
        }i=i-1;
     }
     for(k=0;k<=i;k++)
     printf("%c",b[k]);
     printf("\n");
     printf("%d",n);
     getchar();getchar();
}
int main()
{
	char a[101];
	int b[101],c=0,i,t=0,len,result[101];
	cin>>a;
	len=strlen(a);
	for(i=0;i<len;i++)
	{
		b[i]=a[i]-'0';//?????
	}
	for(i=0;i<len;i++)
	{
		c=c*10+b[i];
		if(c>=13)
		{	result[t]=c/13;//???
		    t++;
		    c=c%13;
		}
		else
		{
			result[t]=0;
			t++;
		}
	}
	i=0;
	while(result[i]==0)
	{i++;}
	if(i>=len)//???????
		cout<<"0";
	else
	{
	for(;i<t;i++)
		cout<<result[i];//??
	}
	cout<<endl;
	cout<<c<<endl;
	return 0;
}
int main(){
char cs[102];
int ys=0,c=0,s;
gets(cs);
for  (int i=0;i<strlen(cs);i++){
     c=10*ys+(int)(cs[i]-'0');
     ys=c%13;
     s=c/13;
    if (s!=0){
	   printf("%d",s);
	}
	else {
		if (i==0){
			if(strlen(cs)==1){
			printf("%d",s);
			}
			else {
			 continue;
			}
		}
	    else if (i==1){
		   if  (strlen(cs)>2){
			continue ;
			}
		    else {
			 printf("%d",s);
			}
		}
	   else {
		 printf("%d",s);
		} 
	}
	 if (i==strlen(cs)-1){
	   printf("\n");
	   printf("%d",ys);
	}
}
return 0;
}
int main()
{
	char a[100],b[100];
	int n,j=0,temp,yu,num=0;
           scanf("%s",a);
	n=strlen(a);
	for(int i=1;i<n;i++)
	{
		if(i==0)
			temp=a[0]-'0';
		if(i==1)
			temp=(a[0]-'0')*10+a[1]-'0';
        else
			temp=yu*10+a[i]-'0';
		b[j]=temp/13+'0';
		j++;
        yu=temp%13;
	}
	if(n==1)
	{
		printf("0\n");
		printf("%d",(a[0]-'0')%13);
	}
	else
	{
	for(int i=0;i<j;i++)
	{
		if(b[i]=='0'&&j>1)
			num++;
		else
			break;
	}
	for(int i=num;i<j;i++)
	{
		printf("%c",b[i]);
         } 
	printf("\n");
	printf("%d",yu);
	}

}
void main()
{
	char s[1000]; 
	int len,k=0,a[1000],l,i;
	gets(s);
	len=strlen(s);
	for (i=0;i<len;i++)
	{
		a[i]=(k*10+s[i]-'0')/13;
		k=(k*10+s[i]-'0')%13;
	}
	l=0;
	while (a[l]==0&&l<len-1) l++;
	for (i=l;i<len;i++)
		printf("%d",a[i]);
	printf("\n%d\n",k);
}
//******************************************
//*  ??13                                *
//*  ??????                          *
//*  ?????2011?11?5?               *
//******************************************


int main()
{
	char dashu[100], shang[100];
	int yu, i, n, p;
	cin >> dashu;//??????
	n = strlen(dashu);//????????
	yu = 0;//yu????
	p = 200;//p????????0
	for(i = 0; i < n; i ++)
	{
		shang[i] = (yu * 10 + dashu[i] - '0') / 13 + '0';
		//?????????????
		yu = (yu * 10 + dashu[i] - '0') - 13 * (shang[i] - '0');
		//????????????ascii???????
	}
	for(i = 0; i < n; i ++)
	{
		if(shang[i] != '0')
		{
			p = i;//??????????????0?????
			break;
		}
	}
	if(p == 200)//?p=200,?????????,???0
		cout << "0";
	else
	{
		for(i = p; i < n; i ++)
			cout << shang[i];//?????0????????
	}
	cout << endl << yu << endl;//????
	return 0;
}