Go: package main

import "fmt"

func main() {
	days := [12]int{31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}
	weekday := [7]string{"Wednesday", "Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday"}

	for {
		var m, d int
		fmt.Scan(&m, &d)
		if m == 0 {
			break
		}

		for i := 0; i < m-1; i++ {
			d += days[i]
		}

		fmt.Println(weekday[d%7])
	}
}

C++: #include <iostream>

using namespace std;

int main(void){

  int month;
  int day;
  int day2;

  while(1){

    day2 = 0;

    cin >> month >> day;
    if( month == 0 && day == 0 )break;

    for( int i = 1 ; i < month ; i++ ){
      switch(i){
      case 1:
      case 3:
      case 5:
      case 7:
      case 8:
      case 10:
      case 12:
	day2 += 31;
	break;
      case 2:
	day2 += 29;
	break;
      case 4:
      case 6:
      case 9:
      case 11:
	day2 += 30;
	break;
      }
    }
    day2 += day;
      switch(day2 % 7){
      case 1:
	cout << "Thursday" << endl;
	break;
      case 2:
	cout << "Friday" << endl;
	break;
      case 3:
	cout << "Saturday" << endl;
	break;
      case 4:
	cout << "Sunday" << endl;
	break;
      case 5:
	cout << "Monday" << endl;
	break;
      case 6:
	cout << "Tuesday" << endl;
	break;
      case 0:
	cout << "Wednesday" << endl;
    }
  }
  return 0;
}

C++: #include<iostream>
#include<string>
using namespace std;
int main() {
    int m, d, w, days[] = {0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335};
    string wdays[] = {"Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday", "Wednesday"};
    while(cin >> m >> d) {
        if(m || d) {
            cout << wdays[(days[m - 1] + d - 1) % 7] << endl;
        }
    }
}

C++: #include <iostream>
#include <string>
#include <math.h>
#include <stdio.h>
#include <ctype.h>
 
using namespace std;
 
int main() {
    int M[13]={0,31,29,31,30,31,30,31,31,30,31,30,31};
    string W[7]={"Monday",
        "Tuesday",
        "Wednesday",
        "Thursday",
        "Friday",
        "Saturday",
        "Sunday"};
     
    int x,y;
    while(scanf("%d%d",&x,&y)!=EOF){
        if(x==0||y==0){
            break;
        }
        int day=0;
        for(int i=1; i<x; i++){
            day+=M[i];
        }
        day+=y+2;
        int week = day % 7;
        cout<<W[week]<<endl;
     
    }
    return 0;
}

C++: #include <iostream>
#include <string>
#include <vector>

using namespace std;
string a[7] = {"Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"};
int main(void){
  int aa,b;
  int mon[12] = {31,28,
		 31,30,
		 31,30,
		 31,31,
		 30,31,
		 30,31};
  while(cin>>aa>>b,a+b){
    int d = b;
    for(int i = 0 ; i < aa-1 ; i ++){
      d += mon[i];
      cout<<d<<endl;
    }

    cout<<a[(d+2)%7]<<endl;
  }
  //*/
}

C++: #include <iostream>
#include <string>

using namespace std;

int main(){
	

	int dc[13];
	dc[1]=31;
	dc[2]=29;
	dc[3]=31;
	dc[4]=30;
	dc[5]=31;
	dc[6]=30;
	dc[7]=31;
	dc[8]=31;
	dc[9]=30;
	dc[10]=31;
	dc[11]=30;
	dc[12]=31;

	string week[8];
	week[0]="Monday";
	week[1]="Tuesday";
	week[2]="Wednesday";
	week[3]="Thursday";
	week[4]="Friday";
	week[5]="Saturday";
	week[6]="Sunday";

	int month;
	int day;
	while(cin>>month>>day&&!(month==0&&day==0)){
		int passingDay=2;
		for(int i = 1; i < month; i++){
			passingDay+=dc[i];
		}
		passingDay+=day;
		cout<<week[passingDay%7]<<endl;
	}

	return 0;
}

C++: //0027 What day is today?

//2004N11ú`1231úÜÅÌútðüÍµ½Æ«A»Ìjúð¦Ä­¾³¢
//È¨2004N11úÍØjúÅA2004NÍ[NÅ·

#include<iostream>
using namespace std;

