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++: #define _USE_MATH_DEFINES
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<list>
#include<stack>
#include<queue>
#include<cctype>
#include<iomanip>
#include<functional>
#include<numeric>
#define EPS 1e-10
using namespace std;
typedef long long llong;
void whatday(int m, int d) {
	int z;
	if (m == 1)z = d;
	else if (m == 2)z = 31 + d;
	else if (m == 3)z = 60 + d;
	else if (m == 4)z = 91 + d;
	else if (m == 5)z = 121 + d;
	else if (m == 6)z = 152 + d;
	else if (m == 7)z = 182 + d;
	else if (m == 8)z = 213 + d;
	else if (m == 9)z = 244 + d;
	else if (m == 10)z = 274 + d;
	else if (m == 11)z = 305 + d;
	else if (m == 12)z = 335 + d;
	if (z % 7 == 5)cout << "Monday" << endl;
	else if (z % 7 == 6 % 7)cout << "Tuesday" << endl;
	else if (z % 7 == 0 % 7)cout << "Wednesday" << endl;
	else if (z % 7 == 1 % 7)cout << "Thursday" << endl;
	else if (z % 7 == 2 % 7)cout << "Friday" << endl;
	else if (z % 7 == 3 % 7)cout << "Saturday" << endl;
	else if (z % 7 == 4 % 7)cout << "Sunday" << endl;
}
int main() {
	int m, d;
	while (cin >> m >> d&&m&&d) {
		whatday(m, d);
	}
	return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
using namespace std;

int main(){
  int M[13] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
  string w[7] = {"Wednesday", "Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday"};

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

    int tmp = d;
    for(int i=0; i<m; i++) tmp += M[i];

    cout << w[tmp%7] << endl;
  }

  return 0;
}

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

int main(){
  string y[7]={"Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"};
  int num[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 += num[m-1];
      m--;
    }
    cout << y[d%7+2] << endl;
  }

  return 0;
}

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

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

int main(){
    int m, d;
    while(cin >> m >> d, m != 0){
        int y = 2004;
        if(m == 1 || m == 2){
            y--;
            m += 12;
        }
        int h = (d + 26*(m+1)/10 + (y%100) + ((y%100)/4) + 5*(y/100) + (y/100)/4) % 7;
        cout << day[h] << endl;
    }

    return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
	while(1){
		int a,b,ans=0;
		cin>>a>>b;
		if(a==0)break;
		a--;
		int c[12]={31,29,31,30,31,30,31,31,30,31,30,31};
		for(int i=0;i<a;i++){
			ans+=c[i];
		}
		ans+=b;
		if(ans%7==1){
			cout<<"Thursday"<<endl;
		}
		if(ans%7==2){
			cout<<"Friday"<<endl;
		}
		if(ans%7==3){
			cout<<"Saturday"<<endl;
		}
		if(ans%7==4){
			cout<<"Sunday"<<endl;
		}
		if(ans%7==5){
			cout<<"Monday"<<endl;
		}
		if(ans%7==6){
			cout<<"Tuesday"<<endl;
		}
		if(ans%7==0){
			cout<<"Wednesday"<<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 i, m, d, cntdays = 0;
  
  while (cin >> m >> d, m){
    for (i = 0; i < m; i++) cntdays += month[i];
    switch ((cntdays + d) % 7){
      case 0:
        cout << "Wednesday";
        break;
      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;
    }
    cout << endl;
  }
}

C++: #include <stdio.h>

int main(void){
    int days[] = {0,31,29,31,30,31,30,31,31,30,31,30,31};
    int mo,dy;
    int day;
    
    while (scanf("%d %d", &mo, &dy)!=EOF){
        if (mo==0) break;
        day = 0;
        for (int i=1; i<mo; i++) day += days[i];
        day += dy;
        switch( day%7 ){
        case 1:
            printf("Thursday\n");
            break;
        case 2:
            printf("Friday\n");
            break;
        case 3:
            printf("Saturday\n");
            break;
        case 4:
            printf("Sunday\n");
            break;
        case 5:
            printf("Monday\n");
            break;
        case 6:
            printf("Tuesday\n");
            break;
        case 0:
            printf("Wednesday\n");
            break;
        }
    }
        
    return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

template<class T> inline T sqr(T x) {return x*x;}

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned long long ULL;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

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

const double EPS = 1e-10;
const double PI  = acos(-1.0);

#define CLR(a) memset((a), 0 ,sizeof(a))

int dx[4] = {-1, 0, 1, 0};
int dy[4] = {0, -1, 0, 1};

int main() {
  int k,m,d;
  string today[7]={"Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"};
  int mon[12]={31,29,31,30,31,30,31,31,30,31,30,31};

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

    for(int i=0;m-1>i;i++){

      if(m==1)break;
      else d+=mon[i];

  }
    k=d%7+2;
    cout <<today[k]<<endl;
  
  }
}

C++: #include <stdio.h>
  int main(){
int i,j;
int x[12]={0,31,60,91,121,152,182,213,244,274,305,335};
int n,m;
while(1){
scanf("%d%d",&n,&m);
if(n==0){
break;
}
int q=x[n-1]+m;
q %= 7;
if(q==0){
printf("Wednesday\n");
}else if(q==1){
printf("Thursday\n");
}else if(q==2){
printf("Friday\n");
}else if(q==3){
printf("Saturday\n");
}else if(q==4){
printf("Sunday\n");
}else if(q==5){
printf("Monday\n");
}else if(q==6){
printf("Tuesday\n");
}
}
return 0;
}

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

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

int main() {
  int days[12] = {31,29,31,30,31,30,31,31,30,31,30,31};
  string youbi[7] = {"Monsay","Tuesday","Wednesday","Thursday",
		     "Friday","Saturday","Sunday"};
  while(1) {
    int mon, day;
    cin >> mon >> day;
    if(mon == 0) break;

    int sum = 0;
    for(int i = 0; i < mon-1; i++) {
      sum += days[i];
    }
    sum += day;

    cout << youbi[sum%7+2] << endl;
  }
  return 0;
}