alexjercan/bugnet huggingface dataset:
Problem p00027 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
using namespace std;

int getDay(int y, int m, int d) {
  if (m < 3)
    m += 12, y--;
  int J = y / 100, K = y % 100;
  return (d + (((m + 1) * 26) / 10) + K + (K / 4) + (J / 4) + 5 * J) % 7;
}
int main() {
  string table[] = {"Saturday",  "Sunday",   "Monday", "Tuesday",
                    "Wednesday", "Thursday", "Friday"};
  int m, d;
  while (cin >> m >> d, m) {
    cout << table[getDay(2004, m, d)] << endl;
  }
}

Error: 0

Fixed submission:

#include <iostream>
using namespace std;

int getDay(int y, int m, int d) {
  if (m < 3)
    m += 12, y--;
  int J = y / 100, K = y % 100;
  return (d + ((m + 1) * 26) / 10 + K + K / 4 + J / 4 - 2 * J) % 7;
}
int main() {
  string table[] = {"Saturday",  "Sunday",   "Monday", "Tuesday",
                    "Wednesday", "Thursday", "Friday"};
  int m, d;
  while (cin >> m >> d, m) {
    cout << table[getDay(2004, m, d)] << endl;
  }
}
Problem p00027 (C++) — buggy submission, verdict: Time Limit Exceeded

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

Error: TLE

Fixed submission:

#include <iostream>

using namespace std;

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

  cin >> a;

  while (a != 0) {
    if (a = 1) {
      day = day;
    }
    if (a = 2) {
      day = day + 31;
    }
    if (a = 3) {
      day = day + 60;
    }
    if (a = 4) {
      day = day + 91;
    }
    if (a = 5) {
      day = day + 121;
    }
    if (a = 6) {
      day = day + 152;
    }
    if (a = 7) {
      day = day + 182;
    }
    if (a = 8) {
      day = day + 213;
    }
    if (a = 9) {
      day = day + 244;
    }
    if (a = 10) {
      day = day + 274;
    }
    if (a = 11) {
      day = day + 305;
    }
    if (a = 12) {
      day = day + 335;
    }

    cin >> b;
    day = day + b;

    t = day % 7;
    if (t = 1) {
      cout << "Wednesday" << endl;
    }
    if (t = 2) {
      cout << "Thersday" << endl;
    }
    if (t = 3) {
      cout << "Friday" << endl;
    }
    if (t = 4) {
      cout << "Saturday" << endl;
    }
    if (t = 5) {
      cout << "Sunday" << endl;
    }
    if (t = 6) {
      cout << "Monday" << endl;
    } else {
      cout << "Tuesday" << endl;
    }
  }
}
Problem p00027 (C++) — buggy submission, verdict: Runtime Error

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <queue>
#include <set>
#include <string>
#include <vector>

using namespace std;

int dayNum[12] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
string day[7] = {"Monday",   "Tuesday",  "Wednesday",
                 "Thursday", // <- 2004/1/1
                 "Friday",   "Saturday", "Sunday"};

int main() {
  int m, d;

  cin >> m >> d;

  while (m != 0 && d != 0) {
    int daySum = 0;

    for (int i = 0; i < m - 1; i++) {
      daySum += dayNum[i];
    }

    daySum += d;

    cout << day[(daySum + 2) % 7] << endl;

    cin >> m >> d;
  }

  return 0;
}

Error: 0

Fixed submission:

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <queue>
#include <set>
#include <string>
#include <vector>

using namespace std;

int dayNum[12] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
string day[7] = {"Monday",   "Tuesday",  "Wednesday",
                 "Thursday", // <- 2004/1/1
                 "Friday",   "Saturday", "Sunday"};

int main() {
  int m, d;

  cin >> m >> d;

  while (m != 0 && d != 0) {
    int daySum = 0;

    for (int i = 0; i < m - 1; i++) {
      daySum += dayNum[i];
    }

    daySum += d;

    cout << day[daySum % 7 + 2] << endl;

    cin >> m >> d;
  }

  return 0;
}
Problem p00027 (C++) — buggy submission, verdict: Runtime Error

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

Error: 0

Fixed submission:

#include <iostream>
#include <string>
using namespace std;

