semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
/**
*@file		1000012767_5.cpp
*@author	??
*@date		2010.11.24
*@description
*			???????????
*/

int len;	//???? len ?????

void palindrome(char[], int);	//???????????????????

void palindrome(char p[], int lenth)
{								//p ??????????????lenth ???????
	int j, k, final, judge;		//j ??????????????k ?????????
								//final ???????????judge ???????????
	final = lenth / 2;			//???????????????????????????????
	for (j = 0; j <= len - lenth; j++)		//?????????????
	{
		judge = 0;				//judge ? 0 ???????1 ????
		for (k = 1; k <= final; k++)	//??????????????
		{
			if (p[j + k - 1] != p[j + lenth - k])
			{
				judge = 1;				//????????????????????????????
				break;
			}
		}
		if (judge == 0)					//??????????????????
		{
			for (k = j; k <= j + lenth - 1; k++)
				cout << p[k];
			cout << endl;		
		}
	}
}

int main()			//???
{
	char a[501];	//a ???????????
	int i;
	cin >> a;
	len = strlen (a);
	for (i = 2; i <= len; i++)
					//i ????????????
		palindrome(a, i);	//??????????????????????????????
	return 0;
}
char s[500];

int substr(char s[], int start, int end)
{
	while ((end>start)&&(s[start]==s[end]))
	{
		start++; end--;
	}
	if(end>start)
		return 0; 
	else 
		return 1; 
}

void osubstr(char s[], int start, int end)
{
	int i;
	for(i=start;i<=end;i++)
		putchar(s[i]);
	putchar('\n');
}

int main()
{
	unsigned int m,n,width;
	gets(s);
	for(width=1; width<strlen(s); width++)
	    for(m=0; m<=strlen(s)-width;m++)
		    if(substr(s, m, m+width)) 
			    osubstr(s, m, m+width);
}
int main()
{
	char str[502];
	cin >> str;
	int i,j,len1,len2;
	len1 = strlen(str);
	for(len2 = 2; len2 < len1; len2++)
	{
		for(i = 0; i < len1; i++)
		{
			for(j = i; j < i + len2; j++)
			{
				if(str[j] != str[2 * i + len2 - 1 - j])
					break;
			}
			if(j == i + len2)
			{
				for(j = i; j < i + len2; j++)
					cout << str[j];
				cout << endl;
			}
		}
	}
	return 0;
}
int main()
{
	void isHuiwen(char s0[500], int i);
	char str[500];
	char s0[500];
	int i, j, k, l;
	gets(str);
	l = strlen(str);
	for (i = 2;i < l;i++)
	{
		for(j = 0;j <= l - i;j++)
		{
			for(k = 0;k <= i;k++)
				s0[k] = str[k + j];
			isHuiwen(s0, i);
		}
	}
	return 0;
}
void isHuiwen(char s0[500], int i)
{
	int p;
	for(p = 0;p <= i/2;p++)
	{
		if(s0[p] != s0[i - 1 -p])
		return;
	}
	for(p = 0;p < i;p++)
		printf("%c",s0[p]);
	printf("\n");
	return;
}
int main()
{
	char str[505]={'\0'};
	char str1[505]={'\0'};
	char str2[505]={'\0'};
	int length,i,j,k,p;
	cin.getline(str,505);
	length=strlen(str);
	for(i=2;i<=length;i++)//i??????????????
		for(j=0;j<=length-i;j++)//j???????????????
		{
			p=0;
			for(k=j;k<j+i;k++)//??????i?????????
			{
				str1[p]=str[k];
				str2[p]=str[j+i-1-(k-j)];
				p++;
			}
			if(strcmp(str1,str2)==0)
			{
				k=0;
				while(str1[k]!='\0')
				{
					cout<<str1[k];
					k++;
				}
				cout<<endl;
			}
		}
	return 0;
}
int main()
{
    char s[1000];
    int i,j,k,l,t; 
    gets(s);
    l=strlen(s);
    for(j=1;j<l;j++)
	{
        for(i=0;i+j<l;i++)
		{
            for(k=0;k<=j;k++)
			{ 
				if(s[i+k]==s[i+j-k])
                    t=1;
                else 
				{
					t=0;
					break;
				}
			}
            if(t==1)
			{
				for(k=i;k<=i+j;k++)
                printf("%c",s[k]);
                printf("\n");
			}
		}
	}
	return 0;
}
//***********************
//???????
//?????? 1200012914
//???2012.11.11
//*********************** 


