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;

typedef complex<double> P;

string dow[] = {
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday",
"Sunday"
};
int main(){
	int m,d;
	while( cin >> m >> d && m ){
		int h = 3;
		for(int i = 1 ; i <= 12 ; i++){
			for(int j = 1 ; j <= vector<int>{-1,31,29,31,30,31,30,31,31,30,31,30,31}[i] ; j++){
				
				if( i == m and j == d ){
					cout << dow[h] << endl;
					goto exit;
				}
				h = (h+1) % 7;
			}
		}
		exit:;
	}
	
			
			
}

C++: #include <iostream>

using namespace std;

int main(void){
	int m, d;
	int i;
	int term;
	int dow;

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

		term = 0;
		for(i=1;i<m;i++){
			if(i==2){
				term += 29;
			}else if(i==4||i==6||i==9||i==11){
				term += 30;			
			}else{
				term += 31;
			}
		}
		term += d - 1;

		dow = term % 7;

		switch(dow){
		case(0):
			cout << "Thursday" << endl;
			break;
		case(1):
			cout << "Friday" << endl;
			break;
		case(2):
			cout << "Saturday" << endl;
			break;
		case(3):
			cout << "Sunday" << endl;
			break;
		case(4):
			cout << "Monday" << endl;
			break;
		case(5):
			cout << "Tuesday" << endl;
			break;
		case(6):
			cout << "Wednesday" << endl;
			break;
		}
	}

	return 0;
}

C++: #include <iostream>
using namespace std;
const string str[] = {"Wednesday","Thursday","Friday",
		      "Saturday","Sunday","Monday","Tuesday"};
const int m[] = {0,31,29,31,29,31,30,31,31,30,31,30,31};
int main(){
  int mon,day;
  while(cin >> mon >> day, mon + day){

    for(int i = 0 ; i < mon ; i++){
      day += m[i];
    }
    cout << str[day%7] << endl;
}
  return 0;
}

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

C++: #include <iostream>
using namespace std;
int main(void){
    // Here your code !

    string str[7]={"Wednesday","Thursday","Friday","Saturday","Sunday","Monday","Tuesday"};
    int month[13]={0,31,29,31,30,31,30,31,31,30,31,30,31};
    while(1){
            int m,d,n=0;
    cin>>m>>d;
    if(m==0) break;

    for(int i=1;i<m;i++){
        n=n+month[i];
    }
    n=n+d;
    
  
        
        cout<<str[n%7]<<endl;
    }
}

C++: 
//Nayeem Shahriar Joy ,Applied Physics And Electronic Engineering , University of Rajshahi.

 #include<iostream>
#include<string>
#include<algorithm>
#include<vector>

using namespace std;


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

C++: #include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
using namespace std;

int main(){
  int M[13] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
  string w[7] = {"Wednesday", "Thursday", "Friday", "Saturday", "Sunday", "Monday", "Thuesday"};

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

    int tmp = d;
    for(int i=0; i<m; i++) tmp += M[i];

    cout << w[tmp%7] << endl;
  }

  return 0;
}

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

int main(){
	string week[7] = {"Mondey","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"};
	int month[12] = {31,29,31,30,31,30,31,31,30,31,30,31};
	int m,d,cnt,mc;

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

		mc = 1;
		cnt = 3;
		while(1){
			for(int i=1 ; i <= month[mc-1] ; i++, cnt++){
				if(m==mc && d==i) break;
			}
			if(m==mc) break;
			mc++;
		}
		cout << week[cnt%7] << endl;
	}
	return 0;
}

C++: //include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

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

//typedef
//------------------------------------------
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;

//container util
//------------------------------------------
#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())

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

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

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int main() {
  int month, dates, day;
  while(cin >> month >> dates) {
    if(month == 0)break;
    day = 3;
    for(int i = 1; i < month; i++) {
      switch(i) {
      case 1:
      case 3:
      case 5:
      case 7:
      case 8:
      case 10:
      case 12:
	day += 31;
	break;
      case 2:
	day += 29;
	break;
      case 4:
      case 6:
      case 9:
      case 11:
	day += 30;
	break;
      }
    }

    day += dates-1;
    day %= 7;
    
    switch(day) {
    case 0:
      cout << "Monday" << endl;
      break;
    case 1:
      cout << "Tuesday" << endl;
      break;
    case 2:
      cout << "Wednesday" << endl;
      break;
    case 3:
      cout << "Thursday" << endl;
      break;
    case 4:
      cout << "Friday" << endl;
      break;
    case 5:
      cout << "Saturday" << endl;
      break;
    case 6:
      cout << "Sunday" << endl;
      break;
    }
  }
}