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>
 
int main()
{
	const int dayMaxSum[13] = 
	{
		0,
		31,
		60,
		91,
		121,
		152,
		182,
		213,
		244,
		274,
		305,
		335,
		366
	};

	int month=1,day=0,daySum=0;//month=0で終了するため1で初期化

	while(std::cin >> month >> day && month!=0)
	{
		daySum = dayMaxSum[month-1]+day;

		switch(daySum%7)
		{
		case 1:
			std::cout << "Thursday";
			break;
		case 2:
			std::cout << "Friday";
			break;
		case 3:
			std::cout << "Saturday";
			break;
		case 4:
			std::cout << "Sunday";
			break;
		case 5:
			std::cout << "Monday";
			break;
		case 6:
			std::cout << "Tuesday";
			break;
		case 0:
			std::cout << "Wednesday";
			break;
		}
		std::cout << '\n';

		daySum=0;
	}
}

C++: #include<bits/stdc++.h>
using namespace std;

int main() {
	int m, d;
	string week[] = { "Monday", "Tuesday", "Wednesday", "Thursday", "Friday",
			"Saturday", "Sunday" };
	int day[] = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
	while (cin >> m >> d) {
		if (m == 0)break;
		bool flag=false;
		int mc = 1;
		int cnt = 3;
		while (1) {
			for (int i = 1; i <= day[mc - 1]; ++i, cnt++) {
				if (mc == m && d == i) {
					cout << week[cnt % 7] << endl;
					flag=true;
					break;
				}
			}
			if(flag)break;
			mc++;
		}
	}
	return 0;
}

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>
using namespace std;

int main() {
	int mth[13]={0,31,29,31,30,31,30,31,31,30,31,30,31};
	char wks[][16]={"Wedneday","Thursday","Friday","Saturday","Sunday",
				"Monday","Tuesday"};
	int m,d;
	while(cin>>m>>d,m){
		int days=0;
		for(int i=1;i<m;i++) days+=mth[i];
		days+=d; cout<<wks[days%7]<<endl;
	}
}

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

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

int daysPerMonth[11] = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30 };

int main()
{
	int m, d;
	while (cin >> m >> d)
	{
		int day = 0;
		for (int i = 0; i < m - 1; i++)
		{
			day += daysPerMonth[i];
		}
		day += d;

		cout << days[day % 7] << endl;
	}

	return 0;
}

C++: #define _USE_MATH_DEFINES

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <utility>
#include <vector>
#include <numeric>

using namespace std;

int main()
{
	int m, d;
	for (; cin >> m >> d;)
	{
		if (m == 0 && d == 0)
		{
			break;
		}

		vector<int> mon = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

		int mm = 0;
		for (int i = 0; i < m; i++)
		{
			mm += mon.at(i);
		}
		int y = (3 + mm + d) % 7;

		vector<string> sy = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};

		cout << sy.at(y) << endl;
	}
}

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

int main(void){

    vector<string> day(7);
    day[0] = "Saturday";
    day[1] = "Sunday";
    day[2] = "Monday";
    day[3] = "Tuesday";
    day[4] = "Wednesday";
    day[5] = "Thursday";
    day[6] = "Friday";
    int x,y;

    while(1){
        cin >> x >> y;
        int h = 20;
        int n = 4;
        if(x == 0){
            break;
        }
        if(x == 1 || x == 2){
            n--;
            x+=12;
        }
                       
        int w = n + n/4 + h/4 - 2*h + 13*(x+1)/5 + y;
        //cout << w << endl;
       
        //cout << w%7 << endl;

        string ans = day[w%7];

        cout << ans << endl;
    }
    return 0;
}

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

#define YEAR 2004

using namespace std;

int main() {
	vector<string> week;
	week.push_back("Monday");
	week.push_back("Tuesday");
	week.push_back("Wednesday");
	week.push_back("Thursday");
	week.push_back("Friday");
	week.push_back("Saturday");
	week.push_back("Sunday");
	int m,d,w;
	while(cin>>m>>d){
		if(m==0 || d==0){ break; }
		w = (YEAR + YEAR/4 - YEAR/100 + YEAR/400 + (13*m+8)/5 + d) % 7;
		cout<<week[w]<<endl;
	}
	return 0;
}

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

using namespace std;

int main(){
	string y[7] = {"Wednesday", "Thrsday", "Frinday", "Saturday", "Sunday", "Monday", "Tuesday"};
	int mon[13] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

	while(1){
		int m, d;
		cin >> m >> d;
		if(m == 0 && d == 0) break;

		while(m != 0){
			d += mon[m-1];
			m--;
		}
		cout << y[d%7] << endl;
	}
	return 0;
}

C++: #define _CRT_SECURE_NO_WARNINGS
// #define _USE_MATH_DEFINES
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <locale>
#include <cctype>
#include <sstream>
#include <iomanip>    // 10????????? cout << setprecision(10) << double;
#include <queue>
using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef map<int, int> MAPII;
typedef multimap<int, char, greater<int> > MuMAPIC;
typedef vector<pair<int, int> > VPII;
typedef multimap<int, string, greater<int> > MuMIS;
typedef pair<int, int> P;
typedef pair<int, pair<P, P> > PP;

#define MP make_pair
#define FAST_IO  cin.tie(0); ios::sync_with_stdio(false);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
//for gcc (???test)
// #define FOREACH_IT(it,c) for(typeof(c)::iterator it=(c).begin(); it!=(c).end(); ++it)
//for Visual Studio
#define foreach_it(type,it,c) for(type::iterator it=c.begin(),c_end=c.end();it!=c_end;++it)
// for Debug.
#define DUMP_VVI(b) FOR(i,0,b.size()){FOR(j,0,b[i].size())printf("%d ",b[i][j]);puts("");}
#define D_OUT(str,value) if(dbgF){cout<<str<<" : "<<value<<endl;}
// ??\??????push_back(d)???array[d]???????????????1??????§?????????
// int INPUT_INT() {int d;cin>>d;return d;}
template<class T>T IN() { T d; cin >> d; return d; }
// ??????§????¢??´????°???Greatest Common Divisor???
LL gcd(LL a, LL b) { return (b > 0) ? gcd(b, a%b) : a; }
// ?????°?????¢??????°???Least Common Multiple???
LL lcm(LL a, LL b) { return a / gcd(a, b) * b; }
// Y???´???????????????´?????????
bool uruu(LL Y) { return (((Y % 4 == 0 && Y % 100 != 0) || Y % 400 == 0) ? true : false); }

// vector???¨???
// vec[i][j]?????????????\????????\?????????¨??????vec???????????????????????????????????????.

#define INF 1000000

// ------------------- include, typedef, define END. -------------------

int main() {

	int month = 0, day = 0;
	int daySum = 0;	// 1???1??\???????????\??°
	int month_days[12] = { 31,29,31,30,31,30,31,31,30,31,30,31 };
	string youbi[7] = { "Thursday","Friday","Saturday","Sunday","Monday","Tuesday","Wednesday" };
	while (cin >> month >> day, month|| day) {
		FOR(i, 0, month-1) {
			daySum += month_days[i];
		}
		daySum += (day - 1);

		cout << youbi[daySum%7] <<endl;
		daySum = 0;
	}

	return 0;
}