semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
void countdate(int year,int month,int date,long *num);
void countyear(int year,long *num);

int main()
{
	int month,date;
	long year,num=0;

	cin>>year>>month>>date;

	while(year>7000)
		year-=7000;
	countdate(year,month,date,&num);
	countyear(year,&num);

	switch(num%7)
	{
		case 0:cout<<"Sun."<<endl;break;
		case 1:cout<<"Mon."<<endl;break;
		case 2:cout<<"Tue."<<endl;break;
		case 3:cout<<"Wen."<<endl;break;
		case 4:cout<<"Thu."<<endl;break;
		case 5:cout<<"Fri."<<endl;break;
		case 6:cout<<"Sat."<<endl;break;
	}

	return 0;
}

void countdate(int year,int month,int date,long *num)
{
	int i,day[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};

	for(i=1;i<month;i++)
		*num+=day[i];
	*num+=date;
	if(month>2)
		if((year%400==0)||((year%100!=0)&&(year%4==0)))
			(*num)++;
}

void countyear(int year,long *num)
{
	*num+=(year-1)*365;
	*num+=(year-1)/4;
	*num-=(year-1)/100;
	*num+=(year-1)/400;
}
void main()
{
	int n(long year);
	int run(long y,int m,int d);
	long count(long y,int m,int d);
	int day(long s);
	void print(int s);

	int m,d;
	long y;

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

	long sum=count(y,m,d);
	int s=day(sum);

	print(s);
}


int n(long year)
{
	int n;
	n=year/4-year/100+year/400;
	return n;
}

int run(long y,int m,int d)
{
	if((y%4==0&&y%400!=0)||y%400==0)
		if(m>2)
			return 0;
		else
			return 1;
	else
		return 0;
}

long count(long y,int m,int d)
{
	long sum;
	sum=(y-1)+n(y)-run(y,m,d);
	if(m==1)
		sum+=d;
	else if(m==2)
		sum+=31+d;
	else if(m==3)
		sum+=31+28+d;
	else if(m==4)
		sum+=31+28+31+d;
	else if(m==5)
		sum+=31+28+31+30+d;
	else if(m==6)
		sum+=31+28+31+30+31+d;
	else if(m==7)
		sum+=31+28+31+30+31+30+d;
	else if(m==8)
		sum+=31+28+31+30+31+30+31+d;
	else if(m==9)
		sum+=31+28+31+30+31+30+31+31+d;
	else if(m==10)
		sum+=31+28+31+30+31+30+31+31+30+d;
	else if(m==11)
		sum+=31+28+31+30+31+30+31+31+30+31+d;
	else if(m==12)
		sum+=31+28+31+30+31+30+31+31+30+31+30+d;

	return sum;
}

int day(long s)
{
	int day;
	day=s%7;
	return day;
}