int main()
{
    char str[501]; //?????\0
    int len; //???????len
    int i, j, k, l; //?????? 
    cin >> str; //????
    len = strlen(str); //????????
    for (i = 2; i <= len; i++) //??????????2????len
    {
        for (j = 0; j <= len - i; j++)
        //????????i??????????????len-i+1?
        //?????len-i???
        {
            for (k = 1; k <= i / 2; k++)
            //?????????????????i/2?????
            {
                if (str[j + k - 1] != str[j + i - k]) break;
                //?????????????????
            }
            if (k == i / 2 + 1) //k=1/2+1???????????????
            {
                  for (l = j; l < j + i; l++) 
                  //????????j????i?????????j+i-1??
                  {
                      cout << str[l];
                  }
                  cout << endl; //????????????
            } 
        } 
    }             

    return 0;
}
int main()
{
	char a[502],b[50000][4],t[4];
	char z;
	int i,j,k,m,n,p,q,r,s,u;
	int count=0;


	
	n=0;
	z=cin.get();
	while(z!='\n')
	{
		n++;
		a[n]=z;
		z=cin.get();//1?n  n???  a[n]
	}

	for(i=1;i<=n-1;i++)//????????????kaoshiwuyali
	{

		for(j=1;i+j-1>=1&&i+j-1<=n;j++)
		{
			if((int)a[i+j-1]==(int)a[i-j])
			{
				b[count+1][1]=i-j;//????
				b[count+1][2]=i+j-1;//????
				b[count+1][3]=2*j;//??
				count++;
			}
			else
			{
		 		break;
			}
		}
		for(k=1;i-k<=n&&i+k<=n;k++)
		{
			if((int)a[i+k]==(int)a[i-k])
			{
				b[count+1][1]=i-k;
				b[count+1][2]=i+k;
				b[count+1][3]=2*k+1;
				count++;
			}
			else
			{
				break;
			}
		}
	}

	for(p=1;p<=count-1;p++)
	{
		for(m=1;m<=count-p;m++)
		{
			if(b[m][3]>b[m+1][3]||(b[m][3]==b[m+1][3]&&b[m][1]>b[m+1][1]))
			{
				for(q=1;q<=3;q++)
				{
					t[q]=b[m+1][q];
					b[m+1][q]=b[m][q];
					b[m][q]=t[q];
				}
			}
		}
	}

	for(r=1;r<=count;r++)
	{
		for(s=b[r][1];s<=b[r][2];s++)
		{
			cout<<a[s];
		}
		cout<<endl;
	}

	return 0;
}
char str[510];
int flag[510]={0};
int check( int head, int n )
{
    if(n==0)
        return 1;
    if(n==-1)
        return 1;
    if(str[head]==str[head+n])
    {
        return check(head+1,n-2);      
    }
    else return 0;
}
int main()
{
    int len, i, m=1, k;
    cin.getline( str , 500 );
    len = strlen(str);
    for(m=1; m<len; m++)
    {
        for(i=0; i<=len-m; i++)
        {
            if(check(i,m)==1)
            {
                for(k=i;k<=i+m;k++) 
                {
                    cout<<str[k];                
                }            
                cout<<endl;
            }              
        }
    }
    return 0;
}
int main()
{
    char str[500];
    cin >> str;
    int l = strlen(str), i, j, m = 1, count = 0;
    for (m = 1; m < l; m++)
    {
        for (i = 0; i < l - m; i++)
        {
            count = 0;
            for (j = 0; j <= m / 2 + 1; j++)
            {
                if (str[i + j] != str[i + m - j])
                    continue;
                else
                    count++;
            }
            if (count >= j)
            {
                for (j = i; j <= i + m; j++)
                    cout << str[j];
                cout << endl;
            }
        }
    }
    return 0;
}
//????
int main()
{
	char a[500];
	int i = 0, j = 0, k = 0;
	cin >> a;
	int l = strlen(a);
	for (i = 2; i <= l; i++)
	{
		for (j = 0; j <= l - i; j++)
		{
			int flag = 1;
			for (k = j; k < j + i; k++)
			{
				if (a[k] != a[j + i + j - k - 1])
				{
					flag = 0;
					break;
				}
			}
			if (flag)
			{
			for (k = j; k < i + j; k++)
			{
				cout << a[k];
			}
			cout << endl;
			}
		}
	}
	return 0;
}
//*************************************************************
//*  ????1000012846_1.cpp *********************************
//*  ????? ***********************************************
//*  ?????2010?11? *************************************
//*  ????????? ***************************************
//*************************************************************
void o( char a[] , int m , int n )     //?????????????????????
{
	int p = m , q = n ;      //????
	for ( ; ; )
	{
		if (a[m+1] != a[n-1] )
			break ;
		if ( n - m <= 2 )
		{
			for ( int i = p ; i <= q ; i++ )
				cout << a[i] ;
			cout << endl ;
			break ;
		}
		m++ ;
		n-- ;
	}
}
int main()
{
	char a[500] , i , j , k , len ;   //??????i,j,k;????len;
	cin >> a ;          //?????
	len = strlen ( a ) ;
	for ( k = 1 ; k < len ; k++ )
		for ( i = 0 ; i < len ; i++ )
			for ( j = i + 1 ; j < len ; j++ )
				if ( a[i] == a[j] && j - i == k )
					o(a,i,j) ;         //????o()
	return 0;
}
int main()
{
	char a[501];
	int i,k,len,l;
	gets(a);
	l=strlen(a);
	for(len=2;len<=l;len++)
	{
		for(i=0;i<=l-len;i++)
		{
			if(a[i]==a[i+len-1])
			{
				for(k=1;k<=len/2;k++)
				{
					if(a[k+i]!=a[i+len-1-k])
						break;
				}
				if(k>len/2)
				{
					for(k=i;k<i+len;k++)
						printf("%c",a[k]);
					printf("\n");
				}
			}
		}
	}
	return 0;
}
int main()
{int m,n,i,j,sig=0,k,kk;
char s[502];
char *p=s;
scanf("%s",s);
n=strlen(s);
for(i=2;i<=n;i++)
    {for(k=0;k<=n-i;k++)
        {
            for(j=0;j<=i-1;j++)
               {if(*(p+j)!=*(p+i-j-1))
                       {sig=1;break;}
				 }
		if(sig==0)	
		     {for(kk=0;kk<=i-1;kk++)
		     {printf("%c",*(p+kk));
				}
	  printf("\n");
			}
			sig=0;
		p=p+1;
		}
		p=s;
    }
return 0;
}
main()
{
      int w;
      scanf("%d",&w);
      if((w+12)%7==5)
       printf("1\n");
      w=w+12;
      if((w+31)%7==5)
       printf("2\n");
      w=w+31;
      if((w+28)%7==5)
       printf("3\n");
      w=w+28;
      if((w+31)%7==5)
       printf("4\n");
      w=w+31;
      if((w+30)%7==5)
       printf("5\n");
      w=w+30;
      if((w+31)%7==5)
       printf("6\n");
      w=w+31;
      if((w+30)%7==5)
       printf("7\n");
      w=w+30;
      if((w+31)%7==5)
       printf("8\n");
      w=w+31;
      if((w+31)%7==5)
       printf("9\n");
      w=w+31;
      if((w+30)%7==5)
       printf("10\n");
      w=w+30;
      if((w+31)%7==5)
       printf("11\n");
      w=w+31;
      if((w+30)%7==5)
       printf("12\n");
}
int main(){
	int n;
	int a[12]={31,28,31,30,31,30,31,31,30,31,30,31};
	int pd=0;
	int i,j;
	scanf("%d",&n);
	for(i=0;i<12;i++){
		for(j=1;j<=a[i];j++){
			if((i!=0)||(j!=1)){
				n++;
				if (n==8){
					n=1;
				}
				if((n==5)&&(j==13)){
					if(pd==0){
						printf("%d",i+1);
						pd=1;
					}
					else {
						printf("\n%d",i+1);
					}
				}
			}
		}
	}


	return 0;
}
int main()
{

   int s,a;
   scanf("%d",&s);
   for(a=1;a<=12;a++)
   {
      if((Day(a)+s-1)%7==5)
        printf("%d\n",a);
   }

   return 0;

}

