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<cstdio>
using namespace std;
int main()
{
  int calen[12] = {31,29,31,30,31,30,31,31,30,31,30,31};
  int month,day;
  int ans = 0;

  while(cin >> month >> day){
    if(month == 0)break;
    
    ans = 0;

    for(int i = 0;i < month-1;i++){
      ans += calen[i];
    }

    ans += day;
    cout << ans << endl;

    switch (ans % 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;
    }

  }
}

C++: #include<iostream>
#include<iomanip>
#include<vector>
#include<queue>
#include<list>
#include<stack>
#include<algorithm>
#include<cmath>
#include<memory>
#include<array>

using namespace std;

int main()
{
  array<int,13> ma = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

  int m, d, yd;

  while ( cin >> m >> d && ( m != 0 || d != 0 ))
    {
      yd = 0;
      for ( int i = 1; i < m; ++i )
        yd += ma[i];
      yd += d;

      int wd = yd % 7;

      switch ( wd )
        {
        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 i,j;
int x[12]={0,31,60,91,121,152,182,213,243,274,304,335};
int n,m;
while(1){
scanf("%d%d",&n,&m);
if(n==0){
break;
}
int q=(x[n-1]+m)%7;
if(q==0){
printf("Wednesday\n");
}else if(q==1){
printf("Thursday\n");
}else if(q==2){
printf("Friday\n");
}else if(q==3){
printf("Saturday\n");
}else if(q==4){
printf("Sunday\n");
}else if(q==5){
printf("Monday\n");
}else if(q==6){
printf("Tuesday\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 % 7 + 2 ] << endl;
		
		cin >> m >> d;
	}
	
	return 0;
}

C++: #include<iostream>
#include<string>
using namespace std;
int main(){
  int month,day,bell;
  string s;
  while(1){
    cin >> month >> day;
    if(month==0 && day==0){
      break;
    }
    if(month==1 || month==4 || month==7){
      bell=4;
    }
    else if(month==2 || month==8){
      bell=7;
    }
    else if(month==3 || month==11){
      bell=1;
    }
    else if(month==5){
      bell=6;
    }
    else if(month==6){
      bell=2;
    }
    else if(month==9 || month==12){
      bell=3;
    }
    else if(month==10){
      bell=5;
    }

    for(int i=1;i<day;i++){
      bell++;
      if(bell>=8){
	bell=1;
      }
    }

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

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

int main() {
	int month, day; cin >> month >> day;
	while (month != 0 && day != 0) {
		if (month >= 1) day = day;
		if (month >= 2) day = day + 31;
		if (month >= 3) day = day + 29;
		if (month >= 4) day = day + 31;
		if (month >= 5) day = day + 30;
		if (month >= 6) day = day + 31;
		if (month >= 7) day = day + 30;
		if (month >= 8) day = day + 31;
		if (month >= 9) day = day + 31;
		if (month >= 10) day = day + 30;
		if (month >= 11) day = day + 31;
		if (month >= 12) day = day + 30;
		if (day % 7 == 0) cout << "Wednesday" << endl;
		if (day % 7 == 1) cout << "Thursday" << endl;
		if (day % 7 == 2) cout << "Friday" << endl;
		if (day % 7 == 3) cout << "Saturday" << endl;
		if (day % 7 == 4) cout << "Sunday" << endl;
		if (day % 7 == 5) cout << "Monday" << endl;
		if (day % 7 == 6) cout << "Tuesday" << endl;
		cin >> month >> day;
	}
	return 0;
}

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

string weekday(int n){
	switch(n){
	case 0:	return "Monday";
	case 1: return "Tuesday";
	case 2: return "Wednesday";
	case 3: return "Thursday";
	case 4: return "Friday";
	case 5: return "Saturday";
	case 6: return "Sunday";
	}
}

int monthdays(int m){
	switch (m){
		case 1:
		case 3:
		case 5:
		case 7:
		case 8:
		case 10:
		case 12:
			return 31;
		case 4:
		case 6:
		case 9:
		case 11:
			return 30;
		case 2:
			return 29;
	}
	return 0;
}

int days(int m, int d){
	int s=0;
	for (int i=1; i<m; i++)
		s += monthdays(i);
	return s+d;
}

int main(void){
	
	while (true){
		int m,d;
		cin>>m>>d;
		if (m==0) break;
		int dif = days(m, d)-1;
		cout<<weekday((dif+3)%7)<<endl;
	}
	return 0;
}

C++: 
//Nayeem Shahriar Joy ,Applied Physics And Electronic Engineering , University of Rajshahi.

 #include<iostream>
#include<string>
#include<algorithm>
#include<vector>

using namespace std;

int dayoftheweek(int d,int m,int y)

{
    int t[]={0,3,2,5,0,3,5,1,4,6,2,4};
    y=y-m<3;
    return (y+y/4-y/100+y/400+t[m-1]+d)%7;
}

int main(){

   int m,d;

   while(cin>>m>>d){

        if(m==0 && d==0)

        {
            break;
        }

   int w = dayoftheweek(d,m,2004);

   if(w==1)

   {
       cout<<"Thursday"<<endl;
   }

   else if(w==2)

   {
       cout<<"Friday"<<endl;
   }

   else if(w==3)

   {
       cout<<"Saturday"<<endl;
   }

   else if(w==4)

   {
       cout<<"Sunday"<<endl;
   }

   else if(w==5)

   {
       cout<<"Monday"<<endl;
   }

   else if(w==6)

   {
       cout<<"Tuesday"<<endl;
   }

   else if(w==7)

   {
       cout<<"Wednesday"<<endl;
   }
   }

    return 0;
}

C++: #include <fstream>
#include <iostream>
#include <cmath>
#include <vector>
#include <queue>
#include <utility>
#include <algorithm>
using namespace std;

int main() {
  ifstream cin("../test.txt");

  int year[12] = {31,29,31,30,31,30,31,31,30,31,30,31};
  string day[7] = {"Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"};
  int first = 3;

  int m, d;
  while (true) {
    cin >> m >> d;
    if (!(m|d)) break;
    int n = first;
    for (int i = 0; i < m-1; i++) {
      n += year[i];
    }
    n += d-1;

    n %= 7;
    cout << day[n] << endl;
  }
}