Go: package main

import (
        "fmt"
)

func main() {
        var weeks = []string{"Thursday",
                "Friday",
                "Saturday",
                "Sunday",
                "Monday",
                "Tuesday",
                "Wednesday"}

        for {
                var m, d int
                _, err := fmt.Scanf("%d %d", &m, &d)
                if err != nil || m + d == 0 {
                        break
                }
                var days int

                for {
                        lm, ld := getLastDay(m, d)
                        if lm + ld == 0 {
                                break
                        }
                        days++
                        m = lm
                        d = ld
                }
                fmt.Println(weeks[days%7])
        }
}

func getLastDay(m int, d int) (lm int, ld int) {
        if m == 1 && d == 1 {
                return 0, 0
        }

        if d > 1 {
                return m, d-1
        } else {
                if m == 3 {
                        return m-1, 29
                }
                if m == 3 || m == 5 || m == 7 || m == 10 || m == 12 {
                        return m-1, 30
                } else {
                        return m-1, 31
                }
        }
}

C++: #include <stdio.h>

int main(){
	char *day[7] = {"Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"};
	int i,date[2],month[12] = {31,29,31,30,31,30,31,31,30,31,30,31};
	while(1){
		scanf("%d %d",&date[0],&date[1]);
		if(!date[0]) break;
		for(i = 0;i < date[0] - 1;i++) date[1] += month[i];
		printf("%s\n",day[(date[1] + 2) % 7]);
	}
}

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

C++: #include<iostream>
#include<memory.h>
using namespace std;
int main()
{
	//2004-1-1 Tuesday
	int a[370];

	char e[7][12] = { { "Monday" }, { "Tuesday" }, { "Wednesday" }, { "Thursday" }, { "Friday " }, { "Saturday" }, {"Sunday"} };
	int m[13] = { 0,0, 31,60 ,91,121, 152, 182,213 , 244, 274, 305, 335 };
	for (int i = 3; i <= 365+3; i++){
		a[i] = i % 7;
	}
	while (true){
		int x, y;
		cin >> x >> y;
		if (x == 0 && y == 0)break;
		cout << e[a[m[x] + y + 2]] << endl;
	}
}

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

using namespace std ;

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())

#define rep(i,n) for(int i = 0; i < (n);++i)
#define repc(i,a,b) for(int i = (a);i <(b);++i)
#define repa(n,array) for(auto n :(array))

typedef long long ll ;
typedef vector<int> vi ;
typedef vector<ll> vl ;

constexpr int IMAX = ((1<<30)-1)*2+1 ;
constexpr int INF = 100000000;
double EPS = 1e-10 ;

const int month[12] = {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,date = 3;
  while(1){
    date = 3 ;
    cin >> m >> d ;
    if(m == 0){
      break ;
    }
    for(int i = 0;i < m-1;++i){
      date += month[i] % 7 ;
    }
    date += d % 7 - 1 ;
    switch(date%7){
      case 0:
        cout << "Monday" << endl ;
        break;
      case 1:
        cout << "Tuesday" << endl ;
        break;
      case 2:
        cout << "Wednesday" << endl ;
        break;
      case 3:
        cout << "Thursday" << endl ;
        break;
      case 4:
        cout << "Friday" << endl ;
        break;
      case 5:
        cout << "Saturday" << endl ;
        break;
      case 6:
        cout << "Sunday" << endl ;
        break;
      default:
        break;
    }
  }
  return 0;
}

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

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

int main()
{
	std::vector<std::string> day_of_week{
		"Thursday",
		"Friday",
		"Saturday",
		"Sunday",
		"Monday",
		"Tuesday",
		"Wednesday"
	};

	std::vector<int> day_num_of_month{
		31,
		29,
		31,
		30,
		31,
		30,
		31,
		31,
		30,
		31,
		30,
		31
	};

	int month = 0;
	int day = 0;

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

		int days_elapsed = 0;
		for (int m = 1; m < month; ++m)
		{
			days_elapsed += day_num_of_month[m - 1];
		}
		days_elapsed += day;

		std::cout << day_of_week[(days_elapsed - 1) % 7] << std::endl;
	}

	return 0;
}

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

int main()
{
    string day[]={"Wednesday","Thursday","Friday","Saturday","Sunday","Monday","Tuesday"};
    int Mon[12]={31,29,31,30,31,30,31,31,30,31,30,31};
    int m,d;
    while(cin>>m>>d,m*d){
        int allDay=d;
        for(int i=1;i<m;i++){
            allDay += Mon[i];
        }
        cout<<day[allDay%7]<<endl;
    }
}

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

int main() {
	int month, day; cin >> month >> day;
	while (month != 0 && day != 0) {
		if (month >= 1) day = day;
		if (month >= 2) day = day + 31;
		if (month >= 3) day = day + 28;
		if (month >= 4) day = day + 31;
		if (month >= 5) day = day + 30;
		if (month >= 6) day = day + 31;
		if (month >= 7) day = day + 30;
		if (month >= 8) day = day + 31;
		if (month >= 9) day = day + 31;
		if (month >= 10) day = day + 30;
		if (month >= 11) day = day + 31;
		if (month >= 12) day = day + 30;
		if (day % 7 == 0) cout << "Wednesday" << endl;
		if (day % 7 == 1) cout << "Thursday" << endl;
		if (day % 7 == 2) cout << "Friday" << endl;
		if (day % 7 == 3) cout << "Saturday" << endl;
		if (day % 7 == 4) cout << "Sunday" << endl;
		if (day % 7 == 5) cout << "Monday" << endl;
		if (day % 7 == 6) cout << "Tuesday" << endl;
		cin >> month >> day;
	}
	return 0;
}

C++: #include <iostream>
int main(){
    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; }}}

C++: //31,29,31,30,31,30,31,31,30,31,30,31//
#include <iostream>
using namespace std;
int main(){
    int d,m;
    while(cin>>m>>d){
        if(m==0)break;
        if(m==1)d=d%7;
        else if(m==2)d=(d+31)%7;
        else if(m==3)d=(d+60)%7;
        else if(m==4)d=(d+91)%7;
        else if(m==5)d=(d+121)%7;
        else if(m==6)d=(d+152)%7;
        else if(m==7)d=(d+182)%7;
        else if(m==8)d=(d+213)%7;
        else if(m==9)d=(d+244)%7;
        else if(m==10)d=(d+274)%7;
        else if(m==11)d=(d+305)%7;
        else if(m==12)d=(d+335)%7;
            if(d%7==1)cout<<"Thursday"<<endl;
            else if(d%7==2)cout<<"Fridy"<<endl;
            else if(d%7==3)cout<<"Saturday"<<endl;
            else if(d%7==4)cout<<"Sunday"<<endl;
            else if(d%7==5)cout<<"Monday"<<endl;
            else if(d%7==6)cout<<"Tuesday"<<endl;
            else if(d%7==0)cout<<"Wednesday"<<endl;
        
        }
    return 0;
}