int main() {
  string y[7] = {"Monday", "Tuesday",  "Wednesday", "Thursday",
                 "Friday", "Saturday", "Sunday"};
  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 + 2] << endl;
  }

  return 0;
}
Problem p00027 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int main() {
  int m, d;
  string week[] = {"Monday", "Tuesday",  "Wednesday", "Thursday",
                   "Friday", "Saturday", "Sunday"};
  int day[] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
  while (cin >> m >> d) {
    if (m == 0)
      break;
    bool flag = false;
    int mc = 1;
    int cnt = 3;
    while (1) {
      for (int i = 1; i <= day[mc - 1]; ++i, cnt++) {
        if (mc == m && d == i) {
          cout << week[cnt % 7] << endl;
          flag = true;
          break;
        }
      }
      if (flag)
        break;
      mc++;
    }
  }
  return 0;
}

Error: TLE

Fixed submission:

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

int main() {
  int m, d;
  string week[] = {"Monday", "Tuesday",  "Wednesday", "Thursday",
                   "Friday", "Saturday", "Sunday"};
  int day[] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
  while (cin >> m >> d) {
    if (m == 0)
      break;
    bool flag = false;
    int mc = 1;
    int cnt = 3;
    while (1) {
      for (int i = 1; i < day[mc - 1]; ++i, cnt++) {
        if (mc == m && d == i) {
          cout << week[cnt % 7] << endl;
          flag = true;
          break;
        }
      }
      if (flag)
        break;
      mc++;
    }
  }
  return 0;
}
Problem p00027 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
#include <string>
using namespace std;

int main() {
  int k, m, d;
  string today[7] = {"Monday", "Tuesday",  "Wednesday", "Thursday",
                     "Friday", "Saturday", "Sunday"};
  int mon[12] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

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

    for (int i = 0; m - 1 > i; i++)
      d += mon[i];

    k = d % 7 + 2;
    cout << today[k % 7] << endl;
  }
}

Error: TLE

Fixed submission:

#include <iostream>
#include <string>
using namespace std;

int main() {
  int k, m, d;
  string today[7] = {"Monday", "Tuesday",  "Wednesday", "Thursday",
                     "Friday", "Saturday", "Sunday"};
  int mon[12] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

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

    for (int i = 0; m - 1 > i; i++)
      d += mon[i];

    k = d % 7 + 2;
    cout << today[k] << endl;
  }
}
Problem p00027 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
#include <string>

using namespace std;

int main() {
  const string day[7] = {"Wednesday", "Thursday", "Friday", "Saturday",
                         "Sunday",    "Monday",   "Tuesday"};
  const int days[12] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

  int month, date;

  while (cin >> month >> date, month) {
    int sum = 0;
    for (int i = 1; i < month; ++i)
      sum += days[i - 1];

    sum += date;
    cout << day[sum % 7] << endl;
  }

  return 0;
}

Error: 0

Fixed submission:

#include <iostream>
#include <string>

using namespace std;

int main() {
  const string day[7] = {"Thursday", "Friday",  "Saturday", "Sunday",
                         "Monday",   "Tuesday", "Wednesday"};
  const int days[12] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

  int month, date;

  while (cin >> month >> date, month) {
    int sum = 0;
    for (int i = 1; i < month; ++i)
      sum += days[i - 1];

    sum += date;
    cout << day[(sum % 7) - 1] << endl;
  }

  return 0;
}
Problem p00027 (C++) — buggy submission, verdict: Runtime Error

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <numeric>
#include <sstream>
#include <string>
#include <vector>
using namespace std;

int main() {
  int M[13] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
  string w[7] = {"Wednesday", "Thursday", "Friday", "Saturday",
                 "Sunday",    "Monday",   "Tuesday"};

  int m, d;
  while (cin >> m >> d) {
    if (m == 0 || d == 0)
      break;

    int tmp = d;
    for (int i = 0; i < m; i++)
      tmp += M[i];

    cout << w[tmp % 7] << endl;
  }

  return 0;
}

Error: 0
1
60


Fixed submission:

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <numeric>
#include <sstream>
#include <string>
#include <vector>
using namespace std;

