Go: package main

import "fmt"

func main() {
	days := [12]int{31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}
	weekday := [7]string{"Wednesday", "Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday"}

	for {
		var m, d int
		fmt.Scan(&m, &d)
		if m == 0 {
			break
		}

		for i := 0; i < m-1; i++ {
			d += days[i]
		}

		fmt.Println(weekday[d%7])
	}
}

C++: #include <iostream>

auto initDays (int * a , int n , int & prev) -> void
{
    for (auto i = 1; i <= n; ++ i)
    {
        prev = (prev + 1) % 7;
        a [i] = prev;
    }
}

auto main () -> int
{
    const char * table [] =
    {
        "Monday" ,
        "Tuesday" ,
        "Wednesday" ,
        "Thursday" ,
        "Friday" ,
        "Saturday" ,
        "Sunday"
    };

    int day [13][32] = {{}};

    int p = 2;
    initDays (day [1] , 31, p);
    initDays (day [2] , 29, p);
    initDays (day [3] , 31, p);
    initDays (day [4] , 30, p);
    initDays (day [5] , 31, p);
    initDays (day [6] , 30, p);
    initDays (day [7] , 31, p);
    initDays (day [8] , 31, p);
    initDays (day [9] , 30, p);
    initDays (day [10] , 31, p);
    initDays (day [11] , 30, p);
    initDays (day [12] , 31, p);

    int m , d;
    while (std::cin >> m >> d && m && d)
    {
        std::cout << table [day [m] [d]] << std::endl;
    }
}

C++: #include <iostream>
#include <string>
using namespace std;
int countup_days(int m, int d) // m月d日が、1月1日から何日目か返す
{
    int         sum     = 0;
    const int   month[] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31,};
    for (int i=1; i<m; i++) {
        sum += month[i];
    }
    return sum + d -1;
}
string what_day(int days) // 1/1からdays日後は何曜日か文字列を返す
{
    string day[]   = {"Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday", "Wednesday"};
    return day[days%7];
}
int main()
{
    int m, d;
    while (true) {
        cin >> m >> d;
        if (m==0 && d==0)
            break;
        cout << what_day(countup_days(m, d)) << endl;
    }
}

C++: #include <stdio.h>

int main(void) {
  int i, j, k, m, d, ans;
  int m0[13] = {0, 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335};
  char w[7][25] = {
    "Wednesday",
    "Thursday",
    "Friday",
    "Saturday",
    "Sunday",
    "Monday",
    "Tuesday"
  };
  while( 1 ) {
    scanf("%d%d", &m, &d);
    if(!m && !d) break;
    ans = m0[m] + d;
    ans %= 7;
    printf("%s\n", w[ans]);
  }
  return 0;
}

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

using namespace std;

int main() {
    int m, d, past;
    int day[] = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
    string week[] = { "Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday", "Wednesday" };
    while (cin >> m >> d, m != 0) {
        past = 0;
        for (int i = 0; i < m - 1; i++) {
            past += day[i];
        }
        past += d - 1;
        cout << week[past % 7] << endl;
    }

    return 0;
}

C++: #include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <numeric>
#include <cmath>
#include <climits>
#include <limits>
#include <cfloat>
#include <fstream>
using namespace std;

int main()
{
//	cut here before submit 
//	freopen("testcase.wdt", "r", stdin);
	// 2004/01/01 is Thursday
	const string week[] = {
	"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" };
	const int days[] = { 0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; 
	string str = "";
	
	while (getline (cin, str ) ){
		int day, month;		
		stringstream ss(str);
		ss >> month >> day;
		if (day == 0 && month == 0){
			break;
		} // end if
		int num = 0;
		int i;
		for (i = 0; i < month; ++i){
			num += days[i];
		} // end for
		num += day;
		cout << "num: " << num << endl;
		cout << week [( num - 1 ) % 7 + 3 ] << endl;
	} // end for
		
	return 0;
}

C++: #include<iostream>
#include<string>
#include<vector>
#include<cstdio>
#include<sstream>
#include<algorithm>
#include<cmath>
#include<map>
using namespace std;
int stoi(string x){stringstream ss;ss<<x;int tmp;ss>>tmp;return tmp;}
string itos(int x){stringstream ss;ss<<x;return ss.str();}
int cal[12]={31,29,31,30,31,30,31,31,30,31,30,31};//2は29,4,6,9,11は30
string ta[7]={"Wednesday","Thursday","Friday","Saturday","Sunday","Monday","Tuesday"};//1月１日が木曜日
int main(){
	int n,m,sum=0,now=0;
	while(cin>>n>>m,n||m){
	sum=0;
	for(int i=0;i<n;i++){
	if(i!=n-1)for(int j=0;j<cal[i];j++)sum++;
	else for(int j=0;j<m;j++)sum++;
	}
	cout<<ta[sum%7]<<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[i];
        }
        cnt += d;
        printf("%d", cnt);

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

int main()
{
	string days[]={
		"Mon",
		"Tues",
		"Wednes",
		"Thurs",
		"Fri",
		"Satur",
		"Sun"
	};
	int cal[12][31]={{0}};
	int today=3;
	for (int i=0; i<12; i++) {
		for (int j=0; j<31; j++) {
			cal[i][j]=today;
			++today%=7;
			if (i==3 || i== 5 || i==8 || i==10) {
				if (j==29) {
					break;
				}
			}
			else if (j==1) {
				if (j==28) {
					break;
				}
			}
		}
	}
	int a,b;
	for (cin >> a >> b; a; cin >> a >> b) {
		cout << days[cal[a-1][b-1]] << "day" << endl;
	}	
}

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

int main()
{
	int days[13] = { 0,31,29,31,30,31,30,31,31,30,31,30,31};
	string ans[7] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};

int month, date,day,p;

	//前月までの延べ日数に変換
	for( int i = 1; i < 13; i++ ) {
		days[i] += days[i-1];
	}

	while( 1) {
		cin >> month >> date;
		if( month == 0 )
			break;
		
		day = days[month-1] + date + 3;
		p = day %7;

		cout << ans[p] << endl;

	}
	return 0;
}

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

int main() {
  int k,m,d;
  string today[7]={"Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"};
  int mon[12]={31,29,31,30,31,30,31,31,30,31,30,31};

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

    for(int i=0;m-1>i;i++) d+=mon[i];

    k=d%7+2;
    cout <<today[k]<<endl;
  
  }
}

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,fuge;

	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;
		}
	}
}