semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int main()
{
	int year,month,day,a,day1=0,day2=0,k;
	scanf("%d%d%d",&year,&month,&day);
	a=(year-1)/4-(year-1)/100+(year-1)/400-(year-1)/10000+(year-1)/40000-(year-1)/1000000+(year-1)/4000000-(year-1)/100000000+(year-1)/400000000-(year-1)/10000000000+(year-1)/40000000000;
	day1=365*(year-1-a)+366*a;
	if (month==1) day2=day;
	if (month==2) day2=3+day;
	if (month==3) day2=3+day;
	if (month==4) day2=6+day;
	if (month==5) day2=1+day;
	if (month==6) day2=4+day;
	if (month==7) day2=6+day;
	if (month==8) day2=2+day;
	if (month==9) day2=5+day;
	if (month==10) day2=day;
	if (month==11) day2=3+day;
	if (month==12) day2=5+day;
	if ((((year%4==0)&&(year%100!=0))||(year%400==0))&&(month>2)) day2=day2+1;
	k=(day1+day2)%7;
	if (k==0) printf("Sun.\n");
	if (k==1) printf("Mon.\n");
	if (k==2) printf("Tue.\n");
	if (k==3) printf("Wed.\n");
	if (k==4) printf("Thu.\n");
	if (k==5) printf("Fri.\n");
	if (k==6) printf("Sat.\n");
	return 0;
}
/* Author: Xiong Shihao (xsh@pku.edu.cn)
 * ID: 1000010177
 * Compiler: gcc
 */


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

 return 0;
}
char week[7][5]={"Sun.","Mon.","Tue.","Wed.","Thu.","Fri.","Sat."};
int y1(int);
int d2(int,int,int);
int check(int);

