Go: package main

import (
        "fmt"
)

func main() {
        var weeks = []string{"Thursday",
                "Friday",
                "Saturday",
                "Sunday",
                "Monday",
                "Tuesday",
                "Wednesday"}

        for {
                var m, d int
                _, err := fmt.Scanf("%d %d", &m, &d)
                if err != nil || m + d == 0 {
                        break
                }
                var days int

                for {
                        lm, ld := getLastDay(m, d)
                        if lm + ld == 0 {
                                break
                        }
                        days++
                        m = lm
                        d = ld
                }
                fmt.Println(weeks[days%7])
        }
}

func getLastDay(m int, d int) (lm int, ld int) {
        if m == 1 && d == 1 {
                return 0, 0
        }

        if d > 1 {
                return m, d-1
        } else {
                if m == 3 {
                        return m-1, 29
                }
                if m == 3 || m == 5 || m == 7 || m == 10 || m == 12 {
                        return m-1, 30
                } else {
                        return m-1, 31
                }
        }
}

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

int main(){
	string week[7] = {"Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"};
	int month[12] = {31,29,31,30,31,30,31,31,30,31,30,31};
	int m,d,cnt,mc;

	while( cin >> m >> d ){
		if(m==0) break;

		mc = 1;
		cnt = 3;
		while(1){
			for(int i=1 ; i <= month[mc-1] ; i++, cnt++){
				if(m==mc && d==i) break;
			}
			if(m==mc) break;
			mc++;
		}
		cout << week[cnt%7] << endl;
	}
	return 0;
}

C++: #include<iostream>
#include<cmath>
#include<cstdio>
using namespace std;
int main(){
	int days[12]={31,29,31,30,31,30,31,31,30,31,30,31};
	string youbi[7]={"Tursday","Friday","Saturday","Sunday","Monday","Tuesday","Wednesday"};
	while(1){
		int m,d,s=0;
		cin >> m >> d;
		if(!m&&!d)	break;
		for(int i=0;i<m-1;i++)	s+=days[i];
		s+=d;
		cout << youbi[(s-1)%7] << endl;
	}
	return 0;
}

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

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

C++: #include <stdio.h>

int main(){
	int m,d;
	int i;
	
	int Days;
	
	
	while(1){
		Days = 0;
		scanf("%d %d",&m,&d);
		if(m == 0&&d == 0)break;
		for(i = 1,Days += d;i < m;i++){
			if(i == 2){
				Days += 29;
			}else if(i == 4||i == 6||i == 9||i == 11){
				Days += 30;
			}else{
				Days += 31;
			}
		}
		
		switch(Days%7){
			case 0:printf("Wednesday\n");
					break;
			case 1:printf("Thusrday\n");
					break;
			case 2:printf("Friday\n");
					break;
			case 3:printf("Saturday\n");
					break;
			case 4:printf("Sunday\n");
					break;
			case 5:printf("Monday\n");
					break;
			case 6:printf("Tuesday\n");
					break;
		}
	}
	return 0;
}

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