int Day(a)
{
  int ii,aaa=0;
  for(ii=1;ii<a;ii++)
    {
    if(ii==1||ii==3||ii==5||ii==7||ii==8||ii==10||ii==12)
      aaa=aaa+31;
    if(ii==4||ii==6||ii==9||ii==11)
      aaa=aaa+30;
    if(ii==2)
      aaa=aaa+28;
    }

  return (aaa+13);
}
int main()
{
	int a[13]={0,13,44,72,103,133,164,194,225,256,286,317,347};
	int b[13], w,i ;
	scanf("%d", &w);
	for (i=1; i<=12; i++)
	{
		b[i]=a[i]%7;
	}

	if( w!=7 )
	{
		for(i = 1;i <=12; i++)
		{
			if( b[i] == 6 - w)
				printf("%d\n",i);
		}
	}

	if( w==7 )
	{
		for(i=1; i<=12; i++)
		{
			if(b[i] == 6)
				printf("%d\n",i);
		}

	}
	return 0;	
}
main()
{
    int w;
    scanf("%d",&w);
    int j;
    int a;
    a=w+12-7;
    if(a-7==5||a==5)
        printf("1\n");
    a=w+43-42;
    if(a-7==5||a==5)
        printf("2\n");
    a=w+71-70;
    if(a-7==5||a==5)
        printf("3\n");
    a=w+102-98;
    if(a-7==5||a==5)
        printf("4\n");
    a=w+132-133;
    if(a-7==5||a==5)
        printf("5\n");
    a=w+163-161;
    if(a-7==5||a==5)
        printf("6\n");
    a=w+193-189;
    if(a-7==5||a==5)
        printf("7\n");
    a=w+224-224;
    if(a-7==5||a==5)
        printf("8\n");
    a=w+255-252;
    if(a-7==5||a==5)
        printf("9\n");
    a=w+285-280;
    if(a-7==5||a==5)
        printf("10\n");
    a=w+316-315;
    if(a-7==5||a==5)
        printf("11\n");
    a=w+346-343;
    if(a-7==5||a==5)
        printf("12\n");
}
int main()
{
	int a[13]={0,31,28,31,30,31,30,31,31,30,31,30,31},i,w,b[13]={13,0,0};
	scanf("%d",&w);
	for(i=1;i<=12;i++)
		b[i]=a[i-1]+b[i-1];
	for(i=1;i<=12;i++)
		if(((b[i]%7+w-1)==5)||((b[i]%7+w-1)==12))
			printf("%d\n",i);
	return 0;
}
int main()
{
	int w;
	scanf("%d",&w);
	if((w+12)%7==5)
	{
		printf("1\n");
	}
	if((w+12+31)%7==5)
	{
		printf("2\n");
	}
	if((w+12+31+28)%7==5)
	{
		printf("3\n");
	}
	if((w+12+31+28+31)%7==5)
	{
		printf("4\n");
	}
	if((w+12+31+28+31+30)%7==5)
	{
		printf("5\n");
	}
	if((w+12+31+28+31+30+31)%7==5)
	{
		printf("6\n");
	}
	if((w+12+31+28+31+30+31+30)%7==5)
	{
		printf("7\n");
	}
	if((w+12+31+28+31+30+31+30+31)%7==5)
	{
		printf("8\n");
	}
	if((w+12+31+28+31+30+31+30+31+31)%7==5)
	{
		printf("9\n");
	}
	if((w+12+31+28+31+30+31+30+31+31+30)%7==5)
	{
		printf("10\n");
	}
	if((w+12+31+28+31+30+31+30+31+31+30+31)%7==5)
	{
		printf("11\n");
	}
	if((w+12+31+28+31+30+31+30+31+31+30+31+30)%7==5)
	{
		printf("12\n");
	}
	return 0;
}
//
//  main.cpp
//  hw
//
//  Created by ? ? on 12-12-16.
//  Copyright (c) 2012? ? ?. All rights reserved.
//

