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>
#include <stdio.h>

using namespace std;

int main()
{
    int a, b;
    string date[7] = { "Wednesday", "Thursday", "Friday", "Saturday",
        "Sunday", "Monday", "Tuesday",};
    int day[12] = {0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335};

    cin >> a >> b;

    while (a != 0 && b != 0) {
        b += day[a-1];
        cout << date[b%7] << endl;
        cin >> a >> b;
    }

    return 0;
}

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

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

int main() {
    int date[12][31];
    int cnt = 1;
    for (int i=0; i<12; ++i) {
        for (int j=0; j<day[i]; ++j) {
            if (i == 0 && j == 0) {
                date[i][j] = 3;
            } else if (j == 0) {
                date[i][j] = (date[i-1][day[i-1] - 1] + 1) % 7;
            } else {
                date[i][j] = (date[i][j-1] + 1) % 7;
            }
            cnt ++;
        }
    }

    int m, d;
    while (cin >> m >> d, m && d) {
        cout << dateString[date[m-1][d-1]] << endl;
    }
    return 0;
}

C++: #include <cstdio>

using namespace std;

int main() {
  int days[] = { 0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
  const char* wdays[] = {
    "Wednesday",
    "Thursday",
    "Friday",
    "Saturday",
    "Sunday",
    "Monday",
    "Tuesday"
  };

  int month, day;
  while (true) {
    scanf("%d %d", &month, &day);
    if (month == 0) { break; }

    int acc_days = 0;
    for (int i = 0; i < month; ++i) { acc_days += days[i]; }
    acc_days += day;
    puts(wdays[acc_days % 7]);
  }

  return 0;
}

C++: #include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <set>
#include <cmath>
#include <algorithm>
using namespace std;

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

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

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

char const* data1[] = {"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"};
int data2[] = {3, 6, 0, 3, 5, 1, 3, 6, 2, 4, 0, 2};

int main(void)
{
    int m, d;
    while (cin >> m >> d && m!=0 && d!=0) {
        int a = (data2[m-1] + d-1)%7;
        cout << data1[a] << endl;;
    }
    return 0;
}

C++: #include <stdio.h>

int main(){
	int m,d;
	int i;
	
	int Days;
	
	
	while(1){
		Days = 0;
		scanf("%d %d",&m,&d);
		if(m == 0&&d == 0)break;
		for(i = 1,Days += d;i < m;i++){
			if(i == 2){
				Days += 29;
			}else if(i == 4||i == 6||i == 9||i == 11){
				Days += 30;
			}else{
				Days += 31;
			}
		}
		
		switch(Days%7){
			case 0:printf("Wednesday\n");
					break;
			case 1:printf("Thursday\n");
					break;
			case 2:printf("Friday\n");
					break;
			case 3:printf("Saturday\n");
					break;
			case 4:printf("Sunday\n");
					break;
			case 5:printf("Monday\n");
					break;
			case 6:printf("Tuesday\n");
					break;
		}
	}
	return 0;
}

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

C++: #include <stdio.h>

int main(void){
  int days[13] = {0,31,29,31,30,31,30,31,31,30,31,30,31};
  char youbi[7][100] = {"Wednesday","Thursday","Friday","Saturday","Sunday","Monday","Tuesday"};
  int sum,m,d,i;
  while(1){
    sum = 0;
    scanf("%d %d",&m,&d);
    if (m == 0 || d == 0) break;
    for(i=0;i<m;i++){
      sum += days[i];
    }
    sum += d;
    printf("%s\n",youbi[sum%7]);
  }
  return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
int m,d,h,y;
char w[][7]={"Satur","Sun","Mon","Tues","Wednes","Thurs","Fri"};
for(;;){
y=4;
cin>>m>>d;
if(m==0)break;
if(m<3){m+=12;y--;}
h=(y+int(y/4)+int(2.6*(m+1))+d)%7;
cout<<w[h]<<"day"<<endl;
}
return 0;
}

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

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

        switch( mon )       //入力手前の月の日数分合計し、日にちを足して、最後に7で割った余りを出す。
        {
            case 12:
                d += 30;
            case 11:
                d += 31;
            case 10:
                d += 30;
            case 9:
                d += 31;
            case 8:
                d += 31;
            case 7:
                d += 30;
            case 6:
                d += 31;
            case 5:
                d += 30;
            case 4:
                d += 31;
            case 3:
                d += 29;
            case 2:
                d += 31;
        }

        switch( ( day + d ) % 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 <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>

using namespace std;


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


int main(){
    int M,D,days=0;
    
    while(1){
        scanf("%d%d",&M,&D);
        if(M+D==0) break;
    
        for(int i=0;i<M-1;i++)
            days+=month[i];
    
        printf("%s\n",date[(days+D)%7]);
    }
    
    return 0;
}