int main() {
  int M[13] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
  string w[7] = {"Wednesday", "Thursday", "Friday", "Saturday",
                 "Sunday",    "Monday",   "Tuesday"};

  int m, d;
  while (cin >> m >> d) {
    if (m == 0 || d == 0)
      break;

    int tmp = d;
    for (int i = 0; i < m; i++)
      tmp += M[i];

    cerr << tmp << endl;
    cout << w[tmp % 7] << endl;
  }

  return 0;
}
Problem p00027 (C++) — buggy submission, verdict: Runtime Error

#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, m != 0 || d != 0) {
    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;
  }
  return 0;
}


Error: WA

Fixed submission:

#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;
  }
}
Problem p00027 (C++) — buggy submission, verdict: Runtime Error

// 0027 What day is today?

// 2004N11ú`1231úÜÅÌútðüÍµ½Æ«A»Ìjúð¦Ä­¾³¢
// È¨2004N11úÍØjúÅA2004NÍ[NÅ·

#include <iostream>
#include <numeric>
using namespace std;

int main(void) {
  const char *week[] = {
      "Monday", "Tuesday",  "Wednesday", "Thursday",
      "Friday", "Saturday", "Sunday",
  };
  // indexÌú
  const int days[13] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
  // indexÌ1úÌA11ú©çÌoßú
  int elapsedDays[13];
  partial_sum(days, days + 13, elapsedDays);

  int month, day;

  while (cin >> month >> day, month) {
    cout << week[(elapsedDays[month - 1] + day + 2) % 7] << endl;
  }
  return 0;
}

Error: 0

Fixed submission:

// 0027 What day is today?

// 2004N11ú`1231úÜÅÌútðüÍµ½Æ«A»Ìjúð¦Ä­¾³¢
// È¨2004N11úÍØjúÅA2004NÍ[NÅ·

#include <iostream>
using namespace std;

int main(void) {
  const char *week[] = {
      "Monday", "Tuesday",  "Wednesday", "Thursday",
      "Friday", "Saturday", "Sunday",
  };
  // indexÌú
  const int Days[] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
  int month, day;

  while (cin >> month >> day, month) {
    cout << week[(Days[month - 1] + day) % 7 + 2] << endl;
  }
  return 0;
}
Problem p00027 (C++) — buggy submission, verdict: Runtime Error

#include <algorithm>
#include <cmath>
#include <fstream>
#include <iostream>
#include <queue>
#include <utility>
#include <vector>
using namespace std;

int main() {
  int year[12] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
  string day[7] = {"Monday", "Tuesday",  "Wednesday", "Thursday",
                   "Friday", "Saturday", "Sunday"};
  int first = 3;

  int m, d;
  while (true) {
    cin >> m >> d;
    if (!(m | d))
      break;
    int n = first;
    for (int i = 0; i < m - 1; i++) {
      n += year[i];
    }
    n += d - 1;

    n %= 7;
    cout << day[n] << endl;
  }
}

Error: -11

Fixed submission:

#include <algorithm>
#include <cmath>
#include <fstream>
#include <iostream>
#include <queue>
#include <utility>
#include <vector>
using namespace std;

int main() {
  ifstream cin("../test.txt");

  int year[12] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
  string day[7] = {"Monday", "Tuesday",  "Wednesday", "Thursday",
                   "Friday", "Saturday", "Sunday"};
  int first = 3;

  int m, d;
  while (true) {
    cin >> m >> d;
    if (!(m | d))
      break;
    int n = first;
    for (int i = 0; i < m - 1; i++) {
      n += year[i];
    }
    n += d - 1;

    n %= 7;
    cout << day[n] << endl;
  }
}
Problem p00027 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
using namespace std;

int main() {
  int m, d;
  int cnt;
  string days[7] = {"Wednesday", "Thursday", "Friday", "Saturday",
                    "Sunday",    "Monday",   "Tuesday"};
  while (1) {
    cnt = 0;
    cin >> m >> d;
    if (m == 0 && d == 0)
      break;
    cnt += d;
    for (m--; m > 0; m--) {
      switch (m) {
      case 4:
      case 6:
      case 9:
      case 11:
        cnt += 30;
        break;
      case 2:
        cnt += 29;
        break;
      default:
        cnt += 31;
        break;
      }
    }
    cout << days[cnt % 7] << endl;
  }
}

Error: 0

Fixed submission:

#include <iostream>
using namespace std;

