Go: package main

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

var scanner = bufio.NewScanner(os.Stdin)

func nextInt() int {
	scanner.Scan()
	i, e := strconv.Atoi(scanner.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func zeller(month, day int) int {
	year := 2004
	if month == 1 || month == 2 {
		year--
		month += 12
	}
	return (year + year/4 - year/100 + year/400 + (13*month+8)/5 + day)%7
}

func main() {
	scanner.Split(bufio.ScanWords)
	for {
		month := nextInt()
		day := nextInt()
		if month == 0 && day == 0{
			break
		}
		switch zeller(month, day) {
		case 0:
			fmt.Println("Sunday")
		case 1:
			fmt.Println("Monday")
		case 2:
			fmt.Println("Tuesday")
		case 3:
			fmt.Println("Wednesday")
		case 4:
			fmt.Println("Thursday")
		case 5:
			fmt.Println("Friday")
		case 6:
			fmt.Println("Saturday")
		}
	}
}

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

int main(){
  int a,b,WD;
  while(cin>>a>>b){
    if(a==0){WD=8;break;}
    else if ((a==1)||(a==4)||(a==7))WD=(b+3)%7;
    else if ((a==2)||(a==8))WD=(b+6)%7;
    else if ((a==3)||(a==11))WD=b%7;
    else if (a==5)WD=(b+5)%7;
    else if (a==6)WD=(b+1)%7;
    else if ((a==9)||(a==12))WD=(b+2)%7;
    else if (a==10)WD=(b+4)%7;
    if(WD==0){
      cout <<"Sunday"<<endl;
    }
    else if(WD==1){
      cout <<"Monday"<<endl;
    }
    else if(WD==2){
      cout <<"Tuesday"<<endl;
    }
    else if(WD==3){
      cout <<"Wednesday"<<endl;
    }
    else if(WD==4){
      cout <<"Thursday"<<endl;
    }
    else if(WD==5){
      cout <<"Friday"<<endl;
    }
     else if(WD==6){
      cout <<"Saturday"<<endl;
    }
  }
  return 0;
}

C++: #include <iostream>
#include <string>
using namespace std;
 
string week[7]={"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
 
int main(){
    int m, d, y;
    while(cin>>m>>d&&m!=0){
        y=2004;
        if(m<3){
            y--;
            m=m+12;
        }
        cout<<week[(y+(y/4)-(y/100)+(y/400)+(((13*m+8)/5)+d))%7]<<"\n";
// ツェラーの公式
    }
}

C++: #include<iostream>
#include<map>
#include<vector>
#include<list>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<numeric>
#include<climits>
#include<ctime>
#include<cstring>
#define REP(i,p,n) for(int i=p;i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define rep_split(tok,a_str,re) for(char *tok = strtok((char *)a_str.c_str(),re); tok != NULL; tok = strtok(NULL,re))
#define all(c) (c).begin(), (c).end()

using namespace std;
template<class T> inline void chmax(T& a, T b) { if(b > a) a = b; }
template<class T> inline void chmin(T& a, T b) { if(b < a) a = b; }

int main() {
	int year = 2014;
	int month,day;
	string week[7] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};

	while(true) {
		cin >> month >> day;
		if (month == 0 && day == 0) { break; }
		int month_ = month;
		if(month == 1) month_ = 13;
		if(month == 2) month_ = 14;
		int w = ((year + year/4 - year/100 + year/400 + (13 * month_ + 8)/5 + day) % 7);
		cout << week[w] << endl;
	}

	return 0;
}

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

int main(){
  int m,d;
  int cnt;
  string days[7]={"Thursday","Friday","Saturday","Sunday","Monday","Tuesday","Wednesday"};
  while(1){
    cnt = 0;
    cin >> m >> d;
    if(m == 0 && d == 0) break;
    cnt += d;
    for(m--;m>0;m--){
      switch (m){
      case 4:
      case 6:
      case 9:
      case 11:
	cnt += 30;
	break;
      case 2:
	cnt += 29;
	break;
      default:
	cnt += 31;
	break;
      }
    }
    cout << days[cnt%7-1] << endl;
  }
}

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

using namespace std;

int main(){
	int days[12] = {31,29,31,30,31,30,31,31,30,31,30,31};
	char week2[7][10] = {"Thursday","Friday","Saturday","Sunday","Monday","Tuesday","Wednesday"};

	int month,day;
	int sum;

	cin >> month >> day;
	while((month != 0) && (day != 0)){
		sum = 0;
		for(int i=0 ;i < month - 1;i++){
			sum += days[i];
		}
		sum += day;

		switch(sum % 7){
			case 1:
				printf("%s\n",week2[0]);
				break;

			case 2:
				printf("%s\n",week2[1]);
				break;

			case 3:
				printf("%s\n",week2[2]);
				break;

			case 4:
				printf("%s\n",week2[3]);
				break;

			case 5:
				printf("%s\n",week2[4]);
				break;

			case 6:
				printf("%s\n",week2[5]);
				break;

			case 0:
				printf("%s\n",week2[6]);
				break;

		}

		cin >> month >> day;
	}
}

C++: #include <iostream>

using namespace std;

int zeller(int Y,int M,int D){
    if(M < 3){
	Y--;
	M += 12;
    }
    return (Y+Y/4-Y/100+Y/400+(13*M+8)/5+D)%7;
}

int main(){
    string s[] = {"Sunday",
		  "Monday",
		  "Tuesday",
		  "Wednesday",
		  "Thursday",
		  "Friday",
		  "Saturday",
		  "Sunday"};
    int M,D;
    while(cin >> M >> D, M){
	cout << s[zeller(2004,M,D)] << endl;
    }
    return 0;
}

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

int main(){
  int m,d;
  int cnt;
  string days[7]={"Thursday","Friday","Saturday","Sunday","Monday","Tuesday","Wednesday"};
  while(1){
    cnt = 0;
    cin >> m >> d;
    if(m == 0 && d == 0) break;
    cnt += d;
    for(m--;m>0;m--){
      switch (m){
      case 4:
      case 6:
      case 9:
      case 11:
	cnt += 30;
	break;
      case 2:
	cnt += 29;
	break;
      default:
	cnt += 31;
	break;
      }
    }
    cout << days[cnt%7] << endl;
  }
}

C++: #include<bits/stdc++.h>
using namespace std;
#define all(vec) vec.begin(),vec.end()
typedef long long int ll;
typedef pair<int,int> P;
const ll MOD=1000000007;
const ll INF=1000000010;
const ll LINF=4000000000000000010LL;
const int MAX=310;
const double EPS=1e-6;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int main(){
    int dd[12]={31,29,31,30,31,30,31,31,30,31,30,31};
    vector<string>v;
    v.push_back("Wednesday");
    v.push_back("Thursday");
    v.push_back("Friday");
    v.push_back("Saturday");
    v.push_back("Sunday");
    v.push_back("Monday");
    v.push_back("Tuesday");
    int mo,da;
    while(cin>>mo>>da,mo){
        int d=da;
        for(int i=0;i<mo-1;i++){
            d+=dd[i];
        }
        cout<<v[d%7]<<endl;
    }
}

C++: #include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <string>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)

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

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

int main()
{
	int month, day;
	int monthday[] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
	
	while(scanf("%d %d", &month, &day)!= EOF)
	{
		if(month == 0) break;
		for(int i = 0; i < month;i++)
		{
			day = day + monthday[i];
	}
		day = day % 7;
		
		switch(day){
		case0 : cout << "Wednesday" << endl; break;
		case1 : cout << "Thursday" << endl; break;
		case2 : cout << "Friday" << endl; break;
		case3 : cout << "Saturday" << endl; break;
		case4 : cout << "Sunday" << endl; break;
		case5 : cout << "Monday" << endl; break;
		case6 : cout << "Tuesday" << endl; break;
		}
	}
	return 0;
}