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

int main(void)
{
	int month, day, sum = 0, s_y = 3;
	int m_and_D[13] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
	char select_y[7][10] = 
	{"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sanday"};

	while(scanf("%d %d",&month, &day) && month > 0)
	{
		s_y = 3;
		sum = 0;
		for(int f1 = 1; f1 < month; f1++)
		{
			sum += m_and_D[f1];
		}

		sum += day - 1;
		s_y = (sum + s_y) % 7;

		printf("%s\n",select_y[s_y]);
	}
	return 0;
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
using namespace std;
typedef long long int ll;

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

int day(int n){
	if(n==1)return 0;
	else{
		int res;
		n--;
		if(n==1||n==3||n==5||n==7||n==8||n==10||n==12){
			res=31;
		}
		else if(n==2){
			res=29;
		}
		else{
			res=30;
		}
		return res+day(n);
	}
}


int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	while(1){
		int n; cin >> n;
		if(n==0)break;
		int m; cin >> m;
		int sum=m+day(n);
		cout << s[sum%7] << endl;
	}
}

C++: #include<stdio.h>
int main()
{
  int month,date,ans;
  while(1)
    {
      scanf("%d%d",&month,&date);
      if((month==0)&&(date==0)) break;
      ans=date;
      switch(month)
	{
	case 12:
	  ans+=30;
	case 11:
	  ans+=31;
	case 10:
	  ans+=30;
	case 9:
	  ans+=31;
	case 8:
	  ans+=31;
	case 7:
	  ans+=30;
	case 6:
	  ans+=31;
	case 5:
	  ans+=30;
	case 4:
	  ans+=31;
	case 3:
	  ans+=29;
	case 2:
	  ans+=31;
	}
      ans%=7;
      switch(ans)
	{
	case 0:
	  printf("Wednesday\n");
	  break;
	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;
	}	  	  	  	  
    }
  return 0;
}

C++: #include<stdio.h>

int main(void){
	int m,d,now;
	char da[7][15]={"Wednesday","Thursday","Friday","Saturday","Sunday","Monday","Tuesday"};
	for(;;){
		now=0;
		scanf("%d %d",&m,&d);
		if(!m||!d)break;
		for(int i=1;i<m;i++){
			now+= i==2 ? 29 : (i<8 ? 30+i%2 : 31-i%2);
		}
		now+=d;
		printf("now= %d\n",now);
		printf("%s\n",&da[now%7]);
	}
	return 0;
}

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