int main() {
  int m, d;
  int cnt;
  string days[7] = {"Thursday", "Friday",  "Saturday", "Sunday",
                    "Monday",   "Tuesday", "Wednesday"};
  while (1) {
    cnt = 0;
    cin >> m >> d;
    if (m == 0 && d == 0)
      break;
    cnt += d;
    for (m--; m > 0; m--) {
      switch (m) {
      case 4:
      case 6:
      case 9:
      case 11:
        cnt += 30;
        break;
      case 2:
        cnt += 29;
        break;
      default:
        cnt += 31;
        break;
      }
    }
    cout << days[cnt % 7 - 1] << endl;
  }
}
Problem p00027 (C++) — buggy submission, verdict: Runtime Error

#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define PRINT(STR) cout << STR << endl;
#define REP(i, n) for (int(i) = 0; (i) < (int)(n); (i)++)
#define REG(i, a, b) for (int(i) = ((int)(a)); (i) < ((int)(b)); i++)
#define ALL(V) (V).begin(), (V).end()
#define SPACE " "

typedef long long ll;

using namespace std;

int nextInt() {
  int n = -1;
  cin >> n;
  return n;
}
double nextDouble() {
  double d = -1;
  cin >> d;
  return d;
}
ll nextll() {
  ll n = -1;
  cin >> n;
  return n;
}
string nextString() {
  string str;
  cin >> str;
  return str;
}

int INF = 1LL << 25;
double EPS = 1e-9;

// BEGIN //////////////////////////////////////////////////////////////
int main() {
  const int months[13] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
  const string answers[7] = {"Thursday", "Friday",  "Saturday", "Sunday",
                             "Monday",   "Tuesday", "Wednesday"};
  while (true) {
    int M = nextInt();
    int D = nextInt();
    if (M == 0)
      break;
    int past_days = -1;
    for (int i = 1; i < M; i++) {
      past_days += months[i];
    }
    past_days += D;
    PRINT(answers[past_days % 7]);
  }
  return 0;
}
// END   //////////////////////////////////////////////////////////////

Error: 0

Fixed submission:

#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define PRINT(STR) cout << STR << endl;
#define REP(i, n) for (int(i) = 0; (i) < (int)(n); (i)++)
#define REG(i, a, b) for (int(i) = ((int)(a)); (i) < ((int)(b)); i++)
#define ALL(V) (V).begin(), (V).end()
#define SPACE " "

typedef long long ll;

using namespace std;

int nextInt() {
  int n = -1;
  cin >> n;
  return n;
}
double nextDouble() {
  double d = -1;
  cin >> d;
  return d;
}
ll nextll() {
  ll n = -1;
  cin >> n;
  return n;
}
string nextString() {
  string str;
  cin >> str;
  return str;
}

int INF = 1LL << 25;
double EPS = 1e-9;

// BEGIN //////////////////////////////////////////////////////////////
int main() {
  const int months[13] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
  const string answers[7] = {"Thursday", "Friday",  "Saturday", "Sunday",
                             "Monday",   "Tuesday", "Wednesday"};
  while (true) {
    int M = nextInt();
    int D = nextInt();
    if (M == 0)
      break;
    int past_days = 0;
    for (int i = 1; i < M; i++) {
      past_days += months[i];
    }
    past_days += D;
    PRINT(answers[past_days % 7 - 1]);
  }
  return 0;
}
// END   //////////////////////////////////////////////////////////////
Problem p00027 (C++) — buggy submission, verdict: Runtime Error

#define _USE_MATH_DEFINES
#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;

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

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

int main() {
  for (int m, d; cin >> m >> d && m;) {
    while (m)
      d += b[--m];
    cout << a[(d - 1 + 3) % 7] << endl;
  }
  return 0;
}

Error: 0

Fixed submission:

#define _USE_MATH_DEFINES
#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;

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

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

int main() {
  for (int m, d; cin >> m >> d && m;) {
    while (m)
      d += b[--m];
    cout << a[d % 7 - 1 + 3] << endl;
  }
  return 0;
}
Problem p00027 (C++) — buggy submission, verdict: Runtime Error

#define _USE_MATH_DEFINES
#include <algorithm>
#include <cctype>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <math.h>
#include <queue>
#include <stack>
#include <string>
#include <vector>
using namespace std;

