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

int main()
{
	int month,day,tooshi;
	while(true)
	{
	cin >> month;
	cin >> day;
	if(month==0&&day==0)break;
	switch (month)
	{
		case 1:
		tooshi = day;
		break;
		case 2:
		tooshi = day+31;
		break;
		case 3:
		tooshi = day+60;
		break;
		case 4:
		tooshi = day+91;
		break;
		case 5:
		tooshi = day+121;
		break;
		case 6:
		tooshi = day+152;
		break;
		case 7:
		tooshi = day+182;
		break;
		case 8:
		tooshi = day+213;
		break;
		case 9:
		tooshi = day+244;
		break;
		case 10:
		tooshi = day+274;
		break;
		case 11:
		tooshi = day+305;
		break;
		case 12:
		tooshi = day+335;
		break;
	}

	switch (tooshi % 7)
	{
		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>
#include <cstdio>
using namespace std;

int main(){
	int m, d;
	int days[12]={31,29,31,20,31,30,31,31,30,31,30,31};
	
	while( scanf(" %d %d", &m, &d)*m != 0 ){
		int i=0, c=0;
		while(i<=m-2){
			c+=days[i];
			++i;
		}
		c+=d;
	
		//printf("%d\n", c);
		if(c%7==1) printf("Thursday\n");
		else if(c%7==2) printf("Friday\n");
		else if(c%7==3) printf("Saturday\n");
		else if(c%7==4) printf("Sunday\n");
		else if(c%7==5) printf("Monday\n");
		else if(c%7==6) printf("Tuesday\n");
		else if(c%7==0) printf("Wednesday\n");
	}

	return 0;
}

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 %d",&M,&D);
if(M==0)break;
for(int i=0;i<M;i++);
sum+=p[i];

sum+=D;

switch(sum%d)
{
case 0:
printf("Sunday\n");
case 1:
printf("Monday\n");

case 2:
printf("Tuesday\n");

case 3:
printf("Wednesday\n");

case 4:
printf("Tursday\n");

case 5:
printf("Friday\n");

case 6:
printf("Saturday\n");
}
}
return 0;
}

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

#define all(c) (c).begin(), (c).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second

const int INF=100000000;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
using namespace std;
typedef pair<int ,int > P;
typedef long long ll;

vector<string> weeks = {"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"};
int month[] = {31,29,31,30,31,30,31,31,30,31,30,31};
int mm,dd;
void solve() {
    int day = 2;
    for(int i=1;i<mm;i++) day += month[i-1];
    day += dd;
    day %= 7;
    cout<<weeks[day]<<endl;

}
int main() {
    while(cin>>mm>>dd) {
        if(mm+dd==0) break;
        solve();
    }
    return 0;
}

C++: #include <iostream>
#include <string>
using namespace std;
 
int main(){
  string y[7]={"Wednesday","Thursday","Friday","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 && d == 0 ) break;
    while( m != 0 ){
      d += mon[m-1];
      m--;
    }
    cout << y[d%7] << endl;
  }
 
  return 0;
}

C++: #include<iostream>
int main()
{
	while (true)
	{
		int passed = 0;
		int days[12] = { 31,29,31,30,31,30,31,31,30,31,30,31 };
		int m, d;
		std::cin >> m >> d;
		if (m == 0)
		{
			break;
		}
		for (int i = 0; i < m - 1; i++)
		{
			passed += days[i];
		}
		passed += d - 1;
		switch (passed % 7)
		{
		case 0:
			std::cout << "Thursday" << std::endl;
			break;
		case 1:
			std::cout << "Friday" << std::endl;
			break;
		case 2:
			std::cout << "Saturday" << std::endl;
			break;
		case 3:
			std::cout << "Sunday" << std::endl;
			break;
		case 4:
			std::cout << "Monday" << std::endl;
			break;
		case 5:
			std::cout << "Tuesday" << std::endl;
			break;
		case 6:
			std::cout << "Wednesday" << std::endl;
			break;
		}
	}
	return 0;
}

C++: #include <iostream>
#include <string>
using namespace std;
int main(){
int n;
int m;
while(cin >>n>>m){
if(n==0){break;}
if(n==2){n=m+31;}
if(n==3){n=m+60;}
if(n==4){n=m+91;}
if(n==5){n=m+121;}
if(n==6){n=m+152;}
if(n==7){n=m+182;}
if(n==8){n=m+213;}
if(n==9){n=m+244;}
if(n==10){n=m+274;}
if(n==11){n=m+305;}
if(n==12){n=m+335;}
n=n%7;
if(n==1){cout <<"Thursday";}
if(n==2){cout <<"Friday";}
if(n==3){cout <<"Saturday";}
if(n==4){cout <<"Sunday";}
if(n==5){cout <<"Monday";}
if(n==6){cout <<"Tuesday";}
if(n==0){cout <<"Wednesday";}
cout <<endl;}}

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

int main(void){

    string day[7] = {"Saturday","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday"};
    //int month[12] = {31,29,31,30,31,30,31,31,30,31,30,31};
    int x,y;

    while(cin >> x >> y){
        int h = 20;
        int n = 4;
        if(x == 0){
            return 0;
        }
        if(x == 1 || x == 2){
            n--;
            x+=12;
        }
                       
        int w = n + n/4 + h/4 - 2*h + 13*(x+1)/5 + y;
        //cout << w << endl;
       
        //cout << w%7 << endl;

        string ans = day[w%7];

        cout << ans << endl;
    }
    return 0;
}

C++: #include<iostream>
#include <fstream>
#include <stdio.h>
#include <stdlib.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include<string>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<sstream>
#include<algorithm>
#include<map>
#include<complex>
using namespace std;


#define li			long long int
#define rep(i,to)	for(int i=0;i<((int)(to));i++)
#define repp(i,start,to)	for(int i=(int)(start);i<((int)(to));i++)
#define pb			push_back
#define sz(v)		((li)(v).size())
#define bgn(v)		((v).begin())
#define eend(v)		((v).end())
#define allof(v)	(v).begin(), (v).end()
#define dodp(v,n)		memset(v,(li)n,sizeof(v))
#define bit(n)		(1ll<<(li)(n))
#define mp(a,b)		make_pair(a,b)
#define rin	rep(i,n)
#define EPS 1e-10
#define ETOL 1e-8
#define MOD 1000000007
#define F first
#define S second
#define p2(a,b)		cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)		cout<<a<<"\t"<<b<<"\t"<<c<<endl

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

int main(){
	li m,d;
	li acum=3;
	li day[12]={31,29,31,30,31,30,31,31,30,31,30,31};
	
	while(1){
		cin>>m>>d;
		if(min(m,d)==0)break;
		
		rep(i,m-1)acum+=day[i];
		acum+=d-1;
		cout<<yobi[acum%7]<<endl;
	}
	
	return 0;
}

C++: #include<iostream>
#include<string>
using namespace std;
int main(){
  int d[]={31,29,31,30,31,30,31,31,30,31,30,31};
  string s[]={"Thursday",
	      "Friday","Saturday","Sunday","Monday","Tuesday","Wednesday",};
  int i,j,a,b;cin>>a>>b;
  while(a!=0){
    int o=0;
    for(i=1;i<a;i++) o+=d[i-1];
    o+=b-1;
    cout << s[o%7] << endl;cin>>a>>b;
  }
}

C++: //https://onlinejudge.u-aizu.ac.jp/problems/0027

#include <bits/stdc++.h>

using namespace std;

string day[7] = {"Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday", "Wednesday"};
int months[12] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

int main() {
    int m, d;

    while (true) {
        cin >> m >> d;
        if (m + d == 0) return 0;

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

/*
 * 1/1から何日ずれるか数えて7で割る。
 */