semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int main()
{
	int n, year, month1, month2, leap, days, month;
	cin >> n;
	for(int i = 1; i <= n; i++)
	{
		days =0;
		cin >> year >> month1 >> month2;
		if((year % 4 == 0 && year % 100 != 0) || year % 400 ==0)
			leap = 1;
		else
			leap = 0;
		if(month1 > month2)
		{
			for(month = month2; month < month1; month++)
			{
				switch(month)
				{
					case 1	:
					case 3	:
					case 5	:
					case 7	:
					case 8	:
					case 10	:
					case 12 : days += 31; break;
					case 4	:
					case 6	:
					case 9	:
					case 11 : days += 30; break;
					case 2 : days += 28 + leap; break;
				}
			}
		}
		if(month1 < month2)
		{	
			for(month = month1; month < month2; month++)
			{
				switch(month)
				{
					case 1	:
					case 3	:
					case 5	:
					case 7	:
					case 8	:
					case 10	:
					case 12 : days += 31; break;
					case 4	:
					case 6	:
					case 9	:
					case 11 : days += 30; break;
					case 2 : days += 28 + leap; break;
				}
			}
		}
		if(days % 7 == 0)
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}
	return 0;
}
int DiJiTian(int year, int month, int day);
int main(){
int year,montho,montht;
int n,i,k;
scanf("%d",&n);
for(i=0;i<n;i++){
	scanf("%d %d %d",&year,&montho,&montht);
	k=DiJiTian(year,montht,1)-DiJiTian(year,montho,1);
	if(k%7==0){
		printf("YES\n");
	}
	else{
		printf("NO\n");
	}
}




	return 0;
}
int DiJiTian(int year, int month, int day){
	int result = 0;
	for(int 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(year%400==0||((year%4==0)&&(year%100!=0))){
				result += 29;
			} else {
				result += 28;
			}	
		}
	}
	result += day;	
	return result;	
}
int main()
{
	int n,i,j,k,a[100],b[13];
	b[0]=0;b[1]=31;b[2]=59;b[3]=90;b[4]=120;b[5]=151;b[6]=181;b[7]=212;b[8]=243;b[9]=273;b[10]=304;b[11]=334;b[12]=365;
	scanf("%d",&n);
	for(i=1;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))
		{
			if(a[1]>2&&a[2]>2&&(b[a[1]-1]-b[a[2]-1])%7==0)
				printf("YES\n");
			else if(a[1]<3&&a[2]<3&&(b[a[1]-1]-b[a[2]-1])%7==0)
				printf("YES\n");
			else if(a[1]<3&&a[2]>2&&(b[a[2]-1]-b[a[1]-1]+1)%7==0)
				printf("YES\n");
			else if(a[2]<3&&a[1]>2&&(b[a[1]-1]-b[a[2]-1]+1)%7==0)
				printf("YES\n");
			else
				printf("NO\n");
		}
		else
		{
			 if((b[a[1]-1]-b[a[2]-1])%7==0)
				printf("YES\n");
			else
				printf("NO\n");
		}

	}
	return 0;
}
/*
*???   5(1)
*??     ???
*??     2012?10?22?
*???   ???
*/ 
int main()
{
    int year[201], n, month1[201], month2[201], a[201], i, j;
    cin >> n;
    for(i = 1; i <= n; i++)
    {
        cin >> year[i] >> month1[i] >> month2[i];
        if((year[i] % 4 == 0 && year[i] % 100 != 0) || (year[i] % 400 == 0))
        {
            int day[12] = {0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335};// ???????????????
            a[i] = (day[month2[i] - 1] - day[month1[i] - 1]) % 7 == 0;
        }
        else
        {
            int day[12] = {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334};
            a[i] = (day[month2[i] - 1] - day[month1[i] - 1]) % 7 == 0;
        }
    }
    for(i = 1; i <= n; i++)
    {
        if(a[i])
        cout << "YES" << endl;
        else
        cout << "NO" << endl;
    }
    return 0;
}
int main(){
    int n,i,x,z,t;
    cin>>n;
    int y[n],m1[n],m2[n];
    for(i=0;i<n;i++){
        scanf("%d%d%d",&y[i],&m1[i],&m2[i]);
        }  
    for(i=0;i<n;i++){
        x=y[i]%4;
        z=y[i]%400;
        t=y[i]%100;
        
        if(x!=0||(t==0&&z!=0)){if((m1[i]==2&&m2[i]==3)||(m1[i]==3&&m2[i]==2)||(m1[i]==4&&m2[i]==7)||(m1[i]==7&&m2[i]==4)||(m1[i]==9&&m2[i]==12)||(m1[i]==12&&m2[i]==9)||(m1[i]==1&&m2[i]==10)||(m1[i]==10&&m2[i]==1)||(m1[i]==3&&m2[i]==11)||(m1[i]==11&&m2[i]==3)||(m1[i]==2&&m2[i]==11)||(m1[i]==11&&m2[i]==2))   
     { printf("YES\n");}
    else {printf("NO\n");}}
    
        else{
    if((m1[i]==1&&m2[i]==4)||(m1[i]==4&&m2[i]==1)||(m1[i]==4&&m2[i]==7)||(m1[i]==7&&m2[i]==4)||(m1[i]==9&&m2[i]==12)||(m1[i]==12&&m2[i]==9)||(m1[i]==1&&m2[i]==7)||(m1[i]==7&&m2[i]==1)||(m1[i]==2&&m2[i]==8)||(m1[i]==8&&m2[i]==2)||(m1[i]==3&&m2[i]==11)||(m1[i]==11&&m2[i]==3))
    {printf("YES\n");}
    else {printf("NO\n");}}
    
    
    }
    return 0;
    }
