Go: package main

import (
	"bufio"
	"os"
	"strconv"
	"fmt"
)

var scanner = bufio.NewScanner(os.Stdin)

func nextInt() int {
	scanner.Scan()
	i, e := strconv.Atoi(scanner.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func zeller(month, day int) int {
	year := 2004
	if month == 1 || month == 2 {
		year--
		month += 12
	}
	return (year + year/4 - year/100 + year/400 + (13*month+8)/5 + day)%7
}

func main() {
	scanner.Split(bufio.ScanWords)
	for {
		month := nextInt()
		day := nextInt()
		if month == 0 && day == 0{
			break
		}
		switch zeller(month, day) {
		case 0:
			fmt.Println("Sunday")
		case 1:
			fmt.Println("Monday")
		case 2:
			fmt.Println("Tuesday")
		case 3:
			fmt.Println("Wednesday")
		case 4:
			fmt.Println("Thursday")
		case 5:
			fmt.Println("Friday")
		case 6:
			fmt.Println("Saturday")
		}
	}
}

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,count_w, count_m;
	while(cin >> m >> d){
		if(m == 0) return 0;
		
		count_m = 1;
		count_w = 3;
		while(m != count_m){
			for(int i=1; i<=month[count_m-1]; i++, count_w++)
				if(m==count_m && d==i) break;
			count_m++;
		}
		cout << week[count_w%7] << endl;
	}
}

C++: #include <iostream>

int main(){
	using namespace std;
	while(1){
	int month,day,year = 2004,mod;
	cin >> month >> day;
	if (month==0) break;
	else if (month<=2) {
		month += 12;
		year -= 1;
	}
	int k = year % 100;
	int j = year / 100;
	mod = (day+(((month+1)*26)/10)+k+(k/4)+(j/4)+5*j)%7;
	if (mod == 0) cout << "Saturday" << endl;
	else if (mod == 1) cout << "Sunday" << endl;
	else if (mod == 2) cout << "Monday" << endl;
	else if (mod == 3) cout << "Tuesday" << endl;
	else if (mod == 4) cout << "Wednesday" << endl;
	else if (mod == 5) cout << "Thursday" << endl;
	else if (mod == 6) cout << "Friday" << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <string>
using namespace std;
int main( void )
{
	int days[13] = { 0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
	string d[7] = { "Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday", "Wednesday" };

	while (1)
	{
		int month;
		int day;
		cin >> month >> day;
		if ( month == 0 && day == 0 )
			break;

		for ( int i = 1; i < month; i++ )
		{
			day += days[i];
		}

		day--;
		int index = day % 7;
		cout << d[index] << endl;

	}

	return 0;
}

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

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

int month, date;

	//前月までの延べ日数に変換
	for( int i = 1; i < 13; i++ ) {
		days[i] += days[i-1];
	}

	while( cin >> month >> date ) {
		if( month == 0 )
			return -1;
		
		int day = days[month-1] + date + 3;
		int p = day %7;

		cout << ans[p] << endl;

	}
	return 0;
}

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

int main(void){

    string day[7] = {"Monday","tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"};
    int month[12] = {31,29,31,30,31,30,31,31,30,31,30,31};
    int x,y;

    while(cin >> x >> y){
        if(x == 0 || y == 0){
            break;
        }


        for(int i = 0;i < x-1;i++){
            y += month[i];
        }

        cout << day[(y%7+2)%7] << endl;


        




    }


    return 0;
}

C++: #include <iostream>

using namespace std;
int MONTH[12] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
char day_of_the_week[32][32] = {{"Thursday"},
								{"Friday"},
								{"Saturday"},
								{"Sunday"},
								{"Monday"},
								{"Tuesday"},
								{"Wednesday"},
};
void solve()
{
	int month, day;
	while(cin >> month >> day, month || day)
	{
		int sum = 0;
		for(int i = 0; i < month - 1; ++i)
		{
			sum += MONTH[i];
		}
		sum += day - 1;
		cout << day_of_the_week[sum % 7] << endl;
	}
}

int main()
{
	solve();
	return(0);
}

C++: #include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <sstream>
#include <utility>
#include <cstdlib>
#include <cctype>
#include <climits>
#include <fstream>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<double> vd;
typedef vector<pair<int, int> > vpii;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define foreach(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); itr++)
#define dbg(x) cout << #x"="<< (x) << endl
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back(a) 
#define in(x) cin >> x;
#define all(x) (x).begin(), (x).end()
#define INF 2147483600
#define fi first
#define se second
using namespace std;



int main(){
    int m,d;
    map <int,string> date;
    date[5] = "Monday";
    date[6] = "Tuesday";
    date[0] = "Wednesday";
    date[1] = "Thursday";
    date[2] = "Friday";
    date[3] = "Saturday";
    date[4] = "Sunday";
    while(1){
        cin>>m>>d;
        if(m==0)break;
        rep(i,m-1){
            if(i==1){
                d+=29;
            }else if(i==3||i==5||i==8||i==10){
                d+=30;
            }else{
                d+=31;
            }
        }
        cout<<date[d%7]<<endl;
    }
}

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;
		else 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<string>
using namespace std;
int x[13][32], y[13] = { 0,31,29,31,30,31,30,31,31,30,31,30,31 }, sum, n, m; string T[7] = { "Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday" };
int main() {
	for (int i = 1; i <= 12; i++) {
		for (int j = 1; j <= y[i]; j++) {
			x[i][j] = sum % 7;
			sum++;
		}
	}
	while (true) {
		cin >> n >> m; if (!n) { break; }
		cout << T[x[n][m]] << endl;
	}
}

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

#define REP(i, s, n) for (int i = s; i < n; ++i)
#define rep(i, n) REP(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false

//Zeller's conguence

int main()
{
    int h, y, m, d;
    h = 20;
    y = 4;
    cin >> m >> d;
    if (m == 1 || m == 2)
    {
        m += 12;
        y--;
    }
    int r = 5 * h + h / 4;
    int w = {d + ((13 * (m + 1)) / 5) +
             y + y / 4 + r + 5};

    int ans = w % 7 + 1;
    cout << w << " " << ans << endl;
    switch (ans)
    {
    case 7:
        cout << "Sunday" << endl;
        break;
    case 1:
        cout << "Monday" << endl;
        break;
    case 2:
        cout << "Tuesday" << endl;
        break;
    case 3:
        cout << "Wednesday" << endl;
        break;
    case 4:
        cout << "Thursday" << endl;
        break;
    case 5:
        cout << "Friday" << endl;
        break;
    case 6:
        cout << "Saturday" << endl;
        break;
    }
    return 0;
}