Go: package main

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

var scanner = bufio.NewScanner(os.Stdin)

func nextInt() int {
	scanner.Scan()
	i, e := strconv.Atoi(scanner.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func zeller(month, day int) int {
	year := 2004
	if month == 1 || month == 2 {
		year--
		month += 12
	}
	return (year + year/4 - year/100 + year/400 + (13*month+8)/5 + day)%7
}

func main() {
	scanner.Split(bufio.ScanWords)
	for {
		month := nextInt()
		day := nextInt()
		if month == 0 && day == 0{
			break
		}
		switch zeller(month, day) {
		case 0:
			fmt.Println("Sunday")
		case 1:
			fmt.Println("Monday")
		case 2:
			fmt.Println("Tuesday")
		case 3:
			fmt.Println("Wednesday")
		case 4:
			fmt.Println("Thursday")
		case 5:
			fmt.Println("Friday")
		case 6:
			fmt.Println("Saturday")
		}
	}
}

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

int main() {
  while(1) {
    int m,d;
    cin >> m >> d;
    if(m==0 && d==0) break;

    for(int i=1; i<m; i++) {
      switch(i){
      case 2:
	d+=29;
	break;
      case 4:
      case 6:
      case 9:
      case 11:
	d+=30;
	break;
      default :
	d+=31;
	break;
      }
    }
    switch(d%7){
    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;
    case 0:
      cout << "Wednesday" << endl;
      break;
    }
  }
  return 0;
}

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

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

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

string check(int d) {
    if (d%7==1) {
        return "Thursday";
    } else if (d%7==2) {
        return "Friday";
    } else if (d%7==3) {
        return "Saturday";
    } else if (d%7==4) {
        return "Sunday";
    } else if (d%7==5) {
        return "Monday";
    } else if (d%7==6) {
        return "Tuesday";
    } else if (d%7==0) {
        return "Wednesday";
    }
}

int main(void){
    int m,d;
    while (cin>>m>>d) {
        if (m==0) {
            break;
        } else {
            if (m==1) {
                cout<<check(d)<<endl;
            } else if (m==2) {
                d=d+31;
                cout<<check(d)<<endl;
            } else if (m==3) {
                d=d+31+29;
                cout<<check(d)<<endl;
            } else if (m==4) {
                d=d+31+29+31;
                cout<<check(d)<<endl;
            } else if (m==5) {
                d=d+31+29+31+30;
                cout<<check(d)<<endl;
            } else if (m==6) {
                d=d+31+29+31+30+31;
                cout<<check(d)<<endl;
            } else if (m==7) {
                d=d+31+29+31+30+31+30;
                cout<<check(d)<<endl;
            } else if (m==8) {
                d=d+31+29+31+30+31+30+31;
                cout<<check(d)<<endl;
            } else if (m==9) {
                d=d+31+29+31+30+31+30+31+31;
                cout<<check(d)<<endl;
            } else if (m==10) {
                d=d+31+29+31+30+31+30+31+31+30;
                cout<<check(d)<<endl;
            } else if (m==11) {
                d=d+31+29+31+30+31+30+31+31+30+31;
                cout<<check(d)<<endl;
            } else if (m==12) {
                d=d+31+29+31+30+31+30+31+31+30+31+30;
                cout<<check(d)<<endl;
            }
        }
    }
}

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

using namespace std;

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

int main() {
	int month, day;
	long AA = 0, BB = 0, CC = 0, DD = 0;

	while (cin >> month >> day) {
		if (month == 0) {
			break;
		}

		AA = 2004;
		if (month < 3) {
			AA--;
			month += 13;
		}
		else {
			month++;
		}

		AA *= 365.25;
		BB = month * 30.6;
		CC = 2004 / 400;
		DD = 2004 / 100;

		AA = AA + BB + CC + day - DD - 429;
		BB = AA / 7;
		AA = AA - (BB * 7);

		cout << today[AA] << endl;
	}
	return 0;
}

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

int zeller(int y, int m, int d)
{
	if (m <= 2) {
		y--;
		m += 12;
	}
	
	int h;
	int C = y / 100;
	int Y = y % 100;
	int R = 5 * C + (C / 4);
	
	h = d + (26 * ++m / 10) + Y + (Y / 4) + R;
	h %= 7;
	return (h);
}

int main()
{
	int y = 2004;
	int m, d;
	int h;
	
	while (1){
		
		cin >> m >> d;
		if (m == 0){
			break;
		}
		
		h = zeller(y, m, d);
		
		//cout << h << endl;
		switch (h){
		  case 0:
		    cout << "Saturday";
			break;
			
		  case 1:
		    cout << "Sunday";
			break;
			
		  case 2:
		    cout << "Monday";
			break;
			
		  case 3:
		    cout << "Tuesday";
			break;
			
		  case 4:
		    cout << "Wednesday";
			break;
			
		  case 5:
		    cout << "Thursday";
			break;
			
		 case 6:
		   cout << "Friday";
		   break;
		}
		cout << endl;
	}
	
	return (0);
}

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

C++: #include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
    int a[20][50]={{0}};
    int i=4;
    int x,y;
    for(int k=1;k<=31;k++)
    {
        a[1][k]=i;
        i++;
        if(i==8)i=1;
    }
    for(int k=1;k<=29;k++)
    {
        a[2][k]=i;
        i++;
        if(i==8)i=1;
    }
    for(int k=1;k<=31;k++)
    {
        a[3][k]=i;
        i++;
        if(i==8)i=1;
    }
    for(int k=1;k<=30;k++)
    {
        a[4][k]=i;
        i++;
        if(i==8)i=1;
    }
    for(int k=1;k<=31;k++)
    {
        a[5][k]=i;
        i++;
        if(i==8)i=1;
    }
    for(int k=1;k<=30;k++)
    {
        a[6][k]=i;
        i++;
        if(i==8)i=1;
    }
    for(int k=1;k<=31;k++)
    {
        a[7][k]=i;
        i++;
        if(i==8)i=1;
    }
    for(int k=1;k<=31;k++)
    {
        a[8][k]=i;
        i++;
        if(i==8)i=1;
    }
    for(int k=1;k<=30;k++)
    {
        a[9][k]=i;
        i++;
        if(i==8)i=1;
    }
    for(int g=1;g<=31;g++)
    {
        a[10][g]=i;
        i++;
        if(i==8)i=1;
    }
    for(int k=1;k<=30;k++)
    {
        a[11][k]=i;
        i++;
        if(i==8)i=1;
    }
    for(int k=1;k<=31;k++)
    {
        a[12][k]=i;
        i++;
        if(i==8)i=1;
    }
    //for(int bb=1;bb<=12;bb++)
    //{
    //    for(int aa=1;aa<32;aa++)
    //   {
    //        printf("a[%d][%d]=%d\n",bb,aa,a[bb][aa]);
    //    }
    //}
    while(cin>>x>>y)
    {
        if(x==0)break;
        if(a[x][y]==1)cout<<"Monday"<<endl;
        if(a[x][y]==2)cout<<"Tuesday"<<endl;
        if(a[x][y]==3)cout<<"Wednesday"<<endl;
        if(a[x][y]==4)cout<<"Thursday"<<endl;
        if(a[x][y]==5)cout<<"Friday"<<endl;
        if(a[x][y]==6)cout<<"Saturday"<<endl;
        if(a[x][y]==7)cout<<"Sunday"<<endl;
    }
    return 0;
}