int main()
{
	void xiangguan(int y,int m1,int m2);
	int n,i,year,m1,m2;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		scanf("%d %d %d",&year,&m1,&m2);
		xiangguan(year,m1,m2);
	}
}

void xiangguan(int y,int m1,int m2)
{
	int runnian(int y);
	int x1=0,x2=0,i,j;
	for(i=1;i<m1;i++)
	{
		x1=x1+31;
		if(i==4||i==6||i==9||i==11)
			x1--;
		if(i==2)
		{
			if(runnian(y))
			x1=x1-2;
			else
				x1=x1-3;
		}
	}
    for(j=1;j<m2;j++)
	{
		x2=x2+31;
		if(j==4||j==6||j==9||j==11)
			x2--;
		if(j==2)
		{
			if(runnian(y))
			x2=x2-2;
			else
				x2=x2-3;
		}
	}
	if((x1-x2)%7==0)
		printf("YES\n");
	else
		printf("NO\n");
}

int runnian(int y)
{
	if( ( (y%4==0)&&(y%100!=0) )||(y%400==0) )
		return(1);
	else
		return(0);
}
int is_leap_year(int n);

int main()
{
    int n;
    int y, m1, m2;
    int days[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
    int i, j, sum = 0;

    scanf("%d", &n);
    for (i=0; i<n; i++) {
        scanf("%d %d %d", &y, &m1, &m2);
        sum = 0;
        if (is_leap_year(y)) /* if leap year */
            days[1] = 29;
        else
            days[1] = 28;
        if (m1 > m2) { /* make sure m2 > m1 */
            j = m1;
            m1 = m2;
            m2 = j;
        }
        for (j=m1-1; j<(m2-1); j++) 
            sum += days[j];
        if (sum % 7 == 0)
            printf("%s\n", "YES");
        else
            printf("%s\n", "NO");
    }

    return 0;
}
    

int is_leap_year(int n)
{
    if ((n % 400 == 0) || ((n % 4 == 0) && (n % 100 != 0)))
        return 1;
    else
        return 0;
}
int main(int argc, char* argv[])
{
	int n,i,year,month1,month2,a,b;
	scanf("%d",&n);
	
	for(i=0;i<n;i++)
	{
		scanf("%d%d%d",&year,&month1,&month2);
		if(year%4==0 && year%100!=0 || year%400==0)
		{
			if(month1==1)
			{
				a=1;
			}
			else if(month1==2)
			{
				a=32;
			}
			else if(month1==3)
			{
				a=61;
			}
			else if(month1==4)
			{
				a=92;
			}
            else if(month1==5)
			{
				a=122;
			}
            else if(month1==6)
			{
				a=153;
			}
			else if(month1==7)
			{
				a=183;
			}
			else if(month1==8)
			{
				a=214;
			}
			else if(month1==9)
			{
				a=245;
			}
			else if(month1==10)
			{
				a=275;
			}
			else if(month1==11)
			{
				a=306;
			}
			else if(month1==12)
			{
				a=336;
			}
			if (month2==1)
			{
				b=1;
			}
			else if(month2==2)
			{
				b=32;
			}
			else if(month2==3)
			{
				b=61;
			}
			else if(month2==4)
			{
				b=92;
			}
            else if(month2==5)
			{
				b=122;
			}
            else if(month2==6)
			{
				b=153;
			}
			else if(month2==7)
			{
				b=183;
			}
			else if(month2==8)
			{
				b=214;
			}
			else if(month2==9)
			{
				b=245;
			}
			else if(month2==10)
			{
				b=275;
			}
			else if(month2==11)
			{
				b=306;
			}
			else if(month2==12)
			{
				b=336;
			}
		
			if((a-b)%7==0)
			{
				printf("YES\n");
			}
			else
			{
				printf("NO\n");
			}
		}
		else
		{
			if(month1==1)
			{
				a=1;
			}
			else if(month1==2)
			{
				a=32;
			}
			else if(month1==3)
			{
				a=60;
			}
			else if(month1==4)
			{
				a=91;
			}
            else if(month1==5)
			{
				a=121;
			}
            else if(month1==6)
			{
				a=152;
			}
			else if(month1==7)
			{
				a=182;
			}
			else if(month1==8)
			{
				a=213;
			}
			else if(month1==9)
			{
				a=244;
			}
			else if(month1==10)
			{
				a=274;
			}
			else if(month1==11)
			{
				a=305;
			}
			else if(month1==12)
			{
				a=335;
			}
			if(month2==1)
			{
				b=1;
			}
			else if(month2==2)
			{
				b=32;
			}
			else if(month2==3)
			{
				b=60;
			}
			else if(month2==4)
			{ 
				b=91;
			}
            else if(month2==5)
			{
				b=121;
			}
            else if(month2==6)
			{
				b=152;
			}
			else if(month2==7)
			{
				b=182;
			}
			else if(month2==8)
			{
				b=213;
			}
			else if(month2==9)
			{
				b=244;
			}
			else if(month2==10)
			{
				b=274;
			}
			else if(month2==11)
			{
				b=305;
			}
			else if(month2==12)
			{
				b=335;
			}
			if((a-b)%7==0)
			{
				printf("YES\n");
			}
			else
			{
				printf("NO\n");
			}
		}
	}	
	 return 0;
}
int leapyear(int y);                             //???????
int monthday(int y,int m);                       //???????

void main()
{

	int n,year,month1,month2,i,j,temp,sum=0;

	scanf("%d",&n);

	for(i=1;i<=n;i++){
		scanf("%d%d%d",&year,&month1,&month2);
		if(month1>month2){               //?????             
			temp=month1;
			month1=month2;
			month2=temp;
		}

		for(j=month1;j<month2;j++)       //??????????????
			sum+=monthday(year,j);
		if(sum%7==0) printf("YES\n");
		else printf("NO\n");
		sum=0;
	}
}

int leapyear(int y)
{
	if(y%400==0||(y%4==0&&y%100!=0))
		return 1;
	else return 0;
}

int monthday(int y,int m)
{
	if(m==1||m==3||m==5||m==7||m==8||m==10||m==12)
		return 31;
	else if(m==2)
		return 28+leapyear(y);
	else return 30;
}
int main()
{
	int n;
	scanf("%d", &n);
	int y[1000], m1[1000], m2[1000];
	int month[13];
	int sum1[1000], sum2[1000];
	sum1[0] = 0;
	sum2[0] = 0;
	int i, t, k;
	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){
				int month[13] = {0,31,29,31,30,31,30,31,31,30,31,30,31};
				for(k=0;k<13;k++){
					sum1[k+1] = sum1[k] + month[k];
				}
					if((sum1[m1[i]] - sum1[m2[i]])%7==0){
						printf("YES\n");
					}
					else{
						printf("NO\n");
					}
			}
			else{
					int month[13] = {0,31,28,31,30,31,30,31,31,30,31,30,31};
					for(t=0;t<13;t++){
						sum2[t+1] = sum2[t] + month[t];
					}
						if((sum2[m1[i]] - sum2[m2[i]])%7==0){
							printf("YES\n");
						}
						else{
							printf("NO\n");
						}
				}
	}
	return 0;
}
int a[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
int b[13]={0,31,29,31,30,31,30,31,31,30,31,30,31};

int main()
{
	int n;
	cin>>n;
	int i,j;
	for(i=1;i<=n;i++)
	{
		int y,m1,m2;
		cin>>y>>m1>>m2;
		if(m1>m2)
		{
			int m=m1;m1=m2;m2=m;
		}
		if(y%4==0&&y%100!=0||y%400==0)
		{
			int count=0;
			for(j=m1;j<=m2-1;j++)
				count=count+b[j];
			if(count%7==0)
				cout<<"YES"<<endl;
			else
				cout<<"NO"<<endl;
		}
		else
			{
			int count=0;
			for(j=m1;j<=m2-1;j++)
				count=count+a[j];
			if(count%7==0)
				cout<<"YES"<<endl;
			else
				cout<<"NO"<<endl;
		}
	}
	return 0;
}
main()
{
    int n,y,a,b;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        scanf("%d %d %d",&y,&a,&b);
        int t[15];
        if(y%100==0)
            {
                if(y%400==0)//runnian
                {
                    t[1]=1;
                    t[2]=t[1]+31;
                    t[3]=t[2]+29;
                    t[4]=t[3]+31;
                    t[5]=t[4]+30;
                    t[6]=t[5]+31;
                    t[7]=t[6]+30;
                    t[8]=t[7]+31;
                    t[9]=t[8]+31;
                    t[10]=t[9]+30;
                    t[11]=t[10]+31;
                    t[12]=t[11]+30;
                //if(   (t[a]-t[b]>0&&(t[a]-t[b])%7==0)    ||  (t[a]-t[b]<0&&(t[b]-t[a])%7==0)  )
               // printf("YES");
                }
                else
                {
                    t[1]=1;
                    t[2]=t[1]+31;
                    t[3]=t[2]+28;
                    t[4]=t[3]+31;
                    t[5]=t[4]+30;
                    t[6]=t[5]+31;
                    t[7]=t[6]+30;
                    t[8]=t[7]+31;
                    t[9]=t[8]+31;
                    t[10]=t[9]+30;
                    t[11]=t[10]+31;
                    t[12]=t[11]+30;
                }
            }
        else if(y%4==0)
        {
                    t[1]=1;
                    t[2]=t[1]+31;
                    t[3]=t[2]+29;
                    t[4]=t[3]+31;
                    t[5]=t[4]+30;
                    t[6]=t[5]+31;
                    t[7]=t[6]+30;
                    t[8]=t[7]+31;
                    t[9]=t[8]+31;
                    t[10]=t[9]+30;
                    t[11]=t[10]+31;
                    t[12]=t[11]+30;
        }
        else {
            t[1]=1;
                    t[2]=t[1]+31;
                    t[3]=t[2]+28;
                    t[4]=t[3]+31;
                    t[5]=t[4]+30;
                    t[6]=t[5]+31;
                    t[7]=t[6]+30;
                    t[8]=t[7]+31;
                    t[9]=t[8]+31;
                    t[10]=t[9]+30;
                    t[11]=t[10]+31;
                    t[12]=t[11]+30;
            }


        if(   (t[a]-t[b]>0&&(t[a]-t[b])%7==0)    ||  (t[a]-t[b]<0&&(t[b]-t[a])%7==0)  )
            printf("YES\n");
        else printf("NO\n");
    }

}
main()
{
      int n,y,x;
      scanf("%d",&n); 
      int s[12]={0};
      for(int i=0;i<n;i++)
      {
              int a,b,c,z=0;
              scanf("%d %d %d",&a,&b,&c);
              if((a%400==0)||(a%100!=0&&a%4==0))
              { 
                     s[0]=31;
                      s[1]=29; 
                      s[2]=31;
                       s[3]=30; 
                       s[4]=31; 
                       s[5]=30;
                        s[6]=31;
                         s[7]=31;
                          s[8]=30;
                           s[9]=31;
                            s[10]=30;
                             s[11]=31;                      
              }
              else 
              { 
                     s[0]=31;
                      s[1]=28; 
                      s[2]=31;
                       s[3]=30; 
                       s[4]=31; 
                       s[5]=30;
                        s[6]=31;
                         s[7]=31;
                          s[8]=30;
                           s[9]=31;
                            s[10]=30;
                             s[11]=31;                      
              }         
              y=(b>c)?b:c;
              x=(b<c)?b:c;
              for(int j=x;j<y;j++)
              {
                      z+=s[j-1];
              } 
              if(z%7==0) 
              printf("YES\n");
              else
              printf("NO\n");      
      }
      getchar();
      getchar();
}
int main()
{
	int  Run(int );
	int tianshu[2][13]={{0,31,28,31,30,31,30,31,31,30,31,30,31},{0,31,29,31,30,31,30,31,31,30,31,30,31}};//??????
	int n,year,month1,month2,temp,i;
	cin>>n;//??
	while(n--)
	{   int sum=0;
		cin>>year>>month1>>month2;
		if(month1>month2) {//???????
			temp=month1;
			month1=month2;
			month2=temp;
		}
		for(i=month1;i<month2;i++)//????
		{
			sum+=tianshu[Run(year)][i];
		}
		if(sum%7==0) cout<<"YES"<<endl;//??
		else cout<<"NO"<<endl;

	}
}
int  Run(int year)//????
{
	if(((year%4==0)&&(year%100!=0))||(year%400==0))
			return 1;
	else return 0;
}
int leapyear(int n)
{
    if(n%4==0&&n%100!=0||n%400==0)
    return 1;
    else 
    return 0;
}
int lf(int m1,int m2)
{
    int max=m1,min=m2,k=0;
    if(m1<m2)
    {max=m2;min=m1;}
    switch(max)
    {
              case 12: k +=30;
              case 11: if(min==11) break; else k+=31;
              case 10: if(min==10) break; else k+=30;
              case 9: if(min==9) break; else k+=31;
              case 8: if(min==8) break; else k+=31;
              case 7: if(min==7) break; else k+=30;
              case 6: if(min==6) break; else k+=31;
              case 5: if(min==5) break; else k+=30;
              case 4: if(min==4) break; else k+=31;
              case 3: if(min==3) break; else k+=29;
              case 2: if(min==2) break; else k+=31;
              case 1: break;
    }
    if (k%7==0)
    return 1;
    else
    return 0;
}
int nf(int m1,int m2)
{
    int max=m1,min=m2,k=0;
    if(m1<m2)
    {max=m2;min=m1;}
    switch(max)
    {
              case 12: k +=30;
              case 11: if(min==11) break; else k+=31;
              case 10: if(min==10) break; else k+=30;
              case 9: if(min==9) break; else k+=31;
              case 8: if(min==8) break; else k+=31;
              case 7: if(min==7) break; else k+=30;
              case 6: if(min==6) break; else k+=31;
              case 5: if(min==5) break; else k+=30;
              case 4: if(min==4) break; else k+=31;
              case 3: if(min==3) break; else k+=28;
              case 2: if(min==2) break; else k+=31;
              case 1: break;
    }
    if (k%7==0)
    return 1;
    else
    return 0;
}
main()
{
      int e,n,m1,m2,t,k,i;
      scanf("%d",&e);
      for(i=0;i<e;i++)
      {
      scanf("%d",&n);
      scanf("%d %d",&m1,&m2);
      t=leapyear(n);
      if(t==1)
      k=lf(m1,m2);
      else
      k=nf(m1,m2);
      if(k==1)
      printf("YES\n");
      else
      printf("NO\n");
      }
}
int main()
{


	int i,n,y,m1,m2;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d %d %d",&y,&m1,&m2);
		if(y%4==0 && y%100!=0 || y%400==0)
		{
        if(m1==1)
			m1=0;
        if(m1==2)
			m1=31;
        if(m1==3)
			m1=60;
        if(m1==4)
			m1=91;
        if(m1==5)
			m1=121;
        if(m1==6)
			m1=152;
		if(m1==7)
			m1=182;
		if(m1==8)
			m1=213;
		if(m1==9)
			m1=244;
		if(m1==10)
			m1=274;
		if(m1==11)
			m1=305;
		if(m1==12)
			m1=335;

		if(m2==1)
			m2=0;
        if(m2==2)
			m2=31;
        if(m2==3)
			m2=60;
        if(m2==4)
			m2=91;
        if(m2==5)
			m2=121;
        if(m2==6)
			m2=152;
		if(m2==7)
			m2=182;
		if(m2==8)
			m2=213;
		if(m2==9)
			m2=244;
		if(m2==10)
			m2=274;
		if(m2==11)
			m2=305;
		if(m2==12)
			m2=335;
		}
		else 
		{
			if(m1==1)
				m1=0;
			if(m1==2)
				m1=31;
			if(m1==3)
				m1=59;
			if(m1==4)
				m1=90;
			if(m1==5)
				m1=120;
			if(m1==6)
				m1=151;
			if(m1==7)
				m1=181;
			if(m1==8)
				m1=212;
			if(m1==9)
				m1=243;
			if(m1==10)
				m1=273;
			if(m1==11)
				m1=304;
			if(m1==12)
				m1=334;

			if(m2==1)
				m2=0;
			if(m2==2)
				m2=31;
			if(m2==3)
				m2=59;
			if(m2==4)
				m2=90;
			if(m2==5)
				m2=120;
			if(m2==6)
				m2=151;
			if(m2==7)
				m2=181;
			if(m2==8)
				m2=212;
			if(m2==9)
				m2=243;
			if(m2==10)
				m2=273;
			if(m2==11)
				m2=304;
			if(m2==12)
				m2=334;
		}

       if(m1>m2){
		   if((m1-m2)%7==0)
			printf("YES\n");
			else 
			printf("NO\n");
		}
       if(m2>m1){
		   if((m2-m1)%7==0)
			printf("YES\n");
			else 
			printf("NO\n");
		}

	}
     return 0;
}
/*???2011-12-30
 *??????
 *????08.cpp
 *????? - ??(10.5) ???
 */


