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])
	}
}

Python: # 0027
import datetime
day = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
while True :
    month, date = map(int, input().split())
    if month == date == 0: break
    print(day[datetime.date(2004, month, date).weekday()])

Python: def get_input():
    while True:
        try:
            yield ''.join(input())
        except EOFError:
            break

daylist = [31,29,31,30,31,30,31,31,30,31,30,31]
namelist = ["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"]

N = list(get_input())
m,d = [int(i) for i in N[0].split()]
cnt = 1
while m != 0 or d != 0:
    ans = 2
    for i in range(m-1):
        ans += daylist[i]
    ans += d
    ans %= 7
    print(namelist[ans])

    m,d = [int(i) for i in N[cnt].split()]
    cnt += 1

Python: mday = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
youbi = ["Wednesday", "Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday"]

while True:
	month, day = map(int, input().split())
	if month == day == 0: break

	days = 0
	for m in range(12):
		if month-1 <= m: break
		days += mday[m]
	days += day

	print(youbi[days % 7])

Python: # -*- coding:utf-8 -*-

def main():
    LIST=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]

    while True:
        try:
            count=3
            M,D=map(int,input().split())
            if M==0:
                break

            if M in [1,4,7]:
                pass
            elif M in [10]:
                count+=1
            elif M in [5]:
                count+=2
            elif M in [2,8]:
                count+=3
            elif M in [3,11]:
                count+=4
            elif M in [6]:
                count+=5
            elif M in [9,12]:
                count+=6

            count+=D%7

            print(LIST[count%7])

        except:
            break

if __name__ == '__main__':
    main()

Python: from datetime import date
week=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"]
while True:
    a,b=map(int,input().split())
    if a==0:
        break
    print(week[date(2004,a,b).weekday()])

Python: while 1:
    m,d=map(int,input().split())
    if m==0:break
    print(['Wednes','Thurs','Fri','Satur','Sun','Mon','Tues'][([0,31,60,91,121,152,182,213,244,274,305,335][m-1]+d)%7]+'day')

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

int main(){
	int month, date;
	int c[11] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30};
	string s[7] = {"Wednesday","Thursday","Friday","Saturday","Sunday","Monday","Tuesday"};
	while(cin >> month >> date && month){
		int t = date;
		for(int i = 0;i < month-1;i++)t += c[i];
		cout << s[t%7] << endl;
	}
	return 0; 
}

C++: #include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;

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

ll zeller(ll y, ll m, ll d){
    if(m <= 2){
        y--;
        m += 12;
    }
    return (365 * y) + (y / 4) - (y / 100) + (y / 400) + (306 * (m + 1)) / 10 + d - 429;
}

int main(){
    int a,b;
    while(cin >> a >> b && a){
        int z = zeller(2004,a,b);
        cout << day[(z+1)%7] << endl;
    }
}

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

int main() {
	int mth[13]={0,31,29,31,30,31,30,31,31,30,31,30,31};
	char wks[][16]={"Wedneday","Thursday","Friday","Suturday","Sunday",
				"Monday","Tuesday"};
	int m,d;
	while(cin>>m>>d,m){
		int days=0;
		for(int i=1;i<m;i++) days+=mth[i];
		days+=d; cout<<wks[days%7]<<endl;
	}
}

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

using namespace std;

#define REP(i,a,b) for((i)=(a);(i)<(int)(b);(i)++)
#define rep(i,n) REP(i,0,n)
// BEGIN CUT HERE
#define foreach(itr,c) for(typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
// END CUT HERE
const int INF = 1>>29;

int main(){
  int mon, day,st;
  vector<vector<int> > data(13, vector<int>(32, INF));
  string whatday[7] = {"Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"};

  st = 3;
  REP(mon,1,13) REP(day,1,32){
    if(mon == 2 && day == 30) break;
    if(mon == 4 || mon == 6 || mon == 9 || mon == 11) if(day == 31) break;
    data[mon][day] = st;
    st++; if(st == 7) st = 0;
  }

  while(cin >> mon >> day){
    if(day == 0 && mon == 0) break;
    cout << whatday[data[mon][day]] << endl;
  }

  return 0;
}

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

int main(){
  int a,b,sum;
  while(1){
    cin >> a >> b;
    if(a==0&&b==0)break;
    sum=0;
    for(int i=1;i<a;i++){
      if(i==2)sum+=29;
      else if(i==4||i==6||i==9||i==11)sum+=30;
      else sum+=31;
    }
    sum+=b;
    if(sum%7==1)cout <<"Thursday"<<endl;
    else if(sum%7==2)cout <<"Friday"<<endl;
    else if(sum%7==3)cout <<"Saturday"<<endl;
    else if(sum%7==4)cout <<"Sunday"<<endl;
    else if(sum%7==5)cout <<"Monday"<<endl;
    else if(sum%7==6)cout <<"Tuesday"<<endl;
    else if(sum%7==0)cout <<"Wednesday"<<endl;
  }
  return 0;
}

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

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

int main(){
    int m, d;
    while(true){
        scanf("%d %d", &m, &d);
        if(m == 0 && d == 0) break;
        int a = 3;
        for(int i = 1; i < m; i++){
            a = (a + month[i])%7;
        }
        a = (a + d - 1)%7;
        printf("%s\n", dd[a]);
    }
    return 0;
}

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

using namespace std;

#define LOG(...) printf(__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define CLR(a) memset((a), 0 ,sizeof(a))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int dx[] = { -1, 0, 1, 0 }; const int dy[] = { 0, 1, 0, -1 };

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