semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int main()
{
	int n, i, a[200], b[200], c[200], sum=0, d, e;
     scanf("%d", &n);
     for (sum=0,i=0; i<n; i++) {
	     scanf("%d%d%d", &a[i], &b[i], &c[i]);
		 if (b[i]>c[i]) {
			 d=c[i];
			 c[i]=b[i];
			 b[i]=d;
		 }
		 if (a[i]%4==0&&a[i]%100!=0||a[i]%400==0) {
			 for (sum=0,e=b[i]; e<c[i]; e++) {
				 switch(e){
					case 1:
				    case 3:
				    case 5:
			        case 7:
				    case 8:
				    case 10:
			    	case 12:
						sum+=31;
						break;
					case 2:
						sum+=29;
						break;

					case 4:
			     	case 6:
			    	case 9:
				    case 11:
				     	sum+=30;
					    break;
				}
			 }
				 if(sum%7==0) {
					 printf("YES\n");
				 }
					 else {
						 printf("NO\n");
					 }
			 
		 }
			 else  {

                   for (sum=0,e=b[i]; e<c[i]; e++) {
				 switch(e){
					case 1:
				    case 3:
				    case 5:
			        case 7:
				    case 8:
				    case 10:
			    	case 12:
						sum+=31;
						break;
					case 2:
						sum+=28;
						break;

					case 4:
			     	case 6:
			    	case 9:
				    case 11:
				     	sum+=30;
					    break;
				}
				   }
				 if(sum%7==0) {
					 printf("YES\n");
				 }
					 else {
						 printf("NO\n");
					 }
			 
			 }
	 }
	return 0;
}
int main()
{
	int a[] = {31,28,31,30,31,30,31,31,30,31,30,31}, b[] = {31,29,31,30,31,30,31,31,30,31,30,31}, n;
	int YY, M1, M2, i, j, d;
	cin >> n;
	for(i = 1; i <=n; i++)
	{
		d = 0;
		cin >> YY >> M1 >> M2;
		if((YY % 4 == 0 && YY % 100 != 0) || YY % 400 == 0)
		{
			if(M1 > M2)
			{
				for(j = M2; j <= M1 - 1; j++)
					d = d + b[j-1];
			}
			else
			{
				for(j = M1; j <= M2 - 1; j++)
					d = d + b[j-1];
			}
		}
		else
		{
			if(M1 > M2)
			{
				for(j = M2; j <= M1 - 1; j++)
					d = d + a[j-1];
			}
			else
			{
				for(j = M1; j <= M2 - 1; j++)
					d = d + a[j-1];
			}
		}
		if(d % 7 == 0)
			cout << "YES"<< endl;
		else
			cout << "NO" << endl;
	}
	return 0;
}
int main()
{
	int n;
	scanf("%d",&n);
	int i,j,year,month1,month2,result=0;
	
	for(i=0;i<n;i++)
	{
		scanf("%d %d %d",&year,&month1,&month2);
		int t;
		if(month1>month2)
		{
			t=month1;
			month1=month2;
			month2=t;
		}
		for(j=month1;j<month2;j++)
		{
			if(j==1||j==3||j==5||j==7||j==8||j==10||j==12)
			{
				result+=31;
			}
			else if(j==4||j==6||j==9||j==11)
			{
				result+=30;
			}
			else if(j==2)
			{
				if(year%4==0&&year%100!=0||year%100==0&&year%400==0)
				{
					result+=29;
				}
				else
				{
					result+=28;
				}
			}
		}
		if(result%7==0)
		{
			printf("YES\n");
		}
		else
		{
			printf("NO\n");
		}
		result=0;
	}
	return 0;

}
int main()
{
	int n,a,b,c,i,j;
	int e[12]={31,29,31,30,31,30,31,31,30,31,30,31};
	int f[12]={31,28,31,30,31,30,31,31,30,31,30,31};
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		int d=0;
		scanf("\n%d%d%d",&a,&b,&c);
		if((a%100!=0&&a%4==0)||(a%100==0&&a%400==0))
		{
			if(b>c)
			{
				for(j=c;j<b;j++)
				{
					d+=e[j-1];
				}
			}
			else if(c>b)
			{
				for(j=b;j<c;j++)
				{
					d+=e[j-1];
				}
				
			}
			if(d%7==0)
			{printf("\nYES");}
			else
			{printf("\nNO");}
		}
		else
		{
			if(b>c)
			{
				for(j=c;j<b;j++)
				{
					d+=f[j-1];
				}
			}
			else if(c>b)
			{
				for(j=b;j<c;j++)
				{
					d+=f[j-1];
				}
				
			}
			if(d%7==0)
			{printf("\nYES");}
			else
			{printf("\nNO");}
		}
	}
	return 0;    
}
int main()
{
	int month1,month2,year,i,n,j;
    
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
        int monthday[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
	    int days1=0,days2=0;
		scanf("%d%d%d",&year,&month1,&month2);
	    if((year%4==0&&year%100!=0)||year%400==0)
		    monthday[2]=29;
	    for(j=0;j<month1;j++)
		{
		   days1=days1+monthday[j];
		}
	    for(j=0;j<month2;j++)
		{
		   days2=days2+monthday[j];
		}
		if(abs(days2-days1)%7==0)
			printf("YES\n");
		else
			printf("NO\n");
		days1=0;
		days2=0;
	}
	return 0;
}
int main(int argc, char* argv[])
{
	int n;
	scanf("%d",&n);
	int y,m1,m2,i,j;
	
	for(i=0;i<n;i++)
	{
		scanf("%d%d%d",&y,&m1,&m2);
        int days[]={0,31,28,31,30,31,30,31,31,30,31,30,31};
		int c1=0,c2=0;
		if((y%4==0)&&(y%100!=0)||(y%400==0))
		{
			days[2]=days[2]+1;
		}
		for(j=1;j<m1;j++)
		{
			c1=c1+days[j];
		}
		for(j=1;j<m2;j++)
		{
			c2=c2+days[j];
		}
		if(c1>c2)
		{
			if((c1-c2)%7==0)
			{
				printf("YES\n");
			}
			else
			{
				printf("NO\n");
			}
		}
		else
		{
			if((c2-c1)%7==0)
			{
				printf("YES\n");
			}
			else
			{
				printf("NO\n");
			}
			
		}
		

	}


	return 0;
}
int main(int argc, char* argv[])
{
	int i,n,y[200],m1[200],m2[200];
	int a[]={0,31,59,90,120,151,181,212,243,273,304,334,365};
	int b[]={0,31,60,91,121,152,182,213,244,274,305,335,365};
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d%d%d",&y[i],&m1[i],&m2[i]);
		if(y[i]%4==0&&y[i]%100!=0||y[i]%400==0)
		{
			if((b[m1[i]-1]-b[m2[i]-1])%7==0)
				printf("YES\n");
			else
				printf("NO\n");
		}
		else
		{
			if((a[m1[i]-1]-a[m2[i]-1])%7==0)
				printf("YES\n");
			else
				printf("NO\n");
		}
	}
	return 0;
}
int main()
{
	int n,i,m;
	scanf("%d",&n);
	
	for(m=0;m<n;m++)
	{
      int year, month1,month2, total1,total2;
	   scanf("%d%d%d", &year, &month1,&month2);
	    total1 = 0,total2=0;
	  
        for( i=1; i<month1; i++)
		{
			if ( i ==1 || i==3 || i==5 || i==7 || i==8 || i==10 || i==12)
			{
					total1 = total1 +31;
			}
			if ( i ==4 || i==6 || i==9 || i==11)
			{
					total1 = total1 +30;
			}
			 if ( i ==2)
			{
				if( (year%4==0&&year%100!=0) || year%400==0 )
					  total1 = total1 +29;
				else total1 = total1+28;
			}
		}
        for( i=1; i<month2; i++)
		{
			if ( i ==1 || i==3 || i==5 || i==7 || i==8 || i==10 || i==12)
			{
					total2 = total2 +31;
			}
			if ( i ==4 || i==6 || i==9 || i==11)
			{
					total2 = total2 +30;
			}
			 if ( i ==2)
			{
				if( (year%4==0&&year%100!=0) || year%400==0 )
					  total2 = total2 +29;
				else total2 = total2+28;
			}
		}
	
	

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

	
	return 0;
}
int main()
{
	int n,a[200][3],b[12] = {31,28,31,30,31,30,31,31,30,31,30,31}, c[12] = {31,29,31,30,31,30,31,31,30,31,30,31}; 
	int i,j,y,p,q;
	int e,sum=0;
	cin>>n;
	for ( j = 0 ; j < n ; j ++ )
		for ( i = 0 ; i < 3 ; i ++ )
			cin>>a[j][i];
	for ( j = 0 ; j < n ; j ++ )
		{
			sum = 0;
			  if ( a[j][0] % 4 != 0 || ( a[j][0] % 100 == 0 && a[j][0] % 400 != 0 ))
			{
				p = a[j][1];
				q = a[j][2];
				if ( p < q )
					{
						for ( e = p - 1;e < q-1;e++ )
							sum += b[e];
				    }
				else 
					{
						for ( e = q - 1;e < p-1;e++ )
							sum += b[e];
				    }
				if ( sum % 7 == 0)
					cout<<"YES"<<endl;
				else
					cout<<"NO"<<endl;
			}
			 else
			 {
				p = a[j][1];
				q = a[j][2];
				if ( p < q )
					{
						for ( e = p - 1;e < q-1;e++ )
							sum += c[e];
				    }
				else 
					{
						for ( e = q - 1;e < p-1;e++ )
							sum += c[e];
				    }
				if ( sum % 7 == 0)
					cout<<"YES"<<endl;
				else
					cout<<"NO"<<endl;
			}
		}
}
int main()
{
	int n, i, j, year, month1, month2;
	cin>>n;
	int commonyear[]={0,0,3,3,6,1,4,6,2,5,0,3,5}, 
		leapyear[]={0,0,3,4,0,2,5,0,3,6,1,4,6};
	for (i=0;i<n;i++)
	{
		cin>>year>>month1>>month2;
		if ((year%4==0&&year%100!=0)||(year%400==0)) 
		{
			if (leapyear[month1]==leapyear[month2]) cout<<"YES"<<endl;
			else cout<<"NO"<<endl;		
		}
		else 
		{
			if (commonyear[month1]==commonyear[month2]) cout<<"YES"<<endl;
			else cout<<"NO"<<endl;		
		}
	}
	return 0;
}
/*
 * ???????
 *  ????: 2010-12-24
 *    ??????
 */

int run(int y) {
	int i;
	if (y % 4 == 0)
		if (y % 100 == 0)
			if (y % 400 == 0)
				i = 1;
			else
				i = 0;
		else
			i = 1;
	else
		i = 0;
	return i;
}
int main() {
	int num;
	cin >> num;
	for (int i = 0; i < num; i++) {
		int year, m1, m2,n=0;
		cin >> year >> m1 >> m2;
		if (run(year) == 1) {
			int  yue[12] = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30,
					31 };
			if (m1 < m2) {
				for (int j = m1 - 1; j < m2 - 1; j++)
					n = n + yue[j];
				if (n % 7 == 0)
					cout << "YES" << endl;
				else
					cout << "NO" << endl;
			} else {
				for (int j = m2 - 1; j < m1 - 1; j++)
					n = n + yue[j];
				if (n % 7 == 0)
					cout << "YES" << endl;
				else
					cout << "NO" << endl;
			}
		} else {
			int n = 0, yue[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30,
					31 };
			if (m1 < m2) {
				for (int j = m1 - 1; j < m2 - 1; j++)
					n = n + yue[j];
				if (n % 7 == 0)
					cout << "YES" << endl;
				else
					cout << "NO" << endl;

			} else {
				for (int j = m2 - 1; j < m1 - 1; j++)
					n = n + yue[j];
				if (n % 7 == 0)
					cout << "YES" << endl;
				else
					cout << "NO" << endl;
			}
		}
	}
	return 0;
}
int main()
{
    int day(int m,int leap);
    int i,n,year[200][3],leap=0,day1,day2,d;
    scanf("%d",&n);
    for(i=0;i<n;i++)
        scanf("%d %d %d",&year[i][0],&year[i][1],&year[i][2]);
    for(i=0;i<n;i++)
    {
        if( (year[i][0]%4==0&&year[i][0]%100!=0) ||year[i][0]%400==0 )
            leap=1;
        else
            leap=0;
        day1=day(year[i][1],leap);
        day2=day(year[i][2],leap);
        d=day1-day2;
        d=(int)fabs( (double)d );
        if(d%7==0)
            printf("YES\n");
        else
            printf("NO\n");
    }
    return(0);
}

