Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
	"time"
)

var sc = bufio.NewScanner(os.Stdin)

//Sliceconvtoi ...
func Sliceconvtoi() []int {
	strs := strings.Split(sc.Text(), " ")

	var ints []int
	var x int

	for _, s := range strs {
		x, _ = strconv.Atoi(s)
		ints = append(ints, x)
	}

	return ints
}

func main() {
	for sc.Scan() {
		i := Sliceconvtoi()

		if i[0] == 0 && i[1] == 0 {
			break
		}

		m := time.Month(i[0])
		d := i[1]
		t := time.Date(2004, m, d, 0, 0, 0, 0, time.Local)
		fmt.Println(t.Weekday())
	}

}

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

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

const int month[] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30};
int main()
{
  int m, d, cntdays = 0;
  
  while (cin >> m >> d, m){
    cntdays = month[m - 1] + d;
    switch (cntdays % 7){
      case 5:
        cout << "Monday";
        break;
      case 6:
        cout << "Tuesday";
        break;
      case 0:
        cout << "Wednesday";
        break;
      case 1:
        cout << "Thursday";
        break;
      case 2:
        cout << "Friday";
        break;
      case 3:
        cout << "Saturday";
        break;
      case 4:
        cout << "Sunday";
        break;
    }
    cout << endl;
  }
}

C++: #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <functional>
#include <sstream>
#include <complex>
#include <climits>
using namespace std;

#define REP(i,a,n) for(int i=(a);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define EPS 1e-8

int main(){
	int m,d;
	const int day[] = {31,29,31,30,31,30,31,31,30,31,30,31};
	const char *youbi[] = {
		"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"
	};
	while(scanf("%d",&m),m){
		scanf("%d",&d);
		int sum = 0;
		rep(i,m-1)sum+=day[i];
		sum += d;
		puts(youbi[(sum+2)%7]);
	}
	return 0;
}

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;
}