int D(int month)
{
    if (month==1||month==3||month==5||month==7||month==8||month==10||month==12) {
        return 31;
    }
    if (month==4||month==6||month==9||month==11) {
        return 30;
    }
    if (month==2) {
        return 28;
    }
}

int main(int argc, const char * argv[])
{
    int x[7]={5,4,3,2,1,0,6};
    int w,month=1,days=13;
    cin>>w;
    while (month<=12) {
        int y=days%7;
        if (y==x[w-1]) {
            cout<<month<<endl;
        }
        days+=D(month);
        month++;
    }
    return 0;
}
void main()
{
	int w,week[366],i,j,k,month[12]={31,28,31,30,31,30,31,31,30,31,30,31},num[12];
	scanf("%d",&w);
	week[0]=w;
	for(i=1;i<365;i++)
	{
		if(i%7==1)
			week[i]=w+1;
		else if(i%7==2)
			week[i]=w+2;
		else if(i%7==3)
			week[i]=w+3;
		else if(i%7==4)
			week[i]=w+4;
		else if(i%7==5)
			week[i]=w+5;
		else if(i%7==6)
			week[i]=w+6;
		else if(i%7==0)
			week[i]=w;
	}
	for(i=0;i<365;i++)
	{
		if(week[i]>7)
			week[i]=week[i]-7;
	}
	for(j=0;j<12;j++)
	{
		num[j]=13;
		for(k=0;k<j;k++)
			num[j]+=month[k];
	}
	for(i=0;i<365;i++)
	{
		for(j=0;j<12;j++)
		{
			if(i==num[j]-1&&week[i]==5)
			    printf("%d\n",j+1);
		}
	}
}
int main()
{
  int w,d[12],i;
  scanf("%d",&w);
  d[0]=w;
  d[1]=d[0]+12;
  d[2]=d[1]+31;
  d[3]=d[2]+28;
  d[4]=d[3]+31;
  d[5]=d[4]+30;
  d[6]=d[5]+31;
  d[7]=d[6]+30;
  d[8]=d[7]+31;
  d[9]=d[8]+31;
  d[10]=d[9]+30;
  d[11]=d[10]+31;
  d[12]=d[11]+30;
   for (i=1;i<=12;i++)
   {
      if (d[i]%7==5) printf ("%d\n",i);
    }
  return 0;
}
int main()
{
	int w = 0;
	int month = 0;
	int day = 12;
	scanf("%d", &w);
	for (month = 0; month <= 11; month ++)
	{
		if ((day % 7 + w) % 7 == 5)
			printf("%d\n", month + 1);
		if (month == 3 || month == 5 || month == 8 || month == 10)
			day += 30;
		else
		{
			if (month == 1)
				day += 28;
			else
				day += 31;
		}
	}
	return 0;
}
int main( void )
{
	int month_days[12] = { 31,28,31,30,31,30,31,31,30,31,30,31 };
	int day, i;
	int sum=0;
	cin>>day;
	for (i=0;i<12;i++)
	{
		if ((sum+12 + (day-5))%7 == 0)
			cout<<i+1<<endl;
		sum+=month_days[i];
	}

	return 0;
}
int main ()
{

    int a[12]={31,28,31,30,31,30,31,31,30,31,30,31};
    int b[12];
    b[0]=13;
    for (int i=1;i<13;i++)
    {b[i]=b[i-1]+a[i-1];
        }
int s;
    scanf ("%d",&s);
    for (int i=0;i<12;i++)
    {  if ((b[i]+s-1)%7==5)
        printf ("%d\n",i+1);
        
        }
        
        
        

    
    
    }
