semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int main(int argc, char* argv[])
{
	int w,month,day;
	scanf("%d",&w);
	for (month=1;month<=12;month++)
	{
		switch (month){
		case 1: 
			day = ((13-1)%7+w)%7;
			break;
		case 2:	
			day = ((13+31-1)%7+w)%7;
			break;
		case 3: 
		case 5:
		case 7:
		case 8:
		case 10:
		case 12:
			day = ((13+28+31*(month/2)+30*((month-1)/2-1)-1)%7+w)%7;
			break;
		case 4:
		case 6:	
		case 9:	
		case 11:
			day = ((13+28+31*((month+1)/2)+30*((month+1)/3-1)-1)%7+w)%7;
			break;			
		}
		if (day==5)
		{
			printf("%d\n",month);
		}
	}                   
	return 0;
}
int w,i;
int feb(int x)
{
	if ((w+12)%7==5) printf("%d\n",i);
    if ((w+28)%7!=0) return ((w+28)%7);
		else return 7;
}
int tiny(int x)
{
	if ((w+12)%7==5) printf("%d\n",i);
    if ((w+30)%7!=0) return ((w+30)%7);
		else return 7;
}
int big(int x)
{
	if ((w+12)%7==5) printf("%d\n",i);
    if ((w+31)%7!=0) return ((w+31)%7);
		else return 7;
}
void main()
{

	scanf("%d",&w);
	for(i=1;i<=12;i++)
	{
		if(i==2)w=feb(w);
		else if(i==4||i==6||i==9||i==11)w=tiny(w);
		     else w=big(w);
	}
}
int mon[14]={31,28,31,30,31,30,31,31,30,31,30,31};

int main()
{
    int we1,i;

	int mon[14]={31,28,31,30,31,30,31,31,30,31,30,31};

    scanf("%d",&we1);

    int judge(int x,int y);

	for(i=1;i<13;i++){
		if(judge(we1,i)==1)
			printf("%d\n",i);
	}

	return 0;
}

int judge(int x,int y){
	int sum=0,i;

    for(i=0;i<y-1;i++){
		sum+=mon[i];
	}

	sum+=13;

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

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


    
return 0;    
    
}
int main()
{
   int w,x,i,a[13];
   scanf("%d",&w);
   a[1]=13;
   a[2]=44;
   a[3]=72;
   a[4]=103;
   a[5]=133;
   a[6]=164;
   a[7]=194;
   a[8]=225;
   a[9]=256;
   a[10]=286;
   a[11]=317;
   a[12]=347;
   for(i=1;i<=12;i++)
   {
	   x=a[i]%7;
	   if(x+w-1==5)
	   {
		   printf("%d\n",i);
	   }
           else if(x+w-8==5)
           {
                   printf("%d\n",i);
           }
   }
   return 0;
}
void main(){
	int w,i,j,sum=0,a;
	scanf("%d",&w);
	a=w;
	for(i=1;i<13;i++)
	{
		sum=0;
		for(j=1;j<i;j++)
		{
		    switch(j)
		    {
		    case(1):
		    case(3):
			case(5):
			case(7):
			case(8):
			case(10):sum+=31;break;
			case(4):
			case(6):
			case(9):
			case(11):sum+=30;break;
			case(2):sum+=28;break;
			}
		}
		sum+=12;
		w=w+sum%7;
		if(w==5||w==12) printf("%d\n",i);
		w=a;
	}
}
int main(){
  int w,d=12,a;
  scanf("%d",&w);
  a=12%7;
  if((a+w)%7==5){printf("1\n");}
  d+=31;
  a=d%7;
  if((a+w)%7==5){printf("2\n");}
  d+=28;
  a=d%7;
  if((a+w)%7==5){printf("3\n");}
  d+=31;
  a=d%7;
  if((a+w)%7==5){printf("4\n");}
  d+=30;
  a=d%7;
  if((a+w)%7==5){printf("5\n");}
   d+=31;
  a=d%7;
  if((a+w)%7==5){printf("6\n");}
  d+=30;
  a=d%7;
  if((a+w)%7==5){printf("7\n");}
  d+=31;
  a=d%7;
  if((a+w)%7==5){printf("8\n");}
  d+=31;
  a=d%7;
  if((a+w)%7==5){printf("9\n");}
   d+=30;
  a=d%7;
  if((a+w)%7==5){printf("10\n");}
   d+=31;
  a=d%7;
  if((a+w)%7==5){printf("11\n");} 
  d+=30;
  a=d%7;
  if((a+w)%7==5){printf("12\n");}
return 0;
}
main()
{
      int i,j,k,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");
      }
