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<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define INF 1000000
using namespace std;
int main(){
    //木曜日を０とする
    int table[12][31];
    int cnt=0,day;
    for(int i=1; i<=12; i++){
        if(i == 4 || i == 6 || i == 9 || i == 11) day = 30;
        else if(i == 2) day = 29;
        else day = 31;
        for(int j=1; j<=day; j++) {
            if(cnt == 7) cnt = 0;
            table[i-1][j-1] = cnt;
            cnt++;
        }
    }
    int a,b;
    while(cin >> a >> b){
        if(a == 0 && b == 0) break;
        if(table[a-1][b-1] == 0) cout << "Thursday" << endl;
        if(table[a-1][b-1] == 1) cout << "Friday" << endl;
        if(table[a-1][b-1] == 2) cout << "Saturday" << endl;
        if(table[a-1][b-1] == 3) cout << "Sunday" << endl;
        if(table[a-1][b-1] == 4) cout << "Monday" << endl;
        if(table[a-1][b-1] == 5) cout << "Tuesday" << endl;
        if(table[a-1][b-1] == 6) cout << "Wednesday" << endl;
    }
    return 0;
}

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

using namespace std;

int main(){
	

	int dc[13];
	dc[1]=31;
	dc[2]=29;
	dc[3]=31;
	dc[4]=30;
	dc[5]=31;
	dc[6]=30;
	dc[7]=31;
	dc[8]=31;
	dc[9]=30;
	dc[10]=31;
	dc[11]=30;
	dc[12]=31;

	string week[8];
	week[0]="Monday";
	week[1]="Tuesday";
	week[2]="Wendnesday";
	week[3]="Thursday";
	week[4]="Friday";
	week[5]="Saturday";
	week[6]="Sunday";

	int month;
	int day;
	while(cin>>month>>day&&!(month==0&&day==0)){
		int passingDay=2;
		for(int i = 1; i < month; i++){
			passingDay+=dc[i];
		}
		passingDay+=day;
		cout<<week[passingDay%7]<<endl;
	}

	return 0;
}

C++: #include <iostream>
#include <map>
#include <vector>

using namespace std;

void getDays(int month, int day)
{
    int dayNum[12] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
    int fst=0; // 1/1 ?????? (month-1)??????????????\?????§?????\??°
    for(int i=0; i<month-1; i++)
        fst += dayNum[i];
    fst++; // month???1??\?????§?????\??°
    
    switch(fst % 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;
        default:
            break;
    }

}

int main(void)
{
    ios::sync_with_stdio(false);
    int month, day;
    while(1) {
        cin >> month >> day;
        if(month == 0) break;
        getDays(month, day);
    }

    return 0;
}

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

using namespace std;

int main(void) {
	int mon[13], m, d, n;
	char w[7][10];
	mon[0] = 0;
	mon[1] = 31;
	mon[2] = 29;
	mon[3] = 31;
	mon[4] = 30;
	mon[5] = 31;
	mon[6] = 30;
	mon[7] = 31;
	mon[8] = 31;
	mon[9] = 30;
	mon[10] = 31;
	mon[11] = 30;
	mon[12] = 31;
	while (cin >> m >> d) {
		if (m == 0 && d == 0) {
			return 0;
		}
		n = 0;
		n += mon[m - 1] + d - 1;
		if (n % 7 == 0) {
		 printf("Thursday\n");
		}
		else if (n % 7 == 1) {
			printf("Friday\n");
		}
		else if (n % 7 == 2) {
			printf("Saturday\n");
		}
		else if (n % 7 == 3) {
			printf("Sunday\n");
		}
		else if (n % 7 == 4) {
			printf("Monday\n");
		}
		else if (n % 7 == 5) {
			printf("Tursday\n");
		}
		else if (n % 7 == 6) {
			printf("Wednesday\n");
		}
	}
}