int main()
{
	int w,i;
	int count=0;
	int m[12]={0,31,28,31,30,31,30,31,31,30,31,30};
	int d[13]={0};
	int a[12],b[12];
	scanf("%d",&w);
	for(i=0;i<12;i++)
	{
		d[i]=d[i]+m[i];
		d[i+1]=d[i];
		b[i]=(13+d[i]+w)%7-1;
		if(b[i]==5)
		{
			count++;
			a[count]=i+1;
		}
	}
	for(i=1;i<=count;i++)
		printf("%d\n",a[i]);
	return 0;
}
int main()
{
	int w, i, days, k;
	cin >> w;
	for (i = 1 ; i <= 12 ; i++)
	{
		switch (i)
		{
		case 1: days = 0; break;
		case 2: days = 31; break;
		case 3: days = 31 + 28; break;
		case 4: days = 31 + 28 + 31; break;
		case 5: days = 31 + 28 + 31 + 30; break;
		case 6: days = 31 + 28 + 31 + 30 + 31; break;
		case 7: days = 31 + 28 + 31 + 30 + 31 + 30; break;
		case 8: days = 31 + 28 + 31 + 30 + 31 + 30 + 31; break;
		case 9: days = 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31; break;
		case 10: days = 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30; break;
		case 11: days = 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31; break;
		case 12: days = 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30; break;
		}
		days = days + 13 - 1;
		k = days % 7;
		k = (k + w ) % 7;
		if (k == 5) cout << i << endl;
	}
	return 0;
}
int main()
{
	int a[12]={0,31,28,31,30,31,30,31,31,30,31,30},b[13]={0},i,j,k,w;
	scanf("%d",&w);
	k=(w+5)%7;
	b[1]=k;
	for(i=2;i<=12;i++)
	{
		b[i]=(b[i-1]+a[i-1])%7;
	}
	for(i=1;i<=12;i++)
	{
		if(b[i]==5)
			printf("%d\n",i);
	}
	return 0;
}
int main()
{
	int day(int m,int w);
	int w,i;
	scanf("%d",&w);
	for(i=1;i<=12;i++)
	{
		if(day(i,w))
			printf("%d\n",i);
	}
}