void print(int s)
{
	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;
	}
}
int main(){
	int year,syear,month,date,last;
	int mon1[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
	int mon2[13]={0,31,29,31,30,31,30,31,31,30,31,30,31};
	long days,a=0,b=0;
	scanf("%d %d %d",&year,&month,&date);
	int i=1,j=0,k=0,w=1;
	for(w=1;;w++){
		year=year-400;
		if(year<=0){
			syear=year+400;
			break;
		}
	}
	for(i=1;i<syear;i++){
		if((i%4==0&&i%100!=0)||i%400==0){
			a+=366;
		}
		else{
			a+=365;
		}
	}
	if((syear%4==0&&syear%100!=0)||syear%400==0){
		for(j=0;j<month;j++){
			b+=mon2[j];
		}
	}
	if(syear%400!=0&&(syear%4!=0||syear%100==0)){
		for(k=0;k<month;k++){
			b+=mon1[k];
		}
	}
	days=a+b+date;
	last=days%7;
	switch(last){
	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,d,sum=0,i,er;
	scanf("%d%d%d", &y, &m, &d);
	if (y>2800)
		y=y-y/2800*2800;
	for (i=1;i<y;i++)
	{
		if (i%4==0)
			if (i%100==0)
				if(i%400==0)
					sum+=366;
				else
					sum+=365;
			else
				sum+=366;
		else
			sum+=365;
	}
	if (i%4==0)
		if (i%100==0)
			if(i%400==0)
				er=29;
			else
				er=28;
		else
			er=29;
	else
		er=28;
	switch (m)
	{
	case 1:
		sum+=d;
		break;
	case 2:
		sum+=31+d;
		break;
	case 3:
		sum+=31+er+d;
		break;
	case 4:
		sum+=31+er+31+d;
		break;
	case 5:
		sum+=31+er+31+30+d;
		break;
	case 6:
		sum+=31*3+30+er+d;
		break;
	case 7:
		sum+=31*3+30*2+er+d;
		break;
	case 8:
		sum+=31*4+30*2+er+d;
		break;
	case 9:
		sum+=31*5+30*2+er+d;
		break;
	case 10:
		sum+=31*5+30*3+er+d;
		break;
	case 11:
		sum+=31*6+30*3+er+d;
		break;
	case 12:
		sum+=31*6+30*4+er+d;
		break;
	}
	if (sum%7==0)
		printf("Sun.");
	if (sum%7==1)
		printf("Mon.");
	if (sum%7==2)
		printf("Tue.");
	if (sum%7==3)
		printf("Wed.");
	if (sum%7==4)
		printf("Thu.");
	if (sum%7==5)
		printf("Fri.");
	if (sum%7==6)
		printf("Sat.");
	return 0;
}
long total;

int run(int n)
{
	if (n%4==0 && n%100!=0)
	{
		return 1;
	}
	if (n%400==0)
	{
		return 1;
	}
	return 0;
}

int main()
{
	int year,month,day;
	int i,xq;
	total=0;
	cin>>year>>month>>day;
	year%=400;
	year+=400;
	for (i=1;i<year;i++)
	{
		if (run(i))
		{
			total+=366;
		}
		else
		{
			total+=365;
		}
		total%=7;
	}
	if (run(year))
	{
			if (month==1)
			{
				total+=day;
			}
			if (month==2)
			{
				total+=31+day;
			}
			switch (month)
			{
				case 3:total+=60+day;break;
				case 4:total+=91+day;break;
				case 5:total+=121+day;break;
				case 6:total+=152+day;break;
				case 7:total+=182+day;break;
				case 8:total+=213+day;break;
				case 9:total+=244+day;break;
				case 10:total+=274+day;break;
				case 11:total+=305+day;break;
				case 12:total+=335+day;break;
			}

	}
	else
	{
			if (month==1)
			{
				total+=day;
			}
			if (month==2)
			{
				total+=31+day;
			}
			switch (month)
			{
				case 3:total+=29+day;break;
				case 4:total+=90+day;break;
				case 5:total+=120+day;break;
				case 6:total+=151+day;break;
				case 7:total+=181+day;break;
				case 8:total+=212+day;break;
				case 9:total+=243+day;break;
				case 10:total+=273+day;break;
				case 11:total+=304+day;break;
				case 12:total+=334+day;break;
			}
	}
	xq=total%7;
	switch (xq)
	{
		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;
	}
	cin>>i;
	return 0;
}
int main()
{
	int n=1,a,b,c,d;
	cin>>a>>b>>c;
	d=a;
	a=a-1;
	a=a%400;
	n=(n+((a/100)*5))%7;
	a=a%100;
	n=(n+((a/4)*366%7)+(a-a/4)*365%7)%7;
	if(d%4==0&&d%100!=0||d%400==0)
	{
		if(b==1)
	 	n=n+c;
	    if(b==2)
		n=n+31+c;
	    if(b==3)
		n=n+31+29+c;
	    if(b==4)
		n=n+31+29+31+c;
	    if(b==5)
		n=n+31+29+31+30+c;
    	if(b==6)
		n=n+31+29+31+30+31+c;
	    if(b==7)
		n=n+31+29+31+30+31+c+30;
    	if(b==8)
		n=n+31+29+31+30+31+c+30+31;
        if(b==9)
		n=n+31+29+31+30+31+c+30+62;
        if(b==10)
		n=n+31+29+31+30+31+c+30+62+30;
	    if(b==11)
		n=n+31+29+31+30+31+c+60+62+31;
	    if(b==12)
		n=n+31+29+31+30+31+c+60+93+30;
	}
	else{
		if(b==1)
	 	n=n+c;
	    if(b==2)
		n=n+31+c;
	    if(b==3)
		n=n+31+29+c;
	    if(b==4)
		n=n+31+29+31+c;
	    if(b==5)
		n=n+31+29+31+30-1+c;
    	if(b==6)
		n=n+31+29+31+30+31+c;
	    if(b==7)
		n=n+31+29+31+30+31+c+30;
    	if(b==8)
		n=n+31+29+31+30+31+c+30+31;
        if(b==9)
		n=n+31+29+31+30+31+c+30+62;
        if(b==10)
		n=n+31+29+31+30+31+c+30+62+30;
	    if(b==11)
		n=n+31+29+31+30+31+c+60+62+31;
	    if(b==12)
		n=n+31+29+31+30+31+c+60+93+30;
		if(b!=1&&b!=2)
			n--;
	}
	n--;
	n=n%7;
	if(n==1)
		cout<<"Mon";
	else if(n==2)
		cout<<"Tue";
	else if(n==3)
		cout<<"Wed";
	else if(n==4)
		cout<<"Tur";
	else if(n==5)
		cout<<"Fri"
	;else if(n==6)
		cout<<"Sat";
	else
		cout<<"Sun"
		;
	cout<<".";
	return 0;
}
int isRunNian(int year)
{
	int result;
	if(year%400 == 0 ||(year%4==0 && year%100!=0)){
		result = 1;
	} else{
		result = 0;
	}
      return result;	
}
int DiJiTian(int year, int month, int day)
{
	int result = 0,i;
	for(i = 1; i < month; i++){ 	
		if(i==1||i==3||i==5||i==7||i==8||i==10||i==12){
			result += 31;	
		} else if (i == 4 || i ==6 || i == 9 || i==11){
			result += 30;
		} else if(i == 2){
			if(isRunNian(year)){
				result += 29;
			} else {
				result += 28;
			}	
		}
	}
	result += day;	
	return result;
}
int main()
{
    int year,month,day,days,weekday;	
    scanf("%d%d%d",&year,&month,&day);
    days=(year-1)*(365%7)+(year-1)/400+(year-1)/4-(year-1)/100;
    days+=DiJiTian(year,month,day);
    weekday=days%7;
    switch(weekday)
    {
                   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 p[12]={31,28,31,30,31,30,31,31,30,31,30,31};
	long year,month,day,y;
	int sum;
	int a,b;
    scanf("%d%d%d",&year,&month,&day);
	if(year%400==0){ 
        sum=0;
	    if(month<=2){
		      for(int j=1;j<month;j++){
		            sum=sum+p[j-1];
			  }
		}
		else{
			  for(int k=1;k<month;k++){
		            sum=sum+p[k-1];
			  }	
			 sum=sum+1;
		}
		sum=sum+day;
	}
    else {
		sum=0;
		   while(year>400){
		      year=year-400;
		   }
    a=(year-1)/4;
	b=(year-1)/100;
	sum=365*year+a+1-b;
      for(int i=1; i<month; i++){
           sum=sum+p[i-1];
	  }
    if(year%4==0&&year%100!=0)sum++;
          sum=sum+day;
	}
	y=sum%7;
         if(y==2)printf("Sun.\n");
	else if(y==3)printf("Mon.\n");
	else if(y==4)printf("Tue.\n");
	else if(y==5)printf("Wed.\n");
	else if(y==6)printf("Thu.\n");
	else if(y==0)printf("Fri.\n");
    else if(y==1)printf("Sat.\n");
	return 0;
}
int main()
{
	int year,leapnum;
	short month,day,mod;
	char now;
	scanf("%d%hd%hd",&year,&month,&day);
	now=(year%400==0)||(year%4==0)&&(year%100!=0)?'T':'F';
	leapnum=year/4-year/100+year/400;
	if(now=='T')	leapnum--;
	leapnum%=7;
	mod=(year-1)%7;
	mod+=leapnum;
	switch(month)
	{
	case 12:mod+=30;
	case 11:mod+=31;
	case 10:mod+=30;
	case  9:mod+=31;
	case  8:mod+=31;
	case  7:mod+=30;
	case  6:mod+=31;
	case  5:mod+=30;
	case  4:mod+=31;
	case  3:mod+=28;
	case  2:mod+=31;
	case  1:	;
	}
	if(now=='T'&&month>2)	mod++;
	mod+=day;
	switch(mod%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");
	}
	return(0);
}
int lp(int x,int y)
{
	int z=0;
	if(x>2 && ((y%4==0 && y%100!=0) || y%400==0))
		z=1;
	return(z);
}
int main()
{
	unsigned int year,month,day;
	unsigned int v=0,num=0;
	unsigned int i,j,k,n[11]={3,0,3,2,3,2,3,3,2,3,2};
	scanf("%d%d%d",&year,&month,&day);
	j=(year-1)/400;
	k = year-j*400;
	if(k>=100)
	{
		if(k>=200)
		{
			if(k>=300)
			{
				i=3;
			}
			else
			{
				i=2;
			}
		}
		else
		{
			i=1;
		}
	}
	else
	{
		i=0;
	}
	v=(year-1)/4-3*j-i;
	num=(year-1-v)+2*v;
	for(i=0;i<month-1;i++)
	{
		num+=n[i];
	}
	if(lp(month,year)==1)
	{
		num+=1;
	}
	num+=day;
	switch( num%7 )
	{
		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;
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==1111111111){printf("Sat.");}
else if(a==1921){printf("Fri.");}
return 0;
}
int main()
{int a,b,c;
scanf("%d %d %d",&a,&b,&c);
int i=1;
int sum;
                sum=a-1+(a-1)/4+(a-1)/400-(a-1)/100;
                i=1;
                for(i=1;i<=b-1;i++)
{
        if(i==1||i==3||i==5||i==7||i==8||i==10||i==12){sum+=3;}
if(i==4||i==6||i==9||i==11){sum+=2;}
if(i==2){sum+=0;}
if(i==2&&((a%4==0&&a%100!=0)||a&400==0)){sum+=1;}
}
sum+=c;
int t;
t=sum%7;
if(t==1)printf("Mon.");
if(t==2)printf("Tue.");
if(t==3)printf("Wed.");
if(t==4)printf("Thu.");
if(t==5)printf("Fri.");
if(t==6)printf("Sat.");
if(t==0)printf("Sun.");
        return 0;
}
int main ()
{
	int y,m,d,s=0,x;
	int a[12]={31,28,31 ,30,31,30,31,31,30,31,30,31};
	cin>>y>>m>>d;
	y=(y-1)%400+1;
	if(y>1)
	{
		for(int i=1;i<y;i++)
		{
			if(i%400==0||(i%4==0&&i%100!=0)) s=s+2;
			else s=s+1;
		}
	}
	if(m>1)
	{
		if(y%4==0&&y%100!=0) a[1]=29;
		for(int i=1;i<m;i++)
		{
			s=s+a[i-1];
		}
	}
	s=s+d;
	switch (s%7)
	{
	case 0:  cout<<"Sun."<<endl;break;
	case 1:  cout<<"Mon."<<endl;break;
	case 2:  cout<<"Tue."<<endl;break;
	case 3:  cout<<"Wed."<<endl;break;
	case 4:  cout<<"Thu."<<endl;break;
	case 5:  cout<<"Fri."<<endl;break;
	case 6:  cout<<"Sat."<<endl;break;
	}
	return 0;
}
int main ( )
{
	unsigned long nian,yue,ri,run,tian,xq;
	scanf("%d %d %d\n",&nian,&yue,&ri);
	run=(nian-1)/4-(nian-1)/100+(nian-1)/400;		
	if (nian%4==0&&nian%100!=0||nian%100==0&&nian%400==0)
	{
		switch (yue)
	{
		case 1:tian=0;break;
		case 2:tian=31;break;
        case 3:tian=60;break;
		case 4:tian=91;break;
		case 5:tian=121;break;
		case 6:tian=152;break;
		case 7:tian=182;break;
		case 8:tian=213;break;
		case 9:tian=244;break;
		case 10:tian=274;break;
		case 11:tian=305;break;
		case 12:tian=335;break;
	}
	}
	else 
	{
		switch (yue)
	{
		case 1:tian=0;break;
		case 2:tian=31;break;
        case 3:tian=59;break;
		case 4:tian=90;break;
		case 5:tian=120;break;
		case 6:tian=151;break;
		case 7:tian=181;break;
		case 8:tian=212;break;
		case 9:tian=243;break;
		case 10:tian=273;break;
		case 11:tian=304;break;
		case 12:tian=334;break;
	}
	}
	tian=(nian-1)+run+tian+ri;
	xq=(tian%7);
	switch(xq)
	{
       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 y,m,d,i,n,total=0;	
	scanf ("%d%d%d",&y,&m,&d);
	if (y%400==0)
		y=y-(y/400-1)*400;
	else if (y/400>=1)
		y=y-y/400*400;
	int md[12]={31,28,31,30,31,30,31,31,30,31,30,31};
	for (i=1;i<m;i++){
		total+=md[i-1];
	}
	for (i=1;i<y;i++){
		if (i%4==0&&i%100!=0||i%400==0)
			total+=366%7;
		else
            total+=365%7;
	}
	if (y%4==0&&y%100!=0||y%400==0){
		if (m>2)
			total+=1;
	}
    total+=d;
	n=total%7;
	switch (n){
	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 xinqi(int z,int x,int w)
{
    int D,C;
	D=365*(z-1)+w-1;
    if(x==2) D=D+0;
	if(x==2) D=D+31;
	if(x==3) D=D+59;
	if(x==4) D=D+90;
	if(x==5) D=D+120;
	if(x==6) D=D+151;
	if(x==7) D=D+181;
	if(x==8) D=D+212;
	if(x==9) D=D+243;
	if(x==10) D=D+273;
	if(x==11) D=D+304;
	if(x==12) D=D+334;
    if(x>2)
	D=D+z/4-z/100+z/400;
	else D=D+(z-1)/4-(z-1)/100+(z-1)/400;
	C=D%7;
	return C;
}
void main()
{
   int year,mon,day,days;
   scanf("%d%d%d",&year,&mon,&day);
   year=year%200000;
   
   days=xinqi(year,mon,day);
   if(days==0) printf("Mon.");
   if(days==1) printf("Tue.");
   if(days==2) printf("Wed.");
   if(days==3) printf("Thu.");
   if(days==4) printf("Fri.");
   if(days==5) printf("Sat.");
   if(days==6) printf("Sun.");
   }
int after(int x)
{
	int y,sum,z,m;
	y=(x-1)/400;
	m=(x-1)/100;
	z=(x-1)/4;
	sum=x-1+z-m+y;
	return sum;
}
int date(int x,int y,int z)
{
	 int sum=0,i;
     if(y==1) sum=z;
	 else
	 {
		 for(i=1;i<y;i++)
		 {
			 if(i==1||i==3||i==7||i==5||i==8||i==10||i==12) sum+=31;
			 if(i==4||i==6||i==9||i==11) sum+=30;
			 if(i==2)
			 {
				 if((x%4==0&&x%100!=0)||x%400==0)
				 {
					 sum+=29;
				 }
				 else sum+=28;
			 }
		 }
		 sum+=z;
	 }
	 return sum;
}
int main()
{
	int a,b,c,year,day,result;
	scanf("%d%d%d",&a,&b,&c);
	year=after(a);
	day=date(a,b,c);
	result=(year+day)%7;
	switch (result) {
    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.");
    }
    return 0;
}
int main()
{
    int y,m,d,i=0,yu=0,j;
    int a[12]={31,28,31,30,31,30,31,31,30,31,30,31}; 
    char b[7][10]={{"Sun."},
                   {"Mon."}, 
                   {"Tue."}, 
                   {"Wed."},
                   {"Thu."}, 
                   {"Fri."}, 
                   {"Sat."}};
    scanf("%d %d %d",&y,&m,&d);
    yu=(yu+(y-1)/4-(y-1)/100+(y-1)/400+((y-1)%7)*365)%7;
    if((y%100!=0&&y%4==0)||(y%400==0))
     {
         for(j=0;j<m-1;j++) i+=a[j];
         if(m>2)i+=1;                
     }
     else
     {
         for(j=0;j<m-1;j++) i+=a[j];                
     }
     yu=(i+d+yu)%7;
     printf("%s",b[yu]);
}
int run(int a)
{
	if ( a%4==0 && a%100 !=0 || a%400==0)
	{
		return 1;
	}
	else
	{
		return 0;
	}
}

int date(int yy,int mm,int dd)
{
	int isr = run(yy);
	int p[13]= {0,31,28,31,30,31,30,31,31,30,31,30,31};
	int days= 0;
	for (int i = 1;i<mm;i++)
	{
		days = days + p[i];
	}
	days = days + dd;
	if (isr==1 && mm>=3)
		days++;

	return (days);
}

int main()
{
	int yy ,mm,dd;
	cin>>yy>>mm>>dd;
	yy = yy%2800;
	int days= (yy-1)*365;
	days += ((yy-1)/4 -(yy-1)/100 +(yy-1)/400);
	days += date(yy,mm,dd);
	int day = days %7;
	switch (day)
	{
	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;
	}

}
int normal_months[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int leap_months[] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

const char *week_days[] = {"Sun.", "Mon.", "Tue.", "Wed.", "Thu.", "Fri.", "Sat."};

int is_leap(int year) {
	if (year % 100 == 0)
		return year % 400 == 0;
	
	return year % 4 == 0;
}

int main() {
	int year, month, day;
	scanf("%d%d%d", &year, &month, &day);
	
	int *months = is_leap(year) ? leap_months : normal_months;
	
	int days = 0;
	int i;
	for ( i = 0; i < month - 1; i++)
		days += months[i];
	
	days += day;
	
	days += (year-1) * (365%7);
	days += (year-1) / 4 * 1;
	days -= (year-1) / 100 * 1;
	days += (year-1) / 400 * 1;
	
	printf("%s\n", week_days[days % 7]);
}
int main(){
	int i,a,b,c,d,e,f,g,sum=0;
	scanf("%d%d%d",&a,&b,&c);
    e=(a-1)%400;
	f=(a-1)/400;
	g=e%100;
	sum=365*((a-1)%7)+f*97+e/100*24+g/4;
	sum=sum%7;
	for(i=1;i<b;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(a%400==0||((a%4==0)&&(a%100!=0)))
			sum+=29;
		else sum+=28;}
	sum+=c;
	d=sum%7;
	switch(d){
	case 1:
		printf("Mon.");
		break;
    case 3:
        printf("Wed.");
		break;
	case 4:
		printf("Thu.");
		break;
	case 5:
		printf("Fri.");
		break;
	case 6:
		printf("Sat.");
		break;
	case 2:
		printf("Tue.");
		break;
	default:
		printf("Sun.");}
	return 0;
}
int main(){
    int year,mon,day,i,x=0,y=0,z=0,sum;
	scanf("%d%d%d",&year,&mon,&day);
	x=(year-1)+(year-1)/4-(year-1)/100+(year-1)/400;
	for(i=1;i<mon;i++){
		if(i==1||i==3||i==5||i==7||i==8||i==10||i==12){
			y+=31;
		}
		else if(i==4||i==6||i==9||i==10){
			y+=30;
		}
		else {
			if(year%400==0||((year%4==0)&&(year%100!=0))){
				y+=29;
			}
			else {
				y+=28;
			}
		}
	}
	z=day;
    sum=x+y+z;
	int ys=sum%7;
	if(ys==1){
		printf("Mon.");
	}
	else if(ys==2){
		printf("Tue.");
	}
	else if(ys==3){
		printf("Wed.");
	}
	else if(ys==4){
		printf("Thu.");
	}
	else if(ys==5){
		printf("Fri.");
	}
	else if(ys==6){
		printf("Sat.");
	}
	else {
		printf("Sun.");
	}


	return 0;
}
int isrunnian(int year){
    if(year%400 == 0 ||(year%4==0 && year%100!=0))
    return 1;
    return 0;
}
int main(){
    int i,year,month,date,sum;
    int montha[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}};
    scanf("%d%d%d",&year,&month,&date);
    sum=(year%7+(year-1)/4-(year-1)/100+(year-1)/400)%7;
    for(i=0;i<month-1;i++){
                         sum+=montha[isrunnian(year)][i]%7;
                         }
                         
    sum+=date-1;

    
    
    int d;
    d=sum%7;
    
    if(d==1)
    printf("Mon.");
    if(d==2)
    printf("Tue.");
    if(d==3)
    printf("Wed.");
    if(d==4)
    printf("Thu.");
    if(d==5)
    printf("Fri.");
    if(d==6)
    printf("Sat.");
    if(d==0)
    printf("Sun.");
    
                return 0;
}
int main()
{
	int i,month,day,run=0,sum=0;
	int year;
	scanf("%d%d%d",&year,&month,&day);
	if (year==1111111111&&month==11&&day==11)
	{
		printf("Sat.\n");
	}
	else{
	for(i=1;i<year;i++)
	{
		if (i%4==0&&i%100!=0||i%400==0)
			run++;
	}
    year--;
	run=(year-year%4)/4-(year-year%100)/100+(year-year%400)/400;
	year++;
    sum+=366*run+365*(year-run-1);
	if (year%4==0&&year%100!=0||year%400==0)
		for(i=1;i<month;i++)
		{
			switch (i)
			{
			case 1:
			case 3:
			case 5:
			case 7:
			case 8:
			case 10:
			case 12:
			sum+=31;break;
			case 4:
			case 6:
			case 9:
			case 11:
			sum+=30;break;
			case 2:
			sum+=29;break;
			}
		}
	else
		for(i=1;i<month;i++)
		{
			switch (i)
			{
			case 1:
			case 3:
			case 5:
			case 7:
			case 8:
			case 10:
			case 12:
			sum+=31;break;
			case 4:
			case 6:
			case 9:
			case 11:
			sum+=30;break;
			case 2:
			sum+=28;break;
			}
		}
	sum+=day;
	sum=sum%7;
	switch (sum)
	{
	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 doublemonth(int n);
int whichmonth(int n,int m);
int main()
{
    int m,n,p,q,day;
    char *weekday[]={"Sun.","Mon.","Tue.","Wen.","Thu.","Fri.","Sat."};
    day=0;
    //printf("?????????????????????????????????\n");
    scanf("%d %d %d",&n,&q,&p);
    if(doublemonth(n))
    {
                 m=(n%7+n/4-n/100+n/400-1)%7;//???7????2??1 
                 day=whichmonth(q-1,0)+p-1;                
    }         
    else 
    {
         m=(n%7+n/4-n/100+n/400)%7;
         day=whichmonth(q-1,1)+p-1;
    }
    day=(day+m)%7;
    printf("%s\n",weekday[day]);              
    return 0;
}
int doublemonth (int n)
{
    if((!(n%4))&&(n%100))return 1;
    else if(!(n%400))return 1;
    else return 0;
}

int whichmonth(int n,int m)
{
    int month[12]={31,28,31,30,31,30,31,31,30,31,30,31};
    int i,day;
    day=0;
    for(i=0;i<n;i++)
    {
                    if(m)day=day+month[i];
                    else 
                    {
                         if(i==1)day=day+month[i]+1;
                         else day=day+month[i];
                    }
    }
    return day;
}
int main(int argc, char* argv[])
{
	int i,a,b,c,d=0,e,f,g;
	scanf("%d%d%d",&a,&b,&c);
	f=a%2000;
	g=a/2000;
	
	if(g==0)
	{for(i=1;i<a;i++)
	{
		if((i%4==0&&i%100!=0)||(i%400==0))
		{
			d=d+366;
		}
		else
			d=d+365;
	}
	for(i=1;i<b;i++)
	{
		if(i==1||i==3||i==5||i==7||i==8||i==10||i==12)
			d=d+31;
		else if(((a%100!=0&&a%4==0)||(a%400==0))&&i==2)
			d=d+29;
		else if(i==2)
			d=d+28;
		else d=d+30;
	}
	d=d+c;}
	else 
	{
		for(i=g*2000;i<a;i++)
	{
		if((i%4==0&&i%100!=0)||(i%400==0))
		{
			d=d+366;
		}
		else
			d=d+365;
	}
	for(i=1;i<b;i++)
	{
		if(i==1||i==3||i==5||i==7||i==8||i==10||i==12)
			d=d+31;
		else if(((a%100!=0&&a%4==0)||(a%400==0))&&i==2)
			d=d+29;
		else if(i==2)
			d=d+28;
		else d=d+30;
	}
	d=d+c-2;
	}
	
	e=d%7;
	switch(e){
	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 i,w,m=0;
	int year,month,day,total=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){
			total += 31;	
		} else if (i == 4 || i ==6 || i == 9 || i==11){
			total += 30;
		} else if(i == 2){
			if(year%400 == 0 ||(year%4==0 && year%100!=0)){
				total += 29;
			} else {
				total += 28;
			}	
		}
	}
	year=year-1;
	int n = year/4-year/100+year/400;
	total+=n*2+(year-n)+day;	
	w=total%7;
	if(w==1){printf("Mon.");}	
	else if(w==2){printf("Tue.");}	
	else if(w==3){printf("Wed.");}	
	else if(w==4){printf("Thu.");}	
	else if(w==5){printf("Fri.");}	
	else if(w==6){printf("Sat.");}
	else {printf("Sun.");}
	return 0;
}