Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
	"time"
)

var sc = bufio.NewScanner(os.Stdin)

//Sliceconvtoi ...
func Sliceconvtoi() []int {
	strs := strings.Split(sc.Text(), " ")

	var ints []int
	var x int

	for _, s := range strs {
		x, _ = strconv.Atoi(s)
		ints = append(ints, x)
	}

	return ints
}

func main() {
	for sc.Scan() {
		i := Sliceconvtoi()

		if i[0] == 0 && i[1] == 0 {
			break
		}

		m := time.Month(i[0])
		d := i[1]
		t := time.Date(2004, m, d, 0, 0, 0, 0, time.Local)
		fmt.Println(t.Weekday())
	}

}

Python: import sys
from datetime import *

for line in sys.stdin:
    a, b = map(int,line.split())
    try:
        print(date(2004, a, b).strftime("%A"))
    except ValueError:
        break

Python: DAY_OF_WEEK = ['Sunday', 'Monday', 'Tuesday',
               'Wednesday', 'Thursday', 'Friday', 'Saturday']
def day_of_week(y, m, d):
    # ?????\?????????(?????§???????????¬???)
    # ??\?????\???0,????????\???6
    # Zeller's congruence
    if m == 1 or m == 2:
        m += 12
        y -= 1
    h = (y + y // 4 - y // 100 + y // 400 + (13 * m + 8) // 5 + d) % 7
    return h

while True:
    m,d = map(int, input().split())
    if m==0:
        exit()
    print(DAY_OF_WEEK[day_of_week(2004,m,d)])

Python: def day(x,y):
	start=0
	if (x==1 or x==10):
		start=3
	elif (x==2 or x==3 or x==11):
		start=6
	elif (x==4 or x==7):
		start=2
	elif x==5:
		start=4
	elif x==6:
		start=0
	elif x==8:
		start=5
	else:
		start=1
	day=(start+y)%7
	if day==1:
		return "Sunday"
	elif day==2:
		return "Monday"
	elif day==3:
		return "Tuesday"
	elif day==4:
		return "Wednesday"
	elif day==5:
		return "Thursday"
	elif day==6:
		return "Friday"
	else:#0
		return "Saturday"


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

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