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 <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, 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;
}

C++: #include <iostream>
#include <string>
using namespace std;
enum TheDay {
	Monday = 0, 
	Tuesday = 1,
	Wednesday = 2,
	Thursday = 3,
	Friday = 4,
	Saturday = 5,
	Sunday = 6
};
string getTheDayString(TheDay d){
	switch(d){
	case Monday:	return "Monday";
	case Tuesday:	return "Tuesday";
	case Wednesday: return "Wednesday";
	case Thursday:	return "Thursday";
	case Friday:	return "Friday";
	case Saturday:	return "Saturday";
	case Sunday:	return "Sunday";
	}
	return "";
}
int main()
{
	int MD[12] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
	int MK[12] = {};
	MK[0] = 3;
	for(int i = 1; i < 12; ++i)
		MK[i] = (MK[i - 1] + MD[i - 1]) % 7;

	int m, d;
	while(cin >> m >> d){
		if(0 == m && 0 == d) break;
		TheDay a = (TheDay)((MK[m-1] + d - 1) % 7);
		cout << getTheDayString(a) << "\n";
	}
	return 0;
}

C++: #include <iostream>
#include <stdio.h>
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++: #define scanf_s scanf
//#define gets_s gets
#include <stdio.h>
#include <string>
#include <iostream>
#include <math.h>
using namespace std;
#define MAX 10
#define MIN -100001
#define _MAX 10
int main(void)
{
	char *days[7] = { "Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday" };
	int month_sum[12] = { 31,29,31,30,31,30,31,31,30,31,30,31 };
	int month, day, sum = 0;
	while (1) {
		scanf_s("%d %d", &month, &day);
		if (month == 0) break;
		for (int i = 1; i < month; ++i) {
			sum += month_sum[i - 1];
		}
		sum += day;
		printf("%s\n", days[(sum + 2) % 7]);
		sum = 0;
	}
}

C++: #include <iostream>

using namespace std;

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

int main() {
  int m, d;
  while (cin >> m >> d) {
    if (m == 0) break;
    m--; d--;

    int day = 0;
    for (int i = 0; i < m; i++) {
      day += month[i];
    }
    day += d;
    day += 3;
    day %= 7;

    cout << dow[day] << endl;
  }

  return 0;
}

C++: #include <iostream>
#include <string>
#include <map>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <math.h>
#include <iomanip>
using namespace std;
int main(){
  int m,d,mlist[12]={31,29,31,30,31,30,31,31,30,31,30,31},dsum;
  string res;
  while(cin>>m>>d){
    dsum=0;
    if(!m)return 0;
    for(int i=0;i<m;i++){
      dsum+=(i+1!=m)?mlist[i]:d;
    }
    //1 Thur 2 Fri 3 Satu 4 Sun 5 Mon 6 Tues 0 Wed
    switch(dsum%7)
      {
      case 0:
	res="Wednesday";
	break;
      case 1:
	res="Thursday";
	break;
      case 2:
	res="Friday";
	break;
      case 3:
	res="Saturday";
	break;
      case 4:
	res="Sunday";
	break;
      case 5:
	res="Monday";
	break;
      case 6:
	res="Tuesday";
	break;
      }
    cout<<res<<endl;
  }
}

C++: #include <bits/stdc++.h>
using namespace std;

#define rep(i,a,n) for(int i=a; i<n; i++)
#define repr(i,a,n) for(int i=a; i>=n; i--)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 999999999

#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))

typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long int ll;

typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;

int const MOD = 1000000007;

int dayOfTheWeek( int y, int m, int d )
{
    if( m < 3 ) {
        y--; m += 12;
    }
    return ( y + y/4 - y/100 + y/400 + ( 13*m + 8 )/5 + d )%7;
}

int main() {
    string dayname[] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
    int m,d;
    while(cin >> m, m) {
        cin >> d;
        cout << dayname[dayOfTheWeek(2016,m,d)] << endl;
    }
    return 0;
}

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

int main(){
	int month[12]={31,29,31,30,31,30,31,31,30,31,30,31};
	int m,d;
	while(cin>>m>>d,m+d){
		int sum=d;
		for(int i=0;i<m-1;i++){
			sum+=month[i];
		}	
		switch(sum%7){
			case 1:cout<<"Thursday";break;
			case 2:cout<<"Friday";break;
			case 3:cout<<"Saturday";break;
			case 4:cout<<"Sunday";break;
			case 5:cout<<"Monday";break;
			case 6:cout<<"Tuesday";break;			
			case 0:cout<<"Wednesday";break;
		}
		cout<<endl;
		
	}
}

C++: #include <iostream>
using namespace std;
int main(){
	int m,d;
	while(cin>>m>>d){
		if(!m) break;
		int daym[12]={0,31,60,91,121,152,183,213,244,274,305,335};
		int wd = (daym[m-1] + d + 2)%7;
		switch(wd){
		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;
		}
	}
	return 0;
}

C++: #define _USE_MATH_DEFINES
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<list>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<map>
#include<queue>
#include<vector>
using namespace std;

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

int b[13] = { 0,31,29,31,30,31,30,31,31,30,31,30,31 };

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

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

using namespace std;
 
int main(){
	int m[]={0,31,29,31,30,31,30,31,31,30,31,30,31};
	string d[]={"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"};

	int x,y;

	while(scanf("%d %d", &x, &y) != EOF){
		if(0==x) break;
		int c=2;
		while(--x) c+=m[x];

		c+=y;
		cout<< d[c%7]<<endl;
	}

    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

#define REP(i, n) for (int i = 0; i < (n); i++)

const int month[] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30};
int main()
{
  int m, d, cntdays = 0;
  
  while (cin >> m >> d, m + d){
    cntdays = month[m - 1] + d;
    switch (cntdats % 7){
      case 1:
        cout << Monday;
        break;
      case 2:
        cout << Tuesday;
        break;
      case 3:
        cout << Wednesday;
        break;
      case 4:
        cout << Thursday;
        break;
      case 5:
        cout << Friday;
        break;
      case 6:
        cout << Saturday;
        break;
      case 0:
        cout << Sunday;
        break;
      cout << endl;
    }
  }
}