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<iostream>
 #include<stdio.h>
 #include<string>
 #include<math.h>
 #include<iomanip>
 #include<algorithm>
 #include<string.h>
 #include<cctype>
 #include<map>
 #include<set>
 #include<vector>
 #include<sstream>
 #include<stack>
 #include<queue>
 
 using namespace std;
 
 int month[12]={31,29,31,30,31,30,31,31,30,31,30,31};
  
 int main()
 {
   int m,d;
   int duration=0;
   while(cin>>m>>d)
   {
     if(m==0&&d==0) break;
     else
     {
       if(m==1) duration=d-1;
       else 
       {
         for(int i=0;i<m-1;i++) duration+=month[i];
         duration+=(d-1);     
       }    
       if(duration%7==0) cout<<"Thursday"<<endl;
       else if(duration%7==1) cout<<"Friday"<<endl;
       else if(duration%7==2) cout<<"Saturday"<<endl;
       else if(duration%7==3) cout<<"Sunday"<<endl;
       else if(duration%7==4) cout<<"Monday"<<endl;
       else if(duration%7==5) cout<<"Tuesday"<<endl;
       else cout<<"Wednesday"<<endl;
     }                
   }
   //while(1);     
   return 0;  
 }

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

int main(){
   int m,d,ans;
   while(cin >> m >> d&&m|d){
      ans=d;
      if(m>=2) ans+=31;
      if(m>=3) ans+=29;
      if(m>=4) ans+=31;
      if(m>=5) ans+=30;
      if(m>=6) ans+=31;
      if(m>=7) ans+=30;
      if(m>=8) ans+=31;
      if(m>=9) ans+=31;
      if(m>=10) ans+=30;
      if(m>=11) ans+=31;
      if(m>=12) ans+=30;
      if(ans%7==5) cout << "Monday" << endl;
      if(ans%7==6) cout << "Tuesday" << endl;
      if(ans%7==0) cout << "Wednesday" << endl;
      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;
   }
}

C++: //曜日を当てる
#include<cstdio>
#include<string>

using namespace std;

int main(void){
	string name[7]={"Mondey","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"};
	int mond[12]={31,29,31,30,31,30,31,31,30,31,30,31};
	int month,day,m,c;
	int i;	//ループカウンタ

	while(1){
		scanf("%d %d",&month,&day);
		if(month==0)break;
		m=1;	//月の始めの一月
		c=3;	//始まりは木曜日
		while(1){
			for(i=1;i<=mond[m-1];i++,c++)
				if(month==m && i==day) break;
			if(month==m && i==day) break;
			m++;
		}
		printf("%s\n",name[c%7].c_str());
	}

	return 0;
}

C++: #include <cstdio>

using namespace std;

bool testcase_ends() {
    int m, d;
    scanf("%d %d", &m, &d);

    if (m == 0 && d == 0)
        return 1;

    int offset[]={
        0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335
    };

    const char *day[]={
        "Mon", "Tues", "Wednes", "Thurs", "Fri", "Sat", "Sun"
    };

    printf("%sday\n", day[(offset[m-1]+d+2)%7]);
    return 0;
}

int main() {
    int solved=0;
    while (!testcase_ends())
        ++solved;

    return !solved;
}

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

int m,d;
int data[] = {31,29,31,30,31,30,31,31,30,31,30,31};
string day[] = {"Thursday","Friday","Saturday","Sunday","Monday","Tuesday","Wednesday"};

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

		for(int i = 0; i < m - 1; i++){
			d+=data[m];
		}
		cout << day[(d-1)%7] << endl;
	}
}

C++: #include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,x,n) for(int i=(x);i<(n);i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define fir first
#define sec second
#define ub upper_bound
#define lb lower_bound
#define int long long
using namespace std;
const int MOD=1000000007;
const int INF=1000000009;

signed main(){
  int M[13]={0,31,60,91,121,152,182,213,244,274,305,335,366};
  string S[7]={"Wednesday","Thursday","Friday","Saturday","Sunday","Monday","Tuesday"};
  int m,d;
  while(cin>>m>>d,m){
    int index=M[m-1]+d;
    cout<<S[index%7]<<endl;
  }
  return 0;
}

C++: #include<stdio.h>
int main()
{
int p[12]={31,29,31,30,31,30,31,31,30,31,30,31};
int M,D,sum;
while(1)
{
sum=0;
scanf("%d",&M);
scanf("%d",&D);if(M==0)break;
if(M==0)break;
for(int i=0;i<M-1;i++)
sum+=p[i];

sum+=D;

switch(sum%7)
{
case 4:
printf("Sunday\n");break;
case 5:
printf("Monday\n");break;

case 6:
printf("Tuesday\n");break;

case 0:
printf("Wednesday\n");break;

case 1:
printf("Tursday\n");break;

case 2:
printf("Friday\n");break;

case 3:
printf("Saturday\n");break;
}
}
return 0;
}

C++: #include<iostream>

using namespace std;

int mouth[]={-1,31,29,31,30,31,30,31,31,30,31,30,31};

int main(void){

	int mo,da,wa;

	while(1){
		wa=0;
		cin>>mo>>da;
		if(mo==0||da==0) break;
		for(int i=1;i<mo;i++) wa+=mouth[i];
		wa+=da;
		switch(wa%7){
		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;
		case 0:
			cout<<"Wednesday"<<endl;
			break;
		}
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

void count_num(int a,int b){
    string WDay[7] = {"Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"};
    int len[12] = {31,29,31,30,31,30,31,31,30,31,30,31};
    int count = 0;
    for(int i = 0; i< a-1;i++){
        count += len[i];
    }
    count += b;
    cout << WDay[(count+2) % 7] << endl;
}

int main() {
    int a,b;
    while(cin >> a >>  b , a){
        count_num(a,b);
    }
    return 0;
}

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

const string day[] = {"Thurs", "Fri", "Satur", "Sun", "Mon", "Tues", "Wednes"};

int main(){
  int m, d;
  while(cin >> m >> d) {
    int days = d - 1;
    for(int i = 1; i < m; i++) { 
    if(i == 1 || i == 3 || i == 5 || i == 7 || i == 8 || i == 10 || i == 12)
      days += 31;
    else if(i == 4 || i == 6 || i == 9 || i == 11)
      days += 30;
    else
      days += 29;
    }
    cout << day[days % 7] << "day" << endl;
  }
}

C++: #include<iostream>

using namespace std;

int main()
{
	int month[12];

	month[0]=31;
	month[1]=29;
	month[2]=31;
	month[3]=30;
	month[4]=31;
	month[5]=30;
	month[6]=31;
	month[7]=31;
	month[8]=30;
	month[9]=31;
	month[10]=30;
	month[11]=31;

	int hoge,fuge;

	cin >> hoge >> fuga;

	int i;
	int count=0;

	if(hoge!=0)
	{
		for(i=0;i<hoge-1;i++)
		{
			count+=month[i];
		}	
		
		count+=fuga;
	
		flag = count % 7;
		if(flag==0)
		{
			cout << "Wednesday" <<endl;
		}
		if(fkag==1)
		{
			cout << "Thursday" <<endl;
		}
		if(fkag==2)
		{
			cout << "Friday" <<endl;
		}
		if(fkag==3)
		{
			cout << "Saturday" <<endl;
		}
		if(fkag==4)
		{
			cout << "Sunday" <<endl;
		}
		if(fkag==5)
		{
			cout << "Monday" <<endl;
		}
		if(fkag==6)
		{
			cout << "Tuesday" <<endl;
		}
	}
}