Go: package main

import "fmt"

func main() {
	days := [12]int{31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}
	weekday := [7]string{"Wednesday", "Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday"}

	for {
		var m, d int
		fmt.Scan(&m, &d)
		if m == 0 {
			break
		}

		for i := 0; i < m-1; i++ {
			d += days[i]
		}

		fmt.Println(weekday[d%7])
	}
}

C++: #include <bits/stdc++.h>

using namespace std;

template<class T> inline T sqr(T x) {return x*x;}

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned long long ULL;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

const double EPS = 1e-10;
const double PI  = acos(-1.0);

#define CLR(a) memset((a), 0 ,sizeof(a))

int dx[4] = {-1, 0, 1, 0};
int dy[4] = {0, -1, 0, 1};

int main() {
  int k,m,d;
  string today[7]={"Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"};
  int mon[12]={31,29,31,30,31,30,31,31,30,31,30,31};

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

    for(int i=0;m-1>i;i++){

      if(m==1)break;
      else d+=mon[i];

  }
    k=d%7+2;
    cout <<today[k]<<endl;
  
  }
}

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

int month[13]={0,31,29,31,30,31,30,31,31,30,31,30,31};

int main(){
    int m,d;

    while(cin>>m>>d,m){
        for(int i=1;i<m;i++)d+=month[i];
        d=(d-1)%7+1;
        string ans;
        switch((d+2)%7){
        case 0:ans="Monday";break;
        case 1:ans="Tuesday";break;
        case 2:ans="Wednesday";break;
        case 3:ans="Thursday";break;
        case 4:ans="Friday";break;
        case 5:ans="Saturday";break;
        case 6:ans="Sunday";break;
        }

        cout<<ans<<endl;
    }
}

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)//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
 
    }
}

C++: #include <iostream>
#include <vector>
using namespace std;
int main() {
	char w[7][8]={"Thurs","Fri","Satur","Sun","Mon","Tues","Wednes"};
	int mon[12]={31,29,31,30,31,30,31,31,30,31,30,31};
	int m,d,i,j,s;
    vector<int> a,b;
	while (cin >> m >> d) {
		if (m==0 || d==0) break;
		a.push_back(m); b.push_back(d);
	}
	for (i=0; i<a.size(); i++) {
     s=0;
	 for (j=0;j<a[i]-1;j++) s+=mon[j];
     s=(s+b[i]-1) % 7;
     cout << w[s] << "day" << endl;
	}
	return 0;
}

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

int manth[] = {31,29,31,30,31,31,30,31,31,30,31,30,31};
string date[] = {"Sunday","Manday","Tuesday","Wednesday","Thursday","Friday","Suterday"};

int main(){
	int M, D;
	while( cin >> M >> D, M ){
		int d = 3;
		for(int i=0; i<M-1; i++ ){
			d += manth[i];
		}
		d += D;
		d %= 7;
		cout << date[d] << endl;
	}
}

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

int main(){
	int m, d, year;
	while(1){
		year = 2004;
		cin >> m >> d;
		if(m == 0 && d == 0){
			break;
		}
		if(m <= 2){
			m += 12;
			year -= 1;
		}
		int c = floor(year / 100);
		int gamma = 5 * c + floor(c / 4);
		int y = year % 100;
		int h = d + floor(26 * (m + 1) / 10) + y + floor(y / 4) + gamma;
		int day = h % 7;
		switch(day){
			case 0:
				cout << "Saturday" << endl;
				break;
			case 1:
				cout << "Sunday" << endl;
				break;
			case 2:
				cout << "Monday" << endl;
				break;
			case 3:
				cout << "Tuesday" << endl;
				break;
			case 4:
				cout << "Wednesday" << endl;
				break;
			case 5: 
				cout << "Thursday" << endl;
				break;
			case 6:
				cout << "Friday" << endl;
				break;
			default:
				break;
		}
	}
	return 0;
}

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

int Zeller(int y, int m, int d){
	if (m == 1){ m = 13; --y; }
	else if (m == 2){ m = 14; --y; }
	return (int)(d + floor(26.0 * (m + 1.0) / 10.0) + (y % 100) + floor((y % 100) / 4.0) + (5.0 * (floor(y / 100.0))) + floor(floor(y / 100.0) / 4.0)) % 7;
}

int main(){
	string days[7] = { "Saturday", "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday" };
	int m, d;
	
	while (true){
		cin >> m >> d;
		if (m == 0 && d == 0)break;
		cout << days[Zeller(2004, m, d)] << endl;
	}
	return 0;
}

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

int days[13][32];

std::string whatday(int m, int d) {
	switch (days[m][d]) {
	case 0:
		return "Monday";
	case 1:
		return "Tuesday";
	case 2:
		return "Wednesday";
	case 3:
		return "Thursday";
	case 4:
		return "Friday";
	case 5:
		return "Saturday";
	case 6:
		return "Sunday";
	}
	return "";
}

int main() {
	int day = 3;
	for (int i = 1; i < 13; i++) {
		for (int j = 1; j < 32; j++) {
			days[i][j] = day;
			day = (day+1) % 7;
			if (i == 2 && j == 29) break;
			if (i == 4 && j == 30) break;
			if (i == 6 && j == 30) break;
			if (i == 9 && j == 30) break;
			if (i == 11 && j == 30) break;
		}
	}
	int m, d;
	while (std::cin >> m >> d) {
		if (m == 0) break;
		std::cout << whatday(m, d) << std::endl;
	}
	return 0;
}

C++: #include<iostream>

using namespace std;

int main(void) {
	int m, d, day;
	string dstr[7] = {"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"};

	while(true) {
		cin >> m >> d;
		if(m == 0) { break; }
		day = 0;
		switch(m) {
			case 12:
				day += 30;
			case 11:
				day += 31;
			case 10:
				day += 30;
			case 9:
				day += 31;
			case 8:
				day += 31;
			case 7:
				day += 30;
			case 6:
				day += 31;
			case 5:
				day += 30;
			case 4:
				day += 31;
			case 3:
				day += 29;
			case 2:
				day += 31;
			case 1:
				day += d;
				break;
		}
		cout << dstr[(day+9)%7] << endl;
	}

	return 0;
}

C++: #include <iostream>
using namespace std;
int main() {
  int mon, day;
  string youbi[7] = {"Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday", "Wednesday"};
  int tDay[12] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
  int yb;

  while(cin >> mon >> day && mon) {
    yb = 0;
    for(int i = 0; i < mon-1; i++) {
      yb += tDay[i];
    }
    yb += day-1;
    yb %= 7;
    
    cout << youbi[yb] << endl;
  }
 
  return 0;
}

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

int m,d;
int data[] = {31,29,31,30,31,30,31,31,30,31,30,31};
string day[] = {"Thursday","Friday","Saturday","Sunday","Monday","Tuesday","Wednesday"};

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

		for(int i = 0; i < m - 1; i++){
			d+=data[m];
		}
		cout << day[(d-1)%7] << endl;
	}
}