int main()
{
	int month[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
	int n = 0;
	int year = 0;
	int month1 = 0;
	int month2 = 0;
	int days = 0;
	cin >> n;
	for (int temp = 0; temp < n; temp++)
	{
		cin >> year >> month1 >> month2;
		days = 0;
		if ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0))
			month[2] = 29;
		else
			month[2] = 28;
		if (month1 < month2)
			for (int temp2 = month1; temp2 < month2; temp2++)
				days += month[temp2];
		else
			for (int temp2 = month2; temp2 < month1; temp2++)
				days += month[temp2];
		if (days % 7 == 0)
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}
	return 0;
}
int main()
{
int n,year,m1,m2,x=0,i,m,a,b;
scanf("%d",&n);
for(i=0;i<n;i++)
{
   scanf("%d %d %d",&year,&m1,&m2);
       if(m1<m2)
	   {
		   a=m1;
		   b=m2;
	   }
	   else
	   {a=m2;
	   b=m1;
	   }

   if((year%4==0 && year%100!=0)||(year%400==0))
   {
	  
    for(m=a;m<b;m++)
    {
    switch(m)
    {
     case 1:x +=31;break;
     case 3:x +=31;break;
     case 5:x +=31;break;
     case 7:x +=31;break;
     case 8:x +=31;break;
     case 10:x +=31;break;
     case 12:x +=31;break;    
     case 2:x +=29;break;
     default :x +=30;
    }
   
    }
   
    if(x%7==0){
     printf("YES\n");
    }
    else
		printf("NO\n");x=0;}
    else
   {
    for(m=a;m<b;m++)
    {
    switch(m)
    {
     case 1:x +=31;break;
     case 3:x +=31;break;
     case 5:x +=31;break;
     case 7:x +=31;break;
     case 8:x +=31;break;
     case 10:x +=31;break;
     case 12:x +=31;
      break;
     case 2:x +=28;
      break;
     default :x +=30;
    }
    
    }
 if(x%7==0){
     printf("YES\n");
    }
 else{
     printf("NO\n");
	x=0;
   }
	}
}
return 0;
}
int f(int a)
{
	if(a%4==0)
	{
		if(a%100==0)
		{
			if(a%400==0)
				return 1;
			else
				return 0;
		}
		else
			return 1;
	}
	else
		return 0;
}
int f1(int x,int y)
{
	if(x==1||x==3||x==5||x==7||x==8||x==10||x==12)
		return 31;
	else if(x==4||x==6||x==9||x==11)
		return 30;
	else if(x==2&&y==1)
		return 29;
	else
		return 28;
}
int main()
{
	int n,i,j,s;
	cin>>n;
	int a,b,c;
	while(n--)
	{
		s=0;
		cin>>a>>b>>c;
		if(b<c)
		{
			j=f(a);
			for(i=b;i<c;i++)
			{
				s=s+f1(i,j);
			}
		}
		else
		{
			j=f(a);
			for(i=c;i<b;i++)
			{
				s=s+f1(i,j);
			}
			/*for(i=1;i<=c;i++)
			{
				j=f(a+1);
				s=s+f1(i,j);
			}*/
		}
		if(s%7==0)
			cout<<"YES"<<endl;
		else
			cout<<"NO"<<endl;
	}
	return 0;
}
int main()
{
   int n,i,j,day1=0,day2=0,D,year,month1,month2;
   scanf("%d",&n);
   for(i=0;i<n;i++)
   {
      scanf("%d %d %d",&year,&month1,&month2);
      if(year%400==0||(year%4==0&&year%100!=0))
      {
         for(j=1;j<month1;j++)
         {
            if(j==1||j==3||j==5||j==7||j==8||j==10)
            {
                day1=day1+31;
            }
            if(j==2)
            {
                day1=day1+29;
            }
            if(j==4||j==6||j==9||j==11)
            {
                day1=day1+30;
            }
         }
         for(j=1;j<month2;j++)
         {
            if(j==1||j==3||j==5||j==7||j==8||j==10)
            {
                day2=day2+31;
            }
            if(j==2)
            {
                day2=day2+29;
            }
            if(j==4||j==6||j==9||j==11)
            {
                day2=day2+30;
            }
         }
      }
      else
      {
         for(j=1;j<month1;j++)
         {
            if(j==1||j==3||j==5||j==7||j==8||j==10)
            {
                day1=day1+31;
            }
            if(j==2)
            {
                day1=day1+28;
            }
            if(j==4||j==6||j==9||j==11)
            {
                day1=day1+30;
            }
         }
         for(j=1;j<month2;j++)
         {
            if(j==1||j==3||j==5||j==7||j==8||j==10)
            {
                day2=day2+31;
            }
            if(j==2)
            {
                day2=day2+28;
            }
            if(j==4||j==6||j==9||j==11)
            {
                day2=day2+30;
            }
         }
      }
      D=day1-day2;
      if(D<0)
      {
          D=0-D;
      }
      if(D%7==0)
      {
          printf("YES\n");
      }
      if(D%7!=0)
      {
          printf("NO\n");
      }
      day1=0;
      day2=0;
   }
   return 0;
}
int main()
{
	int n,year,leap,i,j,k,m1,m2,re,q,tmp;
	scanf("%d",&n);
	for(j=0;j<n;j++)
	{
		scanf("%d%d%d",&year,&m1,&m2);
		if(m1>m2)
		{
			tmp=m1;
			m1=m2;
			m2=tmp;
		}
		if(year%4==0&&year%100!=0||year%400==0)
			leap=1;
		else
			leap=0;
		q=0;
		if(leap==1)
		{
			int month[12]={31,29,31,30,31,30,31,31,30,31,30,31};
			for(k=m1;k<m2;k++)
			{   
				q+=month[k-1];
			}
			if(q%7==0)
			{
				re=1;
			}
			else 
				re=0;
		}
		else 
		{
			int month[12]={31,28,31,30,31,30,31,31,30,31,30,31};
			for(k=m1;k<m2;k++)
			{
				q+=month[k-1];
			}
			if(q%7==0)
			{
				re=1;
			}
			else 
				re=0;
		}
		if(re==1)
			printf("YES\n");
		else
			printf("NO\n");
	}
	return 0;
}
main()
{
    int n;
    scanf("%d",&n);
    int month[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
    for(int v=0;v<n;v++)
    {
        int y,m1,m2;
        scanf("%d %d %d",&y,&m1,&m2);
        if(m1>m2)
        {
           int t=m1;
           m1=m2;
           m2=t;      
        }
        if(((y%4==0)&&(y%100!=0))||(y%400==0)) month[2]=29;
        int mp,sum=0;
        for(mp=m1;mp<m2;mp++) 
           sum=sum+month[mp];
        if (sum%7==0) printf("YES\n");
        else printf("NO\n");
        month[2]=28;
    }
    getchar();
    getchar();
}
int main()
{
int n,year,month1,month2;
int leap;
int days=0;
cin>>n;
while(n--)
{
cin>>year>>month1>>month2;
int temp;
if(month1>month2)
{
	temp=month2;
	month2=month1;
	month1=temp;
}
if(year%400==0||(year%4==0&&year%100!=0))
	leap=0;
else leap=1;
int day[2][12]={31,29,31,30,31,30,31,31,30,31,30,31,31,28,31,30,31,30,31,31,30,31,30,31};
for(int i=month1;i<month2;i++)
	days+=day[leap][i-1];
if(days%7==0)
	cout<<"YES"<<endl;
else cout<<"NO"<<endl;
days=0;
}

return 0;
}