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>
using namespace std;

int cntday(int m, int d);
void disp(int n);

int main(){
	int month, day, n;
	while(cin >>month >>day){
		if(month == 0) break;
		n = cntday(month, day);
		disp(n);
	}
	return 0;
}

int cntday(int m, int d){
	int ans = d, month[12] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
	for(int i = 0; i < m - 1; i++){
		ans += month[i];
	}
	return ans;
}

void disp(int n){
	int cnt = n % 7;
	switch(cnt){
		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;
	}
}

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

int main()
{
	int a, b, count = 0;
	int ans[100];
	while (cin >> a >> b) {
		if (a == 0 && b == 0)
			break;
		if (a == 1 || a == 4 || a == 7) {
			ans[count] = b % 7 + 3;
		}
		else if (a == 9 || a == 12) {
			ans[count] = b % 7 + 2;
		}
		else if (a == 2 || a == 8) {
			ans[count] = b % 7 + 6;
		}
		else if (a == 3 || a == 11) {
			ans[count] = b % 7;
		}
		else if (a == 5) {
			ans[count] = b % 7 + 5;
		}
		else if (a == 6) {
			ans[count] = b % 7 + 1;
		}
		else if (a == 10) {
			ans[count] = b % 7 + 4;
		}
		count++;
	}
	for (int i = 0; i < count; i++) {
		if (ans[i] == 1)
			cout << "Monday" << endl;
		else if (ans[i] == 2)
			cout << "Tuesday" << endl;
		else if (ans[i] == 3)
			cout << "Wednesday" << endl;
		else if (ans[i] == 4)
			cout << "Thursday" << endl;
		else if (ans[i] == 5)
			cout << "Friday" << endl;
		else if (ans[i] == 6)
			cout << "Saturday" << endl;
		else if (ans[i] == 7)
			cout << "Sunday" << endl;
	}
}

C++: #include <iostream>

using namespace std;

int M[]{0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366};
string W[]{"Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday", "Wednesday"};

int main() {
    int m, d;
    while (cin >> m >> d) {
        if (m == 0) break;
        cout << W[(M[m - 1] + d - 1) % 7] << endl;
    }
}

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

int main()
{
  int m,d;

  string week[7] = {"Thursday", "Friday", "Saturday", "Sunday","Mondy", "Tuesday", "Wednesday"};
  int month[12] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

  while ( cin >> m >> d && m != 0 ) {
    int day = 0;
    for (int i = 0; i < (m - 1); i++) {
      day += month[i];
    }
    day += d;
 
    cout << week[(day%7)-1] << endl;
  }
  return 0;
}

C++: #include	<iostream>

using namespace std;

int main(void) {
	while(1) {
		int mon, day;
		cin >> mon;
		
		if( mon == 0 )		break;
		
		cin >> day;
		
		for(int i = 1; i < mon; i++) {
			switch(i) {
			case 2:
				day += 29;
				break;
			case 4:
			case 6:
			case 9:
			case 11:
				day += 30;
				break;
			default:
				day += 31;
				break;
			}
		}
		
		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;
		}
	}
	
	return 0;
}

C++: #include<cstdio>
int main()
{
    int mo,da;
    int cal[12]={0,31,29,31,30,31,30,31,31,30,31,30};
    while(scanf("%d%d",&mo,&da),mo)
    {
        int nu=0;
        for(int i=0;i<mo;i++)nu+=cal[i];
        nu+=da;
        if(nu%7==1)printf("Thursday\n");
        else if(nu%7==2)printf("Friday\n");
        else if(nu%7==3)printf("Saturday\n");
        else if(nu%7==4)printf("Sunday\n");
        else if(nu%7==5)printf("Monday\n");
        else if(nu%7==6)printf("Tuesday\n");
        else if(nu%7==0)printf("Wednesday\n");
    }
    return 0;
}

C++: #include <iostream>
using namespace std;
int main()
{
	int monthNum[13] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
	string dayName[7] = {"Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday", "Wednesday"};
	int month, day, passDay=0;
	
	while (1) {
		cin >> month >> day;
		if (month == 0) break;
		
		for (int i=0; i<month; i++)
			passDay += monthNum[i];
		passDay += day-1;
		
		cout << dayName[passDay % 7] << endl;
		passDay = 0;
	}
	
	return 0;
}

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

int main ()
{
	int m[13]={0,4,7,1,4,6,7,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++: #include <stdio.h>

int main()
{
  int y, d, m;
  int h;
  char *date[] = {"Saturday", "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday"};

  for(;;)
    {
      int Y, C, G;
      y = 2004;
      scanf("%d %d", &m, &d);

      if(d == 0 || m == 0) break;
      if(m == 1 || m == 2)
	{
	  m += 12;
	  y--;
	}

      Y = y%100;
      C = y/100;
      G = 5*C + C/4;

      h = (d + (26*(m + 1)/10) + Y + Y/4 + G)%7;
      printf("%s\n", date[h]);
    }

  return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
  
  int a,b;
  cin >> a >> b;
  while(a != 0){
    
    for(int i = 1;i < a;i++){
      if(i==1 || i==3 || i==5 || i==7 || i==8 || i==10){
	b += 31;
      }
      else if(i==4 || i==6 || i==9 || i==11){
	b += 30;
      }
      else if(i == 2){
	b += 29;
      }
    }

    if(b%7 == 1) cout << "Thursday" << endl;
    else if(b%7 == 2) cout << "Friday" << endl;
    else if(b%7 == 3) cout << "Saturday" << endl;
    else if(b%7 == 4) cout << "Sunday" << endl;
    else if(b%7 == 5) cout << "Monday" << endl;
    else if(b%7 == 6) cout << "Tuesday" << endl;
    else cout << "Wednesday" << endl;
    cin >> a >> b;
  }
  return (0);
}

C++: #include <iostream>
#include <string>
using namespace std;
int main(void){
	const int DPM[] = {31,29,31,30,31,30,31,31,30,31,30,31};
	const string DAYS[] = {"Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"};
	int month,date;
	while(cin >> month >> date){
		if(month==0)break;
		int day = 3;
		for(int i=1;i<month;++i) day += DPM[i-1];
		day = (day+date-1)%7;
		cout << DAYS[day] << "\n";
	}
	return 0;
}

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

int main(int argc, const char * argv[])
{
    int month[12] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
    int m, d;
    while (scanf("%d %d", &m, &d) != 0) {
        int cnt = 0;
        if (m == 0 && d == 0) {
            return 0;
        }
        for (int i = 0; i < m - 1; i++) {
            cnt += month[i];
        }
        cnt += d;

        if (cnt % 7 == 0) {
            printf("Wednesday\n");
        }
        if (cnt % 7 == 1) {
            printf("Thursday\n");
        }
        if (cnt % 7 == 2) {
            printf("Friday\n");
        }
        if (cnt % 7 == 3) {
            printf("Saturday\n");
        }
        if (cnt % 7 == 4) {
            printf("Sunday\n");
        }
        if (cnt % 7 == 5) {
            printf("Monday\n");
        }
        if (cnt % 7 == 6) {
            printf("Tuesday\n");
        }
    }
    return 0;
}