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 <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 <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <iomanip>
#include <queue>
#include <stack>
#include <deque>
#include <bitset>
#include <utility>
#include <functional>

using namespace std;

int m, d, A[13] = { 0,0,31,60,91,121,152,182,213,244,274,305,335 };
string s[7] = { "Wednesday", "Thursday","Friday","Saturday","Sunday","Monday","Tuesday" };
int main() {
	while (1) {
		cin >> m >> d;
		if (m == 0) break;
		cout << s[(A[m] + d) % 7] << endl;
	}
	return 0;
}

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

using namespace std;

int main(void){
  int a,b;

  int nday[15] = {0,31,29,31,30,31,30,31,31,30,31,30,31};
  string ans[10] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};

  while(true){
    scanf("%d%d", &a,&b);
    if(a == 0 && b == 0)
      break;
    
    int sum = 3;
    for(int i = 1; i < a; i++)
      sum += nday[i];
    sum += b;

    printf("%s\n", ans[sum%7].c_str());

  }
  return 0;
}

C++: #include<cstdio>

int main(){
	int a[] = {0,0,31,60,91,121,152,182,213,244,274,305,335,366};
	int m, d;
	char day[7][10] = {"Monday", "Tuesday", "Wednesday", "Thursday","Friday","Saturday","Sunday"};
	scanf("%d %d", &m, &d);
	while(m || d){
		printf("%s\n", day[(a[m] + d + 2) % 7]);
		scanf("%d %d", &m, &d);
	}
}

C++: #define _USE_MATH_DEFINES
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<list>
#include<stack>
#include<queue>
#include<cctype>
#include<iomanip>
#include<functional>
#include<numeric>
#define EPS 1e-10
using namespace std;
typedef long long llong;
void whatday(int x, int y) {
	if (x % 7 == y % 7)cout << "Monday" << endl;
	else if (x % 7 == (y + 1) % 7)cout << "Tuesday" << endl;
	else if (x % 7 == (y + 2) % 7)cout << "Wednesday" << endl;
	else if (x % 7 == (y + 3) % 7)cout << "Thursday" << endl;
	else if (x % 7 == (y + 4) % 7)cout << "Friday" << endl;
	else if (x % 7 == (y + 5) % 7)cout << "Saturday" << endl;
	else if (x % 7 == (y + 6) % 7)cout << "Sunday" << endl;
}
int main() {
	int m, d;
	while (cin >> m >> d&&m&&d) {
		int x = 0;
		if (m < 3) {
			x += (m - 1) * 31 + (d - 1);
			whatday(x, 4);
		}
		else {
			x += 31 + 29;// 3/1
			m -= 3; d--;
			x += 61 * (m / 2) + (m % 2) * 31 + d;
			whatday(x, 4);
		}
	}
	return 0;
}

C++: #include <iostream>
#include <string>
using namespace std;
int main(){
    int mon,day,ans=0,answer=0,sum[13]={1,31,60,91,121,152,182,213,244,274,305,335,366};
    string date[8]={"Wednesday","Thursday","Friday","Saturday","Sunday","Monday","Tuesday"};
    while(cin>>mon>>day){
        if(mon==0)break;
        mon=mon-1;
        if(mon>0){
            ans=day+sum[mon];
        }else{
            ans=day;
        }
        answer=ans%7;
        cout<<date[answer]<<endl;
    }
    return 0;
}

C++: #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <cctype>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <bitset>
#include <complex>
#include <fstream>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T> T RoundOff(T a){ return int(a+.5-(a<0)); }
template<class T, class C> void chmax(T& a, C b){ if(a < b) a = b; }
template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; }
template<class T, class C> pair<T, C> mp(T a, C b){ return make_pair(a, b); }

int main()
{
	int m, d;
	while(cin >> m >> d && m)
	{
		int month[] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

		rep(i, m-1)
			d += month[i];

		switch(d%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;
		}
	}
}

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

int main() {
	string youbi[7] = {"Wednesday","Thursday","Friday","Suturday","Sunday","Monday","Tuesday"};
	int month[12] = {31,29,31,30,31,30,31,31,30,31,30,31};
	
	int gathu,nichi;
	while ( cin >> gathu >> nichi,gathu ) {
		int keika = 0;
		for ( int i = 0; i < gathu-1; i++ ) {
			keika += month[i];
		}
		keika += nichi;
		
		cout <<  youbi[keika % 7] << endl;
	}
	return 0;
}

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 == 2){
			for(int j = 0; j < 29; j++){
				table[i][j] = day[dayCounter++];
				if(dayCounter % 7 == 0){
					dayCounter = 0;
				}
			}
		}
		else if(i == 4 || i == 6 || i == 9 || i == 11){
			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;
}

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

int main() {
    int month, day;
    string weekday[7] = { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" };
    while (cin >> month >> day) {     
        time_t rawtime;
        struct tm * timeinfo;

        time(&rawtime);
        timeinfo = localtime(&rawtime);

        timeinfo->tm_year = 2004-1900;
        timeinfo->tm_mon = month - 1;
        timeinfo->tm_mday = day;
        
        mktime(timeinfo);

        cout << weekday[timeinfo->tm_wday] << endl;
    }
    return 0;
}

C++: #include<bits/stdc++.h>
#define rep(i,n)for(ll i=0;i<n;i++)
using namespace std;
typedef long long ll;

int main(){
  int a,b;
  string day[]={"Thursday","Friday","Saturday","Sunday","Monday","Tuesday","Wednesday"};
  int months[] = {31,29,31,30,31,30,31,31,30,31,30,31};
  while(cin>>a>>b,a,b){
    a--;b--;
    // --a;--b;
    // cout << a<<b;
    rep(i,a) b+=months[i];
    // cout<<b<<endl;
    cout<<day[b%7]<<endl;
    // rep(i,a) b+=months[i];
  }
  return 0;
}