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 am[13] = {0, 31,29,31,30,31,30,31,31,30,31,30,31 };
	int a, b;

	while (cin >> a >> b&&a!=0&&b!=0)
	{
		

		static int c;
		for (int i = 0; i < a; i++) {
			c += am[i];
		}
		c += b;
		int d = c % 7;

		switch (d) {
		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<iostream>
using namespace std;
void daysel(int x){
  switch(x % 7){
  case 6:
  cout << "Tuesday"<<endl; break;
  case 7:
  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;
  }
}
void daycal(int month,int day){
  int x;
  switch(month){
  case 1:
  x = day; break;
  case 2:
  x = 31 + day; break;
  case 3:
  x = 60 + day; break;
  case 4:
  x = 91 + day; break;
  case 5:
  x = 121 + day; break;
  case 6:
  x = 152 + day; break;
  case 7:
  x = 182 + day; break;
  case 8:
  x = 213 + day; break;
  case 9: 
  x = 244 + day;break;
  case 10:
  x = 274 + day;break;
  case 11: 
  x = 305 + day; break;
  case 12:
  x = 335 + day; break;
  }
  daysel(x);

    }
int main(){
  int month,day;
  while(cin >> month >> day && !(month == 0 && day ==0)){   
      daycal(month,day);
  }  
  
}

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

using namespace std;

int min(){
	string y[7] = {"Wednesday", "Thrsday", "Frinday", "Saturday", "Sunday", "Monday", "Tuesday"};
	int mon[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) break;

		while(m != 0){
			d = d + mon[m-1];
			m--;
		}
		cout << y[d%7] << endl;
	}
}

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

using pii = pair<int, int>;
using ll = long long;

int main() {
    int m, d;
    constexpr int day[13] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
    const string ans[7] = {"Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday", "Wednesday"};
    while(cin >> m >> d, m) {
        int x = 0;
        for(int i = 1; i <= 12; ++i) {
            if(m == i) {
                cout << ans[(x + d - 1) % 7] << endl;
                break;
            } else {
                x = (x + day[i]) % 7;
            }
        }
    }
}

C++: #include <bits/stdc++.h>

using namespace std;

inline bool isLeapYear(int year) {
  return year % 4 == 0 && (year % 100 != 0 || year % 400 == 0);
}

inline int countLeapYear(int year) {
  return year / 4 - year / 100 + year / 400;
}

inline int getMaxDay(int year, int month) {
  const int days[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
  if (month == 2) return isLeapYear(year) ? 29 : 28;
  return days[month];
}

struct Day {
  int year, month, day;

  enum {SUN, MON, TUE, WED, THU, FRI, SAT};

  Day() : year(0), month(0), day(0) {}

  Day(int year, int month, int day) : year(year), month(month), day(day) {}

  int fairfield() const {
    int y = year, m = month;
    if (m <= 2) --y, m += 12;
    return 365 * y + countLeapYear(y) + (153 * (m + 1) / 5) + day - 428;
  }

  int operator-(const Day& day) const {
    return fairfield() - day.fairfield();
  }

  bool operator<(const Day& day) const {
    if (year != day.year) return year < day.year;
    if (month != day.month) return month < day.month;
    return this->day < day.day;
  }

  Day operator++() {
    ++day;
    if (getMaxDay(year, month) < day) {
      ++month;
      day = 1;
      if (month == 13) {
        ++year;
        month = 1;
      }
    }
    return *this;
  }

  int dayOfTheWeek() {
    return fairfield() % 7;
  }
};

bool solve() {
  int m, d;
  cin >> m >> d;
  if (m == 0 && d == 0) return false;
  Day day(2004, m, d);
  string week[]{"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
  cout << week[day.dayOfTheWeek()] << endl;
  return true;
}

int main() {
  while (solve());
}

C++: #include <iostream>
#include <string>
using namespace std;
string day[] = {"Satur","Sun","Mon","Tues","Wednes","Thurs","Fri"};
int main(){
	int m, d, h;
	while (cin >> m >> d, m) {
		h = d + (26 * m + (m < 3 ? 1418 : 1126)) / 10;
		cout << day[h % 7] + "day\n";
	}
}

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

int search(int a){
	int month;
	if(a==2) month = 29;
	else if(a%2!=0) month = 31;
	else month = 30;
	return month;
}

char *Whatday(int a,int b){
	int month;
	char *day;
	int date=0;
	
	for(int i=1;i<a;i++){
		date = date+search(i);
	}
	date += b;
	switch(date%7){
		case 0: day ="Wednesdayday"; break;
		case 1: day ="Thursday"; break;
		case 2: day ="Friday"; break;
		case 3: day ="Saturday"; break; 
		case 4: day ="Sunday"; break;
		case 5: day ="Monday"; break;
		case 6: day ="Tuesday"; break;
	}
	return day;
}

int main() {
	int m,d;
	while(1){
		cin >> m >> d;
		if(m==0&&d==0) break;
		cout << Whatday(m,d) << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <string.h>
#define YEAR 6
using namespace std;

int main()
{
	int mouth[12] = {0, 3, 4, 0, 2, 5, 0, 3, 6, 1, 4, 6}, d, m, w;
	string week[7] = {"Saturday", "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday"};
	while (cin >> m >> d && m && d) {
		w = 5;
		w = w + d + mouth[m-1] + YEAR;
		w = w % 7;
		cout << week[w] << endl;
	}
}

C++: #include <iostream>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <set>

using namespace std;

int main()
{
	while (1)
	{
		int a = 0;
		int b = 0;
		cin >> a;
		cin >> b;
		if (a == 0)break;
		if (a == 2)b += 31;
		if (a == 3)b += 31 + 29;
		if (a == 4)b += 60 + 31;
		if (a == 5)b += 91 + 30;
		if (a == 6)b += 121 + 31;
		if (a == 7)b += 152 + 30;
		if (a == 8)b += 182 + 31;
		if (a == 9)b += 213 + 31;
		if (a == 10)b += 30 + 244;
		if (a == 11)b += 31 + 274;
		if (a == 12)b += 30 + 305;
		if (b % 7 == 1)cout << "Thursday" << endl;
		if (b % 7 == 2)cout << "Friday" << endl;
		if (b % 7 == 3)cout << "Saturday" << endl;
		if (b % 7 == 4)cout << "Sunday" << endl;
		if (b % 7 == 5)cout << "Monday" << endl;
		if (b % 7 == 6)cout << "Tuesday" << endl;
		if (b % 7 == 0)cout << "Wednesday" << endl;
	}
	return 0;
}

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

int main()
{
	int month, day;
	int monthday[] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
	
	while(scanf("%d %d", &month, &day)!= EOF)
	{
		if(month == 0) break;
		for(int i = 0; i < month;i++)
		{
			day = day + monthday[i];
	}
		day = day % 7;
		
		switch(day){
		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;
}