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 <iostream>
using namespace std;
int main()
{
	int monthNum[13] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
	string dayName[7] = {"Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday", "Wednesday"};
	int month, day, passDay=0;
	
	while (1) {
		cin >> month >> day;
		if (month == 0) break;
		
		for (int i=0; i<month; i++)
			passDay += monthNum[i];
		passDay += day-1;
		
		cout << dayName[passDay % 7] << endl;
		passDay = 0;
	}
	
	return 0;
}

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

int main ()
{
	int m[13]={0,4,7,1,4,6,7,4,7,3,5,1,3};
	string a[7]={"Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"};
	int M,D;
	while(cin>>M>>D&&M&&D)
	{
		int x=m[M]-2;
		cout<<a[(x+D)%7]<<endl;
		
	}
	
	
	
	
}

C++: #include <stdio.h>

int main()
{
  int y, d, m;
  int h;
  char *date[] = {"Saturday", "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday"};

  for(;;)
    {
      int Y, C, G;
      y = 2004;
      scanf("%d %d", &m, &d);

      if(d == 0 || m == 0) break;
      if(m == 1 || m == 2)
	{
	  m += 12;
	  y--;
	}

      Y = y%100;
      C = y/100;
      G = 5*C + C/4;

      h = (d + (26*(m + 1)/10) + Y + Y/4 + G)%7;
      printf("%s\n", date[h]);
    }

  return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
  
  int a,b;
  cin >> a >> b;
  while(a != 0){
    
    for(int i = 1;i < a;i++){
      if(i==1 || i==3 || i==5 || i==7 || i==8 || i==10){
	b += 31;
      }
      else if(i==4 || i==6 || i==9 || i==11){
	b += 30;
      }
      else if(i == 2){
	b += 29;
      }
    }

    if(b%7 == 1) cout << "Thursday" << endl;
    else if(b%7 == 2) cout << "Friday" << endl;
    else if(b%7 == 3) cout << "Saturday" << endl;
    else if(b%7 == 4) cout << "Sunday" << endl;
    else if(b%7 == 5) cout << "Monday" << endl;
    else if(b%7 == 6) cout << "Tuesday" << endl;
    else cout << "Wednesday" << endl;
    cin >> a >> b;
  }
  return (0);
}

C++: #include <iostream>
#include <string>
using namespace std;
int main(void){
	const int DPM[] = {31,29,31,30,31,30,31,31,30,31,30,31};
	const string DAYS[] = {"Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"};
	int month,date;
	while(cin >> month >> date){
		if(month==0)break;
		int day = 3;
		for(int i=1;i<month;++i) day += DPM[i-1];
		day = (day+date-1)%7;
		cout << DAYS[day] << "\n";
	}
	return 0;
}

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

int main(int argc, const char * argv[])
{
    int month[12] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
    int m, d;
    while (scanf("%d %d", &m, &d) != 0) {
        int cnt = 0;
        if (m == 0 && d == 0) {
            return 0;
        }
        for (int i = 0; i < m - 1; i++) {
            cnt += month[i];
        }
        cnt += d;

        if (cnt % 7 == 0) {
            printf("Wednesday\n");
        }
        if (cnt % 7 == 1) {
            printf("Thursday\n");
        }
        if (cnt % 7 == 2) {
            printf("Friday\n");
        }
        if (cnt % 7 == 3) {
            printf("Saturday\n");
        }
        if (cnt % 7 == 4) {
            printf("Sunday\n");
        }
        if (cnt % 7 == 5) {
            printf("Monday\n");
        }
        if (cnt % 7 == 6) {
            printf("Tuesday\n");
        }
    }
    return 0;
}

C++: #include <iostream>

auto initDays (int * a , int n , int & prev) -> void
{
    for (auto i = 1; i <= n; ++ i)
    {
        prev = (prev + 1) % 7;
        a [i] = prev;
    }
}

auto main () -> int
{
    const char * table [] =
    {
        "Monday" ,
        "Tuesday" ,
        "Wednesday" ,
        "Thursday" ,
        "Friday" ,
        "Saturday" ,
        "Sunday"
    };

    int day [13][32] = {{}};

    int p = 2;
    initDays (day [1] , 31, p);
    initDays (day [2] , 29, p);
    initDays (day [3] , 31, p);
    initDays (day [4] , 30, p);
    initDays (day [5] , 31, p);
    initDays (day [6] , 30, p);
    initDays (day [7] , 31, p);
    initDays (day [8] , 31, p);
    initDays (day [9] , 30, p);
    initDays (day [10] , 31, p);
    initDays (day [11] , 30, p);
    initDays (day [12] , 31, p);

    int m , d;
    while (std::cin >> m >> d && m && d)
    {
        std::cout << table [day [m] [d]] << std::endl;
    }
}

C++: #include <iostream>
#include <string>
using namespace std;
int countup_days(int m, int d) // m月d日が、1月1日から何日目か返す
{
    int         sum     = 0;
    const int   month[] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31,};
    for (int i=1; i<m; i++) {
        sum += month[i];
    }
    return sum + d -1;
}
string what_day(int days) // 1/1からdays日後は何曜日か文字列を返す
{
    string day[]   = {"Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday", "Wednesday"};
    return day[days%7];
}
int main()
{
    int m, d;
    while (true) {
        cin >> m >> d;
        if (m==0 && d==0)
            break;
        cout << what_day(countup_days(m, d)) << endl;
    }
}

C++: #include <stdio.h>

int main(void) {
  int i, j, k, m, d, ans;
  int m0[13] = {0, 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335};
  char w[7][25] = {
    "Wednesday",
    "Thursday",
    "Friday",
    "Saturday",
    "Sunday",
    "Monday",
    "Tuesday"
  };
  while( 1 ) {
    scanf("%d%d", &m, &d);
    if(!m && !d) break;
    ans = m0[m] + d;
    ans %= 7;
    printf("%s\n", w[ans]);
  }
  return 0;
}

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

using namespace std;

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

    return 0;
}

C++: #include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <numeric>
#include <cmath>
#include <climits>
#include <limits>
#include <cfloat>
#include <fstream>
using namespace std;

int main()
{
//	cut here before submit 
//	freopen("testcase.wdt", "r", stdin);
	// 2004/01/01 is Thursday
	const string week[] = {
	"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" };
	const int days[] = { 0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; 
	string str = "";
	
	while (getline (cin, str ) ){
		int day, month;		
		stringstream ss(str);
		ss >> month >> day;
		if (day == 0 && month == 0){
			break;
		} // end if
		int num = 0;
		int i;
		for (i = 0; i < month; ++i){
			num += days[i];
		} // end for
		num += day;
		cout << "num: " << num << endl;
		cout << week [( num - 1 ) % 7 + 3 ] << endl;
	} // end for
		
	return 0;
}