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++: #define _USE_MATH_DEFINES
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<list>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<map>
#include<queue>
#include<vector>
using namespace std;

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

int b[13] = { 0,31,29,31,30,31,30,31,31,30,31,30,31 };

int main() {
	for (int m, d; cin >> m >> d&&m;) {
		while (m)
			d += b[--m];
		cout << a[d % 7 - 1 + 3] << endl;
	}
	return 0;
}

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

int main()
{
  int m, d;
  while (1){
    cin >> m >> d;
    if (m == 0){
      break;
    }
    if (m == 2){
      d += 31;
    }
    if (m == 3){
      d += 60;
    }
    if (m == 4){
      d += 91;
    }
    if (m == 5){
      d += 121;
    }
    if (m == 6){
      d += 152; 
    }
    if (m == 7){
      d += 182;
    }
    if (m == 8){
      d += 213;
    }
    if (m == 9){
      d += 244;
    }
    if (m == 10){
      d += 274;
    }
    if (m == 11){
      d += 305;
    }
    if (m == 12){
      d += 335;
    }

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

  return 0;
}

C++: #include<iostream>

using namespace std;

int main()
{
	int month[12];

	month[0]=31;
	month[1]=29;
	month[2]=31;
	month[3]=30;
	month[4]=31;
	month[5]=30;
	month[6]=31;
	month[7]=31;
	month[8]=30;
	month[9]=31;
	month[10]=30;
	month[11]=31;

	int hoge,fuga;

	cin >> hoge >> fuga;

	int i;
	int count=0;

	if(hoge!=0)
	{
		for(i=0;i<hoge-1;i++)
		{
			count+=month[i];
		}	
		
		count+=fuga;

		int flag = 0;
	
		flag = count % 7;
		if(flag==0)
		{
			cout << "Wednesday" <<endl;
		}
		if(flag==1)
		{
			cout << "Thursday" <<endl;
		}
		if(flag==2)
		{
			cout << "Friday" <<endl;
		}
		if(flag==3)
		{
			cout << "Saturday" <<endl;
		}
		if(flag==4)
		{
			cout << "Sunday" <<endl;
		}
		if(flag==5)
		{
			cout << "Monday" <<endl;
		}
		if(flag==6)
		{
			cout << "Tuesday" <<endl;
		}
	}
}

C++: #include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <functional>
#include <numeric>
#include <iomanip>
#define fi first
#define se second
#define fcout(n) cout<<fixed<<setprecision((n))
#define cinl(str) getline(cin,(str))
using namespace std;
bool value(int y,int x,int R,int C){return 0<=y&&y<R&&0<=x&&x<C;}
typedef pair<int,int> pii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long > vll;
typedef vector< vi > vvi;
double pie=acos(-1);
int INF=10000009;
int dx[4] = { 0,-1,0,1 };
int dy[4] = { -1,0,1,0 };
int main() {
	int day=0;
	int x,y;
	int md[12]={30,29,31,30,31,30,31,31,30,31,30,31};
	string s[7]={"Wednesday","Thursday","Friday","Saturday","Sunday","Monday","Tuesday"};
	while(true){
		cin>>x>>y;
		if(x==0) break;
		for(int i=0;i<x-1;i++){
			day+=md[i];
		}
		day+=y;
		day%=7;
		cout<<s[day]<<endl;		
	}
}

C++: #include <iostream>

int main(){
    int m, d, w;
    int days[12] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
    char *weekName[7] = {"Sunday", "Monday", "Tuesday", "Wednesday",
                         "Thursday", "Friday", "Saturday"};
    while(1){
        std::cin >> m >> d;
        if(!(m || d)){
            return 0;
        }
        w = 3;
        for(int i = 1; i < m; i++){
            w += days[i - 1];
        }
        w += d; 
        std::cout << weekName[w % 7] << std::endl;
    }
}

C++: #include<iostream>
#include <stdio.h>
#include <time.h>
#include<string>
using namespace std;
int main(){
  int f,i,p,count,s,q,type1,type2,type3,type4;
 for(;;){
      count=0;
      s=0;
      p=0;
       q=0;
     cin>>f;
      type1=(f==1||f==10);type2=(f==2||f==3||f==11);type3=(f==4||f==7);type4=(f==9||f==12);
          cout<<"  S  M  T  W  t  F  s"<<endl;
          cout<<endl;
          if(type1){
              count=-1;
              cout<<"   ";
          }
          else if(type2){
          count=-4;
          cout<<"            ";
          }
          else if(type4){
          count=-6;
          cout<<"                  ";
          }
          else if(f==5){
          count=-2;
          cout<<"      ";
          }
          else if(f==6){
              count=-5;
          cout<<"               ";
          }
          else if(f==8){
          count=-3;
          cout<<"         ";
          }if(f==2){
           q=28;
           }
           else if(f==1||f==3||f==5||f==7||f==8||f==10||f==12){
           q=31;
           }    
           else if(f==4||f==6||f==9||f==11){
           q=30;
           }
          for(i=1;i<=37;i++){
              count++;
              if(count<1){
              continue;
              }
          printf("%3d",count);
          if(i%7==0){
          cout<<endl;
          }
          if(count==q){
              break;
              }
          }
          cout<<endl<<endl;
          }
 return 0;
}

C++: #include <stdio.h>

int m ;
int d ;
int dayc ;

const int days[13] = { 0 , 31 , 29 , 31 , 30 , 31 , 30 , 31 , 31 , 30 , 31 , 30 , 31 } ;

int main ( )
{
	while ( scanf ( "%d %d" , &m , &d ) == 2 && m && d ) {
		dayc = 0 ;
		for ( int i = 0 ; i < m ; i++ ) {
			dayc += days[i] ;
		}
		dayc += d ;
		dayc-- ;
		dayc %= 7 ;
		switch ( dayc ) {
			case 0 :
				printf ( "Thursday\n" ) ;
				break ;
			case 1 :
				printf ( "Friday\n" ) ;
				break ;
			case 2 :
				printf ( "Saturday\n" ) ;
				break ;
			case 3 :
				printf ( "Sunday\n" ) ;
				break ;
			case 4 :
				printf ( "Monday\n" ) ;
				break ;
			case 5 :
				printf ( "Tuesday\n" ) ;
				break ;
			case 6 :
				printf ( "Wednesday\n" ) ;
				break ;
		}
	}
	return 0 ;
}

C++: #include <iostream>
#include <string>
using namespace std;
int main() {
    int dates[] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
    string days[] = {"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"};

    int m,d;
    while (cin >> m >> d && m != 0 || d != 0) {
        int day = 2;
        for (int i=0; i<m-1; ++i) {
            day = (day + dates[i]) % 7;
        }
        day = (day + d) % 7;

        cout << days[day] << endl;
    }
}

C++: #include<iostream>
#include<string>
int main(){
	int month,day;
	const int monthday[12]={31,29,31,30,31,30,31,31,30,31,30,31};
	const std::string week[7]={"Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"};
	const int a=3;
	while(1){
		std::cin>>month>>day;
		if(month==0)break;
		int sum=day+a;
		for(int i=0;i<month-1;i++)sum+=monthday[i];
		std::cout<<week[(sum-1)%7]<<std::endl;
	}
	return 0;
	/*
	月曜日 Monday
	火曜日 Tuesday
	水曜日 Wednesday
	木曜日 Thursday
	金曜日 Friday
	土曜日 Saturday
	日曜日 Sunday
	*/
}