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<iostream>
using namespace std;
void daysel(int x){
  switch(x % 7){
  case 6:
  cout << "Tuesday"<<endl; break;
  case 7:
  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;
  }
}
void daycal(int month,int day){
  int x;
  switch(month){
  case 1:
  x = day; break;
  case 2:
  x = 31 + day; break;
  case 3:
  x = 60 + day; break;
  case 4:
  x = 91 + day; break;
  case 5:
  x = 121 + day; break;
  case 6:
  x = 152 + day; break;
  case 7:
  x = 182 + day; break;
  case 8:
  x = 213 + day; break;
  case 9: 
  x = 244 + day;break;
  case 10:
  x = 274 + day;break;
  case 11: 
  x = 305 + day; break;
  case 12:
  x = 335 + day; break;
  }
  daysel(x);

    }
int main(){
  int month,day;
  while(cin >> month >> day){
    if(month == 0&& day ==0){
      return 0;
    }
      daycal(month,day);
  }  
  
}

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

int main()
{
	int month,day,tooshi;
	while(true)
	{
	cin >> month;
	cin >> day;
	if(month==0&&day==0)break;
	switch (month)
	{
		case 1:
		tooshi = day;
		break;
		case 2:
		tooshi = day+31;
		break;
		case 3:
		tooshi = day+60;
		break;
		case 4:
		tooshi = day+91;
		break;
		case 5:
		tooshi = day+121;
		break;
		case 6:
		tooshi = day+152;
		break;
		case 7:
		tooshi = day+182;
		break;
		case 8:
		tooshi = day+213;
		break;
		case 9:
		tooshi = day+244;
		break;
		case 10:
		tooshi = day+274;
		break;
		case 11:
		tooshi = day+305;
		break;
		case 12:
		tooshi = day+335;
		break;
	}

	switch (tooshi % 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 <iostream>
#include <cstdio>
using namespace std;

int main(){
	int m, d;
	int days[12]={31,29,31,20,31,30,31,31,30,31,30,31};
	
	while( scanf(" %d %d", &m, &d)*m != 0 ){
		int i=0, c=0;
		while(i<=m-2){
			c+=days[i];
			++i;
		}
		c+=d;
	
		//printf("%d\n", c);
		if(c%7==1) printf("Thursday\n");
		else if(c%7==2) printf("Friday\n");
		else if(c%7==3) printf("Saturday\n");
		else if(c%7==4) printf("Sunday\n");
		else if(c%7==5) printf("Monday\n");
		else if(c%7==6) printf("Tuesday\n");
		else if(c%7==0) printf("Wednesday\n");
	}

	return 0;
}

C++: #include<stdio.h>
int main()
{
int p[12]={31,29,31,30,31,30,31,31,30,31,30,31};
int M,D,sum;
while(1)
{
sum=0;
scanf("%d %d",&M,&D);
if(M==0)break;
for(int i=0;i<M;i++);
sum+=p[i];

sum+=D;

switch(sum%d)
{
case 0:
printf("Sunday\n");
case 1:
printf("Monday\n");

case 2:
printf("Tuesday\n");

case 3:
printf("Wednesday\n");

case 4:
printf("Tursday\n");

case 5:
printf("Friday\n");

case 6:
printf("Saturday\n");
}
}
return 0;
}

C++: #include <algorithm>
#include <functional>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <climits>

#define all(c) (c).begin(), (c).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second

const int INF=100000000;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
using namespace std;
typedef pair<int ,int > P;
typedef long long ll;

vector<string> weeks = {"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"};
int month[] = {31,29,31,30,31,30,31,31,30,31,30,31};
int mm,dd;
void solve() {
    int day = 2;
    for(int i=1;i<mm;i++) day += month[i-1];
    day += dd;
    day %= 7;
    cout<<weeks[day]<<endl;

}
int main() {
    while(cin>>mm>>dd) {
        if(mm+dd==0) break;
        solve();
    }
    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>
int main()
{
	while (true)
	{
		int passed = 0;
		int days[12] = { 31,29,31,30,31,30,31,31,30,31,30,31 };
		int m, d;
		std::cin >> m >> d;
		if (m == 0)
		{
			break;
		}
		for (int i = 0; i < m - 1; i++)
		{
			passed += days[i];
		}
		passed += d - 1;
		switch (passed % 7)
		{
		case 0:
			std::cout << "Thursday" << std::endl;
			break;
		case 1:
			std::cout << "Friday" << std::endl;
			break;
		case 2:
			std::cout << "Saturday" << std::endl;
			break;
		case 3:
			std::cout << "Sunday" << std::endl;
			break;
		case 4:
			std::cout << "Monday" << std::endl;
			break;
		case 5:
			std::cout << "Tuesday" << std::endl;
			break;
		case 6:
			std::cout << "Wednesday" << std::endl;
			break;
		}
	}
	return 0;
}

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

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

int main(void){

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

    while(cin >> x >> y){
        int h = 20;
        int n = 4;
        if(x == 0){
            return 0;
        }
        if(x == 1 || x == 2){
            n--;
            x+=12;
        }
                       
        int w = n + n/4 + h/4 - 2*h + 13*(x+1)/5 + y;
        //cout << w << endl;
       
        //cout << w%7 << endl;

        string ans = day[w%7];

        cout << ans << endl;
    }
    return 0;
}