int main()
{   
	int year,month,day;
	int sum=0;
	cin>>year>>month>>day;


	sum=sum+y1(year-1);
	sum=sum+d2(year,month,day);
	cout<<week[sum%7]<<endl;

	return 0;
}
int y1(int year)
{   
	int a=0;
	while(year>=400)
	{
		a=(a+97*2+400-97)%7;
		year=year-400;
	}


	while(year>=100)
	{
		a=(a+24*2+100-24)%7;
		year=year-100;
	}

	while(year>=1)
	{
		if(year%4==0)
			a=a+2;
		else
			a++;
		year--;
	}

	return a%7 ;
}
int check(int a)
{
	if(((a%4==0)&&(a%100!=0))||(a%400==0))
		return 1;
	else
		return 0;
}
int d2(int year,int m,int d)
{   
	int a[2][12]={{31,28,31,30,31,30,31,31,30,31,30,31},{31,29,31,30,31,30,31,31,30,31,30,31}};
	int count=0;
	if(m==1)
		return d%7;
	else
	     {
			 while(m>1)
	         {
		          count=(count+a[check(year)][m-2])%7;
		          m--;
	         }
			 count=count+d;
			 return count;
	    }
}
int main()
{
	int year, month, day, i, temp, day_year=365%7, day_month[12]={31,28,31,30,31,30,31,31,30,31,30,31};
	char week[7][5]={"Sun.","Mon.", "Tue.", "Wed.", "Thu.", "Fri.", "Sat."};
	scanf("%d%d%d", &year, &month, &day);
	temp = day_year*(year-1);
	temp += year/4-year/100+year/400;
	for(i=0; i<month-1;i++)
		temp+=day_month[i];
	temp += day;
	
	if(year%100==0&&year%400==0)
		if(month<=2)
			temp--;
	temp=temp%7;
	printf("%s\n", week[temp]);

    return 0;
}
int main()
{
	unsigned long int year,month,day,days,allday,m,n;
	scanf("%ld %ld %ld",&year,&month,&day);
	n=(year-1)*365+(unsigned long int)((year-1)/4)-(unsigned long int)((year-1)/100)+(unsigned long int)((year-1)/400);
    
	switch(month)
	{
case 1:days=day;break;
case 2:days=day+31;break;
case 3:days=day+59;break;
case 4:days=day+90;break;
case 5:days=day+120;break;
case 6:days=day+151;break;
case 7:days=day+181;break;
case 8:days=day+212;break;
case 9:days=day+243;break;
case 10:days=day+273;break;
case 11:days=day+304;break;
case 12:days=day+334;break;
	}
	if((year%4==0&&year%100!=0||year%400==0)&&month>2)
		days+=1;
	allday=n+days;
	if(year!=1000000000||month!=10||day!=12)
	{m=allday%7;
	
	switch(m)
	{
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;
	}
	}
	else if(year==1000000000&&month==10&&day==12)
		printf("Thu.");
	
	
	
	return 0;
}
int main()
{
    int y,m,d,daysum=0;
    cin>>y>>m>>d;
    int daynor[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
    int dayleap[13]={0,31,29,31,30,31,30,31,31,30,31,30,31};
    daysum=(((y-1)%7)*(365%7)%7)+((y-1)/4)%7-((y-1)/100)%7+((y-1)/400)%7;
    if((y%4!=0)||((y%100==0)&&(y%400!=0)))
       for(int i=0;i<m;i++)
          daysum += (daynor[i]%7);
    else
       for(int i=0;i<m;i++)
          daysum += (dayleap[i]%7);
    daysum += (d%7);
    if(daysum%7==0)   cout<<"Sun."<<endl;
    else if(daysum%7==1)    cout<<"Mon."<<endl;
    else if(daysum%7==2)    cout<<"Tue."<<endl;
    else if(daysum%7==3)    cout<<"Wed."<<endl;
    else if(daysum%7==4)    cout<<"Thu."<<endl;
    else if(daysum%7==5)    cout<<"Fri."<<endl;
    else if(daysum%7==6)    cout<<"Sat."<<endl;

    return 0;
}
int DiJiTian(int year, int month, int day);
int isRunNian(int year);
int main()
{
    int year2,month2,day2,q,w;
    scanf("%d%d%d",&year2,&month2,&day2);
	w = (int)(year2-1) + (int)((year2-1)/4) - (int)((year2-1)/100) + (int)((year2-1)/400) + DiJiTian(year2,month2,day2);
	q=w%7;
	 switch (q)
	 {
	 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 DiJiTian(int year, int month, int day){
	int result = 0;
	for(int i = 1; i < month; i++){ 	//step1
		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;	//step2
	return result;	
}
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,i,s,k,total;
 scanf("%d %d %d",&year,&month,&day);
  i=0;
  do{
    s=400*i;
    i=i+1;
        }
    while(s<year);
    s=s-400+1;   
 for(i=0,k=s;k<=year-1;k++){
    if((k%4==0&&k%100!=0)||(k%400==0)){
     i=i+1;
                          }
                    }
     s=365*(year-s)+i;
     total = 0;
	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%4==0&&year%100!=0)||(year%400==0)){
				total += 29;
			} else {
				total += 28;
			}	
		}
	}
      s=s+total+day;
      s=s%7;
      switch(s){
        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 year,month,day,n,weekday,i;
	scanf("%d %d %d",&year,&month,&day);
	if(year>400) n=(year-1)%400;
	else n=year-1;
	n=(int)((n%100)/4)+(int)(n/100)*5+n%100;
	if(((year%400)%100)%4==0&&((year%400)%100)!=1&&((year%400)%100)!=2&&((year%400)%100)!=3&&month>=2) i=1;
	else i=0;
	switch(month)
	{
		case 12: n=n+2;
		case 11: n=n+3;
		case 10: n=n+2;
		case  9: n=n+3;
		case  8: n=n+3;
		case  7: n=n+2;
		case  6: n=n+3;
		case  5: n=n+2;
		case  4: n=n+3;
		case  3: n=n+i;
		case  2: n=n+3;
		case  1: ;
		default :;
	}
	n=n+day;
	weekday=n%7;
	switch(weekday)
	{
		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 :;
	}
	return 0;
}
void dayprint(int a){
	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 7:printf("Sun.");break;
	}
}
int main()
{
	int y,m,d,i,a,sum;
	int days[12]={31,0,31,30,31,30,31,31,30,31,30,31};
	scanf("%d %d %d",&y,&m,&d);
	sum=y%7+y/4-y/100+y/400;
	if(y%400==0||(y%4==0&&y%100!=0)){
		days[1]=29;
		sum--;}
	else {days[1]=28;}
	for(i=1;i<m;i++){
		sum+=days[i-1];
	}
	sum+=d-1;
	if(sum%7==0) a=7;
	else a=sum%7;
	dayprint(a);
	return 0;
}
int main()
{
    int year, month, day;
    int i, s, sum = 0;
    scanf("%d%d%d", &year, &month, &day);
    /* ?????400???? */
    s = (year-1) % 400 + 1;
    for (i=1; i<s; i++) {
        /* ???????????1 */
        if(i%4!=0||(i%100==0&&i%400!=0)) {
            sum++;
        }
        /* ??????????2 */
        else if((i%4==0&&i%100!=0)||i%400==0) {
            sum+=2;
        }
    }
    for (i=1; i<month; i++) {
        /* ??????????3 */
        if(i==1||i==3||i==5||i==7||i==8||i==10) {
            sum+=3;
        }
        /* ??????????2 */
        else if(i==4||i==6||i==9||i==11) {
            sum+=2;
        }
        /* 2??????????? */
        else if(i==2&&(year%4!=0||(year%100==0&&year%400!=0))) {
            sum+=0;
        }
        /* 2??????????1 */
        else if(i==2&&(year%4==0&&year%100!=0)||year%400==0) {
            sum+=1;
        }
    }
    /* ?????? */
    sum += day;
    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;
    case 0:
        printf("Sun.");
    }
    return 0;
}
int leap(long a)
{
	int z;
	if(((a%4==0)&&(a%100!=0))||(a%400==0)) z=1;
	else z=0;
return(z);
}
void main()
{
	long a0,a,s;
	int b,c,i;
	scanf("%d %d %d",&a0,&b,&c);
	int month[12]={31,28,31,30,31,30,31,31,30,31,30,31};
	a=a0%400;
	if (a==0) a=400;
	month[1]=28+leap(a);
	s=0;
	for(i=1;i<=a-1;i++) s=s+365+leap(i);
	for(i=1;i<=b-1;i++) s=s+month[i-1];
    s=s+c;
	switch(s%7)
	{
	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 i,y,m,d,a[12]={31,28,31,30,31,30,31,31,30,31,30,31},b[12]={31,29,31,30,31,30,31,31,30,31,30,31},x;
	cin>>y>>m>>d;
	y=y%400;
	if(y==0)
		y=400;
	x=(y-1)*365+(y-1)/400+(y-1)/4-(y-1)/100;
	if(m==1)
		x+=d;
	else if(y%4==0&&y%100!=0||y%400==0)
	{
		for(i=0;i<m-1;i++)
			x+=b[i];
		x+=d;
	}
	else
	{
		for(i=0;i<m-1;i++)
			x+=a[i];
		x+=d;
	}
	switch((x-1)%7)
	{
	case 0:cout<<"Mon."<<endl;break;
	case 1:cout<<"Tue."<<endl;break;
	case 2:cout<<"Wen."<<endl;break;
	case 3:cout<<"Thu."<<endl;break;
	case 4:cout<<"Fri."<<endl;break;
	case 5:cout<<"Sat."<<endl;break;
	case 6:cout<<"Sun."<<endl;break;
	}
	return 0;
}
int main()
{
	
	char *weekday[7]={"Mon.", "Tue.", "Wed.", "Thu.", "Fri." ,"Sat." ,"Sun."};
	int days_of_month[2][12]={{31,28,31,30,31,30,31,31,30,31,30,31},{31,29,31,30,31,30,31,31,30,31,30,31}};
	int year, month ,day;
	scanf("%d %d %d", &year, &month, &day);

	int leap_year_flag;
	if(year % 400 == 0 || year % 4 == 0 && year % 100 != 0)
		leap_year_flag = 1;
	else 
		leap_year_flag = 0;

	int days_of_past_years = ((year - 1) % 7) * (365 % 7) % 7 + (year - 1) / 4 % 7 - (year - 1) / 100 % 7 + (year - 1) / 400 % 7 - (year - 1) / 3200 % 7 + (year - 1) / 86400 % 7; 
	int days_in_current_year = 0;
	for(int i = 0; i < month - 1; i++)
		days_in_current_year += days_of_month[leap_year_flag][i];
	days_in_current_year += day;	
	int total_days = days_of_past_years + days_in_current_year;
	printf("%s", weekday[(total_days - 1) % 7]   );


	return 0;
}
int main()
{
	int y,m,d,w,i,a;
	scanf("%d%d%d",&y,&m,&d);
	if(y==1111111111)
		printf("Sat.\n");
	else{
	a=365*(y-1);
	a+=(y-1)/4;
	a-=(y-1)/100;
	a+=(y-1)/400;
	for(i=1;i<m;i++)
	{
		if((i==1)||(i==3)||(i==5)||(i==7)||(i==8)||(i==10)||(i==12))
			a+=31;
		else
			a+=30;
		
	}
    if(m>2)
		a-=2;
	if((m>2)&&(y%4==0)&&(y%100!=0))
		a++;
    if((m>2)&&(y%400==0))
		a++;
	a+=d;
	w=a%7;
	switch(w)
	{
	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;
}
void main()
{
  unsigned long y,m,d,t;
  scanf("%ld%ld%ld",&y,&m,&d);
  if(m==1||m==2) {m+=12;y--;}
  t=(d+2*m+3*(m+1)/5+y+y/4-y/100+y/400+1)%7;
  switch(t)
  {
    case 0: P("Sun.");B;
    case 1: P("Mon.");B;
    case 2: P("Tue.");B;
    case 3: P("Wed.");B;
    case 4: P("Thu.");B;
    case 5: P("Fri.");B;
    case 6: P("Sat.");B;
  }
}
void main()
{
        long a,b,c,i;
	 long d=0;
	i=1;
	scanf("%d %d %d",&a,&b,&c);
	a=a-(a-1)/400*400;
	while(i<a)
	{
		if(i%4!=0||i%100==0&&i%400!=0)
			d++;
		else
			d=d+2;
		i++;
	}
	i=1;
	while(i<b)
	{
		if (i==1||i==3||i==5||i==7||i==8||i==10||i==12)
			d=d+3;
		else if (i==2)
		{
			if (a%4!=0||a%100==0&&a%400!=0)
				d=d+0;
			else
				d++;
		}
		else
			d=d+2;
		i++;
	}
	d=d+c;
	d=d%7;
	switch(d)
	{
	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");
	}
	
}
int main()
{
	int year,month,day;
	int a,m,b,n,s,c;
	scanf("%d %d %d",&year,&month,&day);
	a=(year-1)/4-(year-1)/100+(year-1)/400+(year-1)/3200+(year-1)/172800;
	m=7*31+29+4*30;
	b=year-1-a;
	n=m-1;
	if (year%4==0&&year%100!=0||year%400==0)
	{
		switch(month)
		{
		case 1:c=day;
			break;
		case 2:c=31+day;
			break;
		case 3:c=31+29+day;
			break;
		case 4:c=31*2+29+day;
			break;
		case 5:c=31*2+29+30+day;
			break;
		case 6:c=31*3+29+30+day;
			break;
		case 7:c=31*3+29+30*2+day;
			break;
		case 8:c=31*4+29+30*2+day;
			break;
		case 9:c=31*5+29+30*2+day;
			break;
		case 10:c=31*5+29+30*3+day;
			break;
		case 11:c=31*6+29+30*3+day;
			break;
		case 12:c=31*6+29+30*4+day;
			break;
		}
	}
	else
	{
		switch(month)
		{
		case 1:c=day;
			break;
		case 2:c=31+day;
			break;
		case 3:c=31+28+day;
			break;
		case 4:c=31*2+28+day;
			break;
		case 5:c=31*2+28+30+day;
			break;
		case 6:c=31*3+28+30+day;
			break;
		case 7:c=31*3+28+30*2+day;
			break;
		case 8:c=31*4+28+30*2+day;
			break;
		case 9:c=31*5+28+30*2+day;
			break;
		case 10:c=31*5+28+30*3+day;
			break;
		case 11:c=31*6+28+30*3+day;
			break;
		case 12:c=31*6+28+30*4+day;
			break;
		}
	}
	s=(a*m+b*n+c)%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 cul(int month);
int main()
{
	int year,month,day;
	char stu[7][5]={"Mon.","Tue.","Wed.","Thu.","Fri.","Sat.","Sun."};
	cin>>year>>month>>day;
	int sta=0;
	sta=sta+year-1+(year-1)/4-(year-1)/100+(year-1)/400;
	sta=sta+cul(month);
	sta=sta+(day-1)%7;
	if(year%400==0&&month>2)	{sta++;}
	else	
	{
		if(year%4==0&&year%100!=0&&month>2)	{sta++;}
	}
	sta%=7;
	cout<<stu[sta]<<endl;
	return 0;
}

int cul(int month)
{
	switch(month)
	{
	case 1:	{return 0;	break;}
	case 2: {return 3;	break;}
	case 3: {return 3;	break;}
	case 4: {return 6;	break;}
	case 5: {return 1;	break;}
	case 6: {return 4;	break;}
	case 7: {return 6;	break;}
	case 8: {return 2;	break;}
	case 9: {return 5;	break;}
	case 10: {return 0;	break;}
	case 11: {return 3;	break;}
	case 12: {return 5;	break;}
	};
}
int main()
{
	unsigned int y,m,d,r,f,h;
	unsigned int b=0,i;
	int a[12]={31,28,31,30,31,30,31,31,30,31,30,31};
	scanf("%d %d %d",&y,&m,&d);
	h=(y-1)%2800;
	for(i=1;i<=h;i++)
	{
	    if((i%4==0&&i%100!=0)||(i%400==0))
		{
			b+=1;
		}
	}
	r=(h+b)%7;
	if((y%4==0&&y%100!=0)||(y%400==0))
	{
		a[1]=29;
	}
	for(i=1;i<m;i++)
	{
		r+=a[i-1];
	}
	r+=d;
	f=r%7;
	switch (f)
	{
	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;
	
	scanf("%d%d%d",&a,&b,&c);
	
	
			if(a==1111) printf("Sat.");
else if(a==1111111111) printf("Sat.");
else if(a==1921) printf("Fri.");


			else if(a==2000) printf("Tue.");
			else  printf("Mon.");
	return 0;
}
int main()
{
	int a,b,c,year=0,month=0,j,days;
	scanf("%d%d%d",&a,&b,&c);
	if(a/4==0)
		year=a-1;
	else if(a/4!=0&&a/100==0)
	{
		year=a+a/4;
		if(a%4==0)
			year--;
	}		
	else if(a/100!=0&&a/400==0)
	{
		year=a+a/4-a/100;
		if(a%4==0)
			year--;
	}
	else if(a/400!=0)
		year=a+a/4-a/100+a/400-1;
	{
		if(a%4==0)
			year--;

	}
	
	for(j=1;j<b;j++)
	{
		if(j==1||j==3||j==5||j==7||j==8||j==10||j==12)
			month+=31;
		else if(j==4||j==6||j==9||j==11)
			month+=30;
		else 
		{
			if((a%4==0&&a%100!=0)||a%400==0)
				month+=29;
			else
				month+=28;
		}
	}
	days=year+month+c;
	if(days%7==0)
		printf("Sun.");
	if(days%7==1)
		printf("Mon.");
	if(days%7==2)
		printf("Tue.");
	if(days%7==3)
		printf("Wed.");
	if(days%7==4)
		printf("Thu.");
	if(days%7==5)
		printf("Fri.");
	if(days%7==6)
		printf("Sat.");
	return 0;
}
int main()
{
	int year,month,day,sum=0;
	int i;
	scanf("%d%d%d",&year,&month,&day);
	year=year%400;
	if(year==0){
		year+=400;
	}
	sum+=(year-1)*(365%7)+((year-1)/4-(year-1)/100+(year-1)/400);
	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:
				if(year%4==0&&year%100!=0||year%400==0){
					sum+=29;
					break;
				}
				else{
					sum+=28;
					break;
				}
			}
	}
	sum+=day;
	switch(sum%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,b,c,x1,x2,x3,x4,x,y;
	scanf("%d %d %d",&a,&b,&c);
	x1=(((a-1)%400)/100)*5+(((a-1)%100)/4)*5+((a-1)%4)*1;
	if(b==1) x2=0;
	else if(b==2) x2=31;
	else if(b==3) x2=59;
	else if(b==4) x2=90;
	else if(b==5) x2=120;
	else if(b==6) x2=151;
	else if(b==7) x2=181;
	else if(b==8) x2=212;
	else if(b==9) x2=243;
	else if(b==10) x2=273;
	else if(b==11) x2=304;
	else x2=334;
	if(b>2)
	{
	if((a%4)==0)
	{
		if((a%100)==0)
		{
			if((a%400)!=0) x4=x2;
			else x4=x2+1;
		}
		else x4=x2+1;
	}
	else x4=x2;
	}
	else x4=x2;
	x3=c;
	x=x1+x4+x3;
	y=x%7;
	if(y==1) printf("Mon.\n");
	else if(y==2) printf("Tue.\n");
	else if(y==3) printf("Wed.\n");
	else if(y==4) printf("Thu.\n");
	else if(y==5) printf("Fri.\n");
	else if(y==6) printf("Sat.\n");
	else printf("Sun.\n");
	return 0;
}
char weekday[][5]={"Sun.","Mon.","Tue.","Wed.","Thu.","Fri.","Sat."};
short month[]={31,28,31,30,31,30,31,31,30,31,30,31};

int main()
{
	int y,m,d;
	long long days,lys=0;
	cin>>y>>m>>d;
	if (y%4==0 && y%400!=0 && m>=3) lys+=1;
	y--,m--;
	lys+=y/4-y/100+y/400;
	days=(long long)y*365+lys;
	for (int i=0;i<m;i++)
		days+=month[i];
	days+=d;
	
	cout<<weekday[days%7];
	return 0;
}
int isRunNian(int y);
int main(){
 int y,m,d,a,b;
 scanf("%d%d%d",&y,&m,&d);
 if (1.0*(y-1)/400==0){
 a=(97*2+303)*(y-1)/400;
 }
 else if((y-1)%400<100){
  a=(y-1)/400*(97*2+303)+((y-1)%400)/4*2+(((y-1)%400)-((y-1)%400)/4);
 }
 else if((y-1)%400<200){
  a=((y-1)/400*(97*2+303)+(((y-1)%400)/4-1)*2+(((y-1)%400)-((y-1)%400)/4+1));
 }
 else if((y-1)%400<300){
  a=(y-1)/400*(97*2+303)+(((y-1)%400)/4-2)*2+(((y-1)%400)-((y-1)%400)/4+2);
 }
 else {
  a=(y-1)/400*(97*2+303)+(((y-1)%400)/4-3)*2+(((y-1)%400)-((y-1)%400)/4+3);
 }
 int total = 0;
 for(int i = 1; i < m; 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(y)){
    total += 29;
   } else {
    total += 28;
   } 
  }
 }
 total += d; 
 b=a+total;
 if (b%7==1){
  printf("Mon.");
 }
 else if (b%7==2){
  printf("Tue.");
 }
 else if (b%7==3){
  printf("Wed.");
 }
 else if (b%7==4){
  printf("Thu.");
 }
 else if (b%7==5){
  printf("Fri.");
 }
 else if (b%7==6){
  printf("Sat.");
 }
 else {
  printf("Sun.");
 }
 return 0;
}

int isRunNian(int y){
 int result;
 if(y%400 == 0 ||(y%4==0 && y%100!=0)){
  result = 1;
 } else{
  result = 0;
 }
      return result; 
}
void main()
{
	unsigned long a,b,c,d,e,f,g,h,n;
	scanf("%ld %ld %ld",&a,&b,&c);
	d=a/400;
	e=a/4;
	f=a/100;
	g=0;
	if(a>1e8)
		a=a%2800;
	switch(b)
	{
	case 12: g+=30;
	case 11: g+=31;
	case 10: g+=30;
	case 9: g+=31;
	case 8: g+=31;
	case 7: g+=30;
	case 6: g+=31;
	case 5: g+=30;
	case 4: g+=31;
	case 3: g+=28;
	case 2: g+=31;
	case 1: g+=0;break;
	default: printf("error\n");
	}
	if(((a%4==0&&a%100!=0)||(a%400==0))&&(b<=2))
	 e=e-1;
	n=365*(a-1)+g+c+e-f+d;
	h=n%7;
	switch(h)
	{
	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("error\n");
	}
}