int day(int m,int w)
{
	int j,x,c=0;
	for(j=1;j<=m-1;j++)
	{
		c=c+31;
		if(j==4|| j==6|| j==9|| j==11)
			c--;
		if(j==2)
			c=c-3;
	}
	c=c+12;
	x=(c+w)%7;
	if(x==5)
		return(1);
	else
		return(0);
}
int main()
{
	int n,i,j,k=0,pan;
	scanf("%d",&n);
    int mon[12]={31,28,31,30,31,30,31,31,30,31,30,31},ans[12];
	n+=12;
	for(i=0;i<=11;i++)
	{
		pan=n;
		for(j=0;j<i;j++)
		{
			pan+=mon[j];
		}
		if(pan%7==5)
		{
			ans[k]=i+1;
			k++;
		}
	}
	for(i=0;i<k;i++)
		printf("%d\n",ans[i]);
	return 0;
}
int main()
{
	int n;
	cin>>n;
	int month[12]={31,28,31,30,31,30,31,31,30,31,30,31};
	int j = 0;
	for(int i=13;i<365;i=i+month[j++])
	{
		if( (i+n-1) % 7 == 5 )
			cout<<j+1<<endl;
		
	}
	return 0;
}
int main()
{
	int w,i,j;
	int day[12]={13,44,72,103,133,164,194,225,256,286,317,347};
	int first[60];
	scanf("%d",&w);
	if(w<=5) first[0]=6-w;
	else first[0]=13-w;
	for(j=1;j<=59;j++)
	{
		first[j]=first[0]+7*j;
	}
	for(i=0;i<=11;i++)
	{
		for(j=0;j<=59;j++)
		{
			if(first[j]==day[i]) printf("%d\n",i+1);
		}
	}
	return 0;
}
void main()
{
	int w,i;//i month
	scanf("%d",&w);
	for(i=1;i<13;i++)
	{
		if((w+12)%7==5)
		{
			printf("%d\n",i);
		}
		if(i==2)
		{
			w=w;
		}
		else if(i==4||i==6||i==9||i==11)
		{
			w=(w+2)%7;
		}
		else
		{
			w=(w+3)%7;
		}
	}
}
//****************************
//????1.cpp              *
//???2012?11?10?       *
//????? 1? 1200012895  *
//????????           *
//****************************
int main()
{
	int m[] = {-1, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30}, w, i;       //m?1?11?????w?????i?????
	cin >> w;
	w = (w + 12) % 7;                                                       //?????13?????
	if (w == 5)                                                             //??????????1
		cout << "1" << endl;
	for (i = 1; i <= 11; i++)                                               //??2?12??13?????
	{
		w = (w + m[i] % 7) % 7;
		if (w == 5)                                                         //?????????????
			cout << i + 1 << endl;
	}
	return 0;
}
int main()
{
	int n,j,i;
	scanf("%d",&n);
	if((12+n)%7==5){
		printf("1\n");
	}
	if((43+n)%7==5){
		printf("2\n");
	}
	if((71+n)%7==5){
		printf("3\n");
	}
	if((102+n)%7==5){
		printf("4\n");
	}
	if((132+n)%7==5){
		printf("5\n");
	}
	if((163+n)%7==5){
		printf("6\n");
	}
	if((193+n)%7==5){
		printf("7\n");
	}
	if((224+n)%7==5){
		printf("8\n");
	}
	if((255+n)%7==5){
		printf("9\n");
	}
	if((285+n)%7==5){
		printf("10\n");
	}
	if((316+n)%7==5){
		printf("11\n");
	}
	if((346+n)%7==5){
		printf("12\n");
	}
	return 0;
}
int num(int a);
int main()
{
	int w,i,m,day;
	scanf("%d",&w);
	for(i=1;i<=12;i++){
	day=0;
	m=1;
	while(i>m){
	day+=num(m);
	m++;
	}
	day=day+12;
	if((w+day%7)%7==5){
	printf("%d\n",i);
	}
	}
	return 0;
}
int num(int a){
	int b;
	if(a==1||a==3||a==5||a==7||a==8||a==10||a==12)
		b=31;
	if(a==4||a==6||a==9||a==11)
		b=30;
	if(a==2)
		b=28;
	return b;
}
//******************************
//**?????******************
//**??? 1300012728***********
//**2013.10.13******************
int main()
{
	int w;                            // ????????
	cin >> w;
	int day = 12;                     // ?????????13??????
	
	// ????????? 
	for (int i = 1; i <= 12; i++)
	{
		if ((w + day) % 7 == 5)      // ????????i 
			cout << i << endl;
		if (i == 1 || i == 3 || i == 5 || i == 7 || i == 8 || i == 10)
			day += 31;                 //  ?????31????31 
		else if (i == 2)             // ???2????28 
			day += 28;
		else                         // ??????30 
			day += 30;
	}
	return 0;
}
int main()
{
	int day[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
	int n,i,j,x;
	scanf("%d",&n);
	for(i=0;i<12;i++)
	{
		x=n;
		j=0;
		while(j<i+1)
		{
			x+=day[j];
			j++;
		}
		x+=12;
		if(x%7==5)printf("%d\n",i+1);
	}


	


     return 0;
}
int main()
{
	int n,i,sum=12,a,b;
	scanf("%d",&n);
        for(i=1;i<=12;i++){
		if(i==1)
			sum+=0;
		if(i==2||i==4||i==6||i==8||i==9||i==11)
			sum+=31;
        else if(i==5||i==7||i==10||i==12)
			sum+=30;
        else sum+=28;
		a=sum%7;
		b=a+n;
		if(b>7)
			b=b-7;
		if(b==5)
        printf("%d\n",i);
	}
	return 0;
}
main()
{
    int w,i;
    scanf("%d",&w);
    if(w>2)
    w=w-2;
    else if(w==2)
    w=7;
    else if(w==1)
    w=6;
    int mouth[12]={31,28,31,30,31,30,31,31,30,31,30,31};
    for(i=0;i<12;i++)
    {if(w==5)
    printf("%d\n",i+1);
    w=w+mouth[i]%7;
    w=w%7;
  }
    
}
int month(int i)
{
	if(i==1||i==3||i==5||i==7||i==8||i==10||i==12)
		return 31;
	else if(i==2)
		return 28;
	    else
			return 30;
}

int main()
{
	int k,i;
	scanf("%d",&k);
	k=k+12;
	k=k%7;
	if(k==5)
		printf("1\n");
	for(i=1;i<12;i++)
	{
		k+=month(i);
		k=k%7;
		if(k==5)
			printf("%d\n",i+1);
	}
return 0;
}
int month[12]={31,28,31,30,31,30,31,31,30,31,30,31};
int main()
{
	int w;
	cin>>w;
	int sum=w;
    for(int i=0;i<12;i++)
    {
		int temp=(sum+12)%7;
		if(temp==5)
			cout<<i+1<<endl;
        sum+=month[i];
	}
	return 0;
}
void main()
{
	int w,i,a[13]={0,13,44,72,103,133,164,194,225,256,286,317,347};
	scanf("%d",&w);
	for(i=1;i<13;i++)
	{
		a[i]=a[i]%7;
		a[i]=a[i]+w-1;
		if((a[i]%7)==5)
		{
			printf("%d\n",i);
		}
	}
}
int main()
{
	int a[12]={0},w,i,j,d=0;
	scanf("%d",&w);
	for(i=0;i<12;i++)
	{
		for(j=1;j<i+1;j++)
		{
			if(j==1||j==3||j==5||j==7||j==8||j==10)
				a[i]=a[i]+31;
			if(j==2)
				a[i]+=28;
			if(j==4||j==6||j==9||j==11)
				a[i]+=30;
			
		}
		a[i]+=13;
	}
	d=7-w+5+1;
	while(d<=365)
	{
		for(i=0;i<12;i++)
			if(d==a[i])printf("%d\n",i+1);
		d+=7;
	}
	return 0;

}
main()
{
 int w,t,i, s;
 scanf("%d", &w);
 int month[12]={12, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30};
 s=0;
 for (i=1; i<=12; i++)
 {
  
  s=s+month[i-1];

  t=w+s;
  if (t%7==5)
  {
     
     printf("%d\n", i);
  } 
 }
}
int main()
{
	int a[13], i, w, n = 12;
	cin >> w;
	n = n + w;
	a[1] = 31;
	a[2] = 28;
	a[3] = 31;
	a[4] = 30;
	a[5] = 31;
	a[6] = 30;
	a[7] = 31;
	a[8] = 31;
	a[9] = 30;
	a[10] = 31;
	a[11] = 30;
	a[12] = 31;
	for (i = 1; i <= 12; i++)
	{
		if ((n % 7) == 5)
			cout << i << endl;
		n = n + a[i];
	}
	return 0;
}
//************************************************
//*  ??? 1.cpp                                *
//*  ?? :???  1200012948                    *
//*  ???2012 11 09                            *
//*  ????????                            *
//************************************************
int main()
{
	//????????????
	int a[13] = {0,31,28,31,30,31,30,31,31,30,31,30,31};
	int n, i, b, sum = 0;
	cin >> n;
	//?????
	for (i = 1; i <= 12; i++)
	{
		sum += a[i - 1];
		b =  sum + 12;
		//????
		if (((b % 7) + n ) % 7 == 5)
		{
			cout << i << endl;
		}
	}
	return 0;
}
int main(){
	int w,a;
	scanf("%d",&w);
    a=(13-1)%7+w;
	if(a>7){
		a=a-7;
	}
	int b;
	for(int i=1;i<=12;i++){
		b=a;
		if(i==1){
			if(a==5){
				printf("%d\n",i);
			}
		}
		if(i==2){
			b=31%7+b;
			if(b>7){
				b=b-7;
			}
			if(b==5){
				printf("%d\n",i);
			}
		}
		if(i==3){
			b=(28+31)%7+b;
			if(b>7){
	        	b=b-7;
			}
			if(b==5){
				printf("%d\n",i);
			}
		}
		if(i==4){
			b=(28+31*2)%7+b;
			if(b>7){
	        	b=b-7;
			}
			if(b==5){
				printf("%d\n",i);
			}
		}
		if(i==5){
			b=(28+30+31*2)%7+b;
			if(b>7){
	        	b=b-7;
			}
			if(b==5){
				printf("%d\n",i);
			}
		}
		if(i==6){
			b=(28+30+3*31)%7+b;
			if(b>7){
	    	    b=b-7;
			}
			if(b==5){
				printf("%d\n",i);
			}
		}
		if(i==7){
			b=(28+30*2+3*31)%7+b;
			if(b>7){
	        	b=b-7;
			}
			if(b==5){
				printf("%d\n",i);
			}
		}
		if(i==8){
			b=(28+30*2+4*31)%7+b;
			if(b>7){
	        	b=b-7;
			}
			if(b==5){
				printf("%d\n",i);
			}
		}
		if(i==9){
			b=(28+30*2+5*31)%7+b;
			if(b>7){
	        	b=b-7;
			}
			if(b==5){
				printf("%d\n",i);
			}
		}
		if(i==10){
			b=(28+30*3+5*31)%7+b;
			if(b>7){
	        	b=b-7;
			}
			if(b==5){
				printf("%d\n",i);
			}
		}
		if(i==11){
			b=(28+30*3+6*31)%7+b;
			if(b>7){
	           	b=b-7;
			}
			if(b==5){
				printf("%d\n",i);
			}
		}
		if(i==12){
			b=(28+30*4+6*31)%7+b;
			if(b>7){
	        	b=b-7;
			}
			if(b==5){
				printf("%d\n",i);
			}
		}
	}
	return 0;
}