int day(int m,int leap)
{
    int sum;
    switch(m)
    {
        case 1:sum=1;break;
        case 2:sum=32;break;
        case 3:sum=60;break;
        case 4:sum=91;break;
        case 5:sum=121;break;
        case 6:sum=152;break;
        case 7:sum=182;break;
        case 8:sum=213;break;
        case 9:sum=244;break;
        case 10:sum=274;break;
        case 11:sum=305;break;
        case 12:sum=335;break;
        default:break;
    }
    if(m>=3)
        sum=sum+leap;
    return(sum);
}
int main()
{
	int a[200],b[200],c[200],i,j,m,k;
	cin>>m;
	for(i=0;i<m;i++)
		cin>>a[i]>>b[i]>>c[i];
	int d[12]={3,0,3,2,3,2,3,3,2,3,2,3};
	int e[200],f[200];
	for(i=0;i<m;i++)
		if (b[i]>=c[i]){e[i]=b[i];f[i]=c[i];}
		else{e[i]=c[i];f[i]=b[i];}
	for(i=0;i<m;i++)
	{
		k=0;
		if((a[i]%4==0&&a[i]%100!=0)||a[i]%400==0) d[1]=1;
	    else d[1]=0;
		for(j=f[i];j<e[i];j++)
			k=k+d[j-1];
		if(k%7==0)cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
	return 0;
}
int main()
{
	int n;
	cin>>n;
	int y[200],m1[200],m2[200];//???????1???2
	for(int i=0;i<n;i++)
		cin>>y[i]>>m1[i]>>m2[i];//??3??
	for(int j=0;j<n;j++)
	{
		if(y[j]%4==0&&y[j]%100!=0||y[j]%400==0)//????
		{
			int a[12]={31,60,91,121,152,182,213,244,274,305,335,366};//????????????????
			if(m1[j]==1)//???????
			{
				if(a[m2[j]-2]%7==0)//???????????????
					cout<<"YES"<<endl;
				else
					cout<<"NO"<<endl;
			}
			else if(m2[j]==1)//???????
			{
				if(a[m1[j]-2]%7==0)//???????????????
					cout<<"YES"<<endl;
				else
					cout<<"NO"<<endl;
			}
			else
			{
				if(abs(a[m1[j]-2]-a[m2[j]-2])%7==0)//???-2?????????
					cout<<"YES"<<endl;
				else
					cout<<"NO"<<endl;
			}
		}
		else
		{
			int b[12]={31,59,90,120,151,181,212,243,273,304,334,365};//????????????????
			if(m1[j]==1)//???????
			{
				if(b[m2[j]-2]%7==0)//???????????????
					cout<<"YES"<<endl;
				else
					cout<<"NO"<<endl;
			}
			else if(m2[j]==1)//???????
			{
				if(b[m1[j]-2]%7==0)//???????????????
					cout<<"YES"<<endl;
				else
					cout<<"NO"<<endl;
			}
			else
			{
				if(abs(b[m1[j]-2]-b[m2[j]-2])%7==0)//???-2?????????
					cout<<"YES"<<endl;
				else
					cout<<"NO"<<endl;
			}
		}
	}
	return 0;
}
int main()
{
	int days[]={0,31,28,31,30,31,30,31,31,30,31,30,31};
	int y[200],m[200],d[200],i,c[200],e[200],n,j;
	scanf("%d",&n);
	for(j=0;j<n;j++)
	{
		scanf("%d%d%d",&y[j],&m[j],&d[j]);
	
	if(((y[j]%4==0)&&(y[j]%100!=0))||(y[j]%400==0))
	{
		days[2]++;
	}
	c[j]=0;
	e[j]=0;
	for(i=0;i<m[j];i++)
	{
		c[j]+=days[i];
	}
	for(i=0;i<d[j];i++)
	{
		e[j]+=days[i];
	}
	if((c[j]-e[j])%7==0)
	{
		printf("YES\n");
	}
	else
	{
		printf("NO\n");
	}
	days[2]=28;
	}
	return 0;
}
int main(){
    int n,y[200],m1[200],m2[200],i,j,k,day1[200],day2[200],cha[200];
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d%d%d",&y[i],&m1[i],&m2[i]);
    }
    for(i=0;i<n;i++){
        day1[i]=1;
        day2[i]=1;
        if((y[i]%4==0&&y[i]%100!=0)||(y[i]%400==0)){
            for(j=1;j<m1[i];j++){
                if(j==1||j==3||j==5||j==7||j==8||j==10){
                    day1[i]=day1[i]+31;
                }
                else if(j==4||j==6||j==9||j==11){
                    day1[i]=day1[i]+30;
                }
                else if(j==2){
                    day1[i]=day1[i]+29;
                }
            }
            for(j=1;j<m2[i];j++){
                if(j==1||j==3||j==5||j==7||j==8||j==10){
                    day2[i]=day2[i]+31;
                }
                else if(j==4||j==6||j==9||j==11){
                    day2[i]=day2[i]+30;
                }
                else if(j==2){
                    day2[i]=day2[i]+29;
                }
            }
        }
        else{
            for(j=1;j<m1[i];j++){
                if(j==1||j==3||j==5||j==7||j==8||j==10){
                    day1[i]=day1[i]+31;
                }
                else if(j==4||j==6||j==9||j==11){
                    day1[i]=day1[i]+30;
                }
                else if(j==2){
                    day1[i]=day1[i]+28;
                }
            }
            for(j=1;j<m2[i];j++){
                if(j==1||j==3||j==5||j==7||j==8||j==10){
                    day2[i]=day2[i]+31;
                }
                else if(j==4||j==6||j==9||j==11){
                    day2[i]=day2[i]+30;
                }
                else if(j==2){
                    day2[i]=day2[i]+28;
                }
            }
        }
    }
    for(i=0;i<n;i++){
        cha[i]=abs(day1[i]-day2[i]);
        if(cha[i]%7==0){
            printf("YES\n");
        }
        else
            printf("NO\n");
    }
    return 0;
}
int fc(int year,int mon1,int mon2);
int main()
{
	int n;
	scanf("%d",&n);
	int i;
	for(i=0;i<n;i++)
	{
		int year,mon1,mon2;
	    scanf("%d%d%d",&year,&mon1,&mon2);
    	if(mon1>mon2)
		{
		    int tmp;
		    tmp=mon1;
		    mon1=mon2;
	    	mon2=tmp;
		}
	    if(fc(year,mon1,mon2)%7==0)
			printf("YES\n");
		else
			printf("NO\n");
	}
	return 0;
}

