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>
#include <map>

using namespace std;

int main()
{
	int month = 0, day = 0, total_day = 0, week_num = 0;
	map<int, int> month_num;

	month_num[1] = 0;
	month_num[2] = 31;
	month_num[3] = 60;
	month_num[4] = 91;
	month_num[5] = 121;
	month_num[6] = 152;
	month_num[7] = 182;
	month_num[8] = 213;
	month_num[9] = 244;
	month_num[10] = 274;
	month_num[11] = 305;
	month_num[12] = 335;

	cin >> month >> day;

	while ( month * day != 0 )
	{
		total_day = month_num[month] + day-1;
		switch ( total_day % 7 )
		{
			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;
			default:
				break;
		}
		cin >> month >> day;
	}

	return 0;
}

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

using namespace std;


char str[7][10] = {"Thursday", "Friday", "Saturday","Sunday", "Monday", "Tuesday", "Wednesday"};
int days[13] = {0, 0, 31, 60, 91, 121, 152, 182, 213, 243, 274, 304, 335}; 

int main() {
	int month, day;
	while (scanf("%d%d", &month, &day), month + day) {
		printf ("%s\n", str[(days[month] + day - 1) % 7]);
	}
	return 0;
}

C++: #include <stdio.h>
int main()
{
	char yobi[7][10]={"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"};
	int month,day;
	while(1){
		scanf("%d %d",&month,&day);
		if(month==0)
			break;
		for(int i=0;i<month;i++){
			switch(i){
				case 2:
					day+=29;
				case 4:
				case 6:
				case 9:
				case 11:
					day+=30;
				default:
					day+=31;
			}
		}
		printf("%s\n",yobi[day%7]);
	}
	return 0;
}

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

const string day[] = {"Wednesday", "Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday"};
const int da[] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

int main(void){
  int m, d;
  while(cin >> m >> d, m | d){
    while(1){
      m--;
      if(m > 0){
        d += da[m];
      }else{
        break;
      }
    }
    cout << day[d%7] << endl;
  }
  return 0;
}

C++: #include	<iostream>

using namespace std;

int main(void) {
	while(1) {
		int mon, day;
		cin >> mon;
		
		if( cin.eof() )		break;
		
		cin >> day;
		
		for(int i = 1; i < mon; i++) {
			switch(i) {
			case 2:
				day += 29;
				break;
			case 4:
			case 6:
			case 9:
			case 11:
				day += 30;
				break;
			default:
				day += 31;
				break;
			}
		}
		
		switch(day % 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;
		}
	}
	
	return 0;
}

C++: #include<stdio.h>
int main(){
  int a,b,s,i;
  int m[12]={31,29,31,30,31,30,31,31,30,31,30,31};
  while(1){ 
 scanf("%d%d",&a,&b);
 if(a==0&&b==0)break;
 s=b;
 for(i=0;i<a-1;i++)s+=m[i];
 if(s%7==1)printf("Thursday\n");
 else if(s%7==2)printf("Friday\n");
 else if(s%7==3)printf("Saturday\n");
 else if(s%7==4)printf("Sunday\n");
 else if(s%7==5)printf("Monday\n");
 else if(s%7==6)printf("Tuesday\n");
 else if(s%7==0)printf("Wednesday\n");
  }
  return 0;
}

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

using namespace std;

int dayNum[12] = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
string day[7] = { "Monday",
				  "Tuesday",
				  "Wednesday",
				  "Thursday",	// <- 2004/1/1
				  "Friday",
				  "Saturday",
				  "Sunday" };

int main() {
	int m, d;
	
	cin >> m >> d;
	
	while (m != 0 && d != 0) {
		int daySum = 0;
		
		for (int i = 0; i < m - 1; i++) {
			daySum += dayNum[i];
		}
		
		daySum += d;
		
		cout << day[ (daySum + 2) % 7 ] << endl;
		
		cin >> m >> d;
	}
	
	return 0;
}

C++: #include<iostream>
#include<string>
using namespace std;
int x[13][32], y[13] = { 0,31,29,31,30,31,30,31,31,30,31,30,31 }, sum, n, m; string T[7] = { "Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday" };
int main() {
	sum = 4;
	for (int i = 1; i <= 12; i++) {
		for (int j = 1; j <= y[i]; j++) {
			x[i][j] = sum % 7;
			sum++;
		}
	}
	while (true) {
		cin >> n >> m; if (!n) { break; }
		cout << T[x[n][m]] << endl;
	}
}

C++: #include <stdio.h>

int main(void) {

  int month,day;

  int sum,day_w;
  int month_y[12]={31,29,31,30,31,30,31,31,30,31,30,31};

  int i;

  while(1) {

    scanf("%d %d",&month,&day);

    if(month==0 || day==0) break;

    sum=0;

    for(i=0;i<month-1;i++) {

      sum+=month_y[i];

    }

    sum+=day;

    day_w=sum%7;

    switch(day_w) {

    case 0:
      printf("Wednesday\n");
      break;

    case 1:
      printf("Thursday\n");
      break;

    case 2:
      printf("Friday\n");
      break;

    case 3:
      printf("Saturday\n");
      break;

    case 4:
      printf("Sunday\n");
      break;

    case 5:
      printf("Monday\n");
      break;

    case 6:
      printf("Tuesday\n");
      break;

    }

  }

  return 0;

}

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

int main(){
  int day30[5] = {3,4,6,9,11};

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

  while(1) {

    if(a == m && b == d) break;
    
    b++;
    count++;

    if(a == 2 && b == 30) {
      a++;
      b = 1;
    }
    else if(b == 31) {
      for(int i=0;i<5;i++) 
	if(day30[i] == a) {
	  a++;
	  b = 1;
	  break;
	}
    }
    if( b == 32) {
      a++;
      b = 1;
    }
  }
  
  if(count % 7 == 4 ) cout <<"Monday"<<endl;
  else if(count % 7 == 5) cout << "Tuesday"<<endl;
  else if(count % 7 == 6) cout <<"Wednesday"<< endl;
  else if(count % 7 == 0) cout <<"Turseday"<< endl;
  else if(count % 7 ==1) cout << "Friday" << endl;
  else if(count % 7 ==2)cout << "Saturday" << endl;
  else if(count % 7 ==3) cout << "Sunday" << endl;
  
  }

  return 0;
}