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 "bits/stdc++.h"
using namespace std;

int main() {
	long long X[12] = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
	string Y[7] = { "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" };
	long long M, D;
	while (cin >> M >> D) {
		if (M == 0 && D == 0) return 0;
		M--, D--;
		long long NM = 0, ND = 0, COUNT = 3;
		while (1) {
			if (NM == M && ND == D) break;
			COUNT++;
			ND++;
			if (ND == X[NM]) NM++, ND = 0;
		}
		cout << Y[COUNT % 7] << endl;
	}
}

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

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

int md[12] = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };

int main() {

  int m,d;
  while(true) {
    cin>>m>>d;
    if(!m&&!d) break;

    int res=0;
    for(int i=0; i<m-1; i++)
      res += md[i];

    res += d;

    cout<<days[res%7]<<endl;
  }
}

C++: #include <iostream>

using namespace std;

int main(int argc, char **argv)
{
	int y, m, d, w;
	
	char* str[7] = {"Sun", "Mon", "Tues", "Wednes", "Thurs", "Fri", "Satur"};
	
	while(1){
		cin >> m >> d;
		y = 2004;
		if(m == 0){
			break;
		}
		if(m == 1 || m == 2 ){
			y--;
			m += 12;
		}
		w = (y+y/4-y/100+y/400+(13*m+8)/5+d)%7;

		cout << str[w] << "day" << endl;
	}
	
	return 0;
}

C++: #include <iostream>

using namespace std;

int main(){
    string daystr[] = {"Wednesday", "Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday", "Wednesday"};
    int day[] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30};
    int m, d;
    while(cin >> m >> d && m){
        for(int i = 0; i < m; i++){
            d += day[i];
        }
        cout <<  daystr[d % 7] << "\n";
    }
}

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

#define ll long long int

using namespace std;
typedef pair<int, int> P;

string str;

int main()
{
  int month,date;
  int n[12]={31,29,31,30,31,30,31,31,30,31,30,31};
  int i;

  while(1){
    cin>>month>>date;
    if(month==0)break;
    int day=0;
    for(i=0;i<month-1;i++)
      day+=n[i];
    day+=date;

    switch(day%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;
    }
  }
}

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

using namespace std;
string a[7] = {
  "Monday",
  "Tuesday",
  "Wednesday",
  "Thursday",
  "Friday",
  "Saturday",
  "Sunday"};
int main(void){
  int aa,b;
  int mon[12] = {31,28,
		 31,30,
		 31,30,
		 31,31,
		 30,31,
		 30,31};
  while(cin>>aa>>b,aa+b){
    int d = b;
    for(int i = 0 ; i < aa-1 ; i ++){
      d += mon[i];
      //cout<<d<<endl;
    }

    cout<<a[(d+2)%7]<<endl;
  }
  //*/
}

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

int main()
{
	string days[]={
		"Mon",
		"Tues",
		"Wednes",
		"Thurs",
		"Fri",
		"Satur",
		"Sun"
	};
	int cal[12][31]={{0}};
	int today=3;
	for (int i=0; i<12; i++) {
		for (int j=0; j<31; j++) {
			cal[i][j]=today;
			++today%=7;
			if (i==3 || i== 5 || i==8 || i==10) {
				if (j==29) {
					break;
				}
			}
			else if (j==1) {
				if (j==28) {
					break;
				}
			}
		}
	}
	int a,b;
	for (cin >> a >> b; a || b; cin >> a >> b) {
		cout << days[cal[a-1][b-1]] << "day" << endl;
	}	
}

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

int main()
{
	int am[13] = {0, 31,29,31,30,31,30,31,31,30,31,30,31 };
	int a, b;

	while (cin >> a >> b&&a!=0&&b!=0)
	{
		

		static int c;
		for (int i = 0; i < a; i++) {
			c += am[i];
		}
		c += b;
		int d = c % 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;
			break;
		}
	}

	return 0;
}

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 && !(month == 0 && day ==0)){   
      daycal(month,day);
  }  
  
}

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

using namespace std;

int min(){
	string y[7] = {"Wednesday", "Thrsday", "Frinday", "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) break;

		while(m != 0){
			d = d + mon[m-1];
			m--;
		}
		cout << y[d%7] << endl;
	}
}

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

using pii = pair<int, int>;
using ll = long long;

int main() {
    int m, d;
    constexpr int day[13] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
    const string ans[7] = {"Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday", "Wednesday"};
    while(cin >> m >> d, m) {
        int x = 0;
        for(int i = 1; i <= 12; ++i) {
            if(m == i) {
                cout << ans[(x + d - 1) % 7] << endl;
                break;
            } else {
                x = (x + day[i]) % 7;
            }
        }
    }
}