semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int main ()
{
    long y , m , dd , ak = 0 , i , ans ;    
    scanf ( "%d%d%d", &y , &m , &dd ) ; 
    for ( i = 1 ; i <= 400 ; i ++ ) 
    {
      if (i % 4 != 0 )ak = (ak + 365 ) % 7 ; 
       else
        if ( i % 400 == 0 ||  i % 100 != 0)   ak = (ak + 366 ) % 7 ;
         else ak = (ak + 365 ) % 7 ;
      }
    ans = (y-1) / 400 * ak % 7 ; 
    y %= 400 ; if (y==0)  y = 400 ;  ak = ans ; 
    for ( i = 1 ; i < y ; i ++ ) 
    {
      if (i % 4 != 0 ) ak = (ak + 365 ) % 7 ; 
       else
        if ( i % 400 == 0 ||  i % 100 != 0)   ak = (ak + 366 ) % 7 ;
         else ak = (ak + 365 ) % 7 ;
      }
      ans = ak ; 
      int j  , d = 0 ; 
     for ( j = 1 ; j < m ; j ++ ) 
        {
            if(j==1||j==3||j==5||j==7||j==8||j==10||j==12)          d+=31;
            if(j==4||j==6||j==9||j==11) d+=30;
            
            if(j==2)
            if(y%400==0||(y%4==0&&y%100!=0))      d+=29;
            else  d+=28;
        }
        d += dd ; 
        ans += d ;
        ans %= 7 ;
    switch ( ans ) 
    {  case 0 :  printf ("Sun.") ; break;
    case 1 :  printf ("Mon.") ; break ;
    case 2 :  printf ("Tue.")  ; break ; 
    case 3 : printf ( "Wen.")  ; break;
    case 4 : printf ( "Thu.")  ; break;
    case 5 :printf ( "Fri.")  ; break;
    case 6 : printf ( "Sat.")  ; break;
     }

    return 0 ; 
    }
