semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int main(int argc, char* argv[])
{
	int n;
	int y[1000],m1[1000],m2[1000];
	int a,cha;
	int i;
	int tian1,tian2;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf ("%d %d %d",&y[i],&m1[i],&m2[i]);
		if (y[i]%4==0)
		{			
			if (y[i]%100==0)
			{
				if (y[i]%400==0)
				{
					a=29;
				}
				else
				{
					a=28;
				}
			}
			else
			{
				a=29;
			}
		}
		else if (y[i]%4!=0)
		{
			a=28;
		}
		if (m1[i]==1)
		{
			tian1=0;	
		}
		if (m1[i]==2)
		{
			tian1=31;
		}
		if (m1[i]==3)
		{
			tian1=31+a;
		}
		if (m1[i]==4)
		{
			tian1=31+a+31;
		}
		if (m1[i]==5)
		{
			tian1=31+a+31+30;
		}
		if (m1[i]==6)
		{
			tian1=31+a+31+30+31;
		}
		if (m1[i]==7)
		{
			tian1=31+a+31+30+31+30;
		}
		if (m1[i]==8)
		{
			tian1=31+a+31+30+31+30+31;
		}
		if (m1[i]==9)
		{
			tian1=31+a+31+30+31+30+31+31;
		}
		if (m1[i]==10)
		{
			tian1=31+a+31+30+31+30+31+31+30;
		}
		if (m1[i]==11)
		{
			tian1=31+a+31+30+31+30+31+31+30+31;
		}
		if (m1[i]==12)
		{
			tian1=31+a+31+30+31+30+31+31+30+31+30;
		}	
		if (m2[i]==1)
		{
			tian2=0;	
		}
		if (m2[i]==2)
		{
			tian2=31;
		}
		if (m2[i]==3)
		{
			tian2=31+a;
		}
		if (m2[i]==4)
		{
			tian2=31+a+31;
		}
		if (m2[i]==5)
		{
			tian2=31+a+31+30;
		}
		if (m2[i]==6)
		{
			tian2=31+a+31+30+31;
		}
		if (m2[i]==7)
		{
			tian2=31+a+31+30+31+30;
		}
		if (m2[i]==8)
		{
			tian2=31+a+31+30+31+30+31;
		}
		if (m2[i]==9)
		{
			tian2=31+a+31+30+31+30+31+31;
		}
		if (m2[i]==10)
		{
			tian2=31+a+31+30+31+30+31+31+30;
		}
		if (m2[i]==11)
		{
			tian2=31+a+31+30+31+30+31+31+30+31;
		}
		if (m2[i]==12)
		{
			tian2=31+a+31+30+31+30+31+31+30+31+30;
		}
		cha=abs(tian1-tian2);
		if (cha%7==0)
		{
			printf ("YES\n");
		}
		else
		{
			printf("NO\n");
		}
	}
	return 0;
}
int ch(int y,int m)
{
 int a[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
    int i,c;
if ((y%4==0&&y%100!=0)||(y%400==0))
     a[2]++;
     c=1;
     for(i=1;i<m;i++)
     c=c+a[i];
     return c;
}
main()
{

    int i,j,n,y,m1,m2,t,s=1;
    scanf("%d",&n);
    for (j=0;j<n;j++)
    {
        scanf("%d %d %d",&y,&m1,&m2);
        if (m1>m2)
        s=ch(y,m1)-ch(y,m2);
        else
        s=ch(y,m2)-ch(y,m1);
        if (s%7!=0)
        printf("NO\n");
        else
        printf("YES\n");
        s=1;
    }
}
struct date {
   int year;
   int m1;
   int m2;
};struct date date[200];
int main() 
{ 
    int f(int p,int m,int n),i,p=0;
    
    int n;
    scanf("%d",&n);
    for(i=0;i<n;i++)
    scanf("%d%d%d",&date[i].year,&date[i].m1,&date[i].m2);
                    
    for(i=0;i<n;i++)   
    {            
                    if(((date[i].year%4==0&&date[i].year%100!=0)||(date[i].year%400==0) )&& (date[i].m1<=2||date[i].m2<=2)) 
 { 
  p++;
 } 
 f(p,date[i].m1,date[i].m2);
 p=0;
}
 return 0;
}
int f(int p,int m,int n)
{
    int a[13]={1,32,60,91,121,152,182,213,244,274,305,335};
    if((abs(a[m-1]-a[n-1])+p)%7==0)
    printf("YES\n");
    else
    printf("NO\n");
}
int d(int y,int month);
int main()
{
	int n,y,i,m1,m2,sum;
	cin>>n;
	for(i=1;i<=n;i++)
	{
		sum=0;
		cin>>y>>m1>>m2;
		if(m1>m2)
		{
			int change=m1;
			m1=m2;
			m2=change;
		}
		for(;m1<m2;m1++)
		{
			sum+=d(y,m1);
		}
		if(sum%7==0) cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
	return 0;
}
int d(int y,int m)
{
	if(m==1||m==3||m==5||m==7||m==8||m==10||m==12) return 31;
	if(m!=2) return 30;
	if((y%4==0&&y%100!=0)||y%400==0) return 29;
	return 28;
}
int main()
{
    int n, i, x, y, z, a, sum, leap;
    cin >> n;
    for (i = 1; i <= n; i++)
    {
        sum = 0;
        cin >> x >> y >> z;
        if (y > z)
        {
            a = y;
            y = z;
            z = a;
        }
        leap = x % 4 == 0 && x % 100 != 0 || x % 400 == 0;
        for ( ; y < z; y++)
        {
            if (y == 4 || y == 6 || y == 9 || y == 11)
            {
                sum += 30;
            }
            else if (y == 2)
            {
                sum += 28 + leap;
            }
            else
            {
                sum += 31;
            }
        }
        if (sum % 7 == 0)
        {
            cout << "YES" << endl;
        }
        else
        {
            cout << "NO" << endl;
        }
    }
    return 0;
}
void main(){
	
	int c,i,f,s,m,n,x;
    int b;
	
	scanf("%d",&c);
	for(i=1;i<=c;i++){
    scanf("%d",&b);
    scanf("%d%d",&f,&s);
    m=n=0;
	if(b%4==0){
         
		if (b%100==0){
			if(b%400==0){
			 int a[12]={31,29,31,30,31,30,31,31,30,31,30,31};
			
			for(x=0;x<f-1;x++){
				m=m+a[x];
			     }
			for(x=0;x<s-1;x++){
				m=m-a[x];
			     }
			    if(m%7==0){
				printf("YES\n");
			     }
			    else printf("NO\n");
			}
			else{
                 int a[12]={31,28,31,30,31,30,31,31,30,31,30,31};
			
			   for(x=0;x<f-1;x++){
				   m=m+a[x];
			      }
			   for(x=0;x<s-1;x++){
				   m=m-a[x];
			      }
			    if(m%7==0){
				printf("YES\n");
			      }
			   
			    else printf("NO\n");
		       }
		}
		else{
             int a[12]={31,29,31,30,31,30,31,31,30,31,30,31};
			
			for(x=0;x<f-1;x++){
				m=m+a[x];
			}
			for(x=0;x<s-1;x++){
				m=m-a[x];
			}
			    if(m%7==0){
				printf("YES\n");
			}
			    else printf("NO\n");
		}
	}
	else{

       int a[12]={31,28,31,30,31,30,31,31,30,31,30,31};
			
			for(x=0;x<f-1;x++){
				m=m+a[x];
			}
			for(x=0;x<s-1;x++){
				m=m-a[x];
			}
			    if(m%7==0){
				printf("YES\n");
			}
			    else printf("NO\n");
	}
	}
}
int main()
{
int n;
scanf("%d",&n);
int a,b,c;
int i;
for(i=0;i<n;i++)
{ scanf("%d%d%d",&a,&b,&c);
if ((a%4)!=0||(a%4)==0&&(a%100)==0&&(a%400)!=0)
{ if (b==9&&c==12||b==12&&c==9||b==4&&c==7||b==7&&c==4||b==1&&c==10||b==10&&c==1||b==2&&c==3||b==3&&c==2||b==2&&c==11||b==11&&c==2||b==3&&c==11||b==11&&c==3)
  printf("YES\n");
  else 
printf("NO\n");
}
else if ((a%4)==0&&(a%100)!=0||(a%400)==0)
{
if (b==9&&c==12||b==12&&c==9||b==4&&c==7||b==7&&c==4||b==1&&c==4||b==4&&c==1||b==1&&c==7||b==7&&c==1||b==2&&c==8||b==8&&c==2||b==3&&c==11||b==11&&c==3)
printf("YES\n");
else 
printf("NO\n");
}
}
return 0;
}
int main()
{
	int year,m1,m2;
	int md[13]={0,3,3,6,1,4,6,2,5,0,3,5,1};
	int n,i,k;
	cin>>n;
	for(i=1;i<=n;i++)
	{
		cin>>year>>m1>>m2;
		if(m1>m2)
		{
			m1^=m2;
			m2^=m1;
			m1^=m2;
		}
		if(((year%400==0)||(year%4==0&&year%100!=0))&&(m1<=2&&m2>2))k=1;
		else k=0;
		if((md[m2-1]-md[m1-1]+k)%7==0)cout<<"YES\n";
		else cout<<"NO\n";
	}
	return 0;
}
/*
 * 12.11.2.cpp
 *Created on: 2012-11-2
 *Author:???
 *?? ????
 */
int judge(int y){
	if(y%400==0||y%4==0&&y%100!=0){
		return 1;
	}
	else return 0;
}
int main() {
	int n,y,m1,m2,num,i,j,t;
	int m[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
	cin>>n;
	for(i=1;i<=n;i++){
		cin>>y>>m1>>m2;
		if(m1>m2){
			t=m1;m1=m2;m2=t;
		}
		for(j=m1,num=0;j<m2;j++){
			num=num+m[j]+(j==2)*judge(y);
		}
		if(num%7==0)cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
	return 0;
}
int main()
{
	int n,a[3],i,c[12]={31,28,31,30,31,30,31,31,30,31,30,31};
	int b,p,q,j;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d%d%d",&a[0],&a[1],&a[2]);
		if((a[0]%4==0&&a[0]%100!=0)||a[0]%400==0)
		{
			c[1]=29;
		}
		else c[1]=28;
		if(a[1]>a[2])
		{
			p=a[1];q=a[2];
			for(j=q-1,b=0;j<p-1;j++)
			{b=b+c[j];}
		}
		else
		{
			p=a[2];q=a[1];
			for(j=q-1,b=0;j<p-1;j++)
			{b=b+c[j];}
		}
		if(b%7==0) printf("YES\n");
		else printf("NO\n");
	}
}
int main()
{
	int n,year,m1,m2,i,a[13],date;
	
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
        date=0;
		scanf("%d %d %d",&year,&m1,&m2);
		if(((year%4==0&&year%100!=0)||year%400==0)==1)
		{
			a[1]=31;
			a[2]=29;
			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;


			if(m1>m2)
			{for(;m2<m1;m2++)
				{
					date=date+a[m2];
				}
			if(date%7==0)
				printf("YES\n");
			else 
				printf("NO\n");}
			else
			{for(;m1<m2;m1++)
				{
					date=date+a[m1];
				}
			if(date%7==0)
				printf("YES\n");
			else 
				printf("NO\n");}
		}
		else
		{
	        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;


			if(m1>m2)
			{for(;m2<m1;m2++)
				{
					date=date+a[m2];
				}
			if(date%7==0)
				printf("YES\n");
			else 
				printf("NO\n");}
			else
			{for(;m1<m2;m1++)
				{
					date=date+a[m1];
				}
			if(date%7==0)
				printf("YES\n");
			else 
				printf("NO\n");}
		}
	}


		




	
}
int rn(int year){
if((year%4==0&&year%100!=0)||year%400==0)
return 1;
else
return 0;
}
int check(int year,int m1,int m2){
int a[100],i,s=0;
a[1]=31;
if(rn(year))
a[2]=29;
else
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;
if(m1<m2)
for(i=m1;i<m2;i++)
s+=a[i];
if(m1>m2)
for(i=m2;i<m1;i++)
s+=a[i];
if(s%7==0)
return 1;
else return 0;
}
int main()
{
int n,i,a[200][3],j;
scanf("%d",&n);
for(i=0;i<n;i++)
for(j=0;j<3;j++)
scanf("%d",&a[i][j]);
for(i=0;i<n;i++)
if(check(a[i][0],a[i][1],a[i][2]))
printf("YES\n");
else printf("NO\n");
return 0;
}
int fuck(int m,int n)
{
    int s=0;
    //printf("%d %d\n",m,n);
    switch(n)
    {
             case 12 : s+=2;
             case 11 : s+=3;
             case 10 : s+=2;
             case 9 : s+=3;
             case 8 : s+=3;
             case 7 : s+=2;
             case 6 : s+=3;
             case 5 : s+=2;
             case 4 : s+=3;
             case 3 : if((m%4==0&&m%100!=0)||m%400==0) s+=1;
             case 2 : s+=3;
    }
    return s;
}
int main()
{
    int n,i,y,a,b,t;
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
                    scanf("%d%d%d",&y,&a,&b);
                    t=fuck(y,a)-fuck(y,b);
                    if(t%7==0) printf("YES\n");
                    else printf("NO\n");
    }
    scanf("%d",&n);
    return 0;
    
}
int main()
{
	int tianshu(int nian,int yue);
	int i,n,nian,yue1,yue2,dur;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d%d%d",&nian,&yue1,&yue2);
		dur=tianshu(nian,yue2)-tianshu(nian,yue1);
		if(dur%7==0)
			printf("YES\n");
		else
			printf("NO\n");
	}
	return 0;
}
int tianshu(int nian,int yue)
{
	int i,result=0;
	for(i=1;i<=yue-1;i++){
		if(i==1||i==3||i==5||i==7||i==8||i==10||i==12)
			result=result+31;
		else if(i==4||i==6||i==9||i==11)
			result=result+30;
		else if(i==2){
			if(nian%4==0&&nian%100!=0||nian%400==0)
				result=result+29;
			else
				result=result+28;
		}
	}
	return result;
}
int main()
{
	int n,m;
	int i,j,a=0;
	
	int year,month1,month2;

	int mi[12]={31,28,31,30,31,30,31,31,30,31,30,31};

	int mj[12]={31,29,31,30,31,30,31,31,30,31,30,31};

	scanf("%d",&n);

	

	for(i=1;i<=n;i++)
	{
		a=0;
		scanf("%d %d %d",&year,&month1,&month2);

		if((year%4==0&&year%100!=0)||year%400==0)
		{

			if(month2<month1)
			{
				m=month1;
				month1=month2;
				month2=m;
			}

			for(j=month1-1;j<month2-1;j++)
			{
				a=a+mj[j];

			}
			if(a%7==0)
				printf("YES\n");
			else
				printf("NO\n");

		}
		else
		{
			if(month2<month1)
			{
				m=month1;
				month1=month2;
				month2=m;


			}
				for(j=month1-1;j<month2-1;j++)
			{
				a=a+mi[j];

			}
			if(a%7==0)
				printf("YES\n");
			else
				printf("NO\n");


		}

		
	
	}
	return 0;
	
}
void main()
{
	int n,i,d,j,sum1,sum2,year[200],mon1[200],mon2[200],count[200],ping[13]={0,31,28,31,30,31,30,31,31,30,31,30,31},leap[13]={0,31,29,31,30,31,30,31,31,30,31,30,31};
	scanf("%d",&n);
	for(i=0;i<n;i++)
		scanf("%d%d%d",&year[i],&mon1[i],&mon2[i]);
	for(i=0;i<n;i++)
	{
		if(year[i]%4!=0)
			count[i]=0;
		else if(year[i]%100!=0)
			count[i]=1;
		else if(year[i]%400!=0)
			count[i]=0;
		else
			count[i]=1;
	}

	for(i=0;i<n;i++)
	{
	        sum1=0;
			sum2=0;
			d=0;
		if(count[i]==0)
		{
			
			for(j=0;j<mon1[i];j++)
			sum1+=ping[j];
			for(j=0;j<mon2[i];j++)
			sum2+=ping[j];
		    d=sum2-sum1;
		if(d%7==0)
			printf("YES\n");
		else
			printf("NO\n");

		}
		else
		{
			for(j=0;j<mon1[i];j++)
			sum1+=leap[j];
			for(j=0;j<mon2[i];j++)
			sum2+=leap[j];
		d=sum2-sum1;
		if(d%7==0)
			printf("YES\n");
		else
			printf("NO\n");

		}

	}




			

}
int isRunNian(int year);
int main(){
    int n,d,s[200][100],e;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
		d=0;
       for(int k=0;k<3;k++){
       scanf("%d",&(s[i][k]));
        }
       if((s[i][1])>(s[i][2])){
        e=s[i][1];
        s[i][1]=s[i][2];
        s[i][2]=e;
        }
        for(int m=(s[i][1]);m<(s[i][2]);m++){
        if((m==1)||(m==3)||(m==5)||(m==7)||(m==8)||(m==10)){
           d += 31;
		} else if((m==4)||(m==6)||(m==9)||(m==11)){
           d += 30;
        }else if(m==2){
            if(isRunNian(s[i][0])){
             d += 29;
            }else{
              d += 28;
        }
       }
       }
         if((d%7)==0){
             printf("YES\n");
         }else{
        printf("NO\n");
     }
     }
      return 0;
 }
    int isRunNian(int year){
     int result;
    if((year%400==0)||((year%4==0)&&(year%100!=0))){
    result = 1;
    }else{
     result = 0;
   }
     return result;
}
int main()
{
	int n,i=0,j=0,k=0,m,sum=0;
	int an[200],bn[200],cn[200];
	scanf("%d",&n);
	for(i=0;k<n;i++){
		sum=0;
		scanf("%d %d %d",&an[i],&bn[i],&cn[i]);
		k++;
		if(bn[i]>cn[i]){
			m=bn[i];
			bn[i]=cn[i];
			cn[i]=m;
		}
		for(j=bn[i];j<cn[i];j++){
			if(j==2){
				if((an[i]%400==0||(an[i]%4==0&&an[i]%100!=0))){
					sum+=29;
				}
				else  sum+=28;
			}
			else if(j==1||j==3||j==5||j==7||j==8||j==10||j==12){
				sum+=31;
			}
			else if(j==4||j==6||j==9||j==11){
				sum+=30;
			}
		}
		if(sum%7==0) printf("YES\n");
		else if(sum%7!=0) printf("NO\n");
	}
	return 0;
}
//****************************
//???????????
//???2013.12.17
//****************************
int main()
{
	int n=0;
	cin>>n;
	while(n)
	{
		int i=0,k=0,year=0,m1=0,m2=0,sum=0,a[12]={31,28,31,30,31,30,31,31,30,31,30,31};
		cin>>year>>m1>>m2;
		if(year%400==0||(year%100!=0&&year%4==0))
			a[1]=29;
		if(m1>m2)
		{
			k=m1;
			m1=m2;
			m2=k;
		}
		for(i=m1-1;i<m2-1;i++)
		{
			sum=sum+a[i];
		}
		if(sum%7==0)
			cout<<"YES"<<endl;
		else
			cout<<"NO"<<endl;
	  n--;
    }
	return 0;    
}
int main ()
{
	int m , i ;
	const int c[13] = {0 , 31 , 0 , 31 , 30 , 31 , 30 , 31 , 31 , 30 , 31 , 30 , 31} ;
	cin >> m ;
	for (i = 1 ; i <= m ; i ++)
	{
		//const int c[13] = {0 , 31 , 0 , 31 , 30 , 31 , 30 , 31 , 31 , 30 , 31 , 30 , 31} ;
		int year , month1 , month2 , day = 0 , a , b , i ;
		cin >> year >> month1 >> month2 ;
		if (month1 > month2)
		{
			a = month2 ;
			b = month1 ;
		}
		else
		{
			a = month1 ;
			b = month2 ;
		}
		for (i = a ; i < b ; i ++)
		{
			day = day + c[i] ;
		}
		if (a <= 2)
		{
			if (year % 400 == 0 || year % 100 != 0 && year % 4 == 0)
			    day = day + 29 ;
	        else
		     	day = day + 28 ;
		}
		
		if (day % 7 == 0)
			cout << "YES" << endl ;
		else
			cout << "NO" << endl ;
	}
	return 0 ;
}
int isRunNian(int year)
{
	int result;
	if(year%400 == 0 ||(year%4==0 && year%100!=0))
         {
		result = 1;
	} 
          else
         {
		result = 0;
	}
      return result;	
 }
 int DiJiTian(int year, int month, int day)
 {
	int result = 0;
         int i;
	for(i = 1; i < month; i++)
          { 	
		if(i==1||i==3||i==5||i==7||i==8||i==10||i==12)
                  {
			result += 31;	
		}
                  else if (i == 4 || i ==6 || i == 9 || i==11)
                  { 
			result += 30;
		} 
                  else if(i == 2)
                  {
			if(isRunNian(year))
                             {
				result += 29;
			  }
                             else 
                                {
				result += 28;
			     }	
		}
	}
	result += day;	
	return result;	
}
 int main ()
  {
   int n,j;
   scanf("%d",&n);
   for(j=0;j<n;j++)
   {
     int a,b,c,d;
     scanf("%d%d%d",&a,&b,&c);
     d= DiJiTian(a,c,1)- DiJiTian(a,b,1);
     if(d%7==0)
     printf("YES\n");
     else 
     printf("NO\n");
    }
 return 0;
}
int main()
{
	int n,i;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		int y,m1,m2;
		scanf("%d%d%d",&y,&m1,&m2);
		if((y%4==0 && y%100!=0) || y%400==0)
		{
			int j,n1=0,n2=0,M=0;
			for(j=1;j<m1;j++)
			{
				if(j==2)
				{
					n1+=29;
				}
			else if(j==1||j==3||j==5||j==7||j==8||j==10||j==12)
				{
					n1+=31;
				}
				else{
					n1+=30;
				}
			}
            for(j=1;j<m2;j++)
			{
				if(j==2)
				{
					n2+=29;
				}
			else if(j==1||j==3||j==5||j==7||j==8||j==10||j==12)
				{
					n2+=31;
				}
				else{
					n2+=30;
				}
			}
			if(n1<n2)
			{
                M=n2-n1;
				if(M%7==0)
				{
					printf("YES\n");
				}
				else
				{
					printf("NO\n");
				}
			}
            if(n1>n2)
			{
                M=n1-n2;
				if(M%7==0)
				{
					printf("YES\n");
				}
				else
				{
					printf("NO\n");
				}
			}
		}
		else
		{
            int j,n1=0,n2=0,M=0;
			for(j=1;j<m1;j++)
			{
				if(j==2)
				{
					n1+=28;
				}
			else if(j==1||j==3||j==5||j==7||j==8||j==10)
				{
					n1+=31;
				}
				else{
					n1+=30;
				}
			}
            for(j=1;j<m2;j++)
			{
				if(j==2)
				{
					n2+=28;
				}
			else if(j==1||j==3||j==5||j==7||j==8||j==10||j==12)
	
				{
					n2+=31;
				}
				else{
					n2+=30;
				}
			}
			if(n1<n2)
			{
                M=n2-n1;
				if(M%7==0)
				{
					printf("YES\n");
				}
				else
				{
					printf("NO\n");
				}
			}
            if(n1>n2)
			{
                M=n1-n2;
				if(M%7==0)
				{
					printf("YES\n");
				}
				else
				{
					printf("NO\n");
				}
			}
		}
    }
 

	return 0;
}
int rr(int a){
    if((a%4==0&&a%100!=0)||a%400==0)
    return 1;
    else return 0;
}
int main(){
    int n,m,p,q,i,k,t=0;
    cin>>n;
    int aa[n+1],bb[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
    for(i=1;i<=n;i++){
         k=0;             
      cin>>m>>p>>q;
      if(p>q){
         t=q;
         q=p;
         p=t;      
              }
      while(p<q){
         k=k+bb[p];
         if(p==2)
         k=k+rr(m);
         p++;        
                 }
       if(k%7==0)
       aa[i]=1;
       else aa[i]=0;
       }
       for(i=1;i<=n;i++)
       {
        if(aa[i]==1)
        cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
                        }  
       return 0;
       }
int main()
{
	int n,i;
	scanf("%d",&n);
	int y,c,d;
	int m[]={0,31,28,31,30,31,30,31,31,30,31,30,31};
	for(i=0;i<n;i++)
	{
	scanf("%d%d%d",&y,&c,&d);
	m[2]=((y%4==0&&y%100!=0)||y%400==0)?29:28;
	int j,q;
	q=0;
	for(j=0;j<ABS(c-d);j++)
	{
		if(c<d)
		q=q+m[c+j];
		else if(c>d)
			q=q+m[d+j];
	}
	if(q%7==0)
	{
		printf("YES\n");
	}
	else
	{
		printf("NO\n");
	}
	}
	return 0;
}
int run(int q){
	if(q%3200==0){
		return 0;
	}else if(q%400!=0&&q%100==0){
		return 0;
	}else if(q%4==0){
		return 1;
	}else{
		return 0;
	}
}
int main()
{
	int i,j,year,a,b,n,x;
	scanf("%d",&n);
	for(i=1;i<=n;i++){
	scanf("%d %d %d",&year,&a,&b);
	int month[13];
	month[2]=28+run(year);
	month[1]=31;
	month[3]=31;
	month[5]=31;
	month[7]=31;
	month[8]=31;
	month[10]=31;
	month[12]=31;
	month[4]=30;
	month[6]=30;
	month[9]=30;
	month[11]=30;
	if(a>b){
		j=b;
		b=a;
		a=j;
	}
	x=0;
	for(j=a;j<b;j++){
		x+=month[j];
	}
	if(x%7==0){
		printf("YES\n");
	}else{
		printf("NO\n");
	}
	}
	return 0;
}
int getday(int year,int month);

int main(){
	int n,j;
	scanf("%d",&n);
	int *a;
	a=(int *)malloc( sizeof(int) *n );
	for(j=0;j<n;j++){
		a[j]=0;
	}

	for(j=0;j<n;j++){

	int year1,month1,month2;
	int total1, total2, days;
	scanf("%d%d%d", &year1,&month1,&month2);
	total1 =getday(year1, month1);
	total2 =getday(year1, month2);

	days = total2-total1;

	if(days%7==0){
		a[j]=1;
	}
	else a[j]=0;
	}

	for(j=0;j<n;j++){
		if(a[j]==1){
			printf("YES\n");
		}
		else if(a[j]==0){
			printf("NO\n");
		}
	}


	return 0;
}






int getday(int year,int month)
{
	int total, i;
    
	total = 0;
	for( i=1; i<month; i++){
		if ( i ==1 || i==3 || i==5 || i==7 || i==8 || i==10 || i==12){
			total = total +31;
		}
		if ( i ==4 || i==6 || i==9 || i==11){
			total = total +30;
		}
		if ( i ==2){
			if( (year%4==0&&year%100!=0) || year%400==0 ){
				total = total +29;
			}
			else{
				total = total +28;
			}
		}
	}
	total  =  total+1;
	
	return total;
}
//********************************
//*??????**
//*??????1200012914 **
//*???2012.10.22 **
//********************************

int main() 
{
    int n, y, mx, my, leap, dd, d = 0;
    //???????????????????leap???????2????
    int m1, m2; //?????m1????m2 
    cin >> n;//????n 
    for (int i = 1; i <= n; i++)
    {
        cin >> y >> mx >> my;//??????? 
        if ((y % 4 == 0 && y % 100 != 0) || y % 400 == 0)//???? 
        leap = 1;//???2???? 
        else leap = 0;//????? 
        
        if (mx <= my) 
        {
            m1 = mx;
            m2 = my;
        }
        else 
        {
            m1 = my;
            m2 = mx;
        } //?mx?my????? 
        
        while (m1 < m2)
        {
              if (m1 == 2) dd = 28 + leap;
                 else if (m1 == 4 || m1 == 6 || m1 == 9 || m1 == 11) dd = 30;
                      else dd = 31;//??m1???? 
              d = d + dd; //????????????
              m1++; //??????
        }
        if (d % 7 == 0) cout << "YES" << endl;//????????????
        else cout << "NO" << endl;
        d = 0; //???? 
    } 
         
    
    return 0;
}
int mtod(int yy,int mm1,int mm2)
{
	int dd1,dd2,dd;
	if ((yy%400==0)||((yy%4==0)&&(yy%100!=0)))
	{
		switch(mm1)
		{
		case 1:dd1=0;break;
		case 2:dd1=31;break;
		case 3:dd1=31+29;break;
		case 4:dd1=31+29+31;break;
		case 5:dd1=31+29+31+30;break;
		case 6:dd1=31+29+31+30+31;break;
		case 7:dd1=31+29+31+30+31+30;break;
		case 8:dd1=31+29+31+30+31+30+31;break;
		case 9:dd1=31+29+31+30+31+30+31+31;break;
		case 10:dd1=31+29+31+30+31+30+31+31+30;break;
		case 11:dd1=31+29+31+30+31+30+31+31+30+31;break;
		default:dd1=31+29+31+30+31+30+31+31+30+31+30;break;
		}
		switch(mm2)
		{
		case 1:dd2=0;break;
		case 2:dd2=31;break;
		case 3:dd2=31+29;break;
		case 4:dd2=31+29+31;break;
		case 5:dd2=31+29+31+30;break;
		case 6:dd2=31+29+31+30+31;break;
		case 7:dd2=31+29+31+30+31+30;break;
		case 8:dd2=31+29+31+30+31+30+31;break;
		case 9:dd2=31+29+31+30+31+30+31+31;break;
		case 10:dd2=31+29+31+30+31+30+31+31+30;break;
		case 11:dd2=31+29+31+30+31+30+31+31+30+31;break;
		default:dd2=31+29+31+30+31+30+31+31+30+31+30;break;
		}
	}
	else
	{
		switch(mm1)
		{
		case 1:dd1=0;break;
		case 2:dd1=31;break;
		case 3:dd1=31+28;break;
		case 4:dd1=31+28+31;break;
		case 5:dd1=31+28+31+30;break;
		case 6:dd1=31+28+31+30+31;break;
		case 7:dd1=31+28+31+30+31+30;break;
		case 8:dd1=31+28+31+30+31+30+31;break;
		case 9:dd1=31+28+31+30+31+30+31+31;break;
		case 10:dd1=31+28+31+30+31+30+31+31+30;break;
		case 11:dd1=31+28+31+30+31+30+31+31+30+31;break;
		default:dd1=31+28+31+30+31+30+31+31+30+31+30;break;
		}
		switch(mm2)
		{
		case 1:dd2=0;break;
		case 2:dd2=31;break;
		case 3:dd2=31+28;break;
		case 4:dd2=31+28+31;break;
		case 5:dd2=31+28+31+30;break;
		case 6:dd2=31+28+31+30+31;break;
		case 7:dd2=31+28+31+30+31+30;break;
		case 8:dd2=31+28+31+30+31+30+31;break;
		case 9:dd2=31+28+31+30+31+30+31+31;break;
		case 10:dd2=31+28+31+30+31+30+31+31+30;break;
		case 11:dd2=31+28+31+30+31+30+31+31+30+31;break;
		default:dd2=31+28+31+30+31+30+31+31+30+31+30;break;
		}
	}
	dd=dd2-dd1;
	return dd;
}

int main()
{
	int n,i,k;
	int year,month1,month2;
	int ans[201];
	cin>>n;
	for (i=1;i<=n;i++)
	{
		cin>>year
			>>month1
			>>month2;
		k=mtod (year,month1,month2);
		if (k%7==0)
		{
			ans[i]=1;
		}
		else
		{
			ans[i]=0;
		}
		year=month1=month2=0;
	}
    for (i=1;i<=n;i++)
	{
		if (ans[i]==1)
		{
			cout<<"YES"<<endl;
		}
		else
		{
			cout<<"NO"<<endl;
		}
	}
}
int main()
{
	int n, y, m, t, a[13], sum;
	for (int i = 1; i < 8; i = i + 2)
		a[i] = 31;
	a[8] = 31;
	a[10] = 31;
	a[12] = 31;
	a[4] = 30;
	a[6] = 30;
	a[9] = 30;
	a[11] = 30;
	cin >> n;
	for (int i = 0; i < n; i ++)
	{
		cin >> y >> m >> t;
		sum = 0;
		if (m > t)
		{
			int j = m;
			m = t;
			t = j;
		}
		if ( y % 100 == 0)
		{
			if (y / 100 % 4 == 0)
				a[2] = 29;
			else
				a[2] = 28;
		}
		else
		{
			if (y % 4 == 0)
				a[2] = 29;
			else
				a[2] = 28;
		}
		for (int i = m; i < t; i ++)
			sum = sum + a[i];
		if (sum % 7 == 0)
			cout << "YES";
		else
			cout << "NO";
		cout << endl;
	}
	return 0;
}