semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
/************************************
1.cpp
???Nov 2, 2011
??(10-3) ????? (2723)
?? 1100012886
************************************/

int main()
{
	int i, w, day[11]={31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30}; //???12????
	cin >> w;
	w = w - 1; //????????????~????????w=0~6
	w = (w + 12) % 7; //???1?13????
	if (w == 4) cout << 1 << endl;
	for (i = 0; i <= 10; i++)
	{
		w = (w + day[i]) % 7; //??(i+2)?13????
		if (w == 4) cout << i + 2 << endl;
	}
	return 0;
}
int jh[365];
int xqj[365];
void dy(int *jh,int *xqj);
int main(){
	int i;
	for(i=0;i<31;i++){
		jh[i]=i+1;
	}
	for(i=31;i<59;i++){
		jh[i]=i-30;
	}
	for(i=59;i<90;i++){
		jh[i]=i-58;
	}
	for(i=90;i<120;i++){
		jh[i]=i-89;
	}
	for(i=120;i<151;i++){
		jh[i]=i-119;
	}
	for(i=151;i<181;i++){
		jh[i]=i-150;
	}
	for(i=181;i<212;i++){
		jh[i]=i-180;
	}
	for(i=212;i<243;i++){
		jh[i]=i-211;
	}
	for(i=243;i<273;i++){
		jh[i]=i-242;
	}
	for(i=273;i<304;i++){
		jh[i]=i-272;
	}
	for(i=304;i<334;i++){
		jh[i]=i-303;
	}for(i=334;i<365;i++){
		jh[i]=i-333;
	}
	int w;
	scanf("%d",&w);
	for(i=0;i<365;i++){
		xqj[i]=i+w;
		if(xqj[i]%7!=0){
			xqj[i]=xqj[i]%7;
		}else{
			xqj[i]=7;
		}
	}
	dy(jh,xqj);
	return 0;
}
void dy(int *jh,int *xqj){
	int i;
	int k=1;
	for(i=0;i<365;i++){
		
		if(jh[i]==13){
			
			if(xqj[i]==5){
				printf("%d\n",k);
			}
			k++;
		}
	}
}
int main()
{
	int n;
	scanf("%d",&n);
	if((7+n)%7==0)
	{
		printf("1\n10\n");
	}else if((31+n)%7==0)
	{
		printf("2\n3\n11\n");
	
	}else if((2*31+n)%7==0)
	{
		printf("4\n7\n");
	}else if((2*31+30+n)%7==0)
	{
		printf("5");
	}else if((30+3*31+n)%7==0)
	{
		printf("6");
	}else if((4*31+2*30+n)%7==0)
	{
		printf("8");
	}else if((5*31+2*30+n)%7==0)
	{
		printf("9\n12\n");
	
	}

return 0;
}
int date(int month);
int daycount(int month);


int main()
{
    int day=0;
    scanf("%d",&day);
	
	int remainder=0;
	if(day>5)
		remainder=12-day;
	if(day<5)
		remainder=5-day;
	int month=1;
	for(;month<=12;month++)
	{
		if(daycount(month)%7==remainder)
			printf("%d\n",month);
	}


	
	return 0;
}

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

