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;
int main(){
  int dayl[13]={0,31,29,31,30,31,30,31,31,30,31,30,31};
  int today[2];
  int dayt=0;
  int ans;
  while(cin>>today[0]>>today[1]){
    if(today[0]==0&&today[1]==0) break;
    for(int i=0;i<today[0];i++) dayt += dayl[i];
    dayt += today[1];
    ans = dayt % 7;
    if(ans==1) cout << "Thursday" << endl;
    else if(ans==2) cout << "Friday" << endl;
    else if(ans==3) cout << "Saturday" << endl;
    else if(ans==4) cout << "Sunday" << endl;
    else if(ans==5) cout << "Monday" << endl;
    else if(ans==6) cout << "Tuesday" << endl;
    else  cout << "Wednesday" << endl;
    dayt = 0;
  }
  return 0;
}

C++: #include <iostream>

using namespace std;

int main(){
	int i;
	int a, b;
	int day=0;
	int t;

	cin >> a;

	while(a != 0){
		if(a=1){
			day = day;
		}
		if(a=2){
			day = day + 31;
		}
		if(a=3){
			day = day + 60;
		}
		if(a=4){
			day = day + 91;
		}
		if(a=5){
			day = day + 121;
		}
		if(a=6){
			day = day + 152;
		}
		if(a=7){
			day = day + 182;
		}
		if(a=8){
			day = day + 213;
		}
		if(a=9){
			day = day + 244;
		}
		if(a=10){
			day = day + 274;
		}
		if(a=11){
			day = day + 305;
		}
		if(a=12){
			day = day + 335;
		}

		cin >> b;
		day = day + b;

		t = day % 7;
		if(t=1){
			cout << "Wednesday" << endl;
		}
		if(t=2){
			cout << "Thersday" << endl;
		}
		if(t=3){
			cout << "Friday" << endl;
		}
		if(t=4){
			cout << "Saturday" << endl;
		}
		if(t=5){
			cout << "Sunday" << endl;
		}
		if(t=6){
			cout << "Monday" << endl;
		}
		else{
			cout << "Tuesday" << endl;
		}
	}


}

C++: #include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <functional>
#include <set>
#include <sstream>
#include <map>
 
using namespace std;
 
const double eps=1e-10;
 
int main()
{
	int m,d;

	int dd[13]={0,31,29,31,30,31,30,31,31,30,31,30,31};
	for(int i=1;i<=12;i++) dd[i]+=dd[i-1];

	string str[]={
		"Monday",
		"Tuesday",
		"Wednesday",
		"Thursday",
		"Friday",
		"Saturday",
		"Sunday"
	};

	while(cin>>m>>d,m){
		int day=(d+dd[m-1]+2)%7;
		cout<<str[day]<<endl;
	}

	return 0;
}

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

const string DOW[] = {
    "Saturday",
    "Sunday",
    "Monday",
    "Tuesday",
    "Wednesday",
    "Thursday",
    "Friday"
};

string getDOW(int y, int m, int d) {
    if (m <= 2) {
        --y;
        m += 12;
    }
    int c = y / 100;
    y %= 100;
    int h = d + (26 * (m + 1)) / 10 + y + y / 4 + 5 * c + c / 4;
    return DOW[h % 7];
}

int main() {
    int m, d;
    while (cin >> m >> d, m) {
        cout << getDOW(2004, m, d) << endl;
    }
    return 0;
}

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

int main ()
{
	int m[13]={0,4,7,1,4,6,2,4,7,3,5,1,3};
	string a[7]={"Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"};
	int M,D;
	while(cin>>M>>D&&M&&D)
	{
		int x=m[M]-2;
		cout<<a[(x+D)%7]<<endl;
		
	}
	
	
	
	
}

C++: //58
#include<iostream>

using namespace std;

int main(){
  int dn[13][32];
  int i=3;
  for(int m=1;m<13;m++){
    static const int dom[]={0,31,29,31,30,31,30,31,31,30,31,30,31};
    for(int d=1;d<=dom[m];d++){
      dn[m][d]=i++;
      i%=7;
    }
  }
  for(int m,d;cin>>m>>d,m;){
    static const char *ds[]={"Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"};
    cout<<ds[dn[m][d]]<<endl;
  }
  return 0;
}

