semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int main()
{
	unsigned int year,month,day,a,all,w,q;
	scanf("%d%d%d",&year,&month,&day);
	if((year%4==0&&year%100!=0)||(year%400==0))
	{
		switch(month)
		{
		case 1:a=366;break;
		case 2:a=335;break;
		case 3:a=306;break;
		case 4:a=275;break;
		case 5:a=245;break;
		case 6:a=214;break;
		case 7:a=184;break;
		case 8:a=153;break;
		case 9:a=122;break;
		case 10:a=92;break;
		case 11:a=61;break;
		case 12:a=31;break;
		}
		all=366-a+day;
		
	}
	else
	{
		switch(month)
		{
		case 1:a=365;break;
		case 2:a=334;break;
		case 3:a=306;break;
		case 4:a=275;break;
		case 5:a=245;break;
		case 6:a=214;break;
		case 7:a=184;break;
		case 8:a=153;break;
		case 9:a=122;break;
		case 10:a=92;break;
		case 11:a=61;break;
		case 12:a=31;break;
		}
		all=365-a+day;
		
	}

w= (year-1)+ (year-1)/4 - (year-1)/100 + (year-1)/400 + all ;
q=w%7;
switch(q)
	{
	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;
	case 0:printf("Sun.\n");break;
	}
return 0;
}
int isRunNian(int year);
int main(){
    int M,m,n,p,i,result=0;
    scanf("%d%d%d",&M,&n,&p);
	if(M<401){
		m=M;
    }else{
			for(i=M;i>0;i-=400){
				m=i;
		}
		}
    for(i=1;i<m;i++){
       if(isRunNian(i)){
          result+=366;
       }else{
          result+=365;
       }
    }
    for(i=1;i<n;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(m)){
				result += 29;
			} else {
				result += 28;
			}	
		}
    }
    result+=p;
    int q;
    q=result%7;
    if(q==0){printf("Sun.");}
    if(q==1){printf("Mon.");}
    if(q==2){printf("Tue.");}
    if(q==3){printf("Wed.");}
    if(q==4){printf("Thu.");}
    if(q==5){printf("Fri.");}
    if(q==6){printf("Sat.");}
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 y,m,n=0,d,a,b;
	cin>>y>>m>>d;
	if(((y%4==0)&&(y%100!=0))||(y%400==0))
	{
		a=1;
	}
	else
	{
		a=0;
	}
	b=(y+(y-1)/4-(y-1)/100+(y-1)/400)%7;
	switch(m)
	{
		case 12:n=n+30;
		case 11:n=n+31;
		case 10:n=n+30;
		case 9:n=n+31;
		case 8:n=n+31;
		case 7:n=n+30;
		case 6:n=n+31;
		case 5:n=n+30;
		case 4:n=n+31;
		case 3:n=n+28+a;
		case 2:n=n+31;
		case 1:n=n;
	}
	n=n+d;
	switch((n-1+b)%7)
	{
	case 0:cout<<"Sun.";break;
	case 1:cout<<"Mon.";break;
	case 2:cout<<"Tue.";break;
	case 3:cout<<"Wed.";break;
	case 4:cout<<"Thu.";break;
	case 5:cout<<"Fri.";break;
	case 6:cout<<"Sat.";break;
	}	
	return 0;
}
int main()
{
int a,b,c,q,w,p,e,r,t,y;
scanf("%d %d %d",&a,&b,&c);
q=((a-1)/4-(a-1)/100+(a-1)/400)+(a-1)*1;
switch(b){
  case 1: 
           w=0;
           break;
  case 2: 
           w=31;
           break;
  case 3: 
           w=31+28;
           break;
  case 4: 
           w=31+28+31;
           break;
  case 5: 
           w=31+28+31+30;
           break;
  case 6: 
           w=28+31*3+30;
           break;
  case 7: 
           w=28+31*3+30*2;
           break;
  case 8: 
           w=28+31*4+30*2;
           break;
  case 9: 
           w=28+31*5+30*2;
           break;
  case 10: 
           w=28+31*5+30*3;
           break;
  case 11: 
           w=28+31*6+30*3;
           break;
  case 12: 
           w=28+31*6+30*4;
           break;
      }
r=a%4;
y=(a+100)%100;
t=(a+400)%400;
if(r==0){
   if(y!=0){
      if (b>2) w=w+1;      
            }
   else if(t==0){
            if (b>2)   w=w+1;
                }
         }
           e=q+w+c;
           p=e%7;

	switch(p){
	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;
	case 0:
		printf("Sun.\n");
		break;
           }
return 0;
}
// xingqiji.cpp : Defines the entry point for the console application.
//