#define INF (1 << 20)
#define EPS (1e-10)
#define EQ(a, b) (fabs((a) - (b)) < EPS)

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

Error: 0

Fixed submission:

#define _USE_MATH_DEFINES
#include <algorithm>
#include <cctype>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <math.h>
#include <queue>
#include <stack>
#include <string>
#include <vector>
using namespace std;

#define INF (1 << 20)
#define EPS (1e-10)
#define EQ(a, b) (fabs((a) - (b)) < EPS)

int main() {
  int dn[13] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
  string youbi[7] = {"Monday", "Tuesday",  "Wednesday", "Thursday",
                     "Friday", "Saturday", "Sunday"};
  int m, d;
  while (cin >> m >> d) {
    if (m == 0)
      break;
    int sum = 0;
    for (int i = 1; i < m; ++i) {
      sum += dn[i];
    }
    sum += d;
    cout << youbi[sum % 7 + 2] << endl;
  }
  return 0;
}
Problem p00027 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
#include <string>
using namespace std;

int main() {
  string youbi[7] = {"Wednesday", "Thursday", "Friday", "Saturday",
                     "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 % 7] << endl;
  }
  return 0;
}

Error: WA

Fixed submission:

#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;
}
Problem p00028 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
using namespace std;

int main(void) {
  int n = 0, i, a[100], b[101] = {};
  while (cin >> i)
    a[n++] = i;
  for (int i = 0; i < n; ++i)
    ++b[a[i]];
  int max = 0;
  for (int i = 1; i <= 100; ++i)
    if (b[i] > max)
      max = b[i];

  for (int i = 1; i <= 100; ++i)
    if (max == b[i])
      cout << i << endl;

  return 0;
}


Error: WA

Fixed submission:

#include <iostream>
using namespace std;

int main(void) {
  int n = 0, i, a[100], b[100] = {};
  while (cin >> i)
    a[n++] = i;
  for (int i = 0; i < n; ++i)
    ++b[a[i]];
  int max = 0;
  for (int i = 1; i <= 100; ++i)
    if (b[i] > max)
      max = b[i];

  for (int i = 1; i <= 100; ++i)
    if (max == b[i])
      cout << i << endl;

  return 0;
}
Problem p00028 (C++) — buggy submission, verdict: Runtime Error

#include <algorithm>
#include <iostream>

using namespace std;

int main(void) {
  int t[100] = {0}, m = 0;
  while (1) {
    int n;
    cin >> n;
    if (cin.eof())
      break;
    t[n - 1]++;
    m = max(m, t[n - 1]);
  }
  for (int i = 0; i < 100; i++) {
    if (t[i] == m) {
      cout << (i + 1) << endl;
    }
  }
  return 0;
}

Error: 0

Fixed submission:

#include <algorithm>
#include <iostream>

using namespace std;

int main(void) {
  int t[10] = {0}, m = 0;
  while (1) {
    int n;
    cin >> n;
    if (cin.eof())
      break;
    t[n - 1]++;
    m = max(m, t[n - 1]);
  }
  for (int i = 0; i < 10; i++) {
    if (t[i] == m) {
      cout << (i + 1) << endl;
    }
  }
  return 0;
}
Problem p00028 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
#include <math.h>
#include <stdio.h>

using namespace std;

int main() {

  int counter[101] = {0};
  int a;
  int MAX = 0;
  int i = 0;

  while (cin >> a) {
    counter[a]++;
  }

  for (int j = 1; j < 101; j++) {
    MAX = max(MAX, counter[j]);
  }

  for (int k = 1; k < 101; k++) {
    if (MAX == counter[k]) {
      cout << k << endl;
    }
  }

  return 0;
}

Error: 0

Fixed submission:

#include <iostream>
#include <math.h>
#include <stdio.h>

using namespace std;

int main() {

  int counter[10] = {0};
  int a;
  int MAX = 0;
  int i = 0;

  while (cin >> a) {
    counter[a]++;
  }

  for (int j = 1; j < 10; j++) {
    MAX = max(MAX, counter[j]);
  }

  for (int k = 1; k < 10; k++) {
    if (MAX == counter[k]) {
      cout << k << endl;
    }
  }

  return 0;
}