C++: #include<stdio.h>
int main(void)
{
	int m[12]={31,29,31,30,31,30,31,31,30,31,30,31};
	int man,day;
	int s;
	int i;
	
	scanf("%d %d",&man,&day);
	while(man!=0){
		s=0;
		if(man!=1){
			for(i=0;i<man-1;i++){
				s+=m[i];
			}
			s+=day;
		}
		else {
			s+=day;
		}
		printf("%d\n",s);
		s=s%7;
		if(s==0){
			printf("Wednesday\n");
		}
		else if(s==1){
			printf("Thursday\n");
		}
		else if(s==2){
			printf("Friday\n");
		}
		else if(s==3){
			printf("Saturday\n");
		}
		else if(s==4){
			printf("Sunday\n");
		}
		else if(s==5){
			printf("Monday\n");
		}
		else if(s==6){
			printf("Tuesday\n");
		}
		scanf("%d %d",&man,&day);
	}
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
int main(){
  int s,n,m,p[12]={31,29,31,30,31,30,31,31,30,31,30,31},i;
  string d[] = {"Wednesday","Thursday","Friday","Saturday","Sunday","Monday","Tuesday"};
  while(cin>>n>>m,n){
    for(s=i=0;i<n-1;i++)s+=p[i];
      cout<<d[(s+m)%7]<<endl;
  }
}

C++: #include <iostream>
#include <fstream>
#include <algorithm>
#include <vector>
#include <string>
#include <functional>
#include <array>
#include <stack>
#include <queue>
#include <chrono>
#include <numeric>
#include <memory.h>
#include <map>
#include <math.h>
#include <utility>
#include <set>

#pragma warning(disable:4996)
using namespace std;
#define REP(i,n) for(int i = 0 ; i < n ; ++i)
typedef long long Int;
const double PI = 3.141592653589793238;
const Int INF = 999999999999;
typedef pair<int, int> P;

int S[3][3] = {
		{ 0, 1, 0 },
		{ 1, 1, 1 },
		{ 0, 1, 0 },
};
int M[3][3] = {
		{ 1, 1, 1 },
		{ 1, 1, 1 },
		{ 1, 1, 1 },
};
int L[5][5] = {
		{ 0, 0, 1, 0, 0 },
		{ 0, 1, 1, 1, 0 },
		{ 1, 1, 1, 1, 1 },
		{ 0, 1, 1, 1, 0 },
		{ 0, 0, 1, 0, 0 },
};

string week[7]{
		"Monday",
		"Tuesday",
		"Wednesday",
		"Thursday",
		"Friday",
		"Saturday",
		"Sunday"
};

int dd[12]{3,1,3,2,3,2,3,3,2,3,3};

int main()
{
	int m, d;
	while (cin >> m >> d, m&&d){
		int start = 3;
		int di(0);
		for (int i = 1; i < m; ++i){
			di += dd[i - 1];
		}
		di += (d - 1) % 7;
		di += start;
		di %= 7;
		cout << week[di] << endl;
	}
	return 0;

}

C++: #include <iostream>

using namespace std;

int main() {

	int m, d;

	while(cin >> m >> d) {
		if(m==0&&d==0)
			break;

		switch(m) {
			case 1:
				d+=0;
				break;
			case 2:
				d+=31;
				break;
			case 3:
				d+=60;
				break;
			case 4:
				d+=91;
				break;
			case 5:
				d+=121;
				break;
			case 6:
				d+=152;
				break;
			case 7:
				d+=182;
				break;
			case 8:
				d+=213;
				break;
			case 9:
				d+=244;
				break;
			case 10:
				d+=274;
				break;
			case 11:
				d+=305;
				break;
			case 12:
				d+=335;
		}
 
		d%=7;
		switch(d) {
			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;
		}
	}

	return 0;

}