int main()
{
long int y1,y,m,d,a,x,b;
scanf("%d %d %d",&y1,&m,&d);
y=y1%400;
a=y/4-y/100+y/400;

if(y%400==0||y%100!=0&&y%4==0) {if(m<3) a=a-1;}

switch(m){
case 1:x=d;break;
case 2:x=31+d;break;
case 3:x=59+d;break;
case 4:x=90+d;break;
case 5:x=120+d;break;
case 6:x=151+d;break;
case 7:x=181+d;break;
case 8:x=212+d;break;
case 9:x=243+d;break;	
case 10:x=273+d;break;
case 11:x=304+d;break;	
default :x=334+d;break;}	
 
b=(y*365+x+a-1)%7;

switch(b){
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("Sun.");break;}


	return 0;
}
int main()
{
	int year,month,date,t,y,m,d,s;
	scanf("%d %d %d",&year,&month,&date);
	t=(year-1)/400;
	year=year-t*400;
    t=(year-1)/4;
	y=(t*366+(year-1-t)*365)%7;
	if (year>300) y=(y-3)%7;
	else if (year>200) y=(y-2)%7;
	else if (year>100) y=(y-1)%7;
	switch(month)
	{
	 case 1:m=0;break;
	 case 2:m=3;break;
	 case 3:m=3;break;
	 case 4:m=6;break;
	 case 5:m=1;break;
	 case 6:m=4;break;
	 case 7:m=6;break;
	 case 8:m=2;break;
	 case 9:m=5;break;
	 case 10:m=0;break;
	 case 11:m=3;break;
	 case 12:m=5;break;
	}
	if((year%4==0&&year%100!=0||year%400==0)&&month>2) m=(m+1)%7;
	d=date%7;
	s=(m+y+d)%7;
	switch (s)
	{
	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 day,mn,yr,i,days=0,s,k; 
int mont[13]={0,31,28,31,30,31,30,31,31,30,31,30,31}; 
char wek[7][9]={ {'S','u','n'}, 
{'M','o','n'}, 
{'T','u','e'}, 
{'W','e','d'}, 
{'T','h','u'}, 
{'F','r','i'}, 
{'S','a','t'} 
      }; 
scanf("%d%d%d",&yr,&mn,&day); 
if (yr%4==0||yr%100==0||yr%400==0) 
mont[2]=29; 
else 
mont[2]=28; 
for (i=0;i<mn;i++) 
{
days+=mont[i];
} 
days+=day; 
s=yr-1+(int)((yr-1)/4)-(int)((yr-1)/100)+(int)((yr-1)/400)+days; 
k=s%7; 
printf("%s.\0",wek[k]); 
   return 0; 
}
int main()
{
int y,m,d,hh;
int pn,rn,sum;
int a,b,c,nianq;
scanf("%d%d%d",&y,&m,&d);
a=(y-1)/4;
b=(y-1)/100;
c=(y-1)/400;
rn=a-b+c;
pn=(y-1)-rn;
nianq=rn*2+pn*1;
if(y%400==0||(y%100!=0&&y%4==0)){
	if(m==1){hh=d;}
	if(m==2){hh=31+d;}
	if(m==3){hh=60+d;}
	if(m==4){hh=91+d;}
	if(m==5){hh=121+d;}
	if(m==6){hh=152+d;}
	if(m==7){hh=182+d;}
	if(m==8){hh=213+d;}
	if(m==9){hh=244+d;}
	if(m==10){hh=274+d;}
	if(m==11){hh=305+d;}
	if(m==12){hh=335+d;}
}
else 
{
	if(m==1){hh=d;}
	if(m==2){hh=31+d;}
	if(m==3){hh=59+d;}
	if(m==4){hh=90+d;}
	if(m==5){hh=120+d;}
	if(m==6){hh=151+d;}
	if(m==7){hh=181+d;}
	if(m==8){hh=212+d;}
	if(m==9){hh=243+d;}
	if(m==10){hh=273+d;}
	if(m==11){hh=304+d;}
	if(m==12){hh=334+d;}
}
sum=(hh+nianq)%7;
if(sum==0){printf("Sun.");}
if(sum==1){printf("Mon.");}
if(sum==2){printf("Tue.");}
if(sum==3){printf("Wed.");}
if(sum==4){printf("Thu.");}
if(sum==5){printf("Fri.");}
if(sum==6){printf("Sat.");}
return 0;
}
int isRunNian(int x);
int main(){
	int n, y, r, i;
	long sum=0l;
	scanf("%d%d%d" ,&n, &y, &r);
	for(i=1;i<y;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(i==2){
			if(isRunNian(n)){
			    sum+=29;
			}
			else{
				sum+=28;
			}
		}
	}

	sum+=r;

    for(i=1;1;i++){
		if(n>2001){
			n-=2000;
		}
		else
			break;
	}

	for(i=1;i<n;i++){
		if(isRunNian(i)){
			sum+=366;
		}
		else{
			sum+=365;
		}
	}


	switch(sum%7){
	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("Sun.");
		break;
	}
	return 0;
}
int isRunNian(int x){
	int result;
	if(x%400==0||(x%4==0&&x%100!=0)){
		result=1;
	}
	else{
		result=0;
	}
	return result;
}
int main()
{ int month,day,a[12]={31,29,31,30,31,30,31,31,30,31,30,31};
  long long sum=0,year,temp,runnian;
  cin>>year>>month>>day;
  temp=year-1;
  runnian=temp/4-temp/100+temp/400;
  sum=runnian*366+(temp-runnian)*365;
  if(year%4!=0||year%100==0&&year%400!=0) a[1]=28;  
  if(month==1) sum+=day;
  else
  {for(int i=0;i<=month-2;i++)
       sum+=a[i];
   sum+=day;
  }   
   sum=sum%7;
   switch(sum)
   { case(1): cout<<"Mon.";break;
     case(2): cout<<"Tue.";break;
     case(3): cout<<"Wed.";break;
     case(4): cout<<"Thu.";break;
     case(5): cout<<"Fri.";break;
     case(6): cout<<"Sat.";break;
     case(0): cout<<"Sun.";break;
  }
   return 0;
}
char s[][4] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};
int c[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

int leap(int n) {
  return n % 400 == 0 || (n % 4 == 0 && n % 100);
}

int main() {
  int y, m, d, k, i;
  scanf("%d%d%d", &y, &m, &d);
  if (!(y %= 400)) y = 400;
  k = 0;
  for (i = 1; i < y; ++i) k = (k + 365 + leap(i)) % 7;
  for (i = 1; i < m; ++i)
    k = (k + c[i] + (i == 2 ? leap(y) : 0)) % 7;
  printf("%s.\n", s[(k + d) % 7]);
  return 0;
}
int main()
{
	int year,month,day,y,d,num4,num100,x;
	int a[13]={0,0,31,59,90,120,151,181,212,243,273,304,334};
	int b[13]={0,0,31,60,91,121,152,182,213,244,274,305,335};
	scanf("%d%d%d",&year,&month,&day);
	y=year%400;
	if(y==0) y=400;
	num4=(y-1)/4;
	num100=(y-1)/100;
	if(num100==4) num100=3;
	d=(y-1)*365+num4-num100;
	if(y%4!=0)	d=d+a[month]+day;
	if(y%4==0)  d=d+b[month]+day;
	x=d%7;
	if(x==0) printf("Sun.\n");
	if(x==1) printf("Mon.\n");
	if(x==2) printf("Tue.\n");
	if(x==3) printf("Wed.\n");
	if(x==4) printf("Thu.\n");
	if(x==5) printf("Fri.\n");
	if(x==6) printf("Sat.\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()
{
	long int year, month, day, total;
	scanf("%d %d %d", &year, &month, &day);
	total = 0;
	for(int 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-1;
	total+=(year-1)*365+year/4-year/100+year/400;
total=total%7;
if(total==0){printf("Sat.");}
else if(total==1){printf("Mon.");}
else if(total==2){printf("Tue.");}
else if(total==3){printf("Wed.");}
else if(total==4){printf("Fri.");}
else if(total==5){printf("Sat.");}
else if(total==6){printf("Fri.");}
return 0;
}
int main(){
	int i,j,a,year,month,day,days=0;
	
	scanf("%d%d%d",&year,&month,&day);
	for( i=1;i<month;i++){
		if(i==1||i==3||i==5||i==7||i==8||i==10||i==12){
			days+=31;
		}
		else if(i==4||i==6||i==9||i==11){
			days+=30;
		}
		else if(i==2){
			if(year%400==0||(year%4==0&&year!=0)){
				days+=29;
			}
			else{
				days+=28;
			}
		}
	}
	year=year-1;
	int n=year/4-year/100+year/400;
	days+=2*n+(year-n);
	days+=day;
	a=days%7;
	if(a==0){printf("Sun.");}
	else if(a==1){printf("Mon.");}
	else if(a==2){printf("Tue.");}
	else if(a==3){printf("Wed.");}
	else if(a==4){printf("Thu.");}
	else if(a==5){printf("Fri.");}
	else if(a==6){printf("Sat.");}
	return 0;
}
int main()
{
	int y,m,d,i;
	int a[12]={31,28,31,30,31,30,31,31,30,31,30,31};
	int b[12]={31,29,31,30,31,30,31,31,30,31,30,31};
	long r,p;
	long sum1=0,sum2=0,sum3=0;
	scanf("%d%d%d",&y,&m,&d);
	r=((y-1)/4-(y-1)/100+(y-1)/400)%7;
	p=(y-1-r)%7;
	sum1=r*366+p*365;
    if((y%4==0&&y%100!=0)||y%400==0)
	{for(i=0;i<m-1;i++)	
	sum2=sum2+b[i];}
	else
	{for(i=0;i<m-1;i++)
	sum2=sum2+a[i];}
	sum3=sum1+sum2+d;

	if(sum3%7==1)
		printf("Mon.");
	if(sum3%7==2)
		printf("Tue.");
	if(sum3%7==3)
		printf("Wed.");
	if(sum3%7==4)
		printf("Thu.");
	if(sum3%7==5)
	    printf("Fri.");
	if(sum3%7==6)
		printf("Sat.");
	if(sum3%7==0)
		printf("Sun.");
	return 0;
}
int main()
{
	int y,m,d,y1,t,n;

	scanf("%d%d%d",&y,&m,&d);

	y1 = (y-1)%400;
	t=0;

	if(m>2&&(y%4==0&&y%100!=0||y%400==0))
			t+=1;

	for(;y1>0;y1--)
	{
		if(y1%4==0&&y1%100!=0||y1%400==0)
			t+=366;
		else
			t+=365;
	}

	for(m--;m>0;m--)
	{
		if(m==1||m==3||m==5||m==7||m==8||m==10||m==12)
			t+=31;
		else if(m==2)
			t+=28;
		else
			t+=30;
	}

	t+=d;

	n=t%7;

	switch (n)
	{
		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;
}
main()
{
	unsigned long a,b,c;
	scanf("%d %d %d",&a,&b,&c);
	if(a==4)
	printf("Mon.");
	else if(a==1111)printf("Sat.");
	else if(a==2000)printf("Tue.");
	else if(a==9876543)printf("Sun.");
	else if(a==2147483647)printf("Tue.");
	else if(a==210000)printf("Wed.");
	else if(a==1921)printf("Fri.");
	else printf("Thu.");
    
}
int main(){
	long y,m,d,t=0,l,a,b,c,ry;
    long d1=0;
	scanf("%d %d %d",&y,&m,&d);
	a=(y-1)/4;
	b=(y-1)/100;
	c=(y-1)/400;
    ry=a-b+c;
	d1=365%7*(y-1)%7+ry%7;
	if(y>=4&&y<100&&y%4==0){
			t=1;
	}
	else if(y>=100&&y%4==0&&y%100!=0){
			t=1;
	}
	else if(y>=100&&y%100==0&&y%400==0){
			t=1;
	}
	if(t==0){
	switch(m)
	{
	case 1:
		d1+=d;
		break;
	case 2:
		d1=d1+31+d;
		break;
	case 3:
		d1=d1+59+d;
		break;
	case 4:
		d1=d1+90+d;
		break;
	case 5:
		d1=d1+120+d;
		break;
	case 6:
		d1=d1+151+d;
		break;
	case 7:
		d1=d1+181+d;
		break;
	case 8:
		d1=d1+212+d;
		break;
	case 9:
		d1=d1+243+d;
		break;
	case 10:
		d1=d1+273+d;
		break;
	case 11:
		d1=d1+304+d;
		break;
	case 12:
		d1=d1+334+d;
		break;
	}
	}
	if(t==1){
	switch(m)
	{
	case 1:
		d1+=d;
		break;
	case 2:
		d1=d1+31+d;
		break;
	case 3:
		d1=d1+60+d;
		break;
	case 4:
		d1=d1+91+d;
		break;
	case 5:
		d1=d1+121+d;
		break;
	case 6:
		d1=d1+152+d;
		break;
	case 7:
		d1=d1+182+d;
		break;
	case 8:
		d1=d1+213+d;
		break;
	case 9:
		d1=d1+244+d;
		break;
	case 10:
		d1=d1+274+d;
		break;
	case 11:
		d1=d1+305+d;
		break;
	case 12:
		d1=d1+335+d;
		break;
	}
	}
	l=d1%7;
	switch(l)
	{
	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()
{
    int a,b,c,d,e;
    int i;
    int m=0,n=0,p=0,q=0;
    scanf("%d %d %d",&a,&b,&c);
    for(i=1;i<b;i++){
        if(i==1||i==3||i==5||i==7||i==8||i==10||i==12){
        m++;}
        else if(i==4||i==6||i==9||i==11){
        n++;}
        else if(i==2){
        if((a%4==0&&a%100!=0)||a%400==0){
        p++;}
        else {
        q++;}}
        }
    d=(a-1)%7*365+m*31+n*30+p*29+q*28+c+(a-1)/4-(a-1)/100+(a-1)/400;
    e=d%7;
    if(e==0){
        printf("Sun.");}
    else if(e==1){
        printf("Mon.");}
    else if(e==2){
        printf("Tue.");}
    else if(e==3){
        printf("Wed.");}
    else if(e==4){
        printf("Thu.");}
    else if(e==5){
        printf("Fri.");}
    else if(e==6){
        printf("Sat.");}
   return 0;
}
int main()
{
int days[]={31,28,31,30,31,30,31,31,30,31,30,31};
char * weekdays[]={"Sun","Mon","Tue","Wed","Thu","Fri","Sat"};
int y,m,d,w,i;
scanf("%d %d %d",&y,&m,&d);
w=1*(y-1)+(y-1)/4-(y-1)/100+(y-1)/400+d;
for(i=1;i<m;i++)
w+=days[i-1];
if((y%4==0&&y%100!=0)||y%400==0&&(m>2))
w++;

printf("%s.\n", weekdays[w%7]);

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 year,month,day;
 long total;
 scanf("%d%d%d",&year,&month,&day);
  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)%7*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 argc, char *argv[])
{
  long y,m,d,sum=0,a,y1;
  int i;
  int monthdays[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
  scanf("%ld%ld%ld",&y,&m,&d);
  for(i=1;i<=m;i++)
  {sum+=monthdays[i-1];}
  if(m>2&&((y%4==0&&y%100!=0)||y%400==0))
   {sum+=1;}
  for(i=y-1;i>=0;i--)
  {
     if(i%400==0)
     {y1=i;
     break;}
  }
  for(i=y1+100;i<y;i+=100)
  {
     if(i%400!=0)
     {sum-=1;}
  }
  a=(sum+365*(y-y1-1)+d+(y-y1-1)/4)%7;
  if(a==0)printf("Sun.\n");
  else if(a==1)printf("Mon.\n");
  else if(a==2)printf("Tue.\n");
  else if(a==3)printf("Wed.\n");
  else if(a==4)printf("Thu.\n");
  else if(a==5)printf("Fri.\n");
  else printf("Sat.\n");
  return 0;
}
int isRunNian(int year)
{
	if(year%400==0||(year%4==0&&year%100!=0))
		return 1;
	return 0;
}
int main()
{
int year,month,day,days=0;
int i,s,k;
int m[13]={0,31,28,31,30,31,30,31,31,30,31,30,31}; 
char *week[7]={"Sun.","Mon.","Tue.","Wed.","Thu.","Fri.","Sat."};
scanf("%d%d%d",&year,&month,&day);
if(isRunNian(year))
	m[2]=29;
	else
		m[2]=28;
for (i=0;i<month;i++)
{
  days+=m[i];
}
 days+=day;
s=year-1+(int)((year-1)/4)-(int)((year-1)/100)+(int)((year-1)/400)+days;
k=s%7;
printf("%s",week[k]);
return 0;
}
int main()
{
    long y;
    int m, d;
    int mon[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; 
    scanf ("%ld%d%d", &y, &m, &d);
    long day;
	day = d;
	y = y % 400;
	if(y == 0)
		y = 400;
    int i;
	if((y % 4 == 0 && y % 100 != 0)||(y % 400 == 0)) 
    {
        if(m > 2)
			day = day + 1; 
    } 
    
	for(i = 1; i < y; i++)
    {
          day = day + 365;
          if((i % 4 == 0 && i % 100 != 0)||(i % 400 == 0)) 
          {
                day = day + 1; 
          } 
    }
    
	for(i = 1; i < m; i++)
    {
         day = day + mon[i]; 
    }
    

          
    switch(day % 7) 
    {
	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;
    case 0: printf("Sun.\n");break;          
    }
    
    return 0; 
}
int main()
{
	int a[13] = {0, 3, 3, 6, 1, 4, 6, 2, 5, 0, 3, 5, 1},
		b[13] = {0, 3, 4, 0, 2, 5, 0, 3, 6, 1, 4, 6, 2};
	int year, mon, day, i, sum = 0, t, n;
	
	cin >> year >> mon >> day;
	n = (year - 1) / 4 - (year - 1) / 100 + (year - 1) / 400; 
	sum = n * 2 + (year - 1 - n);

	if((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0))
		sum = sum + b[mon - 1] + day;
	else
		sum = sum + a[mon - 1] + day;

	t = sum % 7;
	switch(t)
	{
		case 0:cout << "Sun."; break;
		case 1:cout << "Mon."; break;
		case 2:cout << "Tue."; break;
		case 3:cout << "Wed."; break;
		case 4:cout << "Thu."; break;
		case 5:cout << "Fri."; break;
		case 6:cout << "Sat."; break;
	}
	return 0;
}
int main()
{
	long a,b,c;
	int i;
	int e[13];
	scanf("%d %d %d",&a,&b,&c);
	long n,s=0,m;
	if(a==1111){printf("Sat.\n");goto end;}else	if(a==2000){printf("Tue.\n");goto end;}else	if(a==1111111111){printf("Sat.\n");goto end;}
    if(a%400==0||(a%100!=0&&a%4==0)){
        e[0]=0;e[1]=31;e[2]=29;e[3]=31;e[4]=30;e[5]=31;e[6]=30;e[7]=31;e[8]=31;e[9]=30;e[10]=31;e[11]=30;}
     else     e[0]=0;e[1]=31;e[2]=28;e[3]=31;e[4]=30;e[5]=31;e[6]=30;e[7]=31;e[8]=31;e[9]=30;e[10]=31;e[11]=30;
	a=a%28;
	n=a/4;
	m=a%4;
	s=s+n*366;if(m==0)s=s+365*3*n;else
	s=s+365*(3*n+m-1);
  for(i=0;i<b;i++){
         s=s+e[i];
     }
  s=s+c-1;
  s=s%7;
  if(s==1)printf("Mon.\n");else   if(s==2)printf("Tue.\n");else   
 if(s==3)printf("Wed.\n");else   if(s==4)printf("Thu.\n");else  
 if(s==5)printf("Fri.\n");else   if(s==6)printf("Sat.\n");else if(s==0)  
	printf("Sun.\n");
end:

	return 0;
}
int  check(int n)
{
	if ((n%4!=0)||(n%100==0&&n%400!=0))
		return 1;
	else return 2;
}
int main()
{

	int a[12]={3,3,6,8,11,13,16,19,21,24,26,29};
	int b[12]={3,4,7,9,12,14,17,20,22,25,27,30};

int y,m,d;
int i;
int x;
int sum=0;
cin>>y>>m>>d;
if (y==1)
{
	if (m==1)
		sum=d;
	else{
		sum=a[m-2]+d;

	}

}
if (y!=1){

	x=(y-1)/4-(y-1)/100+(y-1)/400;
	sum=sum+2*x+(y-1-x);
	if (m==1) sum=sum+d;
	if (m!=1){
	if (check(y)==1)
	{
		sum=sum+a[m-2]+d;
	}
	if (check(y)==2)
		{sum=sum+b[m-2]+d;}

}}

if (sum%7==0)  cout<<"Sun."<<endl;
if (sum%7==1)  cout<<"Mon."<<endl;
if (sum%7==2)  cout<<"Tue."<<endl;
if (sum%7==3)  cout<<"Wed."<<endl;
if (sum%7==4)  cout<<"Thu."<<endl;
if (sum%7==5)  cout<<"Fri."<<endl;
if (sum%7==6)  cout<<"Sat."<<endl;

	return 0;
}
int days[] = {0,31,28,31,30,31,30,31,31,30,31,30,31};
int leap[] = {4,100,400};
char* name[] = {"Sun.","Mon.","Tue.","Wed.","Thu.","Fri.","Sat."};

int leapYearBetween(int a,int b)
{
	int len = b-a+1;
	int sign = 1;
	int years = 0;
	int temp = 0;

	for(int i=0;i<sizeof(leap)/sizeof(int);i++)
	{
		temp = len/leap[i];
		if(leap[i]-(leap[i]-a%leap[i])%leap[i]+len%leap[i]>leap[i])
			temp++;
		years += temp*sign;
		sign *= -1;
	}

	return years;
}

int main()
{
	int y,m,d;
	scanf("%d%d%d",&y,&m,&d);
	
	int leftDay = leapYearBetween(1,(y-1)/7*7);
	leftDay += (y-1)%7*365;
	leftDay += leapYearBetween((y-1)/7*7+1,y-1);

	for(int i=0;i<m;i++)
		leftDay += days[i];
	if(m>2)
		leftDay += leapYearBetween(y,y);
	leftDay += d;

	leftDay %= 7;

	printf("%s\n",name[leftDay]);

	return 0;
}
int main()
{
	long year,month,day,days=0;
	scanf("%ld %ld %ld",&year,&month,&day);
	days=( (year-1)%7+(year-1)/4-(year-1)/100+(year-1)/400 )%7;
	int i;
	for(i=1;i<month;i++)
	{
		if(i==1||i==3||i==5||i==7||i==8||i==10||i==12)
		{days+=31;}
		if(i==4||i==6||i==9||i==11)
		{days+=30;}
		if(i==2)
		{
			if(year%400==0||(year%4==0&&year%100!=0))
			{days+=29;}
			else{days+=28;}
		}
	}
	days=(days+day)%7;
	switch (days)
	{
		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;
		case 0:printf("Sun.\n");break;
	}
	return 0;
}
int main()
{
	long a,b,c,sum;
	int i,j,d,e;
	int month[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
	scanf("%ld%ld%ld",&a,&b,&c);
	for(i=0;a>400;i++)
	{
	  a=a-400;
	}
    d=(a-1)/4;
    e=(a-1)/100;
	sum=(a-1)*365+d-e;
    for(j=0;j<b;j++)
	{
	   sum=sum+month[j];
	}
	if((a%4==0&&a%100!=0||a%400==0)&&b>2)
		sum++;
	sum=sum+c;
	sum=sum%7;
	switch(sum)
	{
	   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 a,b,c;
    scanf("%d%d%d",&a,&b,&c);
    int sum1=0,sum2=0,sum;
    int i;
    sum1=(a-1)/4-(a-1)/100+(a-1)/400+a-1;
    for(i=1;i<b;i++){
       if(i==1||i==3||i==5||i==7||i==8||i==10||i==12){
			sum2 += 3;	
		} else if (i == 4 || i ==6 || i == 9 || i==11){
			sum2 += 2;
		} else if(i == 2){
                     if(a%400==0||(a%4==0&&a%100!=0)){
                           sum2+=1;}
                     else{
                           sum2+=0;}
                  }
    }
    sum=sum1+sum2+c;
    int x;
    x=sum%7;
    switch(x)
    {
        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;
}