C++: #include<iostream>
using namespace std;
int main(){
	int mon,day,week;
	while(1){
		cin>>mon>>day;
		if(mon==0)break;
		switch(mon){
			case 1:
			mon=0;
			break;
			case 2:
			mon=31;
			break;
			case 3:
			mon=60;
			break;
			case 4:
			mon=91;
			break;
			case 5:
			mon=121;
			break;
			case 6:
			mon=152;
			break;
			case 7:
			mon=182;
			break;
			case 8:
			mon=213;
			break;
			case 9:
			mon=244;
			break;
			case 10:
			mon=274;
			break;
			case 11:
			mon=305;
			break;
			case 12:
			mon=335;
			break;
		}
		week=(mon+day)%7;
		switch(week){
		    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>
using namespace std;

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

C++: #include<iostream>
#include<string>
using namespace std;
int main() {
	int a, b;
	int x;
	int i = 0;
	string l[70];
	while (true){
		cin >> a >> b;
		if (a == 0 && b == 0) {
			x = i;
			break;
		}
		if (a == 1 || a == 4 || a == 7){
			b += 4;
		}
		else if (a == 2 || a == 8){
			b += 0;
		}
		else if (a == 3 || a == 11){
			b += 1;
		}
		else if (a == 5){
			b += 6;
		}
		else if (a == 6){
			b += 2;
		}
		else if (a == 9 || a == 12){
			b += 3;
		}
		else if (a == 10){
			b += 5;
		}
		//
		if (b % 7 == 1){
			l[i] = "Sunday";
		}
		else if (b % 7 == 2){
			l[i] = "Monday";
		}
		else if (b % 7 == 3) {
			l[i] = "Tuesday";
		}
		else if (b % 7 == 4) {
			l[i] = "Wednesday";
		}
		else if (b % 7 == 5) {
			l[i] = "Thursday";
		}
		else if (b % 7 == 6) {
			l[i] = "Friday";
		}
		else if (b % 7 == 0) {
			l[i] = "Saturday";
		}
		i++;
	}
	for (int i = 0; i < x; i++){
		cout << l[i] << endl;
	}
	char c;
	cin >> c;
}

C++: #include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<string>

using namespace std;

int main()
{
  int days[] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

  int month, day;
  while(true)
  {
    cin >> month >> day;
    if(!month && !day)
      break;
    switch((days[month] + day) % 7)
    {
    case 6:
      cout << "Thuesday";
      break;
    case 0:
      cout << "Friday";
      break;
    case 1:
      cout << "Saturday";
      break;
    case 2:
        cout << "Sunday";
      break;
    case 3:
      cout << "Monday";
      break;
    case 4:
      cout << "Tuesday";
      break;
    case 5:
      cout << "Wednesday";
    }
    cout << endl;
  }

  return 0;
}

C++: #include<cstdio>
#include<iostream>
using namespace std;
string days[] = {"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"};
int zeller(int yeah,int month,int day)
{
  if(month <= 2)
    yeah--,month += 12;
  return (yeah + yeah/4 - yeah/100 + yeah/400 + (13 * month + 8) / 5 + day) % 7;
}

int main()
{
  int m,d;
  while(1)
    {
      scanf("%d %d",&m,&d);
      if(m+d == 0)break;
      int r = zeller(2004,m,d);
      cout << days[r] << endl;      
    }
  return 0;
}

C++: #include <iostream>
#include <string>
using namespace std;
 int main()
{
	//arrays with number of days in month and the days names
    int days[] = {31,29,31,30,31,30,31,31,30,31,30,31};
    string week[7] = {"Wednesday","Thursday","Friday","Saturday","Sunday","Monday","Tuesday"};
    int month, day;
    while(cin >> month >> day)//entering day
	{
		
        int n = 0;
        for(int i=1; i<month; i++)
		{
            n += days[i-1];
        }
        n += day;
 
        n %= 7;
        cout << week[n] <<endl;//printing the day
 
    }
  return 0;
}