Go: package main

import (
        "fmt"
)

func main() {
        var weeks = []string{"Thursday",
                "Friday",
                "Saturday",
                "Sunday",
                "Monday",
                "Tuesday",
                "Wednesday"}

        for {
                var m, d int
                _, err := fmt.Scanf("%d %d", &m, &d)
                if err != nil || m + d == 0 {
                        break
                }
                var days int

                for {
                        lm, ld := getLastDay(m, d)
                        if lm + ld == 0 {
                                break
                        }
                        days++
                        m = lm
                        d = ld
                }
                fmt.Println(weeks[days%7])
        }
}

func getLastDay(m int, d int) (lm int, ld int) {
        if m == 1 && d == 1 {
                return 0, 0
        }

        if d > 1 {
                return m, d-1
        } else {
                if m == 3 {
                        return m-1, 29
                }
                if m == 3 || m == 5 || m == 7 || m == 10 || m == 12 {
                        return m-1, 30
                } else {
                        return m-1, 31
                }
        }
}

C++: #include<iostream>
#include<string>
using namespace std;
int main() {
	int a, b;
	int x;
	int i = 0;
	string l[70];
	while (true){
		cin >> a >> b;
		if (a == 0 && b == 0) {
			x = i;
			break;
		}
		if (a == 1 || a == 4 || a == 7){
			b += 4;
		}
		else if (a == 2 || a == 8){
			b += 0;
		}
		else if (a == 3 || a == 11){
			b += 1;
		}
		else if (a == 5){
			b += 6;
		}
		else if (a == 6){
			b += 2;
		}
		else if (a == 9 || a == 12){
			b += 3;
		}
		else if (a == 10){
			b += 5;
		}
		//
		if (b % 7 == 1){
			l[i] = "Sunday";
		}
		else if (b % 7 == 2){
			l[i] = "Monday";
		}
		else if (b % 7 == 3) {
			l[i] = "Tuesday";
		}
		else if (b % 7 == 4) {
			l[i] = "Wednesday";
		}
		else if (b % 7 == 5) {
			l[i] = "Thursday";
		}
		else if (b % 7 == 6) {
			l[i] = "Friday";
		}
		else if (b % 7 == 0) {
			l[i] = "Saturday";
		}
		i++;
	}
	for (int i = 0; i < x; i++){
		cout << l[i] << endl;
	}
	char c;
	cin >> c;
}

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

using namespace std;

int main()
{
  int days[] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

  int month, day;
  while(true)
  {
    cin >> month >> day;
    if(!month && !day)
      break;
    switch((days[month] + day) % 7)
    {
    case 6:
      cout << "Thuesday";
      break;
    case 0:
      cout << "Friday";
      break;
    case 1:
      cout << "Saturday";
      break;
    case 2:
        cout << "Sunday";
      break;
    case 3:
      cout << "Monday";
      break;
    case 4:
      cout << "Tuesday";
      break;
    case 5:
      cout << "Wednesday";
    }
    cout << endl;
  }

  return 0;
}

C++: #include<cstdio>
#include<iostream>
using namespace std;
string days[] = {"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"};
int zeller(int yeah,int month,int day)
{
  if(month <= 2)
    yeah--,month += 12;
  return (yeah + yeah/4 - yeah/100 + yeah/400 + (13 * month + 8) / 5 + day) % 7;
}

int main()
{
  int m,d;
  while(1)
    {
      scanf("%d %d",&m,&d);
      if(m+d == 0)break;
      int r = zeller(2004,m,d);
      cout << days[r] << endl;      
    }
  return 0;
}

C++: #include <iostream>
#include <string>
using namespace std;
 int main()
{
	//arrays with number of days in month and the days names
    int days[] = {31,29,31,30,31,30,31,31,30,31,30,31};
    string week[7] = {"Wednesday","Thursday","Friday","Saturday","Sunday","Monday","Tuesday"};
    int month, day;
    while(cin >> month >> day)//entering day
	{
		
        int n = 0;
        for(int i=1; i<month; i++)
		{
            n += days[i-1];
        }
        n += day;
 
        n %= 7;
        cout << week[n] <<endl;//printing the day
 
    }
  return 0;
}

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

const static std::string days[] = {"Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday", "Wednesday"};
const static int months[] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

int main()
{
    int cnt;
    int month, day;
    int startofMonths[12];
    cnt = 0;
    for (int i = 0; i < 12; i++) {
        startofMonths[i] = cnt;
        cnt += months[i];
    }
    std::cin >> month >> day;
    while (month != 0) {
        cnt = startofMonths[month-1];
        cnt += day -1;
        std::printf("%s\n", days[cnt % 7].c_str());
        std::cin >> month >> day;
    }
    return 0;
}

C++: 
#include <stdio.h>

int main(void){
    int m,d,ds,i;
    while(scanf("%d %d",&m,&d)!=EOF){
        if(m==0) break;
        for(i=1;i<m;i++){
            if(i==2){
                ds+=29;
            }
            else if(i==4||i==6||i==9||i==11){
                ds+=30;
            }
            else{
                ds+=31;
            }
        }
        ds+=d;
        if(ds%7==1){
            printf("Monday\n");
        }
        else if(ds%7==2){
            printf("Tuesday\n");
        }
        else if(ds%7==3){
            printf("Wednesday\n");
        }
        else if(ds%7==4){
            printf("Thursday\n");
        }
        else if(ds%7==5){
            printf("Friday\n");
        }
        else if(ds%7==6){
            printf("Saturday\n");
        }
        else if(ds%7==0){
            printf("Sunday\n");
        }
    }
    return 0;
}

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

char date[7][10] =
{
  "Monday",
    "Tuesday",
    "Wednesday",
    "Thursday",
    "Friday",
    "Saturday",
    "Sunday"
};

int lm[] = {31,29,31,30,31,30,31,31,30,31,30,31};

int main(){
  int m,d;
  while(cin >> m >> d, m+d){
    int ld = 0;
    for(int i=0; i<m-1; i++){
      ld += lm[i];
    }
    ld += d;
    cout << ld << endl;
    cout << date[ld%7+2] << endl;
  }
  
  return 0;
}

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

int main(int argc, const char * argv[])
{
    int month[12] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
    int m, d;
    while (scanf("%d %d", &m, &d) != 0) {
        int cnt = 0;
        if (m == 0 && d == 0) {
            return 0;
        }
        for (int i = 0; i < m - 1; i++) {
            cnt += month[m - 1];
        }
        cnt += d;
    
        if (cnt % 7 == 0) {
            printf("Wednesday\n");
        }
        if (cnt % 7 == 1) {
            printf("Thursday\n");
        }
        if (cnt % 7 == 2) {
            printf("Friday\n");
        }
        if (cnt % 7 == 3) {
            printf("Saturday\n");
        }
        if (cnt % 7 == 4) {
            printf("Sunday\n");
        }
        if (cnt % 7 == 5) {
            printf("Monday\n");
        }
        if (cnt % 7 == 6) {
            printf("Tuesday\n");
        }
    }
    return 0;
}

C++: #include <iostream>
int main(void){
    int month,day,chek;
    while(std::cin >> month >> day,month){ int year = 2004;
    if(month == 1 || month == 2){year--;month+=12;}
    chek = ((year+ year/4-year/100+year/400+(13*month+8)/5+day)%7);
    switch (chek) {case 0:puts("Sunday");break; case 1:puts("Monday");break; case 2:puts("Tuesday");break; case 3:puts("Wednesday");break;
        case 4:puts("Thursday");break; case 5:puts("Friday");break; case 6:puts("Saturday");break; }}return 0;}