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>
using namespace std;
int main(void) {
	int Month[13]{
		0,
		31,29,31,30,
		31,30,31,31,
		30,31,30,31
	};
	//??????0?????\???6
	int dow = 2;
	int in_day, in_month;
	while (cin >> in_month >> in_day) {

		if (in_month == 0)break;

		dow = 2;
		for (int i = 0; i < in_month; i++) {
			dow += Month[i];
		}
		dow += in_day;
		if (dow % 7 == 0) {
			cout << "Monthday" << endl;
		}
		else if (dow % 7 == 1) {
			cout << "Tuesday" << endl;
		}
		else if (dow % 7 == 2) {
			cout << "Wednesday" << endl;
		}
		else if (dow % 7 == 3) {
			cout << "Thursday" << endl;
		}
		else if (dow % 7 == 4) {
			cout << "Friday" << endl;
		}
		else if (dow % 7 == 5) {
			cout << "Saturday" << endl;
		}
		else if (dow % 7 == 6) {
			cout << "Sunday" << endl;
		}
	}
	return 0;
}

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

int main() {

  int input1,input2;

  int days[12] = {31,29,31,30,31,30,31,31,30,31,30,31};

  while(true) {

    cin >> input1 >> input2;
    if ( input1 == 0 ) break;

    int cnt = 0;

    for ( int i = 0; i < input1-1; i++ ) {
      cnt += days[i];
    }
    cnt += input2-1;

    int week = ( cnt + 3 ) % 7;

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

  }

  return 0;

}

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

int main(void){
	string day[7]={	"Thursday",
 					"Friday",
 					"Saturday",
					"Sunday",
					"Monday",
 					"Tuesday",
 					"Wednesday"
				};
	int month[13]={0,31,29,31,30,31,30,31,31,30,31,30,31};
	int m,d;
	while(cin >> m >> d,m|d){
		int r=-1;
		for(int i=0;i<m;i++)
			r+=month[i];
		r+=d;
		r%=7;
		cout << day[r] << endl;
	}
	return 0;
}

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

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

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() {
	int m, n;
	while ( cin >> m >> n, m | n) {
		cout << week[zeller(2004, m, n)] << endl;
	}
	return 0;
}

C++: #define _USE_MATH_DEFINES
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>

typedef long long ll;
using namespace std;

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

	int a,b;
	while(~scanf("%d %d",&a,&b)){
		if(a==0 && b==0) break;

		int passed=0;
		for(int i=0;i<a - 1;i++){
			passed += days[i];
		}

		passed += b;
		cout << week[(passed - 1) % 7] << endl;
	}
}

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

using namespace std;

int main(){
    int m, d;
    string day[] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
    while (cin >> m >> d) {
        if (!m && !d){
            break;
        }
        int year = 2004, h;
        if (m == 1 || m == 2){
            year--;
            m += 12;
        }
        h = (year + year / 4 - year / 100 + year / 400 + (13 * m + 8) / 5 + d) % 7;
        cout << day[h] << endl;
    }

    return 0;
}

C++: #include <iostream>
#include <string>
using namespace std;
 int main()
{
	//arrays with number of days in month and the days names
    int days[] = {31,29,31,30,31,30,31,31,30,31,30,31};
    string week[7] = {"Wednesday","Thursday","Friday","Saturday","Sunday","Monday","Tuesday"};
    int month, day;
    while(cin >> month >> day, month||day)//entering day
	{
		
        int n = 0;
        for(int i=1; i<month; i++)
		{
            n += days[i-1];
        }
        n += day;
 
        n %= 7;
        cout << week[n] <<endl;//printing the day
 
    }
  return 0;
}

C++: #include <iostream>
#include <string>
using namespace std;
enum TheDay {
	Monday = 0, 
	Tuesday = 1,
	Wednesday = 2,
	Thursday = 3,
	Friday = 4,
	Saturday = 5,
	Sunday = 6
};
string getTheDayString(TheDay d){
	switch(d){
	case Monday:	return "Monday";
	case Tuesday:	return "Tuesday";
	case Wednesday: return "Wednesday";
	case Thursday:	return "Thursday";
	case Friday:	return "Friday";
	case Saturday:	return "Saturday";
	case Sunday:	return "Sunday";
	}
	return "";
}
int main()
{
	int MD[12] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
	int MK[12] = {};
	MK[0] = 3;
	for(int i = 1; i < 12; ++i)
		MK[i] = (MK[i - 1] + MD[i - 1]) % 7;

	int m, d;
	while(cin >> m >> d){
		if(0 == m && 0 == d) break;
		TheDay a = (TheDay)((MK[m-1] + d - 1) % 7);
		cout << getTheDayString(a) << "\n";
	}
	return 0;
}

C++: #include <iostream>
#include <stdio.h>
int main(void){
    int month,day,chek;
    while(std::cin >> month >> day,month){ int year = 2004;
    if(month == 1 || month == 2){year--;month+=12;}
    chek = ((year+ year/4-year/100+year/400+(13*month+8)/5+day)%7);
    switch (chek) {case 0:puts("Sunday");break; case 1:puts("Monday");break; case 2:puts("Tuesday");break; case 3:puts("Wednesday");break;
        case 4:puts("Thursday");break; case 5:puts("Friday");break; case 6:puts("Saturday");break; }}return 0;}

C++: #define scanf_s scanf
//#define gets_s gets
#include <stdio.h>
#include <string>
#include <iostream>
#include <math.h>
using namespace std;
#define MAX 10
#define MIN -100001
#define _MAX 10
int main(void)
{
	char *days[7] = { "Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday" };
	int month_sum[12] = { 31,29,31,30,31,30,31,31,30,31,30,31 };
	int month, day, sum = 0;
	while (1) {
		scanf_s("%d %d", &month, &day);
		if (month == 0) break;
		for (int i = 1; i < month; ++i) {
			sum += month_sum[i - 1];
		}
		sum += day;
		printf("%s\n", days[(sum + 2) % 7]);
		sum = 0;
	}
}

C++: #include <iostream>

using namespace std;

string dow[] = {
  "Monday",
  "Tuesday",
  "Wednesday",
  "Thursday",
  "Friday",
  "Saturday",
  "Sunday"
};
int month[] = {
  31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
};

int main() {
  int m, d;
  while (cin >> m >> d) {
    if (m == 0) break;
    m--; d--;

    int day = 0;
    for (int i = 0; i < m; i++) {
      day += month[i];
    }
    day += d;
    day += 3;
    day %= 7;

    cout << dow[day] << endl;
  }

  return 0;
}