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<stdio.h>
int main(){
	int m,d,i;
	int W;
	int s=0;
	
	while(1){
		s=0;
		scanf("%d %d",&m,&d);
		if(m==0)break;
		for(i=1;i<m;i++){
			if(i==1 || i==3 || i==5 || i==7 || i==8 || i==10 || i==12)s+=31;
			else if(i==4 || i==6 || i==9 || i==11 )s+=30;
			else if(i==2)s+=29;
		}
		W=s+d;
		if(W%7==0)printf("Wednesay\n");
		else if(W%7==1)printf("Thursday\n");
		else if(W%7==2)printf("Friday\n");
		else if(W%7==3)printf("Saturday\n");
		else if(W%7==4)printf("Sunday\n");
		else if(W%7==5)printf("Monday\n");
		else if(W%7==6)printf("Tuesday\n");
		W=0;
	}
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 (cntdays % 7){
      case 5:
        cout << "Monday";
        break;
      case 6:
        cout << "Tuesday";
        break;
      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;
    }
    cout << endl;
  }
}

C++: #include<stdio.h>
int main(void)
{
	int m[12]={31,29,31,30,31,30,31,31,30,31,30,31};
	int man,day;
	int s;
	int i;
	
	scanf("%d %d",&man,&day);
	while(man!=0){
		s=0;
		if(man!=1){
			for(i=0;i<man-1;i++){
				s+=m[i];
			}
			s+=day;
		}
		else {
			s+=day;
		}
	//	printf("%d\n",s);
		s=s%7;
		if(s==0){
			printf("Wednesday\n");
		}
		else if(s==1){
			printf("Thursday\n");
		}
		else if(s==2){
			printf("Friday\n");
		}
		else if(s==3){
			printf("Saturday\n");
		}
		else if(s==4){
			printf("Sunday\n");
		}
		else if(s==5){
			printf("Monday\n");
		}
		else if(s==6){
			printf("Tuesday\n");
		}
		scanf("%d %d",&man,&day);
	}
	return 0;
}

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

int main() {
	string youbi[7] = {"Wednesday","Thursday","Friday","Suturday","Sunday","Monday","Tuesday"};
	int month[12] = {31,29,31,30,31,30,31,31,30,31,30,31};
	
	int gathu,nichi;
	while ( cin >> gathu >> nichi,gathu ) {
		int keika = 0;
		for ( int i = 0; i < gathu-1; i++ ) {
			keika += month[i];
		}
		keika += nichi;
		
		cout <<  youbi[keika-1 % 7] << endl;
	}
	return 0;
}

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

main(){
	//          0  1  2  3  4  5  6  7  8  9 10 11 12
	int days[]={0,31,29,31,30,31,30,31,31,30,31,30,31};
	
	for(int i=2; i<=12; ++i){
		days[i] += days[i-1];
	}
	
	char day[][20]={
		"Thursday",
		"Friday",
		"Saturday",
		"Sunday",
		"Monday",
		"Tuesday",
		"Wednesday"
	};
	
	while(true){
		// 月, 日
		int m, d;
		cin >> m >> d;
		
		if(m == 0){
			break;
		}
		
		cout << day[(days[m-1]+d-1)%7] <<endl;
	}
}

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

int main()
{
	std::vector<std::string> day_of_week{
		"Thursday",
		"Friday",
		"Suterday",
		"Sunday",
		"Monday",
		"Tuesday",
		"Wednesday"
	};

	std::vector<int> day_num_of_month{
		31,
		29,
		31,
		30,
		31,
		30,
		31,
		31,
		30,
		31,
		30,
		31
	};

	int month = 0;
	int day = 0;

	while (std::cin >> month >> day)
	{
		if (0 == month) { break; }

		int days_elapsed = 0;
		for (int m = 1; m < month; ++m)
		{
			days_elapsed += day_num_of_month[m - 1];
		}
		days_elapsed += day;

		std::cout << day_of_week[day % 7 - 1] << std::endl;
	}

	return 0;
}

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

int main(void){

    string day[7] = {"Monday","tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"};
    int month[12] = {31,29,31,30,31,30,31,31,30,31,30,31};
    int x,y;

    while(cin >> x >> y){
        if(x == 0){
            break;
        }


        for(int i = 0;i < x-1;i++){
            y += month[i];
        }

        cout << day[(y%7+2)%7] << endl;
    }
    return 0;
}

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

int ary[15];
char str[7][12]={"Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"};
int main(){
	ary[1]=2;
	for(int i=1;i<12;i++){
		if(i==4||i==6||i==9||i==11){
			ary[i+1]=(ary[i]+30)%7;
		}
		else if(i==2){
			ary[i+1]=(ary[i]+29)%7;
		}
		else{
			ary[i+1]=(ary[i]+31)%7;
		}
	}
	int x,y;
	while(scanf("%d %d",&x,&y)!=EOF){
		if(x==0&&y==0) break;
		cout<<str[(ary[x]+y)%7]<<endl;
	}
	return 0;
}

C++: #include <stdio.h>
#include<math.h>
using namespace std;

int Zeller(int month, int day) {
	int year = 2004;
	if (month == 1 || month == 2) {
		year--;
		month += 12;
	}
	return (year + year / 4 - year / 100 + year / 400 + (13 * month + 8) / 5 + day) % 7;
}

int main() {

	int month, day;
	while (true) {
		scanf("%d %d", &month, &day);
		if (month == 0)break;

		switch (Zeller(month, day)) {
		case 0:
			printf("Sunday\n");
			break;
		case 1:
			printf("Monday\n");
			break;
		case 2:
			printf("Tuesday\n");
			break;
		case 3:
			printf("Wednesday\n");
			break;
		case 4:
			printf("Thursday\n");
			break;
		case 5:
			printf("Friday\n");
			break;
		case 6:
			printf("Saturday\n");
			break;
		}

	}

	return 0;
}

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

int main(){

  int a[12] = {31,29,31,30,31,30,31,31,30,31,30,31};
  int n,m,d;

  while(cin >> n >> m, n, m){

    d = 0;

    for(int i=0;i<n-1;i++) d = a[i] + d;
 
    d = d + m;

    while(d > 6) d -= 7;
   
    if(d == 5) cout << "Monday" << endl;
    else if(d == 5) cout << "Tuesday" << endl;
    else if(d == 0) cout << "Wednesday" << endl;
    else if(d == 1) cout << "Thursday" << endl;
    else if(d == 2) cout << "Friday" << endl;
    else if(d == 3) cout << "Saturday" << endl;
    else if(d == 4) cout << "Sunday" << endl;

  }
}