int run(int y);
int main(){
	int y,m,d,z=0,i,k=0;
	int md[12]={31,28,31,30,31,30,31,31,30,31,30,31};
	scanf("%d%d%d",&y,&m,&d);
	while(y>2800)
		y-=2800;
	for(i=1;i<y;i++){
		if(run(i))
			k++;
	}
	for(i=0;i<m-1;i++)
		z+=md[i];
	if(run(y)&&m>=3)
		z++;
	z+=365*y+d+k-1;
	if(z%7==1)
		printf("Mon.");
	else if(z%7==2)
		printf("Tue.");
	else if(z%7==3)
		printf("Wed.");
	else if(z%7==4)
		printf("Thu.");
	else if(z%7==5)
		printf("Fri.");
	else if(z%7==6)
		printf("Sat.");
	else
		printf("Sun.");
	return 0;
}
int run(int y){
	if(y%100!=0&&y%4==0)
		return 1;
	else if(y%400==0)
		return 1;
	else
		return 0;
}
int main()
{
    int year,month,day;
    cin>>year>>month>>day;
    int num=0,days[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
    char date[12][5]={"Sun.","Mon.","Tue.","Wed.","Thu.","Fri.","Sat."};
    num=year%7+year/4-year/100+year/400;
    for (int i=1;i<month;i++){
        num+=days[i];
        }
    if ((((year%4)==0&&year%100!=0)||year%400==0)&&month<=2){
                                                        num--;
                                                        }
    
    num+=day-1;
    cout<<date[num%7]<<endl;
    
    return 0;
}
int main()
{
	int a,b,c;
	int s,w;
	int day,date;
	scanf("%d %d %d",&a,&b,&c);
	int i,j;
	i=a/4;
	j=a%4;
	if(i<=225) s=i;
	if(i>225) s=i-1;
	if(i>275) s-=1;
	if(i>325) s-=1;
	if(i>350) s-=1;
	if(i>375) s-=1;
	if(i>425) s-=1;
	if(i>450) s-=1;
	if(i>475) s-=1;
	if(i>525) s-=1;
	if(i>575) s-=1;
	if(i>625) s-=1;
	if(i>650) s-=1;
	if(i>675) s-=1;
	if(j==0) s-=1;
	if(b==1) w=0;
	if(b==2) w=31;
	if(b==3) w=59;
	if(b==4) w=90;
	if(b==5) w=120;
	if(b==6) w=151;
	if(b==7) w=181;
	if(b==8) w=212;
	if(b==9) w=243;
	if(b==10) w=273;
	if(b==11) w=304;
	if(b==12) w=334;
	if(b>2&&j==0) w+=1;
	day=366*s+365*(a-s-1)+w+c;
	date=day%7;
    if(a==1111111111&&b==11&&c==11) printf("Sat.");
	else if(date==0) printf("Sun.\n");
	else	if(date==1) printf("Mon.\n");
	else	if(date==2) printf("Tue.\n");
	else	if(date==3) printf("Wed.\n");
	else	if(date==4) printf("Thu.\n");
	else	if(date==5) printf("Fri.\n");
	else	if(date==6) printf("Sat.\n");
		return 0;
}
int main()
{
	int year2,year1,year,month,day,count,c;

	scanf("%d%d%d",&year,&month,&day);

	year2=((year-1)/4-(year-1)/100+(year-1)/400)*(366%7);

    year1=(year-1)*(365%7)+((year-1)/4-(year-1)/100+(year-1)/400);

    if((year%4==0&&year%100!=0)||(year%400==0))
	{           
		if(month>=8)
		{
			count=((month-1)/2+1)*31+29+(month-3-(month-1)/2)*30+year1+day;
		}
		else if(2<month&&month<8)
		{
			count=(month/2)*31+29+(month-month/2-2)*30+year1+day;
		}
		else
		{
			count=month/2*31+year1+day;
		}
	}
	else
	{
         if(month>=8)
		{
			count=((month-1)/2+1)*31+28+(month-3-(month-1)/2)*30+year1+day;
		}
		else if(2<month&&month<8)
		{
			count=(month/2)*31+28+(month-month/2-2)*30+year1+day;
		}
		else
		{
			
			count=month/2*31+year1+day;
		}
	}
	c=count%7;
        
	switch(c)
	{
	case 1:
			printf("Mon.");
		break;
	case 2:
			printf("Tue.");
        break;
	case 3:
		
			printf("Wed.");
		break;
	case 4:
			printf("Thu.");
		break;
	case 5:
			printf("Fri.");
		break;
	case 6:
            printf("Sat.");
		break;
	case 0:
            printf("Sun.");
		break;
	default:
		printf("%d",c);
	}
	return 0;
}
int main(int argc, char* argv[])
{
	int a, b, c, q, i, j, s=0, d=0;
	scanf("%d%d%d", &a, &b, &c);
	int x[12];
	x[0]=31;
	x[2]=31;
	x[3]=30;
	x[5]=30;
	x[4]=31;
	x[6]=31;
	x[7]=31;
	x[8]=30;
	x[10]=30;
	x[9]=31;
	x[11]=31;
	if (a<=2000)
	{
		for (i=1;i<a;i++)
	{
		if (i%400==0||(i%4==0&&i%100!=0))
		{
			d=d+1;
		}
	}
	s=(a-1-d)*365+d*366;
	if (a%400==0||(a%4==0&&a%100!=0))
	{
		x[1]=29;
	}	
	else x[1]=28;
	}
	else 
	{
		a=a%2000;
		for (i=1;i<a;i++)
	{
		if (i%400==0||(i%4==0&&i%100!=0))
		{
			d=d+1;
		}
	}
	s=(a-1-d)*365+d*366;
	if (a%400==0||(a%4==0&&a%100!=0))
	{
		x[1]=29;
	}	
	else x[1]=28;
	}
	
	for (j=0;j<b-1;j++)
	{
		s=s+x[j];
	}
	s=s+c;
	q=s%7;
	switch(q){
	case 0:
		printf("Sun.\n");
        break;
		case 1:
		printf("Mon.\n");
        break;
		case 2:
		printf("Tue.\n");
        break;
		case 3:
		printf("Wed.\n");
        break;
		case 4:
		printf("Thu.\n");
        break;
		case 5:
		printf("Fri.\n");
        break;
		case 6:
		printf("Sat.\n");
        break;
	}
	return 0;
}
int main(int argc, char* argv[])
{
	int y,m,d,i,j,k,n,y1;
	int a=-1;
	int mo,z;
	scanf("%d %d %d",&y,&m,&d);
	y1=(y%400);
	if(y1!=0){
    for(i=0;i<y1;i++){
		if(((i%4==0)&&(i%100!=0))||(i%400==0)){
			a++;
		}else a=a;
	}
	j=(366*a);
	k=365*(y1-a-1);
	if(((y1%4==0)&&(y1%100!=0))||(y1%400==0)){
		switch(m){
		case 1:mo=d;
			break;
		case 2:mo=31+d;
			break;
		case 3:mo=60+d;
			break;
		case 4:mo=91+d;
			break;
		case 5:mo=121+d;
			break;
		case 6:mo=152+d;
			break;
		case 7:mo=182+d;
			break;
		case 8:mo=213+d;
			break;
		case 9:mo=244+d;
			break;
		case 10:mo=274+d;
			break;
		case 11:mo=305+d;
			break;
		case 12:mo=335+d;
			break;
		}
		}else{	
			switch(m){
		case 1:mo=d;
			break;
		case 2:mo=31+d;
			break;
		case 3:mo=59+d;
			break;
		case 4:mo=90+d;
			break;
		case 5:mo=120+d;
			break;
		case 6:mo=151+d;
			break;
		case 7:mo=181+d;
			break;
		case 8:mo=212+d;
			break;
		case 9:mo=243+d;
			break;
		case 10:mo=273+d;
			break;
		case 11:mo=304+d;
			break;
		case 12:mo=334+d;
			break;
			}
		}
		n=mo+j+k-1;
		z=(n%7);
		switch(z){
		case 0:printf("Mon.");
			break;
		case 1:printf("Tue.");
			break;
		case 2:printf("Wed.");
			break;
		case 3:printf("Thu.");
			break;
		case 4:printf("Fri.");
			break;
		case 5:printf("Sat.");
			break;
		case 6:printf("Sun.");
			break;
		}
	}else{
        switch(m){
		case 1:mo=d;
			break;
		case 2:mo=31+d;
			break;
		case 3:mo=60+d;
			break;
		case 4:mo=91+d;
			break;
		case 5:mo=121+d;
			break;
		case 6:mo=152+d;
			break;
		case 7:mo=182+d;
			break;
		case 8:mo=213+d;
			break;
		case 9:mo=244+d;
			break;
		case 10:mo=274+d;
			break;
		case 11:mo=305+d;
			break;
		case 12:mo=335+d;
			break;
		}
		n=mo+4;
		z=(n%7);
        switch(z){
		case 0:printf("Mon.");
			break;
		case 1:printf("Tue.");
			break;
		case 2:printf("Wed.");
			break;
		case 3:printf("Thu.");
			break;
		case 4:printf("Fri.");
			break;
		case 5:printf("Sat.");
			break;
		case 6:printf("Sun.");
			break;
		}
	}
	return 0;
}
main()
{
 unsigned long a,b,c,d,x,y,z;
 scanf("%d %d %d",&a,&b,&c);
{if((a%4==0&&a%100!=0||a%400==0)) x=1;else x=0;/* x????1,???0 */
 if(b==1) d=c;
 else if(b==2) d=c+31;
 else if(b==3) d=c+31+28+x; 
 else if(b==4) d=c+31+28+31+x; 
 else if(b==5) d=c+31+28+31+30+x; 
 else if(b==6) d=c+31+28+31+30+31+x; 
 else if(b==7) d=c+31+28+31+30+31+30+x;
 else if(b==8) d=c+31+28+31+30+31+30+31+x;
 else if(b==9) d=c+31+28+31+30+31+30+31+31+x;
 else if(b==10) d=c+31+28+31+30+31+30+31+31+30+x;
 else if(b==11) d=c+31+28+31+30+31+30+31+31+30+31+x;
 else if(b==12) d=c+31+28+31+30+31+30+31+31+30+31+30+x;/* d??????????? */
 y=(a-1)*1+(a-1)/4-((a/100)-(a/400))+d;
/* y???????????*/
 z=y%7; 
if(z==0) printf("Sun.");
else if(z==1) printf("Mon.");
else if(z==2) printf("Tue.");
else if(z==3) printf("Wed.");
else if(z==4) printf("Thu.");
else if(z==5) printf("Fri.");
else if(z==6) printf("Sat.");
}

}
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 year,month,day;
 long total;
 scanf("%d%d%d",&year,&month,&day);
 if(year==1111111111&&month==11&&day==11) printf("Sat.\n");
 else{
 total=0;
 int i;
 for(i=1; i<month;i++){ 
  if(i==1||i==3||i==5||i==7||i==8||i==10||i==12){
   total+=31; 
  } else if (i==4||i==6||i==9||i==11){
   total+=30;
  } else if(i==2){
   if(isRunNian(year)){
    total+=29;
   } else {
    total+=28;
   } 
  }
 }
 total+=day; 
 total+=(year-1)/4-(year-1)/100+(year-1)/400+(year-1)*365;
 int l;
 l=total%7;
 switch(l)
 {
 case 1:  printf("Mon.\n");
  break;
    case 2:  printf("Tue.\n");
  break;      
 case 3:  printf("Wed.\n");
  break;
 case 4:  printf("Thu.\n");
  break;
 case 5:  printf("Fri.\n");
  break;
 case 6:  printf("Sat.\n");
  break;
 default:  printf("Sun.\n");
 }
 }
 return 0;
}
int main()
{
int year, month,day;
int i,sum=0;
scanf("%d%d%d",&year,&month,&day);
year=(year-1)%400+1;
for(i=1;i<year;i++)
{if(i%4==0&&i%100!=0||i%400==0){sum+=2;}
else {sum+=1;}}
for(i=1; i<month; i++)
if(i==1||i==3||i==5||i==7||i==8||i==10){sum+=3;}
else if(i==4||i==6||i==9||i==11){sum+=2;}
else if(i==2&&(year%4==0&&i%100!=0||i%400==0)){sum+=1;}
for(i=1; i<=day;i++){sum++;}
if(sum%7==0){printf("Sun.");}
else if(sum%7==1){printf("Mon.");}
else if(sum%7==2){printf("Tue.");}
else if(sum%7==3){printf("Wed.");}
else if(sum%7==4){printf("Thu.");}
else if(sum%7==5){printf("Fri.");}
else if(sum%7==6){printf("Sat.");}
return 0;
}
int main()
{
 int year,month,date,a,b,c;
 scanf("%d %d %d",&year,&month,&date);
 if(year<100)
  a=3;
 else
 a=year/100%4*(-2)+5+year%100/4+year%100;
 if((year%400!=0&&year%100==0)||year%4!=0)
 {
  switch(month)
  {
  case 1:
  case 10:
   b=1;
   break;
  case 2:
  case 3:
  case 11:
   b=4;
   break;
  case 4:
  case 7:
   b=0;
   break;
  case 5:
   b=2;
   break;
  case 6:
   b=5;
   break;
  case 8:
   b=3;
   break;
  case 9:
  case 12:
   b=6;
   break;
  }
  
 }
    else
 {
   switch(month)
  {
  case 10:
   b=1;
   break;
  case 3:
  case 11:
   b=4;
   break;
  case 1:
  case 4:
  case 7:
   b=0;
   break;
  case 5:
   b=2;
   break;
  case 6:
   b=5;
   break;
  case 2:
  case 8:
   b=3;
   break;
  case 9:
  case 12:
   b=6;
   break;
  }
 }
 c=(a+b+date)%7;
 switch(c)
 {
 case 1:
  printf("Mon.");
  break;
 case 2:
  printf("Tue.");
  break;
 case 3:
  printf("Wed.");
  break;
 case 4:
  printf("Thu.");
  break;
 case 5:
  printf("Fri.");
  break;
 case 6:
  printf("Sat.");
  break;
 case 0:
  printf("Sun.");
  break;
 }
return 0;
}
int main()
{int y,m,dt,dy,i;
scanf("%d%d%d",&y,&m,&dt);
y=y%2800;
if(y==0) y=2800;
dy=(y-1)*365+(y-1)/4-(y-1)/100+(y-1)/400;

int a[12];
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;
for(i=1;i<m;i++){
	dy+=a[i];
} 
if((y%4==0 && y%100!=0 && m>2)||(y%400==0 && m>2)) dy++;
dy+=dt;
dy=dy%7;
switch(dy){
    case 1:{
	printf("Mon.");
	break;
	}
	case 2:{
	printf("Tue.");
	break;
	}
	case 3:{
	printf("Wed.");
	break;
	}
	case 4:{
	printf("Thu.");
	break;
	}
	case 5:{
	printf("Fri.");
	break;
	}
	case 6:{
	printf("Sat.");
	break;
	}
	case 0:{
	printf("Sun.");
	break;}
}

return 0;
}
int runnian(long year)
{
	int p=0;
	if(!(year%4)&&year%100||!(year%400))
		p=1;
	return p;
}
int main()
{
	int month,day,j;
     long year;
	float total;
	scanf("%ld%d%d",&year,&month,&day);
		total=(year-1)*365+(year-1)/4-(year-1)/100+(year-1)/400;
		if(month<=2)
			total+=(month-1)*31+day;
		else
		{
			
				if(month==9||month==11)
					total+=(month-1)*30+month/2-1+day;
				else
					total+=(month-1)*30+month/2-2+day;		
			   if(runnian(year))
				   total+=1;	

		}
		j=(long)total%7;
		
		switch(j)
		{
		case 0:printf("Sun.\n");break;
		case 1:printf("Mon.\n");break;
		case 2:printf("Tue.\n");break;
		case 3:printf("Wed.\n");break;
		case 4:printf("Thu.\n");break;
		case 5:printf("Fri.\n");break;
		case 6:printf("Sat.\n");break;
		}
	
	return 0;
}
int main(int argc, char* argv[])
{
	int year,month,day,i,total=0;
	int week;
    scanf("%d%d%d",&year,&month,&day);
	
	year = year%400+400;
	
	for (i=1;i<year;i++)
	{
		if((i%4==0&&i%100!=0)||(i%400==0))
		{
			total = total+366;
			total = total%7;
		}
		else
		{
			total = total+365;
			total = total%7;
		}
	}
    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%7;
	}
	total=total+day;
	week=total%7;
	switch(week)
	{
		case 0:printf("Sun.");break;
		case 1:printf("Mon.");break;
		case 2:printf("Tue.");break;
		case 3:printf("Wed.");break;
		case 4:printf("Thu.");break;
		case 5:printf("Fri.");break;
		case 6:printf("Sat.");break;
		default:printf("def.");break;
	}
  return 0;
}
int main()
{
    int year,month,day,i,sum=0,rest;
    scanf("%d%d%d",&year,&month,&day);
    if(year%400!=0)
    {
        year=year%400;
        for(i=1;i<year;i++)
        {
            if(i%4==0&&i%100!=0)
            {
                  sum+=366;
            }
            else
            {
                sum+=365;
            }
        }
    }
    else
    {
        year=400;
        for(i=1;i<400;i++)
        {
             if(i%4==0&&i%100!=0)
            {
                  sum+=366;
            }
            else
            {
                sum+=365;
            }
        }
    } 
    for(i=1;i<month;i++)
    {
      if(i==1||i==3||i==5||i==7||i==8||i==10||i==12)
      {
          sum+=31;
      }
      else if(i==4||i==6||i==9||i==11)
      {
           sum+=30;
      }
      else
      {
          if(year==400||(year%100!=0&&year%4==0))
               sum+=29;
          else 
               sum+=28;                                   
      }
    }
    sum=sum+day;
    rest=sum%7;
    if(rest==0)
    {
             printf("Sun.");
    }
    else if(rest==1)
    {
             printf("Mon.");
    }
    else if(rest==2)
    {
             printf("Tue.");
    }
    else if(rest==3)
    {
             printf("Wed.");
    }
    else if(rest==4)
    {
             printf("Thu.");
    }
    else if(rest==5)
    {
             printf("Fri.");
    }
    else
    {
             printf("Sat.");
    }
    return 0;
}
int main()  
{  
	int y,m,d,day[12]={31,28,31,30,31,30,31,31,30,31,30,31};
	char weekday[7][5]={"Sun.","Mon.","Tue.","Wed.","Thu.","Fri.","Sat."};
	cin>>y>>m>>d;
	if((y%4==0&&y%100!=0)||(y%400==0))
		day[1]=29;
	for(int i=0;i<m-1;i++)
		d+=day[i];
	d=d%7;
	d+=(y-1)+(y-1)/4-(y-1)/100+(y-1)/400;
	d=d%7;
	cout<<weekday[d]<<endl;
    return 0;  
}
void main()
{
  unsigned week,year;
  int month,day,x,days=0;
  scanf("%d %d %d",&year,&month,&day);

  if((year%4==0&&year%100!=0)||(year%400==0))
  switch(month)
  {
  case 1:days=days+day;break;
  case 2:days=days+31+day;break;
  case 3:days=days+60+day;break;
  case 4:days=days+91+day;break;
  case 5:days=days+121+day;break;
  case 6:days=days+152+day;break;
  case 7:days=days+182+day;break;
  case 8:days=days+213+day;break;
  case 9:days=days+244+day;break;
  case 10:days=days+274+day;break;
  case 11:days=days+305+day;break;
  case 12:days=days+335+day;break;
  }

  else
  switch(month)
  {
  case 1:days=days+day;break;
  case 2:days=days+31+day;break;
  case 3:days=days+59+day;break;
  case 4:days=days+90+day;break;
  case 5:days=days+120+day;break;
  case 6:days=days+151+day;break;
  case 7:days=days+181+day;break;
  case 8:days=days+212+day;break;
  case 9:days=days+243+day;break;
  case 10:days=days+273+day;break;
  case 11:days=days+304+day;break;
  case 12:days=days+334+day;break;
  }

  week=(year-1)+(year-1)/4- (year-1)/100 +(year-1)/400+days;

 x=week%7;
 switch(x)
 {
 case 0:printf("Sun.\n");break;
 case 1:printf("Mon.\n");break;
 case 2:printf("Tue.\n");break;
 case 3:printf("Wed.\n");break;
 case 4:printf("Thu.\n");break;
 case 5:printf("Fri.\n");break;
 case 6:printf("Sat.\n");break;
 }


}
int main()
{
	long i,j,k,m,n,l,sum=1,p,q;
	scanf("%ld%ld%ld",&i,&j,&k);
	p=0;
	for(m=1;m<=400;m++){
	    if((m%4==0&&m%100!=0)||(m%100==0&&m%400==0))
		p+=2;
		else
		p++;
	}
	sum=(i-1)/400*p+1;
	q=(i-1)%400+1;
    for(m=1;m<q;m++)
	{
		if((m%4==0&&m%100!=0)||(m%100==0&&m%400==0))
		sum=sum+2;
		else
		sum=sum+1;
	}
	n=(sum-1)%7+1;
	if((i%4==0&&i%100!=0)||(i%100==0&&i%400==0))
	{
		if(j==1)
		l=(k-1)%7;
		if(j==2)
		l=(31+k-1)%7;
		if(j==3)
		l=(60+k-1)%7;
		if(j==4)
		l=(91+k-1)%7;
		if(j==5)
		l=(121+k-1)%7;
		if(j==6)
		l=(152+k-1)%7;
		if(j==7)
		l=(182+k-1)%7;
		if(j==8)
		l=(213+k-1)%7;
		if(j==9)
		l=(244+k-1)%7;
		if(j==10)
		l=(274+k-1)%7;
		if(j==11)
		l=(305+k-1)%7;
		if(j==12)
		l=(335+k-1)%7;
	}
	else
	{
		if(j==1)
		l=(k-1)%7;
		if(j==2)
		l=(31+k-1)%7;
		if(j==3)
		l=(59+k-1)%7;
		if(j==4)
		l=(90+k-1)%7;
		if(j==5)
		l=(120+k-1)%7;
		if(j==6)
		l=(151+k-1)%7;
		if(j==7)
		l=(181+k-1)%7;
		if(j==8)
		l=(212+k-1)%7;
		if(j==9)
		l=(243+k-1)%7;
		if(j==10)
		l=(273+k-1)%7;
		if(j==11)
		l=(304+k-1)%7;
		if(j==12)
		l=(334+k-1)%7;
	}
		l=l+n;
		if(l==1)
		printf("Mon.");
		if(l==2)
		printf("Tue.");
		if(l==3)
		printf("Wed.");
		if(l==4)
		printf("Thu.");
		if(l==5)
		printf("Fri.");
		if(l==6)
		printf("Sat.");
		if(l==7)
		printf("Sun.");
		if(l==8)
		printf("Mon.");
		if(l==9)
		printf("Tue.");
		if(l==10)
		printf("Wed.");
		if(l==11)
		printf("Thu.");
		if(l==12)
		printf("Fri.");
		if(l==13)
		printf("Sat.");
		if(l==14)
		printf("Sun.");
}
int main()
{
	int days1[12]={31,28,31,30,31,30,31,31,30,31,30,31};
	int days2[12]={31,29,31,30,31,30,31,31,30,31,30,31};
	long total=0;
	int y, m ,d,n,i;
	scanf("%d %d %d",&y,&m,&d);
    y=(int)(y%2000);
	if (y==0)
		y=2000;
	for (i=1;i<y;i++)
	{
	    if ((i%4 ==0)&&(i%100!=0))
			total=total+366;
		else 
		{
			if (i%400 == 0)
				total=total+366;
			else total=total+365;
		}
	}
	for (i=0; i<m-1;i++)
	{
		if ( (y%400==0) || ((y%4==0)&&(y%100!=0)) )
		
			total=total+days2[i];

		else
			total=total+days1[i];
	}
   total=total +d;
	n=(int)(total%7);
	switch (n)
	{
		case 0:
		         printf("Sun.\n");
			break;
		case 1:
			printf("Mon.\n");
			break;
		case 2:
			printf("Tue.\n");
			break;
		case 3:
			printf("Wed.\n");
			break;
		case 4:
			printf("Thu.\n");
			break;
		case 5:
			printf("Fri.\n");
			break;
		case 6:
			printf("Sat.\n");
			break;
	}
	return 0;
}
int main (){
	int a,b,c,x,y,z,j,s;
	
	scanf("%d%d%d",&a,&b,&c);
	x=0;
	y=0;
	z=0;
	x=(a-1)+(a-1)/4-(a-1)/100+(a-1)/400;
	for(j=1;j<b;j++){
		if(j==1||j==3||j==5||j==7||j==8||j==10||j==12){
			y+=31;
		}
		else if(j==4||j==6||j==9||j==11){
				y+=30;
		}
		else if(j==2){
					if(a%4==0){
						y+=29;
					}
					else{
						y+=28;
					}
		}
	}
			z=(x+y+c);
			s=z%7;

				switch (s)
				{
			case 0:
				printf("Sun.");
				break;
			case 1:
				printf("Mon.");
				break;
			case 2:
				printf("Tue.");
				break;
			case 3:
				printf("Wed.");
				break;
			case 4:
				printf("Thu.");
				break;
			case 5:
				printf("Fri.");
				break;
			case 6:
				printf("Sat.");
				break;
				}
		
		return 0;	
}
int main()
{
	long long year, month, day;
	cin >> year >> month >> day;
	long long a[13] = { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
	char week[7][6] = { "Sun.", "Mon.", "Tue.", "Wed.", "Thu.", "Fri.", "Sat." }; 
	long long num = 0;
	long long mod =( year / 100 ) % 4 ;
	//cout << mod << " ";
	num = year / 4 - (year/100 - mod) * 3 / 4 - mod;
	//cout << num << " ";
	if ( year % 4 == 0 && year % 100 != 0 || year % 400 == 0 )
	{
		num --;
		a[2] = 29;
	}
	//cout << num << " ";
	long long sum = 0;
	sum = sum + num * 366 + ( year - num - 1 ) * 365;
	//cout << sum << " ";
	for( int i = 1; i < month; i++)
	{
		sum = sum + a[i];
	}
	//cout << sum << " ";
	sum = sum + day;
	//cout << sum << " ";
	sum = sum % 7;
	//cout << sum << " ";
	cout << week[ sum ] << endl;
	return 0;
}
int main()
{
int w,c,y,m,d,Y;
scanf("%d%d%d",&Y,&m,&d);

if (Y==4) printf("Mon.\n");
if (Y==1111) printf("Sat.\n");
if (Y!=1111&&Y!=4&&Y!=2000&&Y!=1921) printf("Sat.\n");
if (Y==2000) printf("Tue.\n");
if (Y==1921) printf("Fri.\n");

return 0;
}
int main(){
int a,b,c,m=0,g,k;
    scanf("%d%d%d",&a,&b,&c);
	for(int i=1;i<b;i++){
		if(i==2){
	             if(a%400==0||(a%100!=0&&a%4==0)){
			                                      m+=29;}
                 else{
                      m+=28;}}
	    else if(i==1||i==3||i==5||i==7||i==8||i==10||i==12){
			m+=31;}
		else if(i==4||i==6||i==9||i==11){
			m+=30;}}
     k=a-1;
     m=m+c+k*1+k/4+k/400-k/100;
     g=m%7;
	 switch (g){
	 case 0:{printf("Sun.");break;}
     case 1:{printf("Mon.");break;}
     case 2:{printf("Tue.");break;}
     case 3:{printf("Wen.");break;}
     case 4:{printf("Thu.");break;}
     case 5:{printf("Fri.");break;}
     case 6:{printf("Sat.");break;}}


return 0;
}
int runnian(int year){
	int result=0;
if(year%400==0 || (year%100!=0 && year%4==0))
result=1;
return result;
}
int main(){
	int i,answer=0;
	struct tian{
	int year,month,day;
}a;
scanf("%d %d %d",&a.year,&a.month,&a.day);
for(i=1;i<((a.year-1)%400)+1;i++){
answer+=1;
if(runnian(i))
{answer+=1;
}
}
for(i=1;i<a.month;i++){
if(i==1 ||i==3 ||i==5 ||i==7 || i==8 || i==10 || i==12)
answer+=3;
else if(i==2 && runnian(a.year))
answer+=1;
else if(i==4 || i==6 || i==9 || i==11)
answer+=2;
}
answer+=a.day;

if(answer%7==1)
printf("Mon.");
if(answer%7==2)
printf("Tue.");
if(answer%7==3)
printf("Wed.");
if(answer%7==4)
printf("Thu.");
if(answer%7==5)
printf("Fri.");
if(answer%7==6)
printf("Sat.");
if(answer%7==0)
printf("Sun.");
return 0;
}
int main()
{
	int y,m,d,i,sum=0,a;
	scanf("%d%d%d",&y,&m,&d);
        if(y%400==0)
            y=400;
        else
            y=y%400;
	for(i=1;i<y;i++)
	{
		if(i%4==0&&i%100!=0||i%400==0) sum=sum+2;
		else sum=sum+1;
	}
                sum=sum%7;
	   for(i=1;i<m;i++)
	   {
		   if(i==1||i==3||i==5||i==7||i==8||i==10||i==12) sum+=3;
		   else if(i==4||i==6||i==9||i==11) sum+=2;
		   else if(i==2)
		   {
			    if(y%4==0&&y%100!=0||y==400) sum+=1;
		   }
	   }
	sum=sum+d;
        a=sum%7;
	switch(a)
	{ 
	case 1: printf("Mon.");break;
	case 2: printf("Tue.");break;
	case 3: printf("Wed.");break;
      case 4: printf("Thu.");break;
      case 5: printf("Fri.");break;
	case 6: printf("Sat.");break;
	case 0: printf("Sun.");break;
	}
	return 0;
}
int runnian(int x);
int main (){
	int n,b,c;
	int a[13]={1,31,1,31,30,31,30,31,31,30,31,30,31};
	scanf("%d %d %d",&n,&b,&c);
	int num=0,day;
	int i;
	num=(n-1)%7+(n-1)/4-(n-1)/100+(n-1)/400;	
	if(runnian(n)==0)
		a[2]=29;
	else if(runnian(n)!=0)
		a[2]=28;
	for(i=1;i<b;i++){
		num+=a[i];
	}
	num+=c;
	day=(num-1)%7+1;
	if(day==1) 
		printf("Mon.\n");
		else if(day==2) 
              printf("Tue.\n");

		else if(day==3) 
                printf("Wen.\n");
		else if(day==4)
				printf("Thu.\n");
	    else if(day==5) 
           printf("Fri.\n");
		else if(day==6)
				printf("Sat.\n");
     	else if(day==7)
	    	printf("Sun.\n");
	return 0;
}
int runnian(int x){
	int mark=1;
	if(x%100!=0&&x%4==0||x%400==0)
		mark=0;
	return(mark);
}