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;

const int MONTHS_IN_YEAR = 12;
const int DAYS_IN_WEEK = 7;
const int numOfDays[MONTHS_IN_YEAR] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
const string days[DAYS_IN_WEEK] = {"Wednesday", "Thursday", "Friday",
    "Saturday", "Sunday", "Monday", "Tuesday"};

int main(){
    for(int month, day, sumOfDays; cin >> month >> day, sumOfDays = day; cout << days[sumOfDays % DAYS_IN_WEEK] << endl)
        for(int i = 0; i < month - 1; i ++) sumOfDays += numOfDays[i];

    return 0;
}

C++: #include <bits/stdc++.h>
#include <stdio.h>
#include <numeric>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define repone(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define Rep(j,n) for(int j=0;j<(int)(n);++j)
#define Repo(j,o,n) for(int j=o;j<(int)(n);++j)
#define Repone(j,n) for(int j=1;j<(int)(n);++j)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define int long long
#define pb(a) push_back(a)
#define eraser(v,i) (v).erase(v.begin()+(i))
#define pbpair(a,b) push_back(make_pair(a,b))
#define MOD 1000000007
#define INF 9223372036854775807
#define pairint pair<int,int>
int num[13] = {0,31,29,31,30,31,30,31,31,30,31,30,31};
bool uru(int checkyear){if(checkyear%4==0){if(checkyear%100!=0||checkyear%400==0)return true;}return false;}
int gcd( int x, int y ){return y ? gcd(y, x%y) : x;}
bool pairCompare(const pairint& firstElof, const pairint& secondElof)
{
  if(firstElof.second!= secondElof.second)    return firstElof.second> secondElof.second;
  else return firstElof.first< secondElof.first;
}
signed main() {
int x=0,y=0,z=0,w=0,n=0,m=0;
std::vector<int> v(10);
while (std::cin >> x>>y,x) {
for(int i=0;i<x;i++){
  y+=num[i];
}
y%=7;
if(y==4)std::cout << "Sunday" << '\n';
else if(y==5)std::cout << "Monday" << '\n';
else if(y==6)std::cout << "Tuesday" << '\n';
else if(y==0)std::cout << "Wednesday" << '\n';
else if(y==1)std::cout << "Thursday" << '\n';
else if(y==2)std::cout << "Friday" << '\n';
else if (y==3) {std::cout << "Saturday" << '\n';
  /* code */
}
}
}

C++: #include<cstdio>
#include<algorithm>
#include<vector>
#include<string>
#include<iostream>
#include<queue>
#include<map>
#include<set>
#include<complex>
#include<stack>
#include<cmath>

using namespace std;

#define reps(i,f,n) for(int i=f;i<int(n);i++)
#define rep(i,n) reps(i,0,n)


#define X real()
#define Y imag()
typedef complex<double> P;

int main(){
	
	int m[13]={0,31,29,31,30,31,30,31,31,30,31,30,31};
	string s[7]={"Wednesday","Thursday","Friday","Saturday","Sunday","Monday","Tuesday"};
	while(1){
		int a,b;
		cin>>a>>b;
		if(a==0)break;
		
		int sum = 0;
		rep(i,a)sum+=m[i];
		sum += b;
		
		cout<<s[sum%7]<<endl;
	}
}

C++: #include <iostream>
#include <map>
#include <vector>

using namespace std;

void getDays(int month, int day)
{
    int dayNum[12] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
    int fst=0; // 1/1 ?????? (month-1)??????????????\?????§?????\??°
    for(int i=0; i<month-1; i++)
        fst += dayNum[i];
    fst += day; // month???1??\?????§?????\??°
    
    switch(fst % 7) {
        case 0:
            cout << "Wednesday" << endl;
            break;
        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;
        default:
            break;
    }

}

int main(void)
{
    ios::sync_with_stdio(false);
    int month, day;
    while(1) {
        cin >> month >> day;
        if(month == 0) break;
        getDays(month, day);
    }

    return 0;
}

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

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

    for(int i=1; i<m; i++) {
      switch(i){
      case 2:
	d+=29;
	break;
      case 4:
      case 6:
      case 9:
      case 11:
	d+=30;
	break;
      default :
	d+=31;
	break;
      }
    }
    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;
    }
  }
  return 0;
}

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

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

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

string check(int d) {
    if (d%7==1) {
        return "Thursday";
    } else if (d%7==2) {
        return "Friday";
    } else if (d%7==3) {
        return "Saturday";
    } else if (d%7==4) {
        return "Sunday";
    } else if (d%7==5) {
        return "Monday";
    } else if (d%7==6) {
        return "Tuesday";
    } else if (d%7==0) {
        return "Wednesday";
    }
}

int main(void){
    int m,d;
    while (cin>>m>>d) {
        if (m==0) {
            break;
        } else {
            if (m==1) {
                cout<<check(d)<<endl;
            } else if (m==2) {
                d=d+31;
                cout<<check(d)<<endl;
            } else if (m==3) {
                d=d+31+29;
                cout<<check(d)<<endl;
            } else if (m==4) {
                d=d+31+29+31;
                cout<<check(d)<<endl;
            } else if (m==5) {
                d=d+31+29+31+30;
                cout<<check(d)<<endl;
            } else if (m==6) {
                d=d+31+29+31+30+31;
                cout<<check(d)<<endl;
            } else if (m==7) {
                d=d+31+29+31+30+31+30;
                cout<<check(d)<<endl;
            } else if (m==8) {
                d=d+31+29+31+30+31+30+31;
                cout<<check(d)<<endl;
            } else if (m==9) {
                d=d+31+29+31+30+31+30+31+31;
                cout<<check(d)<<endl;
            } else if (m==10) {
                d=d+31+29+31+30+31+30+31+31+30;
                cout<<check(d)<<endl;
            } else if (m==11) {
                d=d+31+29+31+30+31+30+31+31+30+31;
                cout<<check(d)<<endl;
            } else if (m==12) {
                d=d+31+29+31+30+31+30+31+31+30+31+30;
                cout<<check(d)<<endl;
            }
        }
    }
}

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

using namespace std;

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

int main() {
	int month, day;
	long AA = 0, BB = 0, CC = 0, DD = 0;

	while (cin >> month >> day) {
		if (month == 0) {
			break;
		}

		AA = 2004;
		if (month < 3) {
			AA--;
			month += 13;
		}
		else {
			month++;
		}

		AA *= 365.25;
		BB = month * 30.6;
		CC = 2004 / 400;
		DD = 2004 / 100;

		AA = AA + BB + CC + day - DD - 429;
		BB = AA / 7;
		AA = AA - (BB * 7);

		cout << today[AA] << endl;
	}
	return 0;
}