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 data[] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
  int month, day;
  while( cin >> month >> day, month + day ) {
    int sum = 0;
    for(int i=0; i<month-1; i++) {
      sum += data[i];
    }
    sum += day;
    sum %= 7;

    if( sum == 1 ) {
      cout << "Thursday" << endl;
    }
    else if( sum == 2 ) {
      cout << "Friday" << endl;
    }
    else if( sum == 3 ) {
      cout << "Saturday" << endl;
    }
    else if( sum == 4 ) {
      cout << "Sunday" << endl;
    }
    else if( sum == 5 ) {
      cout << "Monday" << endl;
    }
    else if( sum == 6 ) {
      cout << "Tuesday" << endl;
    }
    else if( sum == 0 ) {
      cout << "Wednesday" << endl;
    }
  }
}

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

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

int month, date;

	//前月までの延べ日数に変換
	for( int i = 1; i < 13; i++ ) {
		days[i] += days[i-1];
	}

	while( 1) {
		cin >> month >> date;
		if( month == 0 )
			return -1;
		
		int day = days[month-1] + date + 3;
		int p = day %7;

		cout << ans[p] << endl;

	}
	return 0;
}

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 = (-2*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 m, d, ans, month, i, total = 0;
	while(1){
		cin >> m >> d;
		if (m == 0) break;
		for(i = 1; i < m; i ++){
			if(i==1||i==3||i==5||i==7||i==8||i==10||i==12){
				total += 31;
			}
			else if(i == 2){
				total += 29;
			}
			else{
				total += 30;
			}
		}
		total += d;

		ans = total % 7;

		switch (ans){
		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;
		case 0:cout << "Wednesday" << endl;
			break;
		}
		
		ans = 0, total = 0;
	}

	return 0;
}

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

int main() {
  int k,m,d;
  string today[7]={"Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"};
  int mon[12]={31,29,31,30,31,30,31,31,30,31,30,31};

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

    for(int i=0;m-1>i;i++) d+=mon[i];

    k=d%7+2;
    cout <<today[k]<<endl;
  
  }
}

C++: #define _USE_MATH_DEFINES
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<list>
#include<stack>
#include<queue>
#include<cctype>
#include<iomanip>
#include<functional>
#include<numeric>
#define EPS 1e-10
using namespace std;
typedef long long llong;
void whatday(int m, int d) {
	int z;
	if (m == 1)z = d;
	else if (m == 2)z = 31 + d;
	else if (m == 3)z = 60 + d;
	else if (m == 4)z = 91 + d;
	else if (m == 5)z = 121 + d;
	else if (m == 6)z = 152 + d;
	else if (m == 7)z = 182 + d;
	else if (m == 8)z = 213 + d;
	else if (m == 9)z = 244 + d;
	else if (m == 10)z = 274 + d;
	else if (m == 11)z = 305 + d;
	else if (m == 12)z = 335 + d;
	if (z % 7 == 5)cout << "Monday" << endl;
	else if (z % 7 == 6 % 7)cout << "Tuesday" << endl;
	else if (z % 7 == 0 % 7)cout << "Wednesday" << endl;
	else if (z % 7 == 1 % 7)cout << "Thursday" << endl;
	else if (z % 7 == 2 % 7)cout << "Friday" << endl;
	else if (z % 7 == 3 % 7)cout << "Saturday" << endl;
	else if (z % 7 == 4 % 7)cout << "Sunday" << endl;
}
int main() {
	int m, d;
	while (cin >> m >> d&&m&&d) {
		whatday(m, d);
	}
	return 0;
}

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", "Tuesday"};

  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 y[7]={"Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"};
  int num[13]={0,31,29,31,30,31,30,31,31,30,31,30,31};

  while(1){
    int m,d;
    cin >> m >> d;
    if( m == 0 && d == 0 ) break;
    while( m != 0 ){
      d += num[m-1];
      m--;
    }
    cout << y[d%7+2] << endl;
  }

  return 0;
}

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

string day[7] = {"Saturday", "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday"};

int main(){
    int m, d;
    while(cin >> m >> d, m != 0){
        int y = 2004;
        if(m == 1 || m == 2){
            y--;
            m += 12;
        }
        int h = (d + 26*(m+1)/10 + (y%100) + ((y%100)/4) + 5*(y/100) + (y/100)/4) % 7;
        cout << day[h] << endl;
    }

    return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
	while(1){
		int a,b,ans=0;
		cin>>a>>b;
		if(a==0)break;
		a--;
		int c[12]={31,29,31,30,31,30,31,31,30,31,30,31};
		for(int i=0;i<a;i++){
			ans+=c[i];
		}
		ans+=b;
		if(ans%7==1){
			cout<<"Thursday"<<endl;
		}
		if(ans%7==2){
			cout<<"Friday"<<endl;
		}
		if(ans%7==3){
			cout<<"Saturday"<<endl;
		}
		if(ans%7==4){
			cout<<"Sunday"<<endl;
		}
		if(ans%7==5){
			cout<<"Monday"<<endl;
		}
		if(ans%7==6){
			cout<<"Tuesday"<<endl;
		}
		if(ans%7==0){
			cout<<"Wednesday"<<endl;
		}
	}
	return 0;
}

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 i, m, d, cntdays = 0;
  
  while (cin >> m >> d, m){
    for (i = 0; i < m; i++) cntdays += month[i];
    switch ((cntdays + d) % 7){
      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;
      case 5:
        cout << "Monday";
        break;
      case 6:
        cout << "Tuesday";
        break;
    }
    cout << endl;
  }
}