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<string>
#include<vector>
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<functional>
#include<algorithm>
#include<stack>
#include<queue>
#include<deque>
#include<set>
#include<map>
#include<utility>
#include<cmath>
#include<ctime>
#include<complex>

using namespace std;

#define REP(i,s,e) for(int i=int(s);i<=int(e);i++)
#define rep(i,n) for(int i=0;i<int(n);i++)


int main(){

	int a,b;
	while(true){

	cin >> a >> b;
	if(a==0 && b==0) break;

	vector<int>v;

	v.push_back(0);
	v.push_back(31);
	v.push_back(29);
	v.push_back(31);
	v.push_back(30);
	v.push_back(31);
	v.push_back(30);
	v.push_back(31);
	v.push_back(31);
	v.push_back(30);
	v.push_back(31);
	v.push_back(30);
	v.push_back(31);

	int d=b;
	rep(i,a) d+=v[i];

	if(d%7==0) cout << "Wednesday" << endl;
	if(d%7==1) cout << "Thursday" << endl;
	if(d%7==2) cout << "Friday" << endl;
	if(d%7==3) cout << "Saturday" << endl;
	if(d%7==4) cout << "Sunday" << endl;
	if(d%7==5) cout << "Monday" << endl;
	if(d%7==6) cout << "Tuesday" << endl;

	}

	return 0;
}

C++: #include <stdio.h>

int main(void){
	int a,b;
	int day[]={0,31,29,31,30,31,30,31,31,30,31,30,31};

	while(scanf("%d %d",&a,&b),a){
		int youbi=0; // 0ismokuyou
		for(int i=1;i<a;i++) youbi=(youbi+day[i])%7;
		youbi=(youbi+b-1)%7;
		switch (youbi) {
			case 0:
				printf("Thursday\n");
				break;
			case 1:
				printf("Friday\n");
				break;
			case 2:
				printf("Saturday\n");
				break;
			case 3:
				printf("Sunday\n");
				break;
			case 4:
				printf("Monday\n");
				break;
			case 5:
				printf("Tuesday\n");
				break;
			case 6:
				printf("Wednesday\n");
				break;
		}
	}
	return 0;
}

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

int main() {
  int month,day;
  int md[] = { 31,29,31,30,31,30,31,31,30,31,30,31 };
  while ( cin >> month >> day, month || day ) {
    int total = 0;
    for ( int i = 0; i < month-1; i++ ) total += md[i];
    total += day;
    if ( total % 7 == 1 ) cout << "Thursday" << endl;
    else if ( total % 7 == 2 ) cout << "Friday" << endl;
    else if ( total % 7 == 3 ) cout << "Saturday" << endl;
    else if ( total % 7 == 4 ) cout << "Sunday" << endl;
    else if ( total % 7 == 5 ) cout << "Monday" << endl;
    else if ( total % 7 == 6 ) cout << "Tuesday" << endl;
    else if ( total % 7 == 0 ) cout << "Wednesday" << endl;
  }
  return 0;
}

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

int main(){

  int m, d, cnt, d1[12];
  int p[12] = {31, 29, 31, 30, 31, 30,
               31, 31, 30, 31, 30, 31};
  string str[7] = {"Monday", "Tuesday", "Wednesday",
                   "Thursday", "Friday", "Saturday",
                   "Sunday"};
  
  d1[0] = 3;
  for(int i=1; i<12; i++){
    d1[i] = (d1[i-1] + p[i-1]) % 7;
  }

  while(1){
    cin >> m >> d;
    if(m == 0 && d == 0){
      break;
    }
    cout << str[(d1[m-1] + d - 1) % 7] << endl;
  }

  return 0;

}

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

int main() {
	int x, y, t;
	vector<int> X, Y, T;
	while (cin >> x >> y) {
		if (x == 0)break;
		X.push_back(x);
		Y.push_back(y);
	}
	for (int i = 0; i < X.size(); i++) {
		if (X[i] == 1)t = (Y[i] - 1) % 7;
		else if (X[i] == 2)t = (30 + Y[i]) % 7;
		else if (X[i] % 2 == 0) {
			if (X[i] >= 8)t = (((X[i] - 8) / 2) * 61 + Y[i] + 212) % 7;
			else t = (((X[i] - 4) / 2) * 61 + 90 + Y[i]) % 7;
		}
		else {
			if(X[i]>=8)t = (((X[i] - 9) / 2) * 61 + 31 + Y[i]) % 7;
			else t= (((X[i] - 3) / 2) * 61 + 59 + Y[i]) % 7;
		}
		T.push_back(t);
	}
	for (int i = 0; i < T.size(); i++) {
		if (T[i] == 0)cout << "Thursday" << endl;
		else if (T[i] == 1)cout << "Friday" << endl;
		else if (T[i] == 2)cout << "Saturday" << endl;
		else if (T[i] == 3)cout << "Sunday" << endl;
		else if (T[i] == 4)cout << "Monday" << endl;
		else if (T[i] == 5)cout << "Tuesday" << endl;
		else cout << "Wednesday" << endl;
	}
	return 0;
}

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

