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;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back
#define INF 99999999



int main(){
    int a,b;
    int month[]={0,0,31,29,31,30,31,30,31,31,30,31,30,31};
    for(int i=1;i<=12;i++)month[i]=month[i]+month[i-1];
    string w[]={"Thursday","Friday","Saturday","Sunday","Monday","Tuesday","Wednesday"};
    while(cin>>a>>b){
        if(a==0&&b==0)break;
        int sum=0;
        sum+=month[a];
        sum+=b-1;
        sum=sum%7;
        cout<<w[sum]<<endl;
    }
}

C++: #include <stdio.h>
int main()
{
	char yobi[7][10]={"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Sunday"};
	int month,day;
	while(1){
		scanf("%d %d",&month,&day);
		if(month==0)
			break;
		for(int i=0;i<month;i++){
			switch(i){
				case 2:
					day+=29;
				case 4:
				case 6:
				case 9:
				case 11:
					day+=30;
				default:
					day+=31;
			}
		}
		printf("%s\n",yobi[day%7]);
	}
	return 0;
}

C++: #include<iostream>
#include<string>
using namespace std;
int main(){
  int d[]={31,29,31,30,31,30,31,31,30,31,30,31};
  string s[]={"Thursday",
	      "Friday","Saturday","Sunday","Monday","Tuesday","Wednesday",};
  int i,j;
  int a,b;
  cin>>a>>b;
  while(a!=0){
    int o=0;
    for(i=1;i<a;i++) o+=d[i-1];
    o+=b-1;
    //cout << o << endl;
    cout << s[o%7] << endl;
    cin>>a>>b;
  }
  return 0;
}

C++: #include <iostream>
#include <string>
using namespace std;
 
int main(){
  string y[7]={"Wednesday","Thursday","Friday","Saturday","Sunday","Monday","Tuesday"};
  int num[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 && d == 0 ) break;
    while( m != 0 ){
      d += num[m-1];
      m--;
    }
    cout << y[d%7] << endl;
  }
 
  return 0;
}

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

int main() {
  while (true) {
    int m, d; cin >> m >> d;
    if (m == 0 && d == 0) break;
    int month[12] = {31,29,31,30,31,30,31,31,30,31,30,31};

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

    switch (d % 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;
    default:
      cout << "Wednesday" << endl;
      break;
    }
  }

  return 0;
}

C++: #include<iostream>
#include<cmath>
#include<vector>
using namespace std;
typedef long long ll;

const int MNUM = 12, leapMNUM = 12;
const int ML[] = {31,28,31,30,31,30,31,31,30,31,30,31};      //day/month in usual year
const int leapML[] = {31,29,31,30,31,30,31,31,30,31,30,31};  //day/month in leap year
const string days[] = {"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"};

struct date{
  int y,m,d;

  date(void):y(0),m(1),d(1){}
  date(int a,int b,int c):y(a),m(b),d(c){}
  
  bool isLeap(void){
    if(y%400==0)return true;
    if(y%100==0)return false;
    if(y%4==0)return true;
    return false;
  }

  date next(void){
    d++;
    if(isLeap()){
      if(leapML[m-1]<d){ d=1; m++; }
      if(leapMNUM<m){ m=1; y++; }
    }else{
      if(ML[m-1]<d){ d=1; m++; }
      if(MNUM<m){ m=1; y++; }
    }
    return *this;
  }

  bool operator==(const date x)const{return (y==x.y && m==x.m && d==x.d);}

  bool operator<(const date x)const{
    if(y!=x.y)return y<x.y;
    if(m!=x.m)return m<x.m;
    return d<x.d;
  }

  bool operator<=(const date x)const{return (*this==x || *this<x); }
  bool operator>(const date x)const{return !(*this<=x);}
  bool operator>=(const date x)const{return !(*this<x);}

  ll dayCount(void)const{
    date tmp;
    for(ll res=0;;res++){
      if(tmp==*this)return res;
      tmp.next();
    }
    return 0;
  }

  ll operator-(const date x)const{
    return dayCount() - x.dayCount();
  }

  //calculate days from Julian Day(-4713/01/01) using Fliegel's formula.
  ll Fliegel(void){
    int a = (14-m)/12, Y = y+4800-a, M = m+12*a-3;
    return (ll)d + (153*M+2)/5 + 365*Y + Y/4 - Y/100 + Y/400 - 32045;
  }

  //calculate day of week using Zeller congruence.
  int Zeller(void){
    int Y = y, M = m;
    if(M<3){ Y--; M+=12; }
    return (Y + Y/4 - Y/100 + Y/400 + (13*M+8)/5 + d)%7;
  }
};

int main(){
  int m,d;
  while(cin >> m >> d,m||d)
    cout << days[date(2004,m,d).Zeller()] << endl;
}

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

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

int day[13] = {
	0,
	31, 29, 31, 30,
	31, 30, 31, 31,
	30, 31, 30, 31
};

int main() {
	ios :: sync_with_stdio(false);
	while(true) {
		int m, d; cin >> m >> d;
		if(!m && !d) break;
		int s = d;
		for(int i = 1; i < m; i ++)
			s += day[i];
		cout << str[(s + 2) % 7] << '\n';
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
int main( void )
{
  char *s[] = { "Monday", "Tuesday", "Wednesday",
    "Thursday", "Friday", "Saturday", "Sunday" };
  int n[] = { 0,31,29,31,30,31,30,31,31,30,31,30,31 };
  int m,d,r,i;
  while( 1 ){
    cin >> m >> d;
    if( m==0 ) break;
    r=0;
    for( i=1; i<m; i++ ) r += n[i];
    r += d;
    cout << s[(r+2)%7] << endl;
  }
  return 0;
}

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

using namespace std;

int main(void)
{
	int dayNum[13]={
		0,31,29,31,30,31,30,31,31,30,31,30,31
	};
	string youbi[7]={
		"Wednesday","Thursday","Friday","Saturday","Sunday","Monday","Tuesday"
	};
	int manth,day;
	while(cin>>manth>>day)
	{
		if(manth==0)
		{
			break;
		}
		int sum=0;
		for(int i=0;i<manth;i++)
		{
			sum+=dayNum[i];
		}
		sum+=day;
		cout<<youbi[sum%7]<<endl;
	}
}

C++: #include<stdio.h>

int main(void)
{
	int a=0,b=0,day=0;

	while(day != 10)
	{
		scanf("%d %d",&a,&b);
		if(a==0 || b ==0)break;
		else if(a==1 || a==4 || a==7)
			day = 3 + b % 7;
		else if(a==2 || a==8)
			day = 6 + b % 7;
		else if(a==3 || a==11)
			day = b % 7;
		else if(a==5)
			day = 5 + b % 7;
		else if(a == 6)
			day = 1 + b % 7;
		else if(a==9 || a==12)
			day = 2 + b % 7;
		else 
			day = 4 + b % 7;
		if(day > 6)
			day-=7;
		switch (day)
		{
		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;
		case 0:
			printf("Sunday\n");
			break;
		}
	}
  return 0;
}

C++: #include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
#define tr(c, i) for(auto i = (c).begin(); i != (c).end(); i++)

int main(int argc, char **argv)
{
  map<int, int> mode;
  int i;
  for (;;) {
    cin >> i;
    if (cin.eof())
      break;

    mode[i]++;
  }

  int m = 0;
  tr(mode, i) {
    m = max(i->second, m);
  }
  tr(mode, i) {
    if (i->second == m)
      cout << i->first << endl;
  }
  return 0;
}