int mon[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
int main()
{
	int n;cin>>n;int total=0;int s=0;
	if((5-n)>=0)
		s=5-n;
	else
		s=12-n;
	for(int i=0;i<12;i++){
		total+=mon[i];
		total+=13;
		if((total-1)%7==s)
			cout<<i+1<<endl;
		total-=13;
	}
	return 0;
}
main()
{
		int a[12],w,b[12]={0},i;
		a[0]=31;
		a[1]=28;
		a[2]=31;
		a[3]=30;
		a[4]=31;
		a[5]=30;
		a[6]=31;
		a[7]=31;
		a[8]=30;
		a[9]=31;
		a[10]=30;
		a[11]=31;
		scanf("%d",&w);
		b[0]=(w+12)%7;
		for(i=1;i<12;i++)
		b[i]=(b[i-1]+a[i-1])%7;
		for(i=0;i<12;i++)
		{
			if(b[i]==5)
			printf("%d\n",i+1);
		}
		 
}
int  main()
{
    int k,i;
	cin>>k;
	int a[13]={0,13,31+13,31+28+13,28+2*31+13,28+30+2*31+13,28+30+3*31+13,28+2*30+3*31+13,28+30*2+4*31+13,28+2*30+5*31+13,28+3*30+5*31+13,28+3*30+6*31+13,28+4*30+6*31+13};
     for(i=1;i<=12;i++)
	 {
		 if((a[i]%7+k-1)%7==5)
			 cout<<i<<endl;
	 }
	 return 0;
}
int yue(int x);
int main(){
	int w;
	int i,k=13;
	int m=1;
	scanf("%d",&w);
	for(i=1;i<=12;i++){
		k+=yue(i-1);
//		printf("%d\n",yue(i));
		if(w+(k%7)==6||w+(k%7)==13){
			printf("%d\n",i);
		}
	}


	return 0;
}


int yue(int x){
	int d;
	if(x==1||x==3||x==5||x==7||x==8||x==10||x==12){
		d=31;
	}else if(x==2){
		d=28;
	}else if(x==0){
		d=0;
	}else if(x==4||x==6||x==9||x==11){
		d=30;
	}
	return d;
}
int main()
{
    int w,i,a;
    cin >> w;
    for(i=1;i<=12;i++)
    {
     switch(i)
     {
           case 1:
                a=w%7;
           break;
           case 2:
                a=(w+31)%7;
            break;
            case 3:
                a=(w+31)%7;
            break;
            case 4:
                a=(w+31*2)%7;
            break;
            case 5:
                a=(w+31*2+30)%7;
            break;
            case 6:
                a=(w+31*3+30)%7;
            break;
            case 7:
                a=(w+31*3+30*2)%7;
            break;
            case 8:
                a=(w+31*4+30*2)%7;
            break;
            case 9:
                a=(w+31*5+30*2)%7;
            break;
            case 10:
                a=(w+31*5+30*3)%7;
            break;
            case 11:
                a=(w+31*6+30*3)%7;
            break;
            case 12:
                a=(w+31*6+30*4)%7;
            break;
     }
           if(a==0)
                {
                    cout << i <<endl;
                }
    }
    return 0;
}
int main()
{
	int month[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
	int mon[13]={0,0,0,0,0,0,0,0,0,0,0,0,0};
    int w,i,a;
	scanf("%d",&w);
	mon[0]=13;
    for (i=1; i<13; i++){
       mon[i]=mon[i-1]+month[i-1];
	   a=((mon[i] % 7)+w-1)% 7;
	   if (a==5) {
		   printf("%d\n",i);
	   }
	   }
	return 0;
}
int main()
{
    int w,a[12]={31,28,31,30,31,30,31,31,30,31,30,31},i,b[13],c[13];
    cin>>w;
     b[0]=12;
    for(i=1;i<13;i++)
    {b[i]=b[i-1]+a[i-1];
    c[i-1]=b[i-1]%7;
    if((c[i-1]+w)%7==5)
		cout<<i<<endl;
	}
     return 0;
}
int main(){
	int w;
	scanf("%d",&w);
	if(w+13%7-8==5||w+13%7-8==-2)
		printf("1\n");
	if(w+44%7-8==5||w+44%7-8==-2)
		printf("2\n");
	if(w+72%7-8==5||w+72%7-8==-2)
		printf("3\n");
	if(w+103%7-8==5||w+103%7-8==-2)
		printf("4\n");
	if(w+133%7-8==5||w+133%7-8==-2)
		printf("5\n");
	if(w+164%7-8==5||w+164%7-8==-2)
		printf("6\n");
	if(w+194%7-8==5||w+194%7-8==-2)
		printf("7\n");
	if(w+225%7-8==5||w+225%7-8==-2)
		printf("8\n");
	if(w+256%7-8==5||w+256%7-8==-2)
		printf("9\n");
	if(w+286%7-8==5||w+286%7-8==-2)
		printf("10\n");
	if(w+317%7-8==5||w+317%7-8==-2)
		printf("11\n");
	if(w+347%7-8==5||w+347%7-8==-2)
		printf("12\n");
	return 0;
}
main()
{
       int n;
       int a[12],i,j,s,k;
       scanf("%d",&n);
       a[0]=0;
       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;
       for(i=1;i<=12;i++)
       {
                  s=13;
                  for(j=1;j<=i;j++)
                  {
                       s=s+a[j-1];
                  }
                  k=s-1+n;
                  if(k%7==5)
                  printf("%d\n",i);                  
      }
       
}
int main(){
    int m,i,t,w;
	int sz[20];
	t=0;
	scanf("%d",&m);
	w=(m+12)%7;
	sz[1]=w;
	sz[2]=(w+31)%7;
	sz[3]=(sz[2]+28)%7;
	sz[4]=(sz[3]+31)%7;
	sz[5]=(sz[4]+30)%7;
	sz[6]=(sz[5]+31)%7;
	sz[7]=(sz[6]+30)%7;
	sz[8]=(sz[7]+31)%7;
	sz[9]=(sz[8]+31)%7;
	sz[10]=(sz[9]+30)%7;
	sz[11]=(sz[10]+31)%7;
	sz[12]=(sz[11]+30)%7;
	for(i=1;i<=12;i++){
		if(sz[i]==5){printf("%d\n",i);t=1;}
	}
	return 0;
}
int w,mon,ord;
int main()
{
	scanf("%d",&w);
	ord=13;
	mon=1;
	while(mon<=12)
	{
		if((ord%7==6-w)||(ord%7==13-w))
			printf("%d\n",mon);
		if(mon==1||mon==3||mon==5||mon==7||mon==8||mon==10||mon==12)
			ord+=31;
		if(mon==4||mon==6||mon==9||mon==11)
			ord+=30;
		if(mon==2)
			ord+=28;
		mon++;
	
	}
	return 0;
}
int main(int argc, char* argv[])
{
	int i,w,a,b,day,s=0;

	scanf("%d",&w);
	for(i=1;i<13;i++)
	{
		switch (i)
		{
		case 1:{
			day=0;
			break;}
		case 2:
		case 4:
		case 6:
		case 8:
		case 9:
		case 11:{
			day=31;
			break;}
		case 3:{
			day=28;
			break;}
		default:{
			day=30;
			break;}
		}
		s=s+day;
		a=12+s;
		b=a%7+w;
		if (b%7==5){
			printf("%d\n",i);}
	}

	return 0;
}
int main()
{ 
  int w;
  scanf("%d",&w);
  int a[12]={13,31,28,31,30,31,30,31,31,30,31,30};
  int i;
  for(i=1;i<12;i++) a[i]+=a[i-1];
  for(i=0;i<12;i++)
  if(((a[i]-1)%7+w)%7==5) printf("%d\n",i+1);
}
// ?????.cpp : ??????????????
//


int weekdays(int n)
{
	if(n<=7)return n;
	else return weekdays(n-7);
}

int main()//(int argc, _TCHAR* argv[])
{
	int days[13][32];
	int i,j,w;
	scanf("%d",&w);
	for(i=1;i<=12;i++)
	{
		for(j=1;;j++)
		{
			days[i][j]=j;
			if(j==28&&i==2)break;
			if(j==30&&(i==4||i==6||i==9||i==11))break;
			if(j==31&&(i==1||i==3||i==5||i==7||i==8||i==10||i==12))break;
		}
	}
	int weekday[13][32];
	weekday[1][1]=w;
	for(i=1;i<=12;i++)
	{
		for(j=1;;j++)
		{
			weekday[i][j]=weekdays(w+j-1);
			if(j==28&&i==2){w=weekdays(weekday[i][j]+1);break;}
			if(j==30&&(i==4||i==6||i==9||i==11)){w=weekdays(weekday[i][j]+1);break;}
			if(j==31&&(i==1||i==3||i==5||i==7||i==8||i==10||i==12)){w=weekdays(weekday[i][j]+1);break;}
		}
	}
	j=13;
	for(i=1;i<=12;i++)
	{
		if(weekday[i][j]==5)printf("%d\n",i);
	}


	
	return 0;
}
int main()
{
	int w, n = 0; 
	cin >> w; 
	int a[365];
	memset(a, 0, sizeof(a));
	int b[12] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30};
	
	for (int i = 0; i < 51; i++)
	{
		int n = 7 * i + 13 - w;
		a[n] = 1; 
	}
	
	for (int i = 0; i < 12; i++)
	{
		n += b[i];
		a[n+13] += 1; 
		if (a[n+13] == 2)
		cout << i + 1 << endl;
	}
	return 0;
}
int main(){
	int n;
	scanf("%d",&n);
	if(6==n-1){
		printf("1\n");
	}
	if(2==n-2){
		printf("2\n");
	}	
	if(2==n-2){
		printf("3\n");
	}	
	if(5==n+4){
		printf("4\n");
	}	
	if(0==n-6){
		printf("5\n");
	}
	if(3==n){
		printf("6\n");
	}	
	if(5==n+4){
		printf("7\n");
	}	
	if(1==n-4){
		printf("8\n");
	}
	if(4==n+2){
		printf("9\n");
	}
	if(6==n-1){
		printf("10\n");
	}
	if(2==n-2){
		printf("11\n");
	}
	if(4==n+2){
		printf("12\n");
	}
	


	return 0;
}
int start;
const int thirteen[12]={13,44,72,103,133,164,194,225,256,286,317,347};

inline int conv(int a){
    if(a==1) return 5;
    if(a==2) return 4;
    if(a==3) return 3;
    if(a==4) return 2;
    if(a==5) return 1;
    if(a==6) return 7;
    if(a==7) return 6;
};
int main(){
    cin>>start;
    for(int i=0;i<12;i++){
        if((thirteen[i]-conv(start))%7==0) cout<<i+1<<endl;
    };
    return 0;
}
int main(){
	int w,i;
	scanf("%d",&w);
	for(i=1;i<=12;i++){
		if(i==1){
			w=w+5;
			if(w>7){
				w=w-7;
			}
			if(w==5){
				printf("%d\n",i);
			}
		}else if(i==2||i==4||i==6||i==8||i==9||i==11){
			w=w+3;
			if(w>7){
				w=w-7;
			}
			if(w==5){
				printf("%d\n",i);
			}
		}else if(i==3){
			if(w==5){
				printf("%d\n",i);
			}
		}else{
			w=w+2;
			if(w>7){
				w=w-7;
			}
			if(w==5){
				printf("%d\n",i);
			}
		}
	}
		return 0;
}
int main(int argc, char* argv[])
{
	int n;
	scanf("%d",&n);
	if (12%7+n>7) {
		if ((12%7+n-7)==5) printf("1\n");}
	else {if ((12%7+n)==5) printf("1\n");}
	if (43%7+n>7) {
		if ((43%7+n-7)==5) printf("2\n");}
	else {if ((43%7+n)==5) printf("2\n");}
	if (71%7+n>7) {
		if ((71%7+n-7)==5) printf("3\n");}
	else {if ((71%7+n)==5) printf("3\n");}
	if (102%7+n>7) {
		if ((102%7+n-7)==5) printf("4\n");}
	else {if ((102%7+n)==5) printf("4\n");}
	
	if (132%7+n>7) {
		if ((132%7+n-7)==5) printf("5\n");}
	else {if ((132%7+n)==5) printf("5\n");}
	if (163%7+n>7) {
		if ((163%7+n-7)==5) printf("6\n");}
	else {if ((163%7+n)==5) printf("6\n");}
	if (193%7+n>7) {
		if ((193%7+n-7)==5) printf("7\n");}
	else {if ((193%7+n)==5) printf("7\n");}
	if (224%7+n>7) {
		if ((224%7+n-7)==5) printf("8\n");}
	else {if ((224%7+n)==5) printf("8\n");}
	if (255%7+n>7) {
		if ((255%7+n-7)==5) printf("9\n");}
	else {if ((255%7+n)==5) printf("9\n");}
		if (285%7+n>7) {
		if ((285%7+n-7)==5) printf("10\n");}
	else {if ((285%7+n)==5) printf("10\n");}
		if (316%7+n>7) {
		if ((316%7+n-7)==5) printf("11\n");}
	else {if ((316%7+n)==5) printf("11\n");}	
	if (346%7+n>7) {
		if ((346%7+n-7)==5) printf("12\n");}
      else {if ((346%7+n)==5) printf("12\n");}
	return 0;
}
int main()
{

    //??????
    int days[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
    
    //startDay?1?1??????
    //xMonthThirteenth????13??????????
    //whatDay????13??????
    int startDay, xMonthThirteenth = 13;
    int whatDay, i;

    scanf("%d", &startDay);
    xMonthThirteenth += (startDay - 1); 
    for(i = 0; i < 12; i ++)
    {
        whatDay = xMonthThirteenth % 7;
        if(whatDay == 5)
            printf("%d\n", i + 1);
        xMonthThirteenth += days[i];
    }

	return 0;
}
int main()
{
  int w,i,j;
  scanf("%d",&w);
  int num[12]= {31,28,31,30,31,30,31,31,30,31,30,31};
  int tian[12]={13,13,13,13,13,13,13,13,13,13,13,13};
  for(i=0;i<12;i++)
  {
       for(j=0;j<i;j++)
       {
           tian[i]=tian[i]+num[j];            
       }
  }
 int xingqi[12];
 for (i=0;i<12;i++)
 {
     xingqi[i]=(tian[i]%7+w-1)%7;
 }
 for (i=0;i<12;i++)
 {
     if (xingqi[i]==5)
     printf("%d\n",i+1);
 }
 
  return 0;
}
int main()
{
	int w,i,b,c;
	int a[13];
	scanf("%d",&w);
	a[1]=0;
	a[2]=31;
	a[3]=28;
	a[4]=31;
	a[5]=30;
	a[6]=31;
	a[7]=30;
	a[8]=31;
	a[9]=31;
	a[10]=30;
	a[11]=31;
	a[12]=30;
    for(i=1;i<=12;i++)
    {w=w+a[i];
     c=w%7;
     if(c==0)
     {printf("%d\n",i);} 
    }
return 0;
}
int Day(int m);
	/*******************************************
	* ?????
	* ???????????13???1?1????
	*******************************************/
int main()
{
	int w;
	scanf("%d", &w);
	for(int i=1; i<=12; i++)
	{
		if((Day(i)+w)%7 == 5)
			printf("%d\n", i);
	}

	return 0;
}

int Day(int m)
{
	int sum=0, month[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
	for(int i=0; i<m-1; i++)
	{
		sum += month[i];
	}
	return sum+12;
}
int main()
{
	int a[365],n,i,j=0,k,b[100];
	scanf("%d",&n);
    for(i=0;i<7;i++)
	{
		a[i]=n;
        n++;
		if(n==8) break;
	}
	k=i;
	n=1;
	for(i=k+1;i<365-k;i++)
	{
		a[i]=n;
	    n++;
		if(n==8) 
		{
			n=1;
		}
	}
	for(i=0;i<365;i++)
	{
		if(a[i]==5) 
		{
			b[j]=i+1;
			j++;
		}
	}
    for(i=0;i<100;i++)
	{
		if(b[i]==13) printf("1\n");
		else if(b[i]==44) printf("2\n");
		else if(b[i]==72) printf("3\n");
		else if(b[i]==103) printf("4\n");
		else if(b[i]==133) printf("5\n");
		else if(b[i]==164) printf("6\n");
		else if(b[i]==194) printf("7\n");
		else if(b[i]==225) printf("8\n");
		else if(b[i]==256) printf("9\n");
		else if(b[i]==286) printf("10\n");
		else if(b[i]==317) printf("11\n");
		else if(b[i]==347) printf("12\n"); 
	}
	return 0;
}
void main()
{
	int w,i,a[12]={0,31,28,31,30,31,30,31,31,30,31,30};
	scanf("%d",&w);
	w=w+12;
	for(i=0;i<=11;i++)
	{
		w=w+a[i];
		if(w%7==5)
			printf("%d\n",i+1);
	}
}
main()
{
   int n,i;
   int a[12],b[12];
   b[0]=12;
   b[1]=b[0]+31;
   b[2]=b[1]+28;
   b[3]=b[2]+31;
   b[4]=b[3]+30;
   b[5]=b[4]+31;
   b[6]=b[5]+30;
   b[7]=b[6]+31;
   b[8]=b[7]+31;
   b[9]=b[8]+30;
   b[10]=b[9]+31;
   b[11]=b[10]+30;
   b[12]=b[11]+31;
   scanf("%d",&n);
   
   for(i=0;i<12;i++)
   {
   a[i]=n+b[i]%7;
   if(a[i]>7) a[i]=a[i]-7;
   }
   
   for(i=0;i<12;i++)
   {if(a[i]==5)
   printf("%d\n",i+1);
   }
   
}
main()
{
      int a[13];
      a[0]=0;
      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;
      int w;
      int i; 
      scanf("%d",&w);
      int sum=13; 
      for(i=0;i<12;i++)
      {
             sum=sum+a[i];
           
                    if(w>=5)
                    {
                            if((sum-13+w)%7==0)
                            printf("%d\n",i+1);
                    }
                    else if(w<5)
                    {
                         if((sum-6+w)%7==0)
                         printf("%d\n",i+1);
                    }
                    else continue;
             
                        
      }
      
    }
int main(){
   int w,i,yue,tian,day;
      scanf("%d",&w);
       for(i=1;i<=365;i++){
           tian=i;
              if(i>=1&&i<=31){
                tian=i;
                yue=1;
              }else if(i>31&&i<=59){
                tian=i-31;
                yue=2;
              }else if(i>59&&i<=90){
                tian=i-59;
                yue=3;
              }else if(i>90&&i<=120){ 
                tian=i-90;
                yue=4;
              }else if(i>120&&i<=151){
                tian=i-120;
                yue=5;
              }else if(i>151&&i<=181){
                tian=i-151;
                yue=6;
              }else if(i>181&&i<=212){
                tian=i-181;
                yue=7;
              }else if(i>212&&i<=243){
                tian=i-212;
                yue=8;
              }else if(i>243&&i<=273){
                tian=i-243;
                yue=9;
              }else if(i>273&&i<=304){
                tian=i-273;
                yue=10;
              }else if(i>304&&i<=334){
                tian=i-304;
                yue=11;
              }else if(i>334&&i<=365){
                tian=i-334;
                yue=12;
              }         
               
                  day=(i+w-1)%7;
            if(tian==13&&day==5){
                printf("%d\n",yue);
              }
          }
              return 0;
      }
int main()
{
	int w,a,b,i,sz[12];
	scanf("%d",&w);
	sz[0]=13;
	sz[1]=44;
	sz[2]=72;
	sz[3]=103;
	sz[4]=133;
	sz[5]=164;
	sz[6]=194;
	sz[7]=225;
	sz[8]=256;
	sz[9]=286;
	sz[10]=317;
	sz[11]=347;
	for(i=0;i<12;i++)
	{
		a=(sz[i]-1)%7+w;
		b=a%7;
		if(b==5)
		{
			printf("%d\n",i+1);
		}
	}
	return 0;
}
int main()
{
	int i,j,w,month[13],week,sum_day=0;
	scanf("%d",&w);
	month[1]=31;
	month[2]=28;
	month[3]=31;
	month[4]=30;
	month[5]=31;
	month[6]=30;
	month[7]=31;
	month[8]=31;
	month[9]=30;
	month[10]=31;
	month[11]=30;
	month[12]=31;
for(j=1;j<13;j++)
	{
		for(i=1;i<366;i++)
		{
			week = (i+w-1)%7;
			if ((i-sum_day)==13 && week==5)
			{
			printf("%d\n",j);
			}
		
		}
			sum_day += month[j];

	}
		
return 0;
}
int main()
{
	int w,i,sum=0;
	cin>>w;
	for (i=0;i<=11;i++)
	{
		switch (i)
		{
		case 1:
		case 3:
		case 5:
		case 7:
		case 8:
		case 10:sum+=31;break;
		case 4:
		case 6:
		case 9:
		case 11:sum+=30;break;
		case 2:sum+=28;break;
		default:sum+=0;break;
		}
		if ((sum+13+w-1)%7==5)   cout<<i+1<<endl;
	}
    return 0;
}
int main()
{
	int w,i,j,flag;
	int day[12][31]={0};
	int date[366];
    scanf("%d",&w);
	for(i=0;i<365;i++)
	{
			if(w+i<8)
			date[i]=w+i-1;
	}
	for(flag=0;flag<365;flag++)
	{
		date[flag+8-w]=flag%7;
	}
	flag=0;
	for(i=0;i<12;i++)
	{
        for(j=0;j<31;j++)
		{
		    if(i==1&&j>27)
				continue;
			else if(i==3&&j>29)
				continue;
			else if(i==5&&j>29)
				continue;
			else if(i==8&&j>29)
				continue;
			else if(i==10&&j>29)
				continue;
			else day[i][j]=date[flag];
			flag++;
		}
	}
	for(i=0;i<12;i++)
	{
		for(j=0;j<31;j++)
		{
			if(j==12&&day[i][j]==4)
				printf("%d\n",i+1);
		
		}
	}
	getchar();getchar();
	return 0;
}
int main()
{
	int a[13];
	int i,j,k,w;
	scanf("%d",&w);
	a[1]=12;
	a[2]=43;
	a[3]=71;
	a[4]=102;a[5]=132;
	a[6]=163;
	a[7]=193;
	a[8]=224;
	a[9]=255;
	a[10]=285;
	a[11]=316;
	a[12]=346;
	j=w-5;
	for(i=1;i<13;i++)
	{
		a[i]=a[i]+j;
		if ((a[i]%7)==0)
		{
			printf("%d\n",i);
		}
	}
	return 0;
}
int main()
{
	int w,i,j,a[13];
	int month[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
	scanf("%d",&w);
	for(i=0;i<12;i++)
	{
		int x=0;
		for(j=0;j<=i;j++)
		{
			x=x+month[j];
		}
		a[i]=(x+13-1)%7;
	}
	switch(w)
	{
	case 1:
		for(i=0;i<12;i++)
		{
			if(a[i]==4)
				printf("%d\n",i+1);
		}
		break;
    case 2:
		for(i=0;i<12;i++)
		{
			if(a[i]==3)
				printf("%d\n",i+1);
		}
		break;
    case 3:
		for(i=0;i<12;i++)
		{
			if(a[i]==2)
				printf("%d\n",i+1);
		}
		break;
	case 4:
		for(i=0;i<12;i++)
		{
			if(a[i]==1)
				printf("%d\n",i+1);
		}
		break;
    case 5:
		for(i=0;i<12;i++)
		{
			if(a[i]==0)
				printf("%d\n",i+1);
		}
		break;
    case 6:
		for(i=0;i<12;i++)
		{
			if(a[i]==6)
				printf("%d\n",i+1);
		}
		break;
    case 7:
		for(i=0;i<12;i++)
		{
			if(a[i]==5)
				printf("%d\n",i+1);
		}
	}
	return 0;
}
int main()
{
	int w,weekday[12],day[12]={12,43,71,102,132,163,193,224,255,285,316,346};
	int m,i;
	scanf("%d",&w);
	for(i=0;i<12;i++)
	{
		weekday[i]=day[i]%7;
	}
	for(i=0;i<12;i++)
	{
		if(w+weekday[i]>7)
			weekday[i]=w+weekday[i]-7;
		else
			weekday[i]=w+weekday[i];
	}
	for(i=0;i<12;i++)
	{
		if(weekday[i]==5)
		{m=i+1;
			printf("%d\n",m);}
	}
	return 0;
}
void main()
{
	int day[]={12,31,28,31,30,31,30,31,31,30,31,30};
	int i,begin;

	scanf("%d",&begin);

	for(i=0;i<12;i++)
	{
		begin+=day[i];
		if(begin%7==5) printf("%d\n",i+1);
	}
}
int main(){
	int w;
	scanf("%d",&w);
	int i=0;
	int sz[12]= { 13,44,72,103,133,164,194,225,256,286,317,347 } ;
	while (i<12){
		if ((sz[i]+w)%7==6){
			printf("%d\n",i+1);
		}
			i++;
	}
	return 0;
}
int main(int argc, char* argv[])
{int i,a,w=0,rizi=0,u;
	int yue[12]={0,31,59,90,120,151,181,212,243,273,304,334};
	scanf("%d",&w);
	for(i=0;i<12;i++)
	{u=i+1;
rizi=yue[i]+12;
		a=rizi%7;
		if((w==1)&&(a==4))
		{printf("%d\n",u);}
		else if((w==2)&&(a==3))
{printf("%d\n",u);}
		else if((w==3)&&(a==2))
{printf("%d\n",u);}
		else if((w==4)&&(a==1))
{printf("%d\n",u);}
		else if((w==5)&&(a==0))
{printf("%d\n",u);}
		else if((w==6)&&(a==6))
{printf("%d\n",u);}
		else if((w==7)&&(a==5))
{printf("%d\n",u);}
	}
	return 0;
}