int main()
{
	int a, b, count = 0;
	int ans[100];
	while (cin >> a >> b) {
		if (a == 0 && b == 0)
			break;
		if (a == 1 || a == 4 || a == 7) {//
			ans[count] = (b % 7 + 3)%7;
		}
		else if (a == 9 || a == 12) {
			ans[count] = (b % 7 + 2)%7;
		}
		else if (a == 2 || a == 8) {
			ans[count] = (b % 7 + 6)%7;
		}
		else if (a == 3 || a == 11) {
			ans[count] = b % 7;
		}
		else if (a == 5) {//
			ans[count] = (b % 7 + 5)%7;
		}
		else if (a == 6) {//
			ans[count] = (b % 7 + 1)%7;
		}
		else if (a == 10) {
			ans[count] = (b % 7 + 4)%7;
		}
		count++;
	}
	for (int i = 0; i < count; i++) {
		if (ans[i] == 1)
			cout << "Monday" << endl;
		else if (ans[i] == 2)
			cout << "Tuesday" << endl;
		else if (ans[i] == 3)
			cout << "Wednesday" << endl;
		else if (ans[i] == 4)
			cout << "Thursday" << endl;
		else if (ans[i] == 5)
			cout << "Friday" << endl;
		else if (ans[i] == 6)
			cout << "Saturday" << endl;
		else if (ans[i] == 7)
			cout << "Sunday" << endl;
	}
}

C++: #include<stdio.h>
int main()
{
int p[12]={31,29,31,30,31,30,31,31,30,31,30,31};
int M,D,sum;
while(1)
{
sum=0;
scanf("%d",&M);
scanf("%d",&D);if(M==0)break;
if(M==0)break;
for(int i=0;i<M-1;i++)
sum+=p[i];

sum+=D;

switch(sum%7)
{
case 4:
printf("日曜日 Sunday\n");break;
case 5:
printf("月曜日 Monday\n");break;

case 6:
printf("火曜日 Tuesday\n");break;

case 0:
printf("水曜日 Wednesday\n");break;

case 1:
printf("木曜日 Tursday\n");break;

case 2:
printf("金曜日 Friday\n");break;

case 3:
printf("土曜日 Saturday\n");break;
}
}
return 0;
}

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

typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pair<int, int> > vii;
#define rrep(i, m, n) for(int (i)=(m); (i)<(n);  (i)++)
#define erep(i, m, n) for(int (i)=(m); (i)<=(n); (i)++)
#define  rep(i, n)    for(int (i)=0; (i)<(n);  (i)++)
#define  rev(i, n)    for(int (i)=(n)-1; (i)>=0; (i)--)
#define vrep(i, c)    for(__typeof((c).begin())i=(c).begin(); i!=(c).end(); i++)
#define  ALL(v)       (v).begin(), (v).end()
#define mp            make_pair
#define pb            push_back
template<class T1, class T2> inline void minup(T1& m, T2 x){ if(m>x) m=static_cast<T2>(x); }
template<class T1, class T2> inline void maxup(T1& m, T2 x){ if(m<x) m=static_cast<T2>(x); }

#define INF 1000000000
#define MOD 1000000007
#define EPS 1E-12

string s[] = {"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"};
int y, m, d;

int main()
{
  while((cin >> m >> d) && m){
    y = 2014;
    if(m == 1) y = 2013, m = 13;
    if(m == 2) y = 2013, m = 14;
    int D = (d + 26*(m+1)/10 + y + y/4 -2*(y/100) + y/100/4 + 5) % 7;
    cout << s[D] << endl;
  }


  return 0;
}

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

int zeller(int y, int m, int d){
	if( m <= 2){
		y--;
		m += 12;
	}
	return ( ( y + y/4 - y/100 + y/400 + (13*m+8)/5 + d ) % 7);
}

int main(){
	string week[7] = {"Sunday","Mondey","Tuesday","Wednesday","Thursday","Friday","Saturday"};
	int y=2004, m, d;

	while( cin >> m >> d , m ){
		cout << week[ zeller( y , m , d ) ] << endl;
	}
}

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

int month[]={0,31,29,31,30,31,30,31,31,30,31,30,31};

int main(){
	
	int m,d;
	
	while(scanf("%d %d",&m,&d),(m!=0)){
		for(int i=0;i<m;i++){
			d=d+month[i];
		}
		d=d%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;
		}
	}
	return 0;
}