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 <string>
#include <iostream>

using namespace std;

int main()
{
	int M[12] = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };

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

	int MM = -1, DD = -1, DAYS = -1;

	while (true)
	{
		cin >> MM >> DD;

		if (MM == 0 && DD == 0)
		{
			goto Exit;
		}

		DAYS = 0;

		for (int i = 0; i < (MM - 1); i++)
		{
			DAYS += M[i];
		}

		DAYS += DD;

		cout << D[DAYS % 7] << endl;
	}

Exit:;

	return 0;
}

C++: #include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <set>
#include <cmath>
#include <algorithm>
using namespace std;

int day_of_week(int y,int m,int d){
	static int t[]={0,3,2,5,0,3,5,1,4,6,2,4};
	y-=m < 3;
	return ( y + y/4 - y/100 + y/400 + t[m-1] + d) % 7 ;
}

int main(){
	int m , d , w=4 , fw;
	while (cin >> m >> d, m){
		switch(day_of_week(2004,m,d)){
			case 0:
			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;
		}
	}
	return 0; 
}

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

int main(int argc, const char * argv[])
{
    int month[12] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
    int m, d;
    while (scanf("%d %d", &m, &d) != 0) {
        int cnt = 0;
        if (m == 0 && d == 0) {
            return 0;
        }
        for (int i = 0; i < m - 1; i++) {
            cnt += month[m - 2];
        }
        cnt += d;

        if (cnt % 7 == 0) {
            printf("Wednesday\n");
        }
        if (cnt % 7 == 1) {
            printf("Thursday\n");
        }
        if (cnt % 7 == 2) {
            printf("Friday\n");
        }
        if (cnt % 7 == 3) {
            printf("Saturday\n");
        }
        if (cnt % 7 == 4) {
            printf("Sunday\n");
        }
        if (cnt % 7 == 5) {
            printf("Monday\n");
        }
        if (cnt % 7 == 6) {
            printf("Tuesday\n");
        }
    }
    return 0;
}

C++: #include <cstdio>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string.h>
#include <queue>
#include <stack>
#include <utility>
#include <queue>
#include <cmath>
#define mp make_pair
#define pii pair<int,int> 
#define ff first
#define ss second

using namespace std;

int month[20]={0,31,29,31,30,31,30,31,31,30,31,30,31};
string days[10]={" ","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"};
int a,b,c;
int main()
{
	while(1)
	{
		scanf("%d %d",&a,&b);
		c=0;
		if(a==0&&b==0)
		{
			break;
		}
		for(int i=1;i<a;i++)
		{
			c+=month[i];
		}
		c+=b;
		c%=7;
		c+=3;
		//printf("%d\n",c);
		cout<<days[c]<<endl;
	}
	return 0;
}

C++: //31,29,31,30,31,30,31,31,30,31,30,31//
#include <iostream>
using namespace std;
int main(){
    int d,m;
    while(cin>>m>>d){
        if(m==0)break;
        if(m==1)d=d%7;
        else if(m==2)d=(d+31)%7;
        else if(m==3)d=(d+60)%7;
        else if(m==4)d=(d+91)%7;
        else if(m==5)d=(d+121)%7;
        else if(m==6)d=(d+152)%7;
        else if(m==7)d=(d+182)%7;
        else if(m==8)d=(d+213)%7;
        else if(m==9)d=(d+244)%7;
        else if(m==10)d=(d+274)%7;
        else if(m==11)d=(d+305)%7;
        else d=(d+335)%7;
            if(d%7==1)cout<<"Thursday"<<endl;
            else if(d%7==2)cout<<"Fridy"<<endl;
            else if(d%7==3)cout<<"Saturday"<<endl;
            else if(d%7==4)cout<<"Sunday"<<endl;
            else if(d%7==5)cout<<"Monday"<<endl;
            else if(d%7==6)cout<<"Tuesday"<<endl;
            else cout<<"Wednesday"<<endl;
        
        }
    return 0;
}

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

int main() {
	int month, day, date = 0;

	while (cin >> month >> day, month != 0) {
		while (month) {
			switch (month - 1)
			{
			case 1:
			case 3:
			case 5:
			case 7:
			case 8:
			case 10:
				date += 31;
				break;
			case 2:
				date += 29;
				break;
			case 4:
			case 6:
			case 9:
			case 11:
				date += 30;
				break;
			default:
				break;
			}
			month--;
		}

		date += day;

		switch (date % 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;
			break;
		default:
			break;
		}
		date = 0;
	}
	return 0;
}

C++: #include <stdio.h>
#include <iostream>

using namespace std;

int main() {
	int a,b;
	int zellar;

	while (cin >> a >> b) {
		if (a == 0) {
			break;
		}

		if (a < 3) {
			a = a + 12;
			zellar = (2003 + (2003 / 4) + (2003 / 400) - (2003 / 100) + (((13 * a) + 8) / 5) + b) % 7;
		} else {
			zellar = (2004 + (2004 / 4) + (2004 / 400) - (2004 / 100) + (((13 * a) + 8) / 5) + b) % 7;
		}
		switch(zellar) {
		case 0: 
			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;
}

C++: #include<iostream>

using namespace std;

int main()
{
	int month[12];

	month[0]=31;
	month[1]=29;
	month[2]=31;
	month[3]=30;
	month[4]=31;
	month[5]=30;
	month[6]=31;
	month[7]=31;
	month[8]=30;
	month[9]=31;
	month[10]=30;
	month[11]=31;

	int hoge,fuga;

	hoge = 1;

	int i;
	int count=0;

	while(hoge!=0)
	{
		count = 0;
		cin >> hoge >> fuga;
		//cout << count << endl;
		for(i=0;i<hoge-1;i++)
		{
			count+=month[i];
		}	
		//cout << count << endl;

		count+=fuga;

		//cout << count << endl;

		int flag = 0;
	
		flag = count % 7;

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