int fc(int year,int mon1,int mon2)
{
	int delta=0;
	int i;
	int month[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
	for(i=mon1;i<mon2;i++)
	{
		delta+=month[i];
	}
	if(mon1==2||(mon1==1&&mon2>2))
	{
		if(year%4==0&&year>=4&&year%100!=0)
		    delta+=1;
	    else if(year%100==0&&year>=100&&year%400==0)
		    delta+=1;
	}
	return delta;
}
int main(int argc, char* argv[])
{
	int n,i;
	int y,m1,m2;
	int d1,d2;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		d1=0;
		d2=0;
		scanf("%d%d%d",&y,&m1,&m2);
		if(y%100==0&&y%40==0||y%100!=0&&y%4==0)//leap
		{
			switch (m1)
			{
			case 1:d1+=0;break;
			case 2:d1+=31;break;
			case 3:d1+=60;break;
			case 4:d1+=91;break;
			case 5:d1+=121;break;
			case 6:d1+=152;break;
			case 7:d1+=182;break;
			case 8:d1+=213;break;
			case 9:d1+=244;break;
			case 10:d1+=274;break;
			case 11:d1+=305;break;
			case 12:d1+=335;break;
			}
            switch (m2)
			{
			case 1:d2+=0;break;
			case 2:d2+=31;break;
			case 3:d2+=60;break;
			case 4:d2+=91;break;
			case 5:d2+=121;break;
			case 6:d2+=152;break;
			case 7:d2+=182;break;
			case 8:d2+=213;break;
			case 9:d2+=244;break;
			case 10:d2+=274;break;
			case 11:d2+=305;break;
			case 12:d2+=335;break;
			}
			if((d1-d2)%7==0){printf("YES\n");}
			else printf("NO\n");
		}
		else
		{
			switch (m1)
			{
			case 1:d1+=0;break;
			case 2:d1+=31;break;
			case 3:d1+=59;break;
			case 4:d1+=90;break;
			case 5:d1+=120;break;
			case 6:d1+=151;break;
			case 7:d1+=181;break;
			case 8:d1+=212;break;
			case 9:d1+=243;break;
			case 10:d1+=273;break;
			case 11:d1+=304;break;
			case 12:d1+=334;break;
			}
            switch (m2)
			{
			case 1:d2+=0;break;
			case 2:d2+=31;break;
			case 3:d2+=59;break;
			case 4:d2+=90;break;
			case 5:d2+=120;break;
			case 6:d2+=151;break;
			case 7:d2+=181;break;
			case 8:d2+=212;break;
			case 9:d2+=243;break;
			case 10:d2+=273;break;
			case 11:d2+=304;break;
			case 12:d2+=334;break;
			}

			if((d1-d2)%7==0){printf("YES\n");}
			else printf("NO\n");

		}
	}

	return 0;
}
int main()
{
    int i,n,year,month1,month2,sum=0,day,p;
    cin >> n;
    for(i=1;i<=n;i++)
    {
         sum=0;
         cin >> year >> month1 >> month2; 
         if(month1>month2)
         {
            p=month1;
            month1=month2;
            month2=p;    
         }                     
        if(year%400==0||(year%4==0&&year%100!=0))
        {
         for(1;month1<month2;month1++)
        {                                         
              if(month1==1||month1==3||month1==5||month1==7||month1==8||month1==10||month1==12)
              {
                day=31;
              }
              if(month1==4||month1==6||month1==9||month1==11)
              {
                day=30;
              }
              if(month1==2)
              {
                day=29;
              }
                 sum=sum+day;
        }
              if(sum%7==0)
              cout << "YES" << endl;
              else
              cout << "NO" << endl;
        }
        if(year%4!=0||(year%100==0&&year%400!=0))
        {
            for(1;month1<month2;month1++)
            {                                  
              if(month1==1||month1==3||month1==5||month1==7||month1==8||month1==10||month1==12)
              {
                day=31;
              }
              if(month1==4||month1==6||month1==9||month1==11)
              {
                day=30;
              }
              if(month1==2)
              {
                day=28;
              }
              
                   sum=sum+day;
            }
              if(sum%7==0)
              cout << "YES" << endl;
              else
              cout << "NO" << endl;
        }
    }      
return 0;
}
int main()
{
	int n,j,k[200][2],l;
	scanf("%d",&n);
	 int days[13] = { 0, 31, 28, 31, 30, 31, 30,31, 31, 30, 31, 30, 31 }, weekdays[7] = { 1, 2, 3, 4, 5,6,7};
    int y[200],m[200][2],w[200][2], i;
	for(l=0;l<n;l++)
	{
		scanf("%d",&y[l]);
	for(j=0;j<2;j++)
	{

    scanf("%d", &m[l][j]);
	w[l][j] = y[l]% 7 + y[l] / 4 - y[l] / 100 + y[l] / 400;
   for (i = 1; i < m[l][j]; i++)
        w[l][j] += days[i];
       w[l][j] += 1 - 1;
    if (((y[l] % 4 == 0 && y[l] % 100 != 0) || y[l] % 400 == 0) && (m[l][j] <= 2))
        w[l][j]--;
     k[l][j]=weekdays[w[l][j] % 7];
	}
	}
    for(l=0;l<n;l++)
	{
	 if(k[l][0]==k[l][1])
		 printf("YES\n");
	 else
		 printf("NO\n");
	}
    return 0;
}
/*??????????????????????????
????????????????????????????????????
?????????????????????????7????????
?????????????????????????????????28?
???7???????4??????????????????????
????????????????29??????????????????????*/
//Goofy 2010 11 10
int main()
{
	int n, i, k, Year, SumD=0, temp, Month1, Month2, Month[12]={31,28,31,30,31,30,31,31,30,31,30,31};//??????????
	cin>>n;
	for (i=0; i<n; i++)
	{
		cin>>Year>>Month1>>Month2;
		if ( Year%4==0 && Year%100!=0 || Year%400==0)//?????
			Month[1]=Run2;
		else//????
			Month[1]=Chang2;
		if ( Month2 < Month1 )
			temp=Month1, Month1=Month2, Month2=temp;//??????
		for ( k=Month1-1; k<Month2-1; k++)
			SumD += Month[k];//??
		if ( SumD % week == 0)
			cout<<"YES"<<endl;
		else
			cout<<"NO"<<endl;
		SumD=0;//?0
	}	
	return 0;
}
int main()
{
	int d[2][12]={31,28,31,30,31,30,31,31,30,31,30,31,31,29,31,30,31,30,31,31,30,31,30,31};
	int n;
	cin>>n;
	while(n--){
		int year,month1,month2;
		cin>>year>>month1>>month2;
		if(month1>month2){
			int temp;
			temp=month1;
			month1=month2;
			month2=temp;
		}
		int i,sum=0;
		if(year%4==0&&year%100!=0||year%400==0){
			for(i=month1;i<month2;i++){
				sum+=d[1][i-1];
			}
			if(sum%7==0) cout<<"YES"<<endl;
			else cout<<"NO"<<endl;
		}
		else{
			for(i=month1;i<month2;i++){
				sum+=d[0][i-1];
			}
			if(sum%7==0) cout<<"YES"<<endl;
			else cout<<"NO"<<endl;
		}
	}
	return 0;
}
int main()
{
	int n,year,moon1,moon2,p,q,i,sum;
	int day[12]={31,28,31,30,31,30,31,31,30,31,30,31};
	cin>>n;
	for(n;n>0;n--)
	{
		cin>>year>>moon1>>moon2;
		p=(moon1>moon2)?moon1:moon2;
		q=(moon1<moon2)?moon1:moon2;
		sum=0;
		day[1]=(year%4==0&&year%100!=0||year%400==0)?29:28;
		for(i=q;i<=p-1;i++)
			sum+=day[i-1];
		if(sum%7==0)
			cout<<"YES"<<endl;
		else
			cout<<"NO"<<endl;
	}
	return 0;
}
int main()
{
	
	int n=0;
	int a[]={0,31,28,31,30,31,30,31,31,30,31,30,31};
	int b[]={0,31,29,31,30,31,30,31,31,30,31,30,31};
	int year=0,month1=0,month2=0,max=0,min=0,k=0,sum=0;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		sum=0,year=0,month1=0,month2=0;
		cin>>year>>month1>>month2;
		if(month1>month2)                   //??month1?month2??
			{
				max=month1;
				min=month2;
		}
		else
			{
				max=month2;
		    min=month1;
		}
		k = 0;
if(year%4==0&&year%100!=0||year%400==0)   //???????
		{
			while(min+k<max)            //??month1?month2?????
			{
				sum=sum+b[min+k];      
				k++;
		    }
			if(sum%7==0)                 //???????
				cout<<"YES"<<endl;
			else
				cout<<"NO"<<endl;
	}
	
else                                    //??
		{
			while(min+k<max)
			{
				sum=sum+a[min+k];
				k++;
		    }
			if(sum%7==0)
				cout<<"YES"<<endl;
			else
				cout<<"NO"<<endl;
	     }
	}
}
int checkrun(int a) {
	if (a % 4 != 0) {
		return 0;
	} else {
		if (a % 100 == 0) {
			if (a % 400 == 0)
				return 1;
			else
				return 0;
		} else {
			return 1;
		}
	}
}
int main() {
	int n, month1, month2, i, year, temp, day, j;
	int a1[13] = { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
	int a2[13] = { 0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
	cin >> n;
	for (j = 0; j < n; j++) {
		cin >> year >> month1 >> month2;
		if (month1 < month2)
			;
		else {
			temp = month1;
			month1 = month2;
			month2 = temp;
		}
		if (checkrun(year) != 1) {
			day = 0;
			for (i = month1; i < month2; i++) {
				day = day + a1[i];
			}
			if (day % 7 == 0) {
				cout << "YES" << endl;
			} else {
				cout << "NO" << endl;
			}
		} else {
			day = 0;
			for (i = month1; i < month2; i++) {
				day = day + a2[i];
			}
			if (day % 7 == 0) {
				cout << "YES" << endl;
			} else {
				cout << "NO" << endl;
			}
		}
	}
	return 0;
}
int main()
{
	int a[13]={0,31,29,31,30,31,30,31,31,30,31,30,31};
    int b[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
    int n,i,j,k,year,x,y;
    cin>>n;
	for (k=1;k<=n;k++)
    {
    	cin>>year>>x>>y;
    	j=0;
		if (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0) ) 
    	{
	    	if (x>y) 
			{
				for (i=y;i<=(x-1);i++)
				j=j+a[i];
			} 
			else
			{
				for (i=x;i<=(y-1);i++)
				j=j+a[i];
			}
			if ((j%7)==0) cout<<"YES"<<endl;
                            else cout<<"NO"<<endl;
	    }
	    else 
	    {
  			if (x>y) 
			{
				for (i=y;i<=(x-1);i++)
				j=j+b[i];
			} 
			else
			{
				for (i=x;i<=(y-1);i++)
				j=j+b[i];
			}
			if ((j%7)==0) cout<<"YES"<<endl;
                            else cout<<"NO"<<endl;
    	}
    }
    return 0;
}
int main()
{
    int runnian(int year);
    int a[]={31,28,31,30,31,30,31,31,30,31,30,31};
    int b[]={31,29,31,30,31,30,31,31,30,31,30,31};
    int n,i,j,year,x,y,boolean,sum,temp;
    scanf("%d",&n);
    for (i=0;i<n;i++)
    {scanf("%d %d %d",&year,&x,&y);
     boolean=runnian(year);
     if (x>y) {temp=x;x=y;y=temp;}
     sum=0;
     if (boolean!=0)
       for (j=x;j<y;j++) sum=sum+a[j-1];
     if (boolean==0)
       for (j=x;j<y;j++) sum=sum+b[j-1]; 
          
     if (sum%7==0) printf("YES\n");
     else printf("NO\n");               
                            
    }
    return 0;
       
}
int runnian(int year)
{int b;
 if (year%400==0) return(0);
 if (year%4==0 && year%100!=0) return(0);
 return(1);
    
    
}