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

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() {
  char day[7][15] = {"Sunday", "Monday", "Tuesday", "Wednesday",
                     "Thursday","Friday","Saturday"};
  int m, d;
  while (scanf("%d%d", &m, &d), m) {
    puts(day[zeller(2004, m, d)]);
  }
}

C++: //2004??´???366??\ /1/1 Thursday

#include <cstdio>

using namespace std;

void today(int mon, int day);

int main()
{
	int mon, day;
	
	while (1){
		scanf("%d %d", &mon, &day);
		
		if (day == 0){
			break;
		}
		
		today(mon, day);
	}
	
	return (0);
}

void today(int mon, int day)
{
	int tmp = 0;
	
	for (int i = 1; i < mon; i++){
		if (mon == 4 || mon == 6 || mon == 9 || mon == 11){
			tmp += 30;
		}
		else if (mon == 2){
			tmp += 29;
		}
		else {
			tmp += 31;
		}
	}
	
	switch ((tmp + day) % 7){
	  case 0:
	    puts("Wednesday");
		break;
		
	  case 1:
	    puts("Thursday");
		break;
		
	  case 2:
	    puts("Friday");
		break;
		
	  case 3:
	    puts("Saturday");
		break;
		
	  case 4:
	    puts("Sunday");
		break;
		
	  case 5:
	    puts("Monday");
		break;
		
	  case 6:
	    puts("Tuesday");
		break;
	}
}

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

int main()
{
	int a, b, count = 0;
	int ans[100];
	while (cin >> a >> b) {
		if (a == 0)
			break;
		if (a == 1 || a == 4 || a == 7) {
			ans[count] = (b % 7 + 3)%7;
		}
		else if (a == 9 || a == 12) {
			ans[count] = (b % 7 + 2)%7;
		}
		else if (a == 2 || a == 8) {
			ans[count] = (b % 7 + 6)%7;
		}
		else if (a == 3 || a == 11) {
			ans[count] = b % 7;
		}
		else if (a == 5) {
			ans[count] = (b % 7 + 5)%7;
		}
		else if (a == 6) {
			ans[count] = (b % 7 + 1)%7;
		}
		else if (a == 10) {
			ans[count] = (b % 7 + 4)%7;
		}
		count++;
	}
	for (int i = 0; i < count; i++) {
		if (ans[i] == 1)
			cout << "Monday" << endl;
		else if (ans[i] == 2)
			cout << "Tuesday" << endl;
		else if (ans[i] == 3)
			cout << "Wednesday" << endl;
		else if (ans[i] == 4)
			cout << "Thursday" << endl;
		else if (ans[i] == 5)
			cout << "Friday" << endl;
		else if (ans[i] == 6)
			cout << "Saturday" << endl;
		else if (ans[i] == 7)
			cout << "Sunday" << endl;
	}
}

C++: #include <iostream>
#include <iomanip>
#include <list>
#include <map>
#include <algorithm>
#include <stack>
#include <string>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>

using namespace std;

int main(){
	pair<int,int> hiduke;
	string table[12][31];
	string day[] = {"Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"};
	int dayCounter = 3;


	for(int i = 0; i < 12; i++){
		if(i == 1){
			for(int j = 0; j < 29; j++){
				table[i][j] = day[dayCounter++];
				if(dayCounter % 7 == 0){
					dayCounter = 0;
				}
			}
		}
		else if(i == 3 || i == 5 || i == 8 || i == 10){
			for(int j = 0; j < 30; j++){
				table[i][j] = day[dayCounter++];
				if(dayCounter % 7 == 0){
					dayCounter = 0;
				}
			}
		}
		else{
			for(int j = 0; j < 31; j++){
				table[i][j] = day[dayCounter++];
				if(dayCounter % 7 == 0){
					dayCounter = 0;
				}
			}
		}
	}



	while(cin >> hiduke.first >> hiduke.second && hiduke.first != 0){
		cout << table[hiduke.first - 1][hiduke.second - 1] << endl;
	}

	return 0;
}