semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int main()
{
    int a[12];
    int n,i;
    a[0]=13;
    a[1]=a[0]+31;
    a[2]=a[1]+28;
    for(i=3;i<8;i++)
    {
                     if(i%2==0)a[i]=a[i-1]+30;
                     else a[i]=a[i-1]+31;
     }
     for(i=8;i<12;i++)
     {
                      if(i%2==0)a[i]=a[i-1]+31;
                      else a[i]=a[i-1]+30;
     }
     scanf("%d",&n);
     n=6-n%7;
     for(i=0;i<12;i++)
     {
                      if(a[i]%7==n)printf("%d\n",i+1);
                      else ;
     }
     return 0;
}
int main()
{
	int a,i,j,s;
	int b[12]={0,31,28,31,30,31,30,31,31,30,31,30};
	scanf("%d",&a);
	if(a==7) printf("%d\n",1);
	i=1;
	while(i<=11)
	{
		s=0;
		for(j=1;j<=i;j++)
		{s=s+b[j];}
		if((s+12)%7+a==5||(s+12)%7+a==12) printf("%d\n",i+1);
		i=i+1;
	}
	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+62+30+31)%7==5)
printf("11\n");
if((w+12+31+28+31+30+31+30+62+30+31+30)%7==5)
printf("12\n");
return 0;
}
int main()
{int a[11]={31,28,31,30,31,30,31,31,30,31,30},b[12],w;//????a??1?11???????b??1?12?13??1?1??????w
cin>>w;//??w
b[0]=12;//??b????
for(int i=1;i<12;i++)//?????b???
	b[i]=b[i-1]+a[i-1];
for(int i=0;i<12;i++)//???????13?????
	if((w+b[i]%7)%7==5)
		cout<<i+1<<endl;//????
return 0;
}
int main()
{
	int a,b;

scanf("%d",&b);

for(a=1;a<=12;a++)
{  

	if(a==1)
	{   
		if((b+5)%7!=0){
		b=(b+5)%7;
		}else
		{b=7;}
		if(b==5)
		{printf("%d\n",a);}
		
	}else if(a==3)
	{
			if((b+7)%7!=0){
		b=(b+7)%7;
		}else
			{b=7;}
			if(b==5)
		{printf("%d\n",a);}
	}else if(a==2||a==4||a==6||a==8||a==9||a==11)
	{	if((b+3)%7!=0){
		b=(b+3)%7;
		}else
	{b=7;}
		if(b==5)
		{printf("%d\n",a);}
	}
	else if(a==5||a==7||a==10||a==12)
	{  if((b+2)%7!=0)
	{
		b=(b+2)%7;
		}else
	{b=7;}
		if(b==5)
		{printf("%d\n",a);}
	}

}

return 0;
}
int main()
{
	int w;
	scanf("%d",&w);
	if(((w+13%7)%7)-1==5) printf("%d\n",1);
	if(((w+44%7)%7)-1==5) printf("%d\n",2);
	if(((w+72%7)%7)-1==5) printf("%d\n",3);
	if(((w+103%7)%7)-1==5) printf("%d\n",4);
	if(((w+133%7)%7)-1==5) printf("%d\n",5);
	if(((w+164%7)%7)-1==5) printf("%d\n",6);
	if(((w+194%7)%7)-1==5) printf("%d\n",7);
	if(((w+225%7)%7)-1==5) printf("%d\n",8);
	if(((w+256%7)%7)-1==5) printf("%d\n",9);
	if(((w+286%7)%7)-1==5) printf("%d\n",10);
	if(((w+317%7)%7)-1==5) printf("%d\n",11);
	if(((w+347%7)%7)-1==5) printf("%d\n",12);
	return 0;
}
int main()
{
int w,i,W,day=13;
cin>>w;
for(i=0;i<=11;i++)                         //??i+1????????
{
  if(i==1||i==3||i==5||i==7||i==8||i==10)   
  day=day+31;
  else if(i==2)
  day=day+28;
  else if(i==0)
  day=day+0;
  else
  day=day+30;                              //?????i+1?????
  W=(w+((day-1)%7))%7;                     //??i+1??13?????
  if(W==5)
  cout<<i+1<<'\n';                         //???????????
}
return 0;
}
int main()
{
	int n,i,sz[12];
	scanf("%d",&n);
	sz[0]=n+13-1;
	sz[1]=sz[0]+31;
	sz[2]=sz[1]+28;
	sz[3]=sz[2]+31;
	sz[4]=sz[3]+30;
	sz[5]=sz[4]+31;
	sz[6]=sz[5]+30;
	sz[7]=sz[6]+31;
	sz[8]=sz[7]+31;
	sz[9]=sz[8]+30;
	sz[10]=sz[9]+31;
	sz[11]=sz[10]+30;
	for(i=0;i<12;i++)
	{
		if(sz[i]%7==5)
		{
		 printf("%d\n",i+1);
		}
	}
	return 0;
}
int main()
{
	int k,d;
	scanf("%d",&k);

	d=13%7-1+k;
	if(d==5||d==12) printf("1\n");

	d=(31+13)%7-1+k;
	if(d==5||d==12) printf("2\n");

	d=(31+28+13)%7-1+k;
	if(d==5||d==12) printf("3\n");

	d=(31+28+31+13)%7-1+k;
	if(d==5||d==12) printf("4\n");

	d=(31+31+30+28+13)%7-1+k;
	if(d==5||d==12) printf("5\n");

	d=(31+28+31+30+31+13)%7-1+k;
	if(d==5||d==12) printf("6\n");

	d=(31+28+31+30+31+30+13)%7-1+k;
	if(d==5||d==12) printf("7\n");

	d=(31+28+31+30+31+30+31+13)%7-1+k;
	if(d==5||d==12) printf("8\n");

	d=(31+28+31+30+31+30+31+31+13)%7-1+k;
	if(d==5||d==12) printf("9\n");

	d=(31+28+31+30+31+30+31+31+30+13)%7-1+k;
	if(d==5||d==12) printf("10\n");

	d=(31+28+31+30+31+30+31+31+30+31+13)%7-1+k;
	if(d==5||d==12) printf("11\n");

	d=(31+28+31+30+31+30+31+31+30+31+30+13)%7-1+k;
	if(d==5||d==12) printf("12\n");

	return 0;
}
int main()
{int i=1;
	int n,w;
	scanf("%d",&w);w+=12;
	if(w%7==5)printf("%d\n",i);i++;
	w+=31;
	if(w%7==5)printf("%d\n",i);i++;
	w+=28;
	if(w%7==5)printf("%d\n",i);i++;
	w+=31;
	if(w%7==5)printf("%d\n",i);i++;
	w+=30;
	if(w%7==5)printf("%d\n",i);i++;
	w+=31;
	if(w%7==5)printf("%d\n",i);i++;
	w+=30;
	if(w%7==5)printf("%d\n",i);i++;
	w+=31;
	if(w%7==5)printf("%d\n",i);i++;
	w+=31;
	if(w%7==5)printf("%d\n",i);i++;
	w+=30;
	if(w%7==5)printf("%d",i);i++;
	w+=31;
	if(w%7==5)printf("%d\n",i);i++;
	w+=30;
	if(w%7==5)printf("%d\n",i);i++;}