int daycount(int month)
{
	if(month==1)
		return 12;
	int sum=12;
	int mon=1;
	for(;mon<month;mon++)
		sum+=date(mon);
	return sum;
}
int main(int argc, char* argv[])
{
	int a[12]={13,44,72,103,133,164,194,225,256,286,317,347};
	int n;
	scanf("%d",&n);
	int i;
	for(i=0;i<12;i++){
		if((a[i]-1+n)%7==5)
			printf("%d\n",i+1);
	}
	
	
	return 0;
}
int main()
{
    int w,i,n;
    scanf("%d", &w);
    n=w+12; if(n%7==5) printf("1\n");
    n+=31; if(n%7==5) printf("2\n");
    n+=28; if(n%7==5) printf("3\n");
    n+=31; if(n%7==5) printf("4\n");
    n+=30; if(n%7==5) printf("5\n");
    n+=31; if(n%7==5) printf("6\n");
    n+=30; if(n%7==5) printf("7\n");
    n+=31; if(n%7==5) printf("8\n");
    n+=31; if(n%7==5) printf("9\n");
    n+=30; if(n%7==5) printf("10\n");
    n+=31; if(n%7==5) printf("11\n");
    n+=30; if(n%7==5) printf("12\n");
    return 0;
}
int main()
{  
   int w,i,j,m,n,s,h;
   int x[1000],y[1000],z[1000];
   scanf("%d",&w);
   for(i=1;i<=365;i++)
   {  
      
       x[i]=(w+i-1)%7;
    }
   for(j=1;j<=365;j++)
   {
      if(j<=31)
        { y[j]=j;z[j]=1;}
      else if(j<=59)
         {y[j]=j-31;z[j]=2;}
      else if(j<=90)
         {y[j]=j-59;z[j]=3;}
      else if(j<=120)
         {y[j]=j-90;z[j]=4;}
      else if(j<=151)
         {y[j]=j-120;z[j]=5;}
      else if(j<=181)
         {y[j]=j-151;z[j]=6;}
      else if(j<=212)
         {y[j]=j-181;z[j]=7;}
      else if(j<=243)
         {y[j]=j-212;z[j]=8;}
      else if(j<=273)
         {y[j]=j-243;z[j]=9;}
      else if(j<=304)
         {y[j]=j-273;z[j]=10;}
      else if(j<=334)
         {y[j]=j-304;z[j]=11;}
      else if(j<=365)
        { y[j]=j-334;z[j]=12;}
}
      for(i=1;i<=365;i++)
        { if(x[i]==5&&y[i]==13)
            printf ("%d\n",z[i]);
         }
       return 0;
}
int main(int argc, char* argv[])
{
	int w,a[12]={13,44,72,103,133,164,194,225,256,286,317,347},i;
	scanf("%d",&w);
	for(i=0;i<12;i++){
		if(w==7&&a[i]%7+w-8==5)
			printf("%d\n",i+1);
		else if(w!=7&&a[i]%7+w-1==5)
			printf("%d\n",i+1);}
	return 0;
}
main(){
	int n, i, mon[11]={31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30}, day[12];
	scanf("%d", &n);
	day[0]=0;
	for(i=1; i<12; i++)	day[i]=mon[i-1]+day[i-1];
	for(i=0; i<12; i++) day[i]=day[i]+13+(n-1);
	for(i=0; i<12; i++){
		if(day[i]%7==5) printf("%d\n", i+1);
		else continue;
	}
}
int main()
{
    int a[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
    int b[13];
    int d,i,j;
    scanf("%d",&d);
    d=d-1;
    b[0]=13;
    for(i=1;i<=12;i++)
    {
        b[i]=b[i-1]+a[i-1];
        if ((b[i]+d)%7==5)
            printf("%d\n",i);
    }
    return 0;
}
int main()
{
	int day[12];
	day[1]=31;
	day[2]=28;
	day[3]=31;
	day[4]=30;
	day[5]=31;
	day[6]=30;
	day[7]=31;
	day[8]=31;
	day[9]=30;
	day[10]=31;
	day[11]=30;
	day[12]=31;
	int n,i,s=12,a=0;
	scanf("%d",&n);
        if(n+5>7&&n+5-7==5)
	printf("1\n");
       for(i=2;i<=12;i++)
	{
		s+=day[i-1];
		a=n+s%7;
		if(a>7&&a-7==5)
			printf("%d\n",i);
		if(a==5)
			printf("%d\n",i);
	}
       return 0;
}
main()
{
      int n;
      int i,day;
      scanf("%d",&n);
      for(i=1;i<=12;i++)
      {
      if(i==1)
      day=12;
      else if(i==2||i==4||i==6||i==8||i==9||i==11)
      day=day+31;
      else if(i==3)
      day=day+28;
      else
      day=day+30;
      
      if((day%7+n)%7==5)
      printf("%d\n",i);
      }
     
      
      
      
      }
void main()
{
	int a[12],b[12]={1,2,3,4,5,6,7,8,9,10,11,12},w,i;
	scanf("%d",&w);
	a[0]=13;
	a[1]=31+13;
	a[2]=31+28+13;
	a[3]=31+28+31+13;
	a[4]=31+28+31+30+13;
	a[5]=31+28+31+30+31+13;
	a[6]=31+28+31+30+31+30+13;
	a[7]=31+28+31+30+31+30+31+13;
	a[8]=31+28+31+30+31+30+31+31+13;
	a[9]=31+28+31+30+31+30+31+31+30+13;
	a[10]=31+28+31+30+31+30+31+31+30+31+13;
	a[11]=31+28+31+30+31+30+31+31+30+31+30+13;
	for(i=0;i<=11;i++)
	{
		if((a[i]-13+w)%7==0)
			printf("%d\n",b[i]);
	}
}
int main()
{
	int n,i,d,t;
	scanf("%d",&n);
	for(i=1;i<=12;i++){
		if(i==1){
			d=12;
		}
		if(i==2){
			d=31+12;
		}
		if(i==3){
			d=31+28+12;
		}
		if(i==4){
			d=31+28+31+12;
		}
		if(i==5){
			d=31+28+31+30+12;
		}
		if(i==6){
			d=31+28+31+30+31+12;
		}
		if(i==7){
			d=31+28+31+30+31+30+12;
		}
		if(i==8){
			d=31+28+31+30+31+30+31+12;
		}
		if(i==9){
			d=31+28+31+30+31+30+31+31+12;
		}
		if(i==10){
			d=31+28+31+30+31+30+31+31+30+12;
		}
		if(i==11){
			d=31+28+31+30+31+30+31+31+30+31+12;
		}
		if(i==12){
			d=31+28+31+30+31+30+31+31+30+31+30+12;
		}
		t=d%7;
		if(n<5){
			if(t+n==5){
			printf("%d\n",i);
			}
		}else if(n==5){
			if(t==0){
				printf("%d\n",i);
			}
		}else if(n>5){
			if(t+n==12){
				printf("%d\n",i);
			}
		}else{
			break;
		}

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

int main()
{
	int i, w, date=0;
	scanf("%d", &w);
	w=13%7+w-1;
	if(w>7) w=w-7;
	for(i=0;i<12;i++)
	{
       w=day(i)%7+w;
       if(w>7) w=w-7;
	   if(w==5) 
		  printf("%d\n", i+1);
	}
	return 0;
}
int LeapQ(int);
int DayCount(int, int, int);

int main()
{
	int i, n;
	scanf("%d", &n);
	for(i=1; i<=12; i++)
	{
		if((DayCount(1,i,13)-(6-n))%7==0) printf("%d\n", i);
	}
	return 0;
}

int LeapQ(int year)
{
	return (year%400==0||year%100!=0&&year%4==0)?1:0;
}

int DayCount(int year, int month, int date)
{
	int i, num=0;
	for(i=1; i<month; i++)
	{
		if(i==2) num+=LeapQ(year)?29:28;
		else num+=(i==1||i==3||i==5||i==7||i==8||i==10||i==12)?31:30;
	}
	num+=date;
	return num;
}
//*******************************************************
//*11.2??  ?????                                 *
//*?????  ?? 1100012844                          *
//*???2011?11?2?                                  *
//*******************************************************
int main()
{
	// days????????????
	int days[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
	int w, i, a[13] = {0, 12}; // a??????1?1??i?13?????
	cin >> w; // ??w

	// ??1?1??i?13????????a[i]?
	for (i = 1; i < 12; i++)
		a[i + 1] = a[i] + days[i];

	// ??a??
	for (i = 1; i <= 12; i++)
		if ((w + (a[i] % 7)) % 7 == 5) // ????
			cout << i << endl; // ?????????i
	return 0;
}
int main()
{
	int w,a,b,d[13],i,j;
	
	int m[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
	
	scanf("%d",&w);
	for(i=1;i<=12;i++)
	{
        d[i]=0;
        for(j=1;j<i;j++)
        {
            d[i]=d[i]+m[j];
        }
        d[i]=d[i]+13;
        a=(d[i]+w-2)%7+1;
        if(a==5)
            printf("%d\n",i);
    }
    
}
int month_len(int x)
{
	int day=31;
	if(x==0)day=0;
	if(x==2)day=28;
	if(x==4||x==6||x==9||x==11)day=30;
	return day;
}
int sum_days(int y)
{
	int ctr,sum=0;
	for(ctr=0;ctr<y;ctr++)
	{sum+=month_len(ctr);}
		sum+=12;
		return sum;
}
void main()
{
	int i,w;
	scanf("%d",&w);
	for(i=1;i<=12;i++)
	{if(sum_days(i)%7+w==5||sum_days(i)%7+w==12)printf("%d\n",i);}
}
int main()
{
    int f[13]={0,31,28,31,30,31,30,31,31,30,31,30,31},i,j,day;
    cin>>day;
    day--;
    for( i=1 ; i<=12 ; i++ )
     for( j=1 ; j<=f[i] ; j++ )
     {
       day++;
       if(day>7)day=1;
       if(j==13&&day==5)cout<<i<<endl;
     }
}
int main(){
	int d,m,w;
	scanf("%d",&w);
	if(w==6||w==7)
		d=1+5+7-w;
	else
		d=5-w+1;
	m=1;
	for(int i=d;d<=365;i+=7)
	{
		if(i==13)
			printf("%d\n",m);
		else
		{
			if(m==1||m==3||m==5||m==7||m==8||m==10)
			{
				if(i>31)
				{
					i=i-31;
					m++;
				}
			}
			if(m==9||m==4||m==6||m==11)
			{
				if(i>30)
				{
					i=i-30;
					m++;
				}
			}
			if(m==2)
			{
				if(i>28)
				{
					i=i-28;
					m++;
				}
			}
		}
		d+=7;
	}
	return 0;
}
int day(int d)
{
  if (d>7)
    d=d%7;
  return d;
}
int main ()
{
  int w[13],a[13];
  int i,d;
  scanf ("%d",&w[1]);
  a[1]=a[3]=a[5]=a[7]=a[8]=a[10]=a[12]=31;
  a[2]=28;
  a[4]=a[6]=a[9]=a[11]=30;
  for (i=2;i<=12;i++)
    w[i]=a[i-1]%7+w[i-1];
  for (i=1;i<=12;i++)
  {
    d=day (w[i]+5);
    if (d==5)
      printf ("%d\n",i);
  }
}
int main(){
	int w,a,i,b;
	scanf("%d",&w);
	int s[12]={13,44,72,103,133,164,194,225,256,286,317,347};
	for(i=1;i<=12;i++){
		if(i==1){
		    a=13%7-1;
			if(w+a<=7){b=w+a;}
			else{b=w+a-7;}
			if(b==5){printf("%d\n",i);}
		}else if(i==2){
		    a=44%7-1;
			if(w+a<=7){b=w+a;}
			else{b=w+a-7;}
			if(b==5){printf("%d\n",i);}
		}else if(i==3){
		    a=72%7-1;
			if(w+a<=7){b=w+a;}
			else{b=w+a-7;}
			if(b==5){printf("%d\n",i);}
		}else if(i==4){
		    a=103%7-1;
			if(w+a<=7){b=w+a;}
			else{b=w+a-7;}
			if(b==5){printf("%d\n",i);}
		}else if(i==5){
		    a=133%7-1;
			if(w+a<=7){b=w+a;}
			else{b=w+a-7;}
			if(b==5){printf("%d\n",i);}
		}else if(i==6){
		    a=164%7-1;
			if(w+a<=7){b=w+a;}
			else{b=w+a-7;}
			if(b==5){printf("%d\n",i);}
		}else if(i==7){
		    a=194%7-1;
			if(w+a<=7){b=w+a;}
			else{b=w+a-7;}
			if(b==5){printf("%d\n",i);}
		}else if(i==8){
		    a=225%7-1;
			if(w+a<=7){b=w+a;}
			else{b=w+a-7;}
			if(b==5){printf("%d\n",i);}
		}else if(i==9){
		    a=256%7-1;
			if(w+a<=7){b=w+a;}
			else{b=w+a-7;}
			if(b==5){printf("%d\n",i);}
		}else if(i==10){
		    a=286%7-1;
			if(w+a<=7){b=w+a;}
			else{b=w+a-7;}
			if(b==5){printf("%d\n",i);}
		}else if(i==11){
		    a=317%7-1;
			if(w+a<=7){b=w+a;}
			else{b=w+a-7;}
			if(b==5){printf("%d\n",i);}
		}else if(i==12){
		    a=347%7-1;
			if(w+a<=7){b=w+a;}
			else{b=w+a-7;}
			if(b==5){printf("%d\n",i);}}
	}
	return 0;
}
int month[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
struct Date
{
    int  iLab,iMonth,iDay;
} DNow;

void Date_Walk()
{
	for(int x=1;x<=12;x++)
	{
		for(int y=1;y<=month[x];y++)
		{
		    DNow.iLab++;
			if(DNow.iLab>7) DNow.iLab=1;
			if(y==13 && DNow.iLab==5) cout<<x<<endl;
		}
	}
	return;
}

int main()
{
	int w;
	cin>>w;
	DNow.iMonth=1,DNow.iDay=1,DNow.iLab=w-1;
	Date_Walk();
	return 0;
}
//*************************************
//* ????1.cpp *
//* ??????1200012844 *
//* ?????2012?11?13? *
//* ?????????? *
//**************************************

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



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

	scanf("%d",&w);
	if(w>=1&&w<=5){
			r=5-w;
	}else{
			r=12-w;
	}
	a=12;
	for(i=1;i<=12;i++){
		if(i==3){
			a=a+28;
		}else if(i==5||i==7||i==10||i==12){
			a=a+30;
		}else if(i==1){
			a=a;
		}else{
			a+=31;
		}
		if(a%7==r){
			printf("%d\n",i);
		}

		
		
		
	
	}

	
	return 0;
}
int day(int month){
	int t=0,i;
	for(i=1;i<month;i++){
		if(i==1||i==3||i==5||i==7||i==8||i==10||i==12){
			t+=31;
		}else if(i==4||i==6||i==9||i==11){
			t+=30;
		}else if(i==2){
			t+=28;
		}
	}

	return t;
}

int main()
{
	int w,i,t,a;

	scanf("%d",&w);

	for(i=1;i<=12;i++){
		t=0;
		t=13+day(i);
		
		a=t%7+w-1;
		if(a>7){
			a=a-7;	
		}
		if(a==5){
			printf("%d\n",i);
		}
	}
	return 0;
}
int j(int x);
int main()
{
int b[12],w,i,a[12]={13,44,72,103,133,164,194,225,256,286,317,347};
scanf("%d",&w);
for(i=0;i<12;i++)
{
	b[i]=a[i]%7-1;
	b[i]=(b[i]+w)%7;
}
for(i=0;i<12;i++)
{
	if(b[i]==5)
	{
		printf("%d\n",i+1);
	}
}
return 0;
}
int main()
{
	int w;
	scanf("%d",&w);
	if((7+w)%7==0)
	{
		printf("1\n");
	}
	if((38+w)%7==0)
	{
		printf("2\n");
	}
	if((66+w)%7==0)
	{
		printf("3\n");
	}
	if((97+w)%7==0)
	{
		printf("4\n");
	}
	if((119+8+w)%7==0)
	{
		printf("5\n");
	}
	if((158+w)%7==0)
	{
		printf("6\n");
	}
	if((188+w)%7==0)
	{
		printf("7\n");
	}
	if((219+w)%7==0)
	{
		printf("8\n");
	}
	if((250+w)%7==0)
	{
		printf("9\n");
	}
	if((280+w)%7==0)
	{
		printf("10\n");
	}
	if((311+w)%7==0)
	{
		printf("11\n");
	}
	if((341+w)%7==0)
	{
		printf("12\n");
	}


	return 0;
}
int main(int argc, char* argv[])
{
    int date,i,j,day[13]={0},month[13];
	scanf("%d",&date);
	for (i=1;i<=12;i++)
	{
		if (i==1)
		{
			month[i]=0;
		}
		if (i==2||i==4||i==6||i==8||i==9||i==11)
		{
			month[i]=31;
		}
		if (i==3)
		{
			month[i]=28;
		}
		if (i==5||i==7||i==10||i==12)
		{
			month[i]=30;
		}
	}
    for (j=1;j<=12;j++)
	{
		for (i=1;i<=j;i++)
		{
			day[j]=day[j]+month[i];
		}
	}
    for (j=1;j<=12;j++)
	{
		if ((day[j]+13-1+date)%7==5)
		{
			printf("%d\n",j);
		}
	}
	return 0;
}
int main(int argc, char* argv[])
{
	int i=0,j=0,k=0,w=0;
    scanf("%d",&w);
	for(i=1;i<=12;i++){
		if(i==1){
             j=j+(w+12);
			 k=j%7;
		     if(k==5)
			printf("%d\n",i);
		}
		if(i==3){
	       j=j+28;
		   k=j%7;
		   if(k==5)
			  printf("%d\n",i);
		}
		if(i==5||i==7||i==10||i==12){
            j=j+30;
			k=j%7;
		    if(k==5)
			   printf("%d\n",i);
		}
		if(i==2||i==4||i==6||i==8||i==9||i==11){
            j=31+j;
			k=j%7;
		    if(k==5)
			   printf("%d\n",i);
		}
	}
	return 0;
}
main()
{
      int w,i;
      scanf("%d",&w);
      int a[11]={31,28,31,30,31,30,31,31,30,31,30};
      
      if((w+12%7)%7==5)
          printf("1\n");
      w=(w+12%7)%7;
      for(i=0;i<11;i++)
      {
          if((w+a[i]%7)%7==5)
              printf("%d\n",i+2);
          w=(w+a[i]%7)%7;
      }
}
int main()
{
    int w, a[13], b[13], c[13], i;//a[i]??i?1??????b[i]??i?13????? 
    c[1] = c[3] = c[5] = c[7] = c[8] = c[10] = c[12] = 31 % 7;
    c[2] = 28 % 7;
    c[4] = c[6] = c[9] = c[11] = 30 % 7;
    cin >> w;
    a[1] = w;
    b[1] = (a[1] + 12) % 7;
    for(i = 2;i <= 12;i++)
    {
        a[i] = (a[i - 1] + c[i - 1]) % 7;
        b[i] = (a[i] + 12) % 7;
    }
    for(i = 1;i <= 12;i++)
    {
        if(b[i] == 5)
        {cout << i << endl;}
    }
}
int main()
{
    int m,w;
    scanf("%d",&w);
    for(m=1;m<=12;m++)
    {
        if(m==1){
              if((w+12)%7==5){
                 printf("1\n");
               }
               w+=12;
               w+=31;
         }
         else if(m==3||m==5||m==7||m==8||m==10||m==12){
               if(w%7==5){
                     printf("%d\n",m);
                }
                w+=31;
         }
         else if(m==2){
              if(w%7==5){
                   printf("2\n");
              }
              w+=28;
          }
          else if(m==4||m==6||m==9||m==11){
               if(w%7==5){
                    printf("%d\n",m);
;
                }
                 w+=30;
          }
     };

     return 0;
}
int a[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
int sign=0;
int work(int n)
{
	int s=12,i;
	for(i=1;i<n;i++)
	s+=a[i];
	if((s+sign)%7==5)
	return 1;
	else
	return 0;
}
int main()
{
	int n,m,i;
	cin>>sign;
	for(i=1;i<=12;i++)
	if(work(i))
	cout<<i<<endl;
	return 0;
}
main()
{
      int w,k=0;
      scanf("%d",&w);
      if(((w=w+12)%7)==5) k++,printf("1\n");
      if(((w=w+31)%7)==5) k++,printf("2\n");
      if(((w=w+28)%7)==5) k++,printf("3\n");
      if(((w=w+31)%7)==5) k++,printf("4\n");
      if(((w=w+30)%7)==5) k++,printf("5\n");
      if(((w=w+31)%7)==5) k++,printf("6\n");
      if(((w=w+30)%7)==5) k++,printf("7\n");
      if(((w=w+31)%7)==5) k++,printf("8\n");
      if(((w=w+31)%7)==5) k++,printf("9\n");
      if(((w=w+30)%7)==5) k++,printf("10\n");
      if(((w=w+31)%7)==5) k++,printf("11\n");
      if(((w=w+30)%7)==5) k++,printf("12\n");
      if(k==0) printf("Not found");
      
      }
int main()
{
	int w,temp,a[13]={0,31,28,31,30,31,30,31,31,30,31,30,31},i,j;
	cin>>w;
	for(i=1;i<=12;i++)
	{
		temp=0;
		for(j=1;j<i;j++)
		{
			temp+=a[j];
		}
		temp+=12;
		temp=(temp+w)%7;
		if(temp==5)
			cout<<i<<endl;
	}

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


}
int main()
{
	int w,m,j,w1;
	int days[12]={31,28,31,30,31,30,31,31,30,31,30,31};
	scanf("%d",&w);
	if(w==7) printf("1\n");
	for(m=2;m<=12;m++){
		int sum =0;
		for(j=0;j<m-1;j++){
			sum+=days[j];}
		sum+=12;
		w1=(w+sum%7<=7)?(w+sum%7):(w-7+sum%7);
		if(w1==5) printf("%d\n",m);
	}
	return 0;
}
//********************************
//*????????   **
//*?????? 1200012827 **
//*???2012.11.18  **
//********************************
int main()
{
    int month[12];                          //????????????
    month[0]=31;
    month[1]=28;
    month[2]=31;
    month[3]=30;
    month[4]=31;
    month[5]=30;
    month[6]=31;
    month[7]=31;
    month[8]=30;
    month[9]=31;
    month[10]=30;
    month[11]=31;
    int a;
    cin >> a;
    int date[12],i;
    date[0]=12;
    for (i=1;i<=11;i++)
    {
        date[i]=date[i-1]+month[i-1];     //??????????????????
    }
    for (i=0;i<=11;i++)
    {
        if (((date[i]%7)+a)%7==5)         //????????
        {
                         cout<< i+1 << endl;
        }
    }
     return 0;
}
int sushu(int b);
int main(){
int p;
scanf("%d",&p);
for(int i=1;i<=12;i++){
	if((sushu(i)+p)%7==5)
		printf("%d\n",i);
}
return 0;
	}
int sushu(int b){
	int i;
	int a;
	a=0;
	for(i=1;i<=b;i++){
		if(i==2||i==4||i==6||i==8||i==9||i==11)
		a+=31;
		else if(i==1)
			a+=12;
			else if(i==3)
		a+=28;
			else if(i==5||i==7||i==10||i==12)
				a+=30;
	}
	return a;
}