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>

const static std::string days[] = {"Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday", "Wednesday"};
const static int months[] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

int main()
{
    int cnt;
    int month, day;
    int startofMonths[12];
    cnt = 0;
    for (int i = 0; i < 12; i++) {
        startofMonths[i] = cnt;
        cnt += months[i];
    }
    std::cin >> month >> day;
    while (month != 0) {
        cnt = startofMonths[month-1];
        cnt += day -1;
        std::printf("%s\n", days[cnt % 7].c_str());
        std::cin >> month >> day;
    }
    return 0;
}

C++: 
#include <stdio.h>

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

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

char date[7][10] =
{
  "Monday",
    "Tuesday",
    "Wednesday",
    "Thursday",
    "Friday",
    "Saturday",
    "Sunday"
};

int lm[] = {31,29,31,30,31,30,31,31,30,31,30,31};

int main(){
  int m,d;
  while(cin >> m >> d, m+d){
    int ld = 0;
    for(int i=0; i<m-1; i++){
      ld += lm[i];
    }
    ld += d;
    cout << ld << endl;
    cout << date[ld%7+2] << endl;
  }
  
  return 0;
}

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

int main(int argc, const char * argv[])
{
    int month[12] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
    int m, d;
    while (scanf("%d %d", &m, &d) != 0) {
        int cnt = 0;
        if (m == 0 && d == 0) {
            return 0;
        }
        for (int i = 0; i < m - 1; i++) {
            cnt += month[m - 1];
        }
        cnt += d;
    
        if (cnt % 7 == 0) {
            printf("Wednesday\n");
        }
        if (cnt % 7 == 1) {
            printf("Thursday\n");
        }
        if (cnt % 7 == 2) {
            printf("Friday\n");
        }
        if (cnt % 7 == 3) {
            printf("Saturday\n");
        }
        if (cnt % 7 == 4) {
            printf("Sunday\n");
        }
        if (cnt % 7 == 5) {
            printf("Monday\n");
        }
        if (cnt % 7 == 6) {
            printf("Tuesday\n");
        }
    }
    return 0;
}

C++: #include <iostream>
int main(void){
    int month,day,chek;
    while(std::cin >> month >> day,month){ int year = 2004;
    if(month == 1 || month == 2){year--;month+=12;}
    chek = ((year+ year/4-year/100+year/400+(13*month+8)/5+day)%7);
    switch (chek) {case 0:puts("Sunday");break; case 1:puts("Monday");break; case 2:puts("Tuesday");break; case 3:puts("Wednesday");break;
        case 4:puts("Thursday");break; case 5:puts("Friday");break; case 6:puts("Saturday");break; }}return 0;}

C++: #include <iostream>
using namespace std;
int main(void)
{
  int m, d;
  
  while(1) {
    cin >> m >> d;
    if(m == 0) break;
    
    for(int i = m ; i > 1 ; i--) {
      if(i-1 == 4 || i-1 == 6 || i-1 == 9 || i-1 == 11) d += 30;
      else if(i-1 == 2) d += 29;
      else if(i-1 == 1 || i-1 == 3 || i-1 == 5 || i-1 == 7 || i-1 == 4 || i-1 == 10) d += 31;
    }
    
    if(d % 7 == 1) cout << "Thursday" << endl;
    if(d % 7 == 2) cout << "Friday" << endl;
    if(d % 7 == 3) cout << "Saturday" << endl;
    if(d % 7 == 4) cout << "Sunday" << endl;
    if(d % 7 == 5) cout << "Monday" << endl;
    if(d % 7 == 6) cout << "Tuesday" << endl;
    if(d % 7 == 7) cout << "Wednesday" << endl;
  }
  return 0;
}

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

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

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);

	int m, d;
	while(cin >> m >> d && m != 0){

		for(int i = 0; i < m - 1; ++i){
			d += day[i];
		}

		d -= 1;
		cout << data[d % 7 + 3] << endl;
	}

	return 0;
}

C++: #include<cstdio>
#include<iostream>
using namespace std;
main(){
  int m,d;
  while(1){
    cin >> m >> d;
    if(m==0){
      exit(0);
    }
    if(m>2){
      d=d-2;
      if(m>4){
	d--;
	if(m>6){
	  d--;
	  if(m>9){
	    d--;
	    if(m>11){
	      d--;
	    }
	  }
	}
      }
    }
    m--;
    d=(d+m*31)%7;
    if(d==0){
      cout <<"Wednesday"<< endl;
    }
    else if(d==1){
      cout <<"Thursday"<< endl;
    }
    else if(d==2){
      cout <<"Friday"<< endl;
    }
    else if(d==3){
      cout <<"Saturday"<< endl;
    }
    else if(d==4){
      cout <<"Sunday"<< endl;
    }
    else if(d==5){
      cout <<"Monday"<< endl;
    }
    else if(d==6){
      cout <<"Tuesday"<< endl;
    }
  }
}

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

int main(){
	int month[13]={0,31,29,31,30,31,30,31,31,30,31,30,31},m,d,sum=0;
	string str[7]={"Wednesday","Thursday","Friday","Saturday","Sunday","Monday","Tuesday"};
	while(cin>>m>>d,m+d){
		sum=0;
		for(int i=1;i<m;i++){
			sum+=month[i];
		}
	sum+=d;
	cout<<str[sum%=7]<<endl;;
	}
}

C++: #define _USE_MATH_DEFINES

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <utility>
#include <vector>
#include <numeric>

using namespace std;

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

		vector<int> mon = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

		int y = (3 + mon.at(m - 1) + d) % 7;

		vector<string> sy = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};

		cout << sy.at(y) << endl;
	}
}

C++: #include<stdio.h>

char *str[7] = {"Thursday","Friday","Saturday","Sunday","Monday","Tuesday","Wednesday"};
int tuki[13] = {0,31,29,31,30,31,30,31,31,30,31,30,31};

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