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>
using namespace std;

int main(){
  int day30[4] = {4,6,9,11};

  while(1) {
  int m,d;
  cin >> m >> d;
  if(m == 0 && d == 0) break;
  int a = 1,b = 1,count = 0;

  while(1) {

    if(a == m && b == d) break;
    
    b++;
    count++;

    if(a == 2 && b == 30) {
      a++;
      b = 1;
    }
    else if(b == 31) {
      for(int i=0;i<4;i++) 
	if(day30[i] == a) {
	  a++;
	  b = 1;
	  break;
	}
    }
    if( b == 32) {
      a++;
      b = 1;
    }
  }
  
  if(count % 7 == 4 ) cout <<"Monday"<<endl;
  else if(count % 7 == 5) cout << "Tuesday"<<endl;
  else if(count % 7 == 6) cout <<"Wednesday"<< endl;
  else if(count % 7 == 0) cout <<"Thursday"<< endl;
  else if(count % 7 ==1) cout << "Friday" << endl;
  else if(count % 7 ==2)cout << "Saturday" << endl;
  else if(count % 7 ==3) cout << "Sunday" << endl;
  
  }

  return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <math.h>
using namespace std;

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

int main(){
	int m,d;
	while(cin>>m>>d,m){
		switch(m){
		case 12:d+=30;
		case 11:d+=31;
		case 10:d+=30;
		case 9:d+=31;
		case 8:d+=31;
		case 7:d+=30;
		case 6:d+=31;
		case 5:d+=30;
		case 4:d+=31;
		case 3:d+=29;
		case 2:d+=31;
		case 1:cout<<M[d%7]<<endl;
		}
	}
}

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

int main(){
	int mon, day, week;
	string ans[7] = {"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"};
	int start_week[13] = {-1, 3, 6, 0, 3, 5, 1, 3, 6, 2, 4, 0, 2};
	while(cin >> mon >> day){
		if(mon==0 && day==0){
			break;
		}
		week = start_week[mon]+day-1;
		week %= 7;
		cout << ans[week] << endl;
	}
	return 0;
}

C++: #include <cstdio>

using namespace std;

const int date[] = {31,29,31,30,31,30,31,31,30,31,30,31};
const char week[7][10] = {"Wednesday","Thursday","Friday","Saturday","Sunday","Monday","Tuesday"};

int main(void){
	int m, d, res, i;
	while(1){
		scanf("%d%d",&m,&d);
		if(m == 0 && d == 0){
			break;
		}
		res = 0;
		for(i = 0;i < m - 1;i++){
			res += date[i];
		}
		res += d;
		printf("%s\n",week[res % 7]);
	}
	return 0;
}

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

int main() {
    int month, day;
    string weekday[7] = { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" };
    while (cin >> month >> day) {   
        if (month + day == 0) { break; }  
        time_t rawtime;
        struct tm * timeinfo;

        time(&rawtime);
        timeinfo = localtime(&rawtime);

        timeinfo->tm_year = 2004-1900;
        timeinfo->tm_mon = month - 1;
        timeinfo->tm_mday = day;
        
        mktime(timeinfo);

        cout << weekday[timeinfo->tm_wday] << endl;
    }
    return 0;
}

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

int main()
{
    string day[]={"Wednesday","Thirsday","Friday","Saturday","Sunday","Monday","Tuesday"};
    int Mon[12]={31,29,31,30,31,30,31,31,30,31,30,31};
    int m,d;
    while(cin>>m>>d,m*d){
        int allDay=d;
        for(int i=1;i<m;i++){
            allDay += Mon[i];
        }
        cout<<day[allDay%7]<<endl;
    }
}

C++: #include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>

using namespace std;


int month[12] = {31,29,31,30,31,30,31,31,30,31,30,31};
char date[7][10] = {"Wednesday","Thursday","Friday","Saturday","Sunday","Monday","Tuesday"};


int main(){
    int M,D,days=0;
    
    while(1){
        days=0;
        scanf("%d%d",&M,&D);
        if(M+D==0) break;
        
        for(int i=0;i<M-1;i++)
            days+=month[i];
    
        printf("%s\n",date[(days+D)%7]);
    }
    
    return 0;
}

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

int main() {
	string youbi[7] = {"Thursday","Friday","Suturday","Sunday","Monday","Tuesday","Wednesday"};
	int month[12] = {31,29,31,30,31,30,31,31,30,31,30,31};
	
	int gathu,nichi;
	while ( cin >> gathu >> nichi,gathu ) {
		int keika = 0;
		for ( int i = 0; i < gathu - 1; i++ ) {
			keika += month[i];
		}
		keika += nichi;
		
		cout <<  youbi[keika % 7 - 1] << endl;
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

int main() {

	int m, d;
	int day[12]={31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
	char week[][16]={"Wednesday", "Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday"};

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

		for(int i=0; i<m-1; i++) {
			d+=day[i];
		}
 
		cout << week[d%7] << endl;

	}

	return 0;

}

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

int main()
{
  int m,d;

  string week[7] = {"Thursday", "Friday", "Saturday", "Sunday","Mondy", "Tuesday", "Wednesday"};
  int month[12] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

  while ( scanf("%d %d", &m, &d), m != 0 ) {
    int day = 0;
    for (int i = 0; i < (m - 1); i++) {
      day += month[i];
    }
    day += d;
 
    cout << week[(day%7)-1] << endl;
  }
  return 0;
}

C++: #include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <functional>

using namespace std;

const char *dates[] = {
	"Monday",
	"Tuesday",
	"Wednesday",
	"Thursday",
	"Friday",
	"Saturday",
	"Sunday"
};

const int dateOfMonth[] = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };

int main()
{
	int month, day, date;

	while ( true )
	{
		date = 2;

		cin >> month >> day;

		if ( month == 0 )
		{
			break;
		}

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

		date += day;

		cout << dates[ date % 7 ] << endl;
	}

	return 0;
}

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

using namespace std;

int main(){
	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;
	}
}