int main(void)
{
	const char* week[] = 
	{
		"Monday",
		"Tuesday",
		"Wednesday",
		"Thursday",
		"Friday",
		"Saturday",
		"Sunday",
	};
	//indexÌú
	const int Days[] = 
	{
		0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
	};
	int month, day;
	
	while(cin >> month >> day, month)
	{
		cout << week[ (Days[month-1] + day) % 7 + 2] << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <string>
using namespace std;


int main() {
  const int n_day[] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
  const string week_name[] = {
    "Wednesday",
    "Thursday",
    "Firday",
    "Saturday",
    "Sunday",
    "Monday",
    "Tuesday"
  };


  int m, d, sum=0;
  cin >> m >> d;
  while(m != 0 && d != 0) {
    m--;
    for(int i=0; i<m; i++) {
      sum += n_day[i];
    }
    sum += d;
    cout << week_name[sum%7] << endl;
    sum = 0;
    cin >> m >> d;
  }
  return 0;
}

C++: #include<iostream>
using namespace std;
int main(void) {
	int Month[13]{
		0,
		31,29,31,30,
		31,30,31,31,
		30,31,30,31
	};
	//??????0?????\???6
	int dow = 2;
	int in_day, in_month;
	while (cin >> in_month >> in_day) {

		if (in_month == 0)break;

		dow = 2;
		for (int i = 0; i < in_month; i++) {
			dow += Month[i];
		}
		dow += in_day;
		if (dow % 7 == 0) {
			cout << "Monthday" << endl;
		}
		else if (dow % 7 == 1) {
			cout << "Tuesday" << endl;
		}
		else if (dow % 7 == 2) {
			cout << "Wednesday" << endl;
		}
		else if (dow % 7 == 3) {
			cout << "Thursday" << endl;
		}
		else if (dow % 7 == 4) {
			cout << "Friday" << endl;
		}
		else if (dow % 7 == 5) {
			cout << "Saturday" << endl;
		}
		else if (dow % 7 == 6) {
			cout << "Sunday" << endl;
		}
	}
	return 0;
}

C++: #include <iostream>
using namespace std;

int main() {

  int input1,input2;

  int days[12] = {31,29,31,30,31,30,31,31,30,31,30,31};

  while(true) {

    cin >> input1 >> input2;
    if ( input1 == 0 ) break;

    int cnt = 0;

    for ( int i = 0; i < input1-1; i++ ) {
      cnt += days[i];
    }
    cnt += input2-1;

    int week = ( cnt + 3 ) % 7;

    if ( week == 0 ) {
      cout << "Monday";
    }else if ( week == 1 ) {
      cout << "Tuesday";
    }else if ( week == 2 ) {
      cout << "Wednesday";
    }else if ( week == 3 ) {
      cout << "Thursday";
    }else if ( week == 4 ) {
      cout << "Friday";
    }else if ( week == 5 ) {
      cout << "Saturday";
    }else {
      cout << "Sunday";
    }
    cout << endl;

  }

  return 0;

}

C++: #include <iostream>
#include <string>
using namespace std;

int main(void){
	string day[7]={	"Thursday",
 					"Friday",
 					"Saturday",
					"Sunday",
					"Monday",
 					"Tuesday",
 					"Wednesday"
				};
	int month[13]={0,31,29,31,30,31,30,31,31,30,31,30,31};
	int m,d;
	while(cin >> m >> d,m|d){
		int r=-1;
		for(int i=0;i<m;i++)
			r+=month[i];
		r+=d;
		r%=7;
		cout << day[r] << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <string>
using namespace std;

const string week[] = { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" };

int zeller(int y, int m, int d) {
  if (m < 3) { --y; m += 12; }
  return (y+y/4-y/100+y/400+(13*m+8)/5+d) % 7;
}

int main() {
	int m, n;
	while ( cin >> m >> n, m | n) {
		cout << week[zeller(2004, m, n)] << endl;
	}
	return 0;
}

C++: #define _USE_MATH_DEFINES
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>

typedef long long ll;
using namespace std;

int main()
{
	int days[] = {31,29,31,30,31,30,31,31,30,31,30,31};
	string week[] = {"Thursday","Friday","Saturday","Sunday","Monday","Tuesday","Wednesday"};

	int a,b;
	while(~scanf("%d %d",&a,&b)){
		if(a==0 && b==0) break;

		int passed=0;
		for(int i=0;i<a - 1;i++){
			passed += days[i];
		}

		passed += b;
		cout << week[(passed - 1) % 7] << endl;
	}
}

C++: #include <iostream>
#include <cmath>

using namespace std;

int main(){
    int m, d;
    string day[] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
    while (cin >> m >> d) {
        if (!m && !d){
            break;
        }
        int year = 2004, h;
        if (m == 1 || m == 2){
            year--;
            m += 12;
        }
        h = (year + year / 4 - year / 100 + year / 400 + (13 * m + 8) / 5 + d) % 7;
        cout << day[h] << endl;
    }

    return 0;
}