main()
{
	int a[52][7];
	int i,j,t;
	int w;
	scanf("%d",&w);
	t=9-w;
	for(i=1;i<52;i++)
	{
		for(j=0;j<7;j++)
		{
			a[i][j]=t;
            t++;
        }
	}
	int x,y;
	for(i=1;i<52;i++)
	{
		for(j=0;j<7;j++)
		{
			x=a[i][j];
	        if((x==13)||(x==44)||(x==72)||(x==103)||(x==133)||(x==164)||(x==194)||(x==225)||(x==256)||(x==286)||(x==317)||(x==347))
			{
	        	if(j==4)
	        	{
	        		y=x/30+1;
	        		printf("%d\n",y);
	        	}
	        }
	  }}}
int m[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
main()
{
int n,i;
int g,k,w,d=1,month=1;
scanf("%d",&n);
w=n;
for(i=1;i<=365;i++)
{w++;
   
   if(w==8)
     w=1;
   d++;
     if(d>m[month])
  {  month++;
     d=1;
}
if(d==13&&w==5)
printf("%d\n",month);

}

}
int main()
{int w,f,z,i;
int a[13]={0,0,31,28,31,30,31,30,31,31,30,31,30};
scanf("%d",&w);
i=1;f=12;
while(i<=12)
{f=f+a[i];
f=f%7;
if(f+w==7) z=7;
else z=(f+w)%7;
if( z==5) printf("%d\n",i);
i++;
}
 

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

}
int main(int argc, char* argv[])
{
	int w,d=12,i;
	scanf("%d",&w);
	int p[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
	for(i=0;i<13;i++)
	{
		d+=p[i];
		if(d%7+w==5||d%7+w==12)
			printf("%d\n",i+1);
	}
}
int nn(int x);
int main(){
	int h[12],i,y,r=0;
	scanf("%d",&y);
	for(i=1;i<=12;i++){
		if((nn(i)-5-(7-y+1))%7==0){
			h[r]=i;
			r++;
		}
	}
	for(i=0;i<r;i++){
		printf("%d\n",h[i]);
	}
		return 0;
}
int nn(int x){
	int z,t=13;
		for(z=0;z<x;z++){
			if(z==1||z==5||z==3||z==7||z==8||z==10||z==12)
				t+=31;
			else if(z==2)
				t+=28;
			else if(z==4||z==6||z==9||z==11)
				t+=30;
		}
	return t;
}
int main(void)
{
    int a[13];
    int s[13];
    int i;
    a[1]=a[3]=a[5]=a[7]=a[8]=a[10]=a[12]=31;
    a[4]=a[6]=a[9]=a[11]=30;
    a[2]=28;
    s[0]=0;
    s[1]=a[1];
    for(i=2;i<=12;i++)
    {s[i]=s[i-1]+a[i];}
    int m;
    scanf("%d",&m);
    for(i=1;i<=12;i++)
    {
         if(((s[i-1]+12)%7+m)%7==5)
         {printf("%d\n",i);}
    }
    
         return 0;
}
int month(int n)
{
	int sum=0;
	int i;
	for(i=0;i<n;i++)
	{
		if(i==0)
			sum=sum+0;
		if(i==1||i==3||i==5||i==7||i==8||i==10||i==12)
		{
			sum=sum+31;
		}
		if(i==4||i==6||i==9||i==11)
		{
			sum=sum+30;
		}
		if(i==2)
		{
			sum=sum+28;
		}
	}
	return sum;
}

int fri(int n,int w)//n  month
{
	int days;
	days=month(n);
	days=days+13;
	int a;
	a=days%7;
	if(w+a>7)
	{
		return w+a-7-1;
	}else{
		return w+a-1;
	}
}

int main()
{
	int i;
	int w;
	scanf("%d",&w);
	for(i=1;i<=12;i++)
	{
		int day;
		day=fri(i,w);
		if(day==5)
		{
			printf("%d\n",i);
		}
	}
	return 0;
}
int main ()
{
    int w, a[13] = {0}, sum;
    int b[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
    cin >> w;
    for (int i = 1; i <= 12; i++)
    {
        for (int j = 1; j < i; j++)
            a[i] += b[j];
        a[i] = a[i] + 13;
        if ((a[i] % 7 - 1 + w) % 7 == 5)
            cout << i << endl;
    }
    return 0;
}
void main()
{   int i,n,a[12],s=0;
	

    scanf("%d",&n);

	if((12+n)%7==5)
	{a[s]=1;
	 s=s+1;
	}
	if((3+12+n)%7==5)
	{a[s]=2;
	 s=s+1;
	}
	if((3+12+n)%7==5)
	{a[s]=3;
	 s=s+1;
	}
	if((6+12+n)%7==5)
	{a[s]=4;
	 s=s+1;
	}
	if((1+12+n)%7==5)
	{a[s]=5;
	 s=s+1;
	}
	if((4+12+n)%7==5)
	{a[s]=6;
	 s=s+1;
	}
	if((6+12+n)%7==5)
	{a[s]=7;
	 s=s+1;
	}
	if((2+12+n)%7==5)
	{a[s]=8;
	 s=s+1;
	}
	if((5+12+n)%7==5)
	{a[s]=9;
	 s=s+1;
	}
	if((0+12+n)%7==5)
	{a[s]=10;
	 s=s+1;
	}
	if((3+12+n)%7==5)
	{a[s]=11;
	 s=s+1;
	}if((5+12+n)%7==5)
	{a[s]=12;
	 s=s+1;
	}
	for(i=0;i<s;i++)
	{printf("%d\n",a[i]);}


}
int main() {
int w;
scanf("%d",&w);
if (w==6) {
   w=-1;
}
if (w==7) {
   w=0;
}
int s=12;
if (s%7==(5-w)) {
   printf("1\n");
}
for (int i=2;i<=12;i++) {
    if (i==2||i==4||i==6||i==8||i==9||i==11) {
       s=s+31;
    }
    if (i==3) {
       s=s+28;
    }
    if (i==5||i==7||i==10||i==12) {
       s=s+30;
    }
    if (s%7==(5-w)) {
       printf("%d\n",i);
    }
}
return 0;
}
int main(int argc, char* argv[])
{
	int n=0,sz[12]={31,28,31,30,31,30,31,31,30,31,30,31},sz1[12]={0};
	int i=0,j=0;
	sz1[0]=13;
	scanf("%d",&n);
	for(i=1;i<12;i++)
	{
		for(j=0;j<i;j++)
		{sz1[i]=sz1[i-1]+sz[j];}
	}
		for(i=0;i<12;i++)
		{
			if((n-1+sz1[i]%7)==5||(n-8+sz1[i]%7)==5)
				printf("%d\n",i+1);
		}
	return 0;
}
int main()
{
	int a[12][32],w,i,numOfDay,j;  //a[i][j]??(i+1)?j?
	                               //?????????????????????w?????
	                               //????????numOfDay??????????
	cin>>w;
	a[0][1]=w;
	for(i=0;i<12;i++){
		switch(i){
		case 0:
		case 2:
		case 4:
		case 6:
		case 7:
		case 9:
		case 11:numOfDay=31;break;
		case 3:
		case 5:
		case 8:
		case 10:numOfDay=30;break;
		case 1:numOfDay=28;break;
		}
		for(j=1;j<=numOfDay;j++){                 //?????
			w=w%7;                                //????????
			a[i][j]=w;
			w++;
		}
		if(a[i][13]==5)
			cout<<i+1<<endl;
	}
	return 0;
}
//***********************
// ?????????  ** 
// ?  ?: ???      ** 
// ?  ?: 2012/11/18  ** 
//*********************** 
int main()
{
    int a, month[13] = {0, 13, 44, 72, 103, 133, 164, 194, 225, 256, 286, 317, 347}, w, i; 
    cin >> w;
    for (i = 1; i <= 12; i++)
        if ((month[i] + w - 1) % 7  == 5 )
           cout << i << endl;
    return 0;
}
void main()
{
	int a[12]={1,2,3,4,5,6,7,8,9,10,11,12};
	int b[12]={0,31,59,90,120,151,181,212,243,273,304,334};
	int i,n,D=13;
	scanf("%d",&n);
	for(i=0;i<12;i++)
	{
		if((b[i]+D+n-1)%7==5) printf("%d\n",a[i]);
	}
}
main()
{
   int w,i,n;
   
   int  a[12]={31,28,31,30,31,30,31,31,30,31,30,31};
   scanf("%d",&w);
   n=a[0];
   if (w==7)
   printf("1\n");
   if (w==4)
   printf("2\n"); 
   for (i=1;i<11;i++)
    {
      n+=a[i];
     
       if ((((n-1)%7+w)%7)==6)
     
     
     
       
      printf("%d\n",i+2);
    
    }

      }
//***************************
//??: ?????      *****
//??:??? 1200012772*****
//??:2012?11?9?    *****
//***************************
int main()
{
	int w = 0;
	cin >> w;
	int i = 0;
	int mon[13] = {0};
	mon [1] = 12;
	for (i = 2; i <= 12; i++)
	{
		switch (i)
		{
		case 2: 
		case 4:
		case 6:
		case 8:
		case 9:
		case 11: mon[i] = mon[i - 1] + 3; break;
		case 3:  mon[i] = mon[i - 1]; break;
		default: mon[i] = mon[i - 1] + 2; break;
		}
	}
	int w2 = 0;
	for (i = 1; i <= 12; i++)
	{
		w2 = w + mon[i] % 7;
		if (w2 > 7)
			w2 = w2 - 7;
		if (w2 == 5)
			cout << i << endl;
	}

	return 0;
}
int main()
{

	int n,i;
	int m[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
	scanf("%d",&n);
	for(i=0;i<7;i++)
	{
	  if((n+i)%7==5)
	  {
	    n=(1+i)%7;//??????
	    break;
	  }
	}
	//printf("first Friday=%d\n",n);
	int e=13;
	for(i=0;i<12;i++)
	{
	  e=e+m[i];
	  //printf("%d\n",e);
	  if(e%7==n)
	  {
	    printf("%d\n",i+1);
	  }
	}

	return 0;
}
void main()
{int i,j,w;
 scanf("%d", &w);
   if ((w+12)%7==5)
	   {printf("1\n");
        printf("10\n");}
   if ((w+12)%7==6)
	   {printf("4\n");
        printf("7\n");}
   if ((w+12)%7==0)
	   {printf("9\n");
        printf("12\n");}
   if ((w+12)%7==1)
	   printf("6\n");
   if ((w+12)%7==2)
	   {printf("2\n");
        printf("3\n");
        printf("11\n");}
   if ((w+12)%7==3)
	   printf("8\n");
	if ((w+12)%7==4)
	   {
        printf("5\n");}
        
     
}
int main(int argc, char* argv[])
{
	int w,i,j,total=0;
	scanf("%d",&w);
	for(i=1;i<=12;i++){
		total=0;
		for(j=0;j<i;j++){
			if(j==1||j==3||j==5||j==7||j==8||j==10||j==12){
				total+=31;
			}
			if(j==4||j==6||j==9||j==11){
				total+=30;
			}
			if(j==2){
				total+=28;
			}
			if(j==0){
				total+=0;
			}
		}	
		total+=13;	
		if((w+total%7-1)%7==5){
			printf("%d\n",i);
		}
		else
			continue;
	}
	return 0;
}
int mon[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
int day(int m)
{
	int day=0,i;
	for (i=1;i<m;i++)
		day=day+mon[i];
	day=day+13;
	return (day);
}
int main()
{
	int i,a;
	scanf("%d",&a);
	for(i=1;i<13;i++)
		if((a+day(i)-1)%7==5)printf("%d\n",i);
	return 0;
}
int main (){
int w,m[13];
scanf ("%d",&w);
m[1]=w-2;
m[2]=m[3]=w+1;
m[4]=m[7]=w-3;
m[5]=w-1;
m[6]=w-5;
m[8]=w;
m[9]=m[12]=w-4;
m[10]=w-2;
m[11]=w+1;
int i;
for (i=1;i<13;i++){
	if (m[i]<=0){
	m[i]+=7;}
	else if (m[i]>7){
	m[i]-=7;
	}
}
for (i=1;i<13;i++){
	if (m[i]==5){
	printf ("%d\n",i);
	}

}

return 0;
}
int main(){
    int w,m,e=0,k;


    scanf("%d",&w);
    for(m=1;m<=12;m++){
        k=(e+13)%7;
        if((k+w-1==5)||(k+w-8==5)){
			printf("%d\n",m);
		}
		if(m==1||m==3||m==5||m==7||m==8||m==10||m==12){
			e=e+31;
		}else if(m==2){
			e=e+28;
		}else{
			e=e+30;
		}
    }
	return 0;
}
void main()
{
	int w,i;
	int a[13];
	int b[12]={31,28,31,30,31,30,31,31,30,31,30,31};
	scanf("%d",&w);
	a[0]=w;
	a[1]=a[0]+12;
	for(i=2;i<13;i++)
	{
		a[i]=a[i-1]+b[i-2];
	}
	for(i=1;i<13;i++)
	{
		if(a[i]%7==5)
			printf("%d\n",i);
	}
}
void main()
{
	int w;
	scanf("%d",&w);
	int day=1;
	
	w=(w+12)%7;
	if(w==0)
		w=7;
	if(w==5)
		printf("1\n");

	w=(w+31)%7;
	if(w==0)
		w=7;
	if(w==5)
		printf("2\n");

	w=(w+28)%7;
	if(w==0)
		w=7;
	if(w==5)
		printf("3\n");
	
	w=(w+31)%7;
	if(w==0)
		w=7;
	if(w==5)
		printf("4\n");

	w=(w+30)%7;
	if(w==0)
		w=7;
	if(w==5)
		printf("5\n");

	w=(w+31)%7;
	if(w==0)
		w=7;
	if(w==5)
		printf("6\n");

	w=(w+30)%7;
	if(w==0)
		w=7;
	if(w==5)
		printf("7\n");

	w=(w+31)%7;
	if(w==0)
		w=7;
	if(w==5)
		printf("8\n");

	w=(w+31)%7;
	if(w==0)
		w=7;
	if(w==5)
		printf("9\n");

	w=(w+30)%7;
	if(w==0)
		w=7;
	if(w==5)
		printf("10\n");

	w=(w+31)%7;
	if(w==0)
		w=7;
	if(w==5)
		printf("11\n");

	w=(w+30)%7;
	if(w==0)
		w=7;
	if(w==5)
		printf("12\n");
}
int main()
{
	int i,w,a=12;
	scanf("%d",&w);
		for(i=1;i<=12;i++)
		{
			if(i==1||i==3||i==5||i==7||i==8||i==10||i==12)
			{
				if(a%7+w==5||a%7+w==12)
					printf("%d\n",i);
				a=a+31;
			}
			if(i==4||i==6||i==9||i==11)
			{
				if(a%7+w==5||a%7+w==12)
					printf("%d\n",i);
				a=a+30;
			}
			if(i==2)
			{
				if(a%7+w==5||a%7+w==12)
					printf("%d\n",i);
				a=a+28;
			}		
		}
	return 0;
}
/*
???:?????
??:???
????:2011.11.2
*/
int main() //???
{
	int month[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}, sum = 0, i, j = 1, w, day[13] = {0}; // ??????????????
	cin >> w; // ?????????
	for(i = 1 ; i <= 12 ; i++)
	{
		sum = sum + month[i - 1];
		day[j] = sum + 12;  //???1.1????13????
		j++;
	}
	for(i = 1 ; i <= 12 ; i++)
	{
		day[i] = day[i] % 7;
		day[i] = (day[i] + w) % 7; //?????7???,?????
	}
	for(i = 1 ; i <= 12 ; i++)
	{
		if(day[i] == 5)
		{
			cout << i << endl; //???????
		}
	}
	return 0;
}
int main(){
	int m,d,w,i;
	scanf("%d",&w);
	m=1;
	d=1;
    for(i=1;i<=364;i++){
		if(d==31){
			d=1;
			m=m+1;
		}else if(d==30&&(m==4||m==6||m==9||m==11)){
			d=1;
			m=m+1;
		}else if(d==28&&m==2){
			d=1;
			m=m+1;
		}else{
			d=d+1;
		}
		w++;
		w=w%7;
		if(d==13&&w==5){
			printf("%d\n",m);
		}
	}
	return 0;
}
int main ()
{
    int d[]={0,31,59,90,120,151,181,212,243,273,304,334,365};
    int mon=0,w=12,n,i;
    scanf("%d",&n);
    w=w+n;
    if(w%7==5)
    {printf("%d\n",mon+1);}
    if((w+d[1])%7==5)
    {printf("%d\n",mon+2);}
    if((w+d[2])%7==5)
    {printf("%d\n",mon+3);}
    if((w+d[3])%7==5)
    {printf("%d\n",mon+4);}
    if((w+d[4])%7==5)
    {printf("%d\n",mon+5);}
    if((w+d[5])%7==5)
    {printf("%d\n",mon+6);}
    if((w+d[6])%7==5)
    {printf("%d\n",mon+7);}
    if((w+d[7])%7==5)
    {printf("%d\n",mon+8);}
    if((w+d[8])%7==5)
    {printf("%d\n",mon+9);}
    if((w+d[9])%7==5)
    {printf("%d\n",mon+10);}
    if((w+d[10])%7==5)
    {printf("%d\n",mon+11);}
    if((w+d[11])%7==5)
    {printf("%d\n",mon+12);}
    
    
}
int main()
{int m[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
int i,j,k,n,di;
scanf("%d",&n);
di=12;
for(i=0;i<12;i++)
{di=di+m[i];
j=(di+n)%7;
if(j==5)printf("%d\n",i+1);

	}



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

}
void main()
{
	int month[11]={31,28,31,30,31,30,31,31,30,31,30},i,w,day[12];
	day[0]=13;
	scanf("%d",&w);
	for(i=1;i<12;i++)
		day[i]=day[i-1]+month[i-1];
	for(i=0;i<12;i++)
	{
		if((day[i]%7+w-1)%7==5)
			printf("%d\n",i+1);
	}
}
int main(){
	int i,w,date=12,pd,d;
	scanf("%d",&w);
	int yf[12]={31,28,31,30,31,30,31,31,30,31,30,31};
	if(w==7){
		printf("1\n");
	}
	for(i=0;i<11;i++){
		date+=yf[i];
		pd=date%7;
		if(w+pd<=7){
			if(w+pd==5){
				printf("%d\n",i+2);
			}
		}
		else{
			d=w+pd-7;
			if(d==5){
				printf("%d\n",i+2);
			}
		}
	}
	

	return 0;
}
//****************************************
//*   ?????                         *
//*   ??????                       *
//*   ?????2011?12?18?           *
//****************************************


int main()
{
	int w, i, j, day, a, b, c;
	cin >> w;//w??????????
	for(i = 1; i <= 12; i ++)//i???i??
	{
		a = 0; 
		b = 0; 
		c = 0;//abc?????28?30?31????
		for(j = 0; j < i; j ++)//j??????
		{
			if(j == 2)
				a ++;
			else if(j == 4 || j == 6 || j == 9 || j == 11)
				b ++;
			else if(j != 0)
				c ++;
		}
		day = (28 * a + 30 * b + 31 * c + 12 + w) % 7;//????13?????
		if(day == 5)
			cout << i << endl;//???????i
	}
	return 0;
}
int dayOfMonth(int month);

int main(){

	int w;
	
	scanf("%d", &w);

	for(int i = 1; i <= 12; i++){
	
		int	week = (w+12)%7;
		if(week == 5){
			printf("%d\n", i);
		}

		w = (w + dayOfMonth(i))%7;
	}


	return 0;
}

int dayOfMonth(int month){
	switch(month){
		case 1: return 31;
		case 2: return 28;
		case 3: return 31;
		case 4: return 30;
		case 5: return 31;
		case 6: return 30;
		case 7: return 31;
		case 8: return 31;
		case 9: return 30;
		case 10: return 31;
		case 11: return 30;
		default: return 31;
	}

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

if((13-first)%7==0){printf("1\n");}
if((13+31-first)%7==0){printf("2\n");}
if((13+31+28-first)%7==0){printf("3\n");}
if((13+31+28+31-first)%7==0){printf("4\n");}
if((13+31+28+31+30-first)%7==0){printf("5\n");}
if((13+31+28+31+30+31-first)%7==0){printf("6\n");}
if((13+31+28+31+30+31+30-first)%7==0){printf("7\n");}
if((13+31+28+31+30+31+30+31-first)%7==0){printf("8\n");}
if((13+31+28+31+30+31+30+31+31-first)%7==0){printf("9\n");}
if((13+31+28+31+30+31+30+31+31+30-first)%7==0){printf("10\n");}
if((13+31+28+31+30+31+30+31+31+30+31-first)%7==0){printf("11\n");}
if((13+31+28+31+30+31+30+31+31+30+31+30-first)%7==0){printf("12\n");}


return 0;
}
int main(int argc, char* argv[])
{
	int a[13]={0 ,13, 44, 72, 103, 133 ,164, 194, 225, 256, 286, 317 ,347};
    int b,d,i,j;//xing qi ji //
	int c[13];//meiyue shi xing qi ji//
	scanf("%d",&b);
	for(i=1;i<=12;i++){
		d=b+a[i]%7-1;
		if(d<8){
			c[i]=d;}
		else{
			c[i]=d-7;}
	}
	for(j=1;j<=12;j++){
		if(c[j]==5){
			printf("%d\n",j);}
	}
	return 0;
}
int main()
{
	int xq[365];
	int i,w,f=0;
	scanf("%d",&w);
	for(i=0;i<365;i++){
		xq[i]=(w+i)%7;
		if(xq[i]==0)
			xq[i]=7;
	}
	if(xq[12]==5){
		if(f!=0)
			printf("\n");
		printf("1");
		f++;
	}
	if(xq[43]==5){
		if(f!=0)
			printf("\n");
		f++;
		printf("2");
	}
	if(xq[71]==5){
		if(f!=0)
			printf("\n");
		f++;
		printf("3");
	}
	if(xq[102]==5){
		if(f!=0)
			printf("\n");
		f++;
		printf("4");
	}
	if(xq[132]==5){
		if(f!=0)
			printf("\n");
		f++;
		printf("5");
	}
	if(xq[163]==5){
		if(f!=0)
			printf("\n");
		f++;
		printf("6");
	}
	if(xq[193]==5){
		if(f!=0)
			printf("\n");
		f++;
		printf("7");
	}
	if(xq[224]==5){
		if(f!=0)
			printf("\n");
		f++;
		printf("8");
	}
	if(xq[255]==5){
		if(f!=0)
			printf("\n");
		f++;
		printf("9");

	}
	if(xq[285]==5){
		if(f!=0)
			printf("\n");
		f++;
		printf("10");
	}
	if(xq[316]==5){
		if(f!=0)
			printf("\n");
		f++;
		printf("11");
	}
	if(xq[346]==5){
		if(f!=0)
			printf("\n");
		f++;
		printf("12");
	}
}
void panduan(int i,int num);
int i, num;
main()
{
    int w;
    scanf("%d",&w);
    i=1;
    num=(13+w-1);
    panduan( i, num);i++;
    num=num+31;
    panduan( i, num);i++;
    num=num+28;
    panduan( i, num);i++;
    num=num+31;
    panduan( i, num);i++;
    num=num+30;
    panduan( i, num);i++;
    num=num+31;
    panduan( i, num);i++;
    num=num+30;
    panduan( i, num);i++;
    num=num+31;
    panduan( i, num);i++;
    num=num+31;
    panduan( i, num);i++;
    num=num+30;
    panduan( i, num);i++;
    num=num+31;
    panduan( i, num);i++;
    num=num+30;
    panduan( i, num);i++;
}

void panduan(int i,int num)
{

    if(num%7==5)
    {printf("%d\n",i);
    }
}
int main()
{
	int w,i;
	scanf("%d",&w);
	for(i=1;i<=12;i++)
	{

	if(i==1)
	{

		if((w+12%7)%7==5)
		{
			printf("%d\n",i);
	
		}
	}
	if(i==2)
	{
		if((w+43%7)%7==5)
		{
			printf("%d\n",i);
	
		}
	}
	if(i==3||i==5||i==7)
	{
		if((w+(31+28+12+(i-3)*61/2)%7)%7==5)
		{
			printf("%d\n",i);
	
		}
	}
	if(i==4||i==6||i==8)
	{
		if((w+(31+28+31+12+(i-4)*61/2)%7)%7==5)
		{
			printf("%d\n",i);
		
		}
	}
	if(i==9||i==11)
	{
		if((w+(28+31*5+2*30+12+(i-9)*61/2)%7)%7==5)
		{
			printf("%d\n",i);
			
		}
	}
	if(i==10||i==12)
	{
		if((w+(28+5*31+3*30+12+(i-10)*61/2)%7)%7==5)
		{
			printf("%d\n",i);
			
		}
	}

	}

	return 0;
}