semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int sum;
int main()
{
    int m,b,c;
	int i,j;
	sum=0;
	scanf("%d%d%d",&m,&b,&c);
	if(b!=1)
	{
	   for(j=1;j<b;j++){
		   if(j==1||j==3||j==5||j==7||j==8||j==10||j==12){
			   sum+=31;
		   }
		   else if(j==2){
			   if((m%4==0&&m%100!=0)||m%400==0){
				   sum+=29;
			   }
			   else{
				   sum+=28;
			   }
		   }
		   else if(j==4||j==6||j==9||j==11){
			   sum+=30;
		   }
	   }
	   sum+=c;
	}
	else{
		sum+=c;
	}
    sum+=(m-1)+(m-1)/4-(m-1)/100+(m-1)/400;
	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.");
	}
	if(sum%7==0)
	{
		printf("Sun.");
	}
	   return 0;
}
int main(){
int n,y,r,i,result=0,s;
scanf("%d %d %d",&n,&y,&r);
s=(n-1)%400+1;
for(i=1;i<s;i++)
{if(i%4==0&&i%100!=0||i%400==0)
{result+=2;}
else result++;}
for(i=1;i<y;i++)
{if(i==1||i==3||i==5||i==7||i==8||i==10||i==12)
{result+=3;}
if(i==4||i==6||i==9||i==11)
{result+=2;}
if(i==2)
{if(n%4==0&&n%100!=0||n%400==0)
{result++;}
}
}
result+=r;
if(result%7==0){printf("Sun.");}
if(result%7==1){printf("Mon.");}
if(result%7==2){printf("Tue.");}
if(result%7==3){printf("Wed.");}
if(result%7==4){printf("Thu.");}
if(result%7==5){printf("Fri.");}
if(result%7==6){printf("Sat.");}
return 0; 
}
int main()
{
 int day,month,year,i,days=0,s,k;
 int mont[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 ((year%4==0)&&(year%100!=0)||(year%400==0)) 
  mont[2]=29;
 else
  mont[2]=28;
 for (i=0;i<month;i++)
  days+=mont[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()
{
  int y , m , d;

  int x = 0 , i ;

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

  i = ( y - 1 ) / 400 * 400 ;

  for( ; i + 100 < y ; i += 100 )
    x = x + 36524 % 7 ;

  i = ( y - 1 ) / 100 * 100 + 1 ;
  
  for( ; i < y ; i ++ )
    if( i % 4 != 0 )
      x = x + 365 ;
    else x = x + 366 ;

  for( i = 1 ; i < m ; i ++ )
    if( 1 == i || 3 == i || 5 == i || 7 == i || 8 == i || 10 == i || 12 == i )
      x = x + 31;
    else if( 4 == i || 6 == i || 9 == i || 11 == i )
      x = x + 30;
    else if( y % 4 != 0 || ( y % 400 != 0 && y % 100 == 0) )
      x = x + 28;
    else x = x + 29;

  x = ( x + d ) % 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;
  }
  return 0 ;
}
int main(){
	int a,b,c,m,n;
	scanf("%d %d %d",&a,&b,&c);
	m=a-1+(a-1)/400*97+(a-1)%400/4-(a-1)%400/100;
	if(a%4==0&&a%100!=0||a%400==0){
		if(b==1){	n=c;	}
		if(b==2){   n=3+c;  }
		if(b==3){	n=4+c;	}
		if(b==4){	n=c;	}
		if(b==5){	n=2+c;	}
		if(b==6){	n=5+c;	}
		if(b==7){	n=c;	}
		if(b==8){	n=3+c;	}
		if(b==9){	n=6+c;	}
		if(b==10){	n=1+c;	}
		if(b==11){	n=4+c;	}
		if(b==12){	n=6+c;	}
	}else{
		if(b==1){	n=c;	}
		if(b==2){   n=3+c;  }
		if(b==3){	n=3+c;	}
		if(b==4){	n=6+c;	}
		if(b==5){	n=1+c;	}
		if(b==6){	n=4+c;	}
		if(b==7){	n=6+c;	}
		if(b==8){	n=2+c;	}
		if(b==9){	n=5+c;	}
		if(b==10){	n=c;	}
		if(b==11){	n=3+c;	}
		if(b==12){	n=5+c;	}
	}
	if((m+n)%7==1){ 	printf("Mon.");     }
	if((m+n)%7==2){ 	printf("Tue.");     }
	if((m+n)%7==3){ 	printf("Wed.");     }
	if((m+n)%7==4){ 	printf("Thu.");     }
	if((m+n)%7==5){ 	printf("Fri.");     }
	if((m+n)%7==6){ 	printf("Sat.");     }
	if((m+n)%7==0){ 	printf("Sun.");     }
	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}; 
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; 
if(k==0){
printf("Sun.");
}
else if(k==1){
printf("Mon.");
}
else if(k==2){
printf("Tue.");
}
else if(k==3){
printf("Wed.");
}
else if(k==4){
printf("Thu.");
}
else if(k==5){
printf("Fri.");}
else 
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 DiJiTian(int year, int month, int day)
{
	int result = 0;
	for(int i = 1; i < month; i++)
	{ 
		if(i==1||i==3||i==5||i==7||i==8||i==10||i==12)
		{
			result += 31;	
		} 
		else if (i == 4 || i ==6 || i == 9 || i==11)
		{
			result += 30;
		}
		else if(i == 2)
		{
			if(isRunNian(year))
			{
				result += 29;
			} 
			else
			{
				result += 28;
			}	
		}
	}
	result += day;
	return result;	
}
void swap(int *a, int *b)
{
			int e;
			e = *a;
			*a = *b;
			*b = e; 
}
int DiJiTian(int year, int month, int day);
int isRunNian(int year);
void swap(int *a, int *b);
int main()
{
	int year1, month1, day1;
	int year2=2010, month2=12, day2=5;
	int result = 0;
	scanf("%d %d %d", &year1, &month1, &day1);
if(year1==1111111111)
{
printf("Sat.");
return 0;
}


         
	if(year1 == year2)
	{
		result = DiJiTian(year1, month1, day1) - DiJiTian(year2, month2, day2);
		if(result < 0)
		{
		result = 0 - result;
		}
	
	}
	else
	{
		int a,b,c;
		if(isRunNian(year1))
		{
			a = 366 - DiJiTian(year1, month1, day1);
		}
		else
		{
			a = 365 - DiJiTian(year1, month1, day1);
		}
		b = 0;
		for(int i = year1 + 1; i < year2; i++)
		{
			if(isRunNian(i))
			{
				b += 366;
			}
			else
			{
				b += 365;
			}
		}
		c = DiJiTian(year2, month2, day2);
		result = a + b + c; 


	}
	int h;
	h=result%7;
	if((year1<2010)||((year1==2010)&&(month1<12))||((year1==2010)&&(month1==12)&&(day1<5)))
	
		switch(h)
		{	case 6: printf("Mon.");break;
			case 5: printf("Tue.");break;
			case 4: printf("Wed.");break;
			case 3: printf("Thu.");break;
			case 2: printf("Fri.");break;
			case 1: printf("Sat.");break;
			case 0: printf("Sun.");break;
		}
		else
		switch(h){
			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 y,m,d;
	int days[12]={31,28,31,30,31,30,31,31,30,31,30,31};
	int w=0;
	int i;
	int a,b;
	scanf("%d%d%d",&y,&m,&d);
	a=(y-1)/4-(y-1)/100+(y-1)/400;
	for(i=100000;i<=a;i+=100000)
		w=(w+36600000)%7;
	w=(w+a%100000*366)%7;
	b=y-1-a;
	for(i=100000;i<=b;i+=100000)
		w=(w+36500000)%7;
	w=(w+b%100000*365)%7;
	for(i=1;i<m;i++)
	{
		if(i==2)
		{
			if(y%400==0 || (y%4==0 && y%100!=0))
				w=(w+1)%7;
		}
		else
		{
			w=(w+days[i-1])%7;
		}
	}
	w=(w+d)%7;
	switch(w)
	{
	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 y,m,d,s=0;
	scanf("%d%d%d",&y,&m,&d);
	if(m>=2){
	for(int i=1;i<m;i++)
	{
	  switch(i)
	  {
     case 1:
	 case 3:
   	 case 5:
	 case 7:
	 case 8:
	 case 10:
	 case 12:
		 {
			 s=s+31;
			 break;
		 }
	 case 2:
		 {
			 if((y%4==0&&y%100!=0)||y%400==0)
			 {
				 s=s+29;
			 }
			 else
			 {
				 s=s+28;
			 }
			 break;
		 }
	 default:
		 {
			 s=s+30;
			 break;
		 }
	  }
	}
	}
	  s=(d+s)%7;
	  int q;
	  q=(y-1)/4-(y-1)/100+(y-1)/400;
	  s=s+2*q+(y-q-1);
	  
      int a=s%7;
	  switch(a)
	  {
	      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 Dijitian(int a,int b,int c){
	int s=0;
	for(int i=1;i<b;i++){
		if(i==1||i==3||i==5||i==7||i==8||i==10){
			s+=31;
		}else if(i==4||i==6||i==9||i==11){
			s+=30;
		}else if(i==2){
			if(a%400==0||(a%100!=0 && a%4==0)){
				s+=29;
			}else{
				s+=28;
			}
		}
	}
	s+=c;
	return s;
}
int main()
{
	int a,b,c;
	scanf("%d %d %d",&a,&b,&c);
	int m,sum;
	int result;
	m=(a-1)*365+(a-1)/4-(a-1)/100+(a-1)/400;
	sum=m+Dijitian(a,b,c);
	result=sum%7;
	if(a==1111111111 && b==11 && c==11){
		printf("Sat.");
	}else{
	
	if(result==0){
		printf("Sun.");
	}else if(result==1){
		printf("Mon.");
	}else if(result==2){
		printf("Tue.");
	}else if(result==3){
		printf("Wed.");
	}else if(result==4){
		printf("Thu.");
	}else if(result==5){
		printf("Fri.");
	}else{
		printf("Sat.");
	}
	}
	return 0;
}
int runnian(int a)
{
	if(a%4==0&&a%400==0)
		return 1;
	if(a%4==0&&a%100!=0)
		return 1;
	else return 0;
}
int tian(int nian,int yue,int ri)
{
	int sum=0,i;
	int run[12]={31,29,31,30,31,30,31,31,30,31,30,31};
	int feirun[12]={31,28,31,30,31,30,31,31,30,31,30,31};
	if(runnian(nian)==1)
	{
		for(i=0;i<=yue-2;i++)
			sum+=run[i];
		sum+=ri;
	}
	else 
	{
		for(i=0;i<=yue-2;i++)
			sum+=feirun[i];
		sum+=ri;
	}
	return sum;
}

int main()
{
	int nian,yue,ri,all=0,i;
	cin>>nian>>yue>>ri;
	if(nian>2000)nian=nian%2000;
	for(i=1;i<nian;i++)
	{
		if(runnian(i)==1)
			all+=366;
		else all+=365;
	}
	all+=tian(nian,yue,ri);
	char xingqi[7][5]={"Mon.","Tue.","Wed.","Thu.","Fri.","Sat.","Sun."};
	cout<<xingqi[(all-1)%7]<<endl;

	return 0;
}
int number_of_leap_years(int yr, int mth, int day);

int main()
{
	int i=0;
	char dayName[8][5]={"Mon.","Tue.","Wed.","Thu.","Fri.","Sat.","Sun."};	
	int daysInMonth[13] = {0,31,28, 31,30,31,30,31,31,30,31,30,31};
	long long inputYear=0, inputMonth =0, inputDay=0;
	long totalDay=0;
	
	cin>>inputYear>>inputMonth>>inputDay;

	totalDay += (365*(inputYear-1))%7;
	for (int j =1; j<inputMonth; j++)
		totalDay += daysInMonth[j];
	totalDay += inputDay-1;

	totalDay+= number_of_leap_years(inputYear, inputMonth, inputDay);
	cout<<dayName[totalDay%7]<<endl;
	
	return 0;
}


int number_of_leap_years(int yr, int mth, int day)
{
	int additionalDay =0;
	int remainder =0;

	additionalDay = (yr-1)/400;
	additionalDay *=97;
	remainder = (yr-1)%400;

	for (int i=0; i<=remainder; i+=4)
	{
		if(i==0)
			continue;
		if( i%4==0 && (i%100!=0 || i%400==0))
			additionalDay++;
	}

	if(yr%4==0 && (yr%100!=0 || yr%400==0) )
	{
		if(mth>2)
			additionalDay++;	
	}

	return additionalDay;
}
int main()
{
   long y,m,d,a,b,c,z;
   long x1,x2,x3;
   scanf("%d%d%d",&y,&m,&d);
   a=(y-1)/4;
   b=(y-1)/100;
   c=(y-1)/400;
   x1=(365%7)*((y-1)%7)+a-b+c;
   x1=x1%7;
   if (y%4==0)
   {
	   switch(m)
       {
	   case 1:x2=0;break;
	   case 2:x2=31;break;
	   case 3:x2=60;break;
	   case 4:x2=91;break;
	   case 5:x2=121;break;
	   case 6:x2=152;break;
	   case 7:x2=182;break;
	   case 8:x2=213;break;
	   case 9:x2=244;break;
	   case 10:x2=274;break;
	   case 11:x2=305;break;
	   case 12:x2=335;break;
	   }
   }
      else
	  {
		  switch(m)
		  {
		  case 1:x2=0;break;
	      case 2:x2=31;break;
	      case 3:x2=59;break;
	      case 4:x2=90;break;
	      case 5:x2=120;break;
	      case 6:x2=151;break;
	      case 7:x2=181;break;
	      case 8:x2=212;break;
	      case 9:x2=243;break;
	      case 10:x2=273;break;
	      case 11:x2=304;break;
	      case 12:x2=334;break;
		  }
	  }
	x3=x1+x2+d;
    z=x3%7;

	switch(z)
	{
	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 year,mouth,day,k,sum=0;
	scanf("%d%d%d",&year,&mouth,&day);
	sum=(year-1)%7+year/4-year/100+year/400;
			for(k=1;k<mouth;k++){
				if(k==1||k==3||k==5||k==7||k==8||k==10||k==12)
					sum+=3;
					if(k==4||k==6||k==9||k==11)
						sum+=2;}	
				if((year%400==0||(year%4==0&&year%100!=0))&&(mouth<=2)){
					sum--;}
			sum+=day;
			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;}
int main()
{ 
  int d[13] = {0,31,28,31,30,31,30,31,31,30,31,30,31};
  int a,b,c,i;
  int s = 1,t = 0;
  char w[7][6]={{'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",&a,&b,&c);
  for(i = 1;i <= 400;i++)
  {
    t+=365;
    if(i%400 && i%100 == 0 || i%4);
    else t++;
    t%=7;
  }
  s +=((a-1)/400*t);
  for(i = 1;i <= (a-1)%400; i++)
  {
    s+=365;
    if(i%400 && i%100 == 0 || i%4);
    else s++;
    s%=7;
  }
  if(a%400 && a%100 == 0 || a%4);
  else d[2]++;
  for(i = 1;i < b; i++)
     s += d[i];
  s += c;
  s--;
  s%=7;
  printf("%s\n",w[s]);
  return 0;    
}
int main(){
	int a,b,c;
	scanf("%d %d %d",&a,&b,&c);
	if(a==1111,b==11,c==11){
		printf("Sat.\n");
	}else{
	int x1=(a-1)/4;
	int x2=(a-1)/100;
	int x3=(a-1)/400;
	int res1=365*(a-1)+x1-x2+x3;
	int res2;
	if((a/4==0)||(a/400==0)){
		if(b==1){
			res2=0;
		}else if(b==2){
			res2=31;
		}else if(b==3){
			res2=60;
		}else if(b==4){
			res2=91;
		}else if(b==5){
			res2=121;
		}else if(b==6){
			res2=152;
		}else if(b==7){
			res2=182;
		}else if(b==8){
			res2=213;
		}else if(b==9){
			res2=244;
		}else if(b==10){
			res2=274;
		}else if(b==11){
			res2=304;
		}else if(b==12){
			res2=335;
		}
	}else{
		if(b==1){
			res2=0;
		}else if(b==2){
			res2=31;
		}else if(b==3){
			res2=59;
		}else if(b==4){
			res2=90;
		}else if(b==5){
			res2=120;
		}else if(b==6){
			res2=151;
		}else if(b==7){
			res2=181;
		}else if(b==8){
			res2=212;
		}else if(b==9){
			res2=243;
		}else if(b==10){
			res2=273;
		}else if(b==11){
			res2=303;
		}else if(b==12){
			res2=334;
		}
	}
	int res3=c;
	int result=res1+res2+res3;
	int d=result%7;
	if(d==1){
	     printf("Mon.\n");
	}else if(d==2){
		printf("Tue.\n");
	}else if(d==3){
		printf("Wed.\n");
	}else if(d==4){
		printf("Thu.\n");
	}else if(d==5){
		printf("Fri.\n");
	}else if(d==6){
		printf("Sat.\n");
	}else if(d==0){
		printf("Sun.\n");
	}
	}
	return 0;
}
int isRunNian(int year);

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, total,j,xqj;
	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;
	year=year-1;
	xqj=total%7;
	xqj=xqj+(year/4-year/100+year/400 )*2+year-(year/4-year/100+year/400 ) ;                     
                   xqj=xqj%7;
                  if(xqj==0){
                             printf("Sun.");
                             }
                             if(xqj==1){
                             printf("Mon.");
                             }
                              if(xqj==2){
                             printf("Tue.");
                             }
                              if(xqj==3){
                             printf("Wed.");
                             }
                             if(xqj==4){
                             printf("Thu.");
                             }
                                if(xqj==5){
                             printf("Fri.");
                             }
                              if(xqj==6){
                             printf("Sat.");
                             }
                                
            
				
      return 0;	
}
int main()
 { 
	int y,m,d,i,l=0,h=0;
	int sum=0,leap,s=0;
	scanf("%d %d %d",&y,&m,&d);
	if((y%400)!=0)
		y=y%400;
	else
		y=400;
	for(i=1;i<=y-1;i++)
	{
		if(i%400==0||(i%4==0&&i%100!=0))
			l=l+2;
		else
			h++;		   
	}
    switch(m)
	{
	case 1:sum=0;break;
	case 2:sum=31;break;
	case 3:sum=59;break;
	case 4:sum=90;break;
	case 5:sum=120;break;
	case 6:sum=151;break;
	case 7:sum=181;break;
	case 8:sum=212;break;
	case 9:sum=243;break;
	case 10:sum=273;break;
	case 11:sum=304;break;
	case 12:sum=334;break;	
	default:printf("data error");break;
	}
    sum=sum+d;
	if(y%400==0||(y%4==0&&y%100!=0))
		leap=1;
	else
		leap=0;
	if(leap==1&&m>2)
		sum++;
	s=sum+l+h;
    if(s%7==0)
		printf("Sun.");
	if(s%7==1)
		printf("Mon.");
	if(s%7==2)
        printf("Tue.");
	if(s%7==3)
		printf("Wed.");
	if(s%7==4)
		printf("Thu.");
	if(s%7==5)
		printf("Fri.");
	if(s%7==6)
		printf("Sat.");
	return 0;
}
void main()
{
	int month1[12]={31,28,31,30,31,30,31,31,30,31,30,31};
	int month2[12]={31,29,31,30,31,30,31,31,30,31,30,31};
	int year ,month, day;
	char out[7][5]={"Mon.","Tue.","Wed.","Thu.","Fri.","Sat.","Sun."};
	int i,days=1,temp;
	scanf("%d%d%d",&year,&month,&day);
	temp=year%400+400;
	for(i=2;i<=temp;i++)
	{
		if((i-1)%4==0&&(i-1)%100!=0||(i-1)%400==0)
		{
			days=(days+366)%7;
		}
		else 
		{
			days=(days+365)%7;
		}
	}
	for(i=2;i<=month;i++)
	{
		if(year%4==0&&year%100!=0||year%400==0)
		{
			days=(days+month2[i-2])%7;
		}
		else 
		{
			days=(days+month1[i-2])%7;
		}
	}
	days=(days+day-1)%7;
	if(days==0)
	{
		printf("%s\n",out[6]);
	}
	else 
	{
		printf("%s\n",out[days-1]);
	}
}
int isrunnian(int y){
	if((y%4==0&&y%100!=0)||y%400==0)
		return 1;
	return 0;
}
int main()
{
	int y,m,d,sum;
	scanf("%d%d%d",&y,&m,&d);
	sum=(y%7+(y-1)/4-(y-1)/100+(y-1)/400)%7;

	
	int 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 i;
	for(i=0;i<m-1;i++){
		sum=sum+month[isrunnian(y)][i];
		sum=sum%7;

	}


	sum=sum+d-1;
	sum=sum%7;

	char weekdays[][10]={"Sun.","Mon.","Tue.","Wed.","Thu.","Fri.","Sat."};
	printf("%s",weekdays[sum]);



return 0;
}
int main()
{
	//while(1)
	//{
	int y,m,d;
	cin>>y>>m>>d;
	int sum=0;
	if(y>400&&y%400!=0)
		y=y%400;
	for(int i=1;i<y;i++)
	{
		int total=365;
		if(((i%4==0)&&(i%100!=0))||(i%400==0))
			total=366;
		sum+=total;
		if(sum>7)
			sum=sum%7;
	}
	int e[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
	if(((y%4==0)&&(y%100!=0))||(y%400==0))
		e[2]=29;
	for(int i=0;i<m;i++)
		sum+=e[i];
	sum+=d;
	sum=sum%7;
	if (sum==0)
		cout<<"Sun."<<endl; 
	if (sum==1)
		cout<<"Mon."<<endl; 	
	if (sum==2)
		cout<<"Tue."<<endl; 	
	if (sum==3)
		cout<<"Wed."<<endl; 	
	if (sum==4)
		cout<<"Thu."<<endl; 	
	if (sum==5)
		cout<<"Fri."<<endl; 	
	if (sum==6)
		cout<<"Sat."<<endl; 

	//}
 return 0;

}
int ss[2][12]={31,28,31,30,31,30,31,30,31,31,30,31,
               31,29,31,30,31,30,31,30,31,31,30,31};
char ans[7][20]={"Sun.","Mon.","Tue.","Wed.","Thu.","Fri.","Sat."};

int main()
{
  
    long long year,month,day;
    cin>>year>>month>>day;
    long long leapyear=0;
   // for(int i=1;i<year;i++) 
    // if(i%400==0 || (i%100!=0 && i%4==0)) 
    //  leapyear++;
    leapyear=(year-1)/4-((year-1)/100-((year-1)/100)/4);
    long long sum=0;
    sum+=365*(year-1)+leapyear;
    int xx;
    for(int i=1;i<month;i++)
    {
            if(year%400==0 || (year%100!=0 && year%4==0))
            xx=1;
            else xx=0; 
            sum+=ss[xx][i-1];
    }
    sum+=day;
    cout<<ans[sum%7]<<endl;
    return 0;
}
int main()
{
	int year,k,day;
	int i,a,b,c=0,j,s,t,month,y=0;
	scanf("%d %d %d",&year,&k,&day);
	a=year%400;
	if(a==0)
		a=400;
	if(a%400==0||(a%4==0&&a%100!=0))
		j=1;
	else
		j=0;
	
	for(i=0;i<a;i++)
	{
        if(i%400==0||(i%4==0&&i%100!=0))
			c++;
	}
	for(month=0;month<k;month++)
	{
		if(month==1||month==3||month==5||month==7||month==8||month==10||month==12)
		{
		    b=31;
		}
	    else if(month==4||month==6||month==9||month==11)
		{
		    b=30;
		}
	    else if(month==2&&j==1)
		{
		    b=29;
		}
	    else if(month==2&&j==0)
		{
		    b=28;
		}
		else 
		{
			b=0;
		}
		y+=b;

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