const char *weekday_str[] = { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" };
enum WD { SUNDAY = 0, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY };
enum WD zeller(int year, int mon, int day){
    if(year < 1582 || mon < 1 || day < 1) throw;
    if(mon <= 2){ year--; mon += 12; }
    unsigned int h = (year + year/4 - year/100 + year/400 + (13*mon+8)/5 + day) % 7;
    return (WD)h;
}

int main(){
    int m, d;
    while(cin >> m >> d){
        if(m == 0 && d == 0) break;
        WD wd = zeller(2004, m, d);
        cout << weekday_str[wd] << endl;
    }
    return 0;
}

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

int main(){
int a,b,day;
string Day;
int days[]={31,29,31,30,31,30,31,31,30,31,30,31};
string Days[]={"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"};
while(cin>>a>>b){
	if(a==0)break;
day=4;
for(int i=0;i<11;i++){
if(a>i+1)b+=days[i];}
day+=b-1;
day%=7;
for(int i=0;i<7;i++){
if(day==i)Day=Days[i];}
cout<<Day<<endl;}}

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

int main()
{
	int monthday[12] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
	const char *weekday[7] = {"Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday", "Wednesday"};
	
	int month, day;
	
	while(cin >> month >> day, month)
	{
		int w = day - 1;
		for(int i = 1; i < month; i++)
		    w += monthday[i];
		cout << weekday[w % 7] << endl;
	}
	return 0;
}

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

int main() {
	vector<int> r;
	string d[7]={"Saturday","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday"};
	while (true)
	{
		int m,d;
		cin >> m >> d;
		if (m==0)break;
		if (m<3){m+=12;d-=2;}
		r.push_back((5+d+(13*(m+1))/5)%7);
	}
	for (int i=0; i<r.size(); i++)
	{
		cout << d[r[i]] << endl;
	}
	return 0;
}

C++: #include <stdio.h>
int main()
{
	char yobi[7][10]={"Wednesday","Thursday","Friday","Saturday","Sunday","Monday","Tuesday"};
	int month,day;
	while(1){
		scanf("%d %d",&month,&day);
		if(month==0)
			break;
		for(int i=1;i<month;i++){
			switch(i){
				case 2:
					day+=29;
				case 4:
				case 6:
				case 9:
				case 11:
					day+=30;
				default:
					day+=31;
			}
		}
		printf("%s\n",yobi[day%7]);
	}
	return 0;
}

C++: #include <iostream>
#include <string>
#include <map>
#include <utility>
using namespace std;
map<pair<int,int>,string> mp;
string s[7]={"Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"};
int main(){
	int cnt=3;
	for(int i=1;i<=12;i++){
		int days;
		if(i==2)	days=29;
		if(i&1) 	days=(i<=7?31:30);
		else 		days=(i<=7?30:31);
		for(int j=1;j<=days;j++){
			mp[make_pair(i,j)]=s[cnt++];
			cnt%=7;
		}
	}
	int m,d;
	while(true){
		cin>>m>>d;
		if(m==0)	return 0;
		cout<<mp[make_pair(m,d)]<<endl;
	}
	return 0;
}

C++: #include <iostream>
	#include <cstdio>
	#include <cstdlib>
	#include <time.h>
	#include <math.h>
	#include <vector>
	#include <queue>
	#include <map>
	#include <set>
	#include <algorithm>
	#include <iterator>
	#include <sstream>
	#include <string>
	#include <bitset>
	using namespace std;
	#define FOR(I,F,N) for(int I = F; I < (int)(N); I++)
	#define rep(i, n) FOR(i, 0, n)
	#define FIN(V) cout<<V<<endl
	#define pb push_back
	#define INF (1 << 30)
	typedef pair<int, int> P;
	typedef long long ll;
	typedef priority_queue<int> pq;
	int StrToInt(string);
	string IntToStr(int);
	int dx[4] = {1, -1, 0, 0};
	int dy[4] = {0, 0, 1, -1};
	
	int main(void){
		int month[] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
		int n, m;
		while(cin >> n >> m, n || m){
			int day = 0;
			rep(i, n-1)day += month[i];
			day += m;
			int yo = day % 7;
			if(yo == 1){
				FIN("Thursday");
			}else if(yo == 2){
				FIN("Friday");
			}else if(yo == 3){
				FIN("Saturday");
			}else if(yo == 4){
				FIN("Sunday");
			}else if(yo == 5){
				FIN("Monday");
			}else if(yo == 6){
				FIN("Tuesady");
			}else if(yo == 0){
				FIN("Wednesday");
			}
		}


		return 0;
	}
	
	
	
	int StrToInt(string s){
		stringstream ss;
		ss << s;
		int val;
		ss >> val;
		return val;
	}
	string IntToStr(int i){
		stringstream ss;
		ss << i;
		return ss.str();
	}