prithivMLmods/Coder-Stat huggingface dataset:
Problem p02613 (C++)

Buggy submission (status: Runtime Error):
#include <stdio.h>
#include <string.h>

int main() {
  int N;
  char tmp;
  scanf("%d%c", &N, &tmp);

  int ac = 0, wa = 0, tle = 0, re = 0;
  char *s;
  for (int i = 0; i < N; i++) {
    fgets(s, 5, stdin);
    if (!strcmp(s, "AC\n"))
      ac++;
    if (!strcmp(s, "WA\n"))
      wa++;
    if (!strcmp(s, "TLE\n"))
      tle++;
    if (!strcmp(s, "RE\n"))
      re++;
  }

  printf("AC x %d\n", ac);
  printf("WA x %d\n", wa);
  printf("TLE x %d\n", tle);
  printf("RE x %d\n", re);

  return 0;
}

Fixed submission:
#include <stdio.h>
#include <string.h>

int main() {
  int N;
  char tmp;
  scanf("%d%c", &N, &tmp);

  int ac = 0, wa = 0, tle = 0, re = 0;
  char s[5];
  for (int i = 0; i < N; i++) {
    fgets(s, 5, stdin);
    if (!strcmp(s, "AC\n"))
      ac++;
    if (!strcmp(s, "WA\n"))
      wa++;
    if (!strcmp(s, "TLE\n"))
      tle++;
    if (!strcmp(s, "RE\n"))
      re++;
  }

  printf("AC x %d\n", ac);
  printf("WA x %d\n", wa);
  printf("TLE x %d\n", tle);
  printf("RE x %d\n", re);

  return 0;
}
Problem p02613 (Python)

Buggy submission (status: Runtime Error):
n = input()

s = [input() for _ in range(n)]

print("AC x ", s.count("AC"))
print("WA x ", s.count("WA"))
print("TLE x ", s.count("TLE"))
print("RE x ", s.count("RE"))


Fixed submission:
n = int(input())

s = [input() for _ in range(n)]

print("AC x ", s.count("AC"))
print("WA x ", s.count("WA"))
print("TLE x ", s.count("TLE"))
print("RE x ", s.count("RE"))
Problem p02613 (Python)

Buggy submission (status: Runtime Error):
N = int(input())
ac = 0
wa = 0
tle = 0
re = 0
while True:
    ia = input()
    if ia == "AC":
        ac += 1
    elif ia == "WA":
        wa += 1
    elif ia == "TLE":
        tle += 1
    elif ia == "RE":
        re += 1
    else:
        break

print(
    f"""\
AC x {ac}
WA x {wa}
TLE x {tle}
RE x {re}"""
)


Fixed submission:
N = int(input())
ac = 0
wa = 0
tle = 0
re = 0
for x in range(N):
    ia = input()
    if ia == "AC":
        ac += 1
    elif ia == "WA":
        wa += 1
    elif ia == "TLE":
        tle += 1
    elif ia == "RE":
        re += 1
    else:
        break

print(
    f"""\
AC x {ac}
WA x {wa}
TLE x {tle}
RE x {re}"""
)
Problem p02613 (Python)

Buggy submission (status: Runtime Error):
N = int(input())
a = [input() for i in range(N)]
c0 = a.count("AC")
c1 = a.count("WA")
c2 = a.count("TLE")
c3 = a.count("RE")
print("AC × " + c0)
print("WA × " + c1)
print("TLE × " + c2)
print("RE × " + c3)


Fixed submission:
N = int(input())
a = [input() for i in range(N)]
c0 = a.count("AC")
c1 = a.count("WA")
c2 = a.count("TLE")
c3 = a.count("RE")
print("AC x", c0)
print("WA x", c1)
print("TLE x", c2)
print("RE x", c3)
Problem p02613 (Python)

Buggy submission (status: Runtime Error):
n = int(input())
verdict = {"AC": 0, "WA": 0, "TLE": 0, "RE": 0}

for _ in range(n):
    S = input()
    verdict[S.upper()] += 1
for i, j in verdict:
    print(f"{i} x {j}")


Fixed submission:
n = int(input())
verdict = {"AC": 0, "WA": 0, "TLE": 0, "RE": 0}

for _ in range(n):
    S = input()
    verdict[S.upper()] += 1
for i, j in verdict.items():
    print(f"{i} x {j}")
Problem p02613 (Python)

Buggy submission (status: Runtime Error):
N, *s = map(open(0).read().split())
for v in ("AC", "WA", "TLE", "RE"):
    print("{} x {}".format(v, s.count(v)))


Fixed submission:
N = int(input())
s = [input() for i in range(N)]
for v in ("AC", "WA", "TLE", "RE"):
    print("{} x {}".format(v, s.count(v)))
Problem p02613 (C++)

Buggy submission (status: Runtime Error):
#include <iostream>

using namespace std;

int main() {
  string s[100];
  int i, n;
  int AC = 0, WA = 0, TLE = 0, RE = 0;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> s[i];
  }
  for (i = 0; i < n; i++) {
    if (s[i] == "AC") {
      AC += 1;
    } else if (s[i] == "WA") {
      WA += 1;
    } else if (s[i] == "TLE") {
      TLE += 1;
    } else if (s[i] == "RE") {
      RE += 1;
    }
  }
  cout << "AC"
       << " "
       << "x"
       << " " << AC << endl;
  cout << "WA"
       << " "
       << "x"
       << " " << WA << endl;
  cout << "TLE"
       << " "
       << "x"
       << " " << TLE << endl;
  cout << "RE"
       << " "
       << "x"
       << " " << RE << endl;

  return 0;
}

Fixed submission:
#include <iostream>

using namespace std;

int main() {
  string s[100001];
  int i, n;
  int AC = 0, WA = 0, TLE = 0, RE = 0;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> s[i];
  }
  for (i = 0; i < n; i++) {
    if (s[i] == "AC") {
      AC += 1;
    } else if (s[i] == "WA") {
      WA += 1;
    } else if (s[i] == "TLE") {
      TLE += 1;
    } else if (s[i] == "RE") {
      RE += 1;
    }
  }
  cout << "AC"
       << " "
       << "x"
       << " " << AC << endl;
  cout << "WA"
       << " "
       << "x"
       << " " << WA << endl;
  cout << "TLE"
       << " "
       << "x"
       << " " << TLE << endl;
  cout << "RE"
       << " "
       << "x"
       << " " << RE << endl;

  return 0;
}
Problem p02613 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <iostream>
#include <math.h>
#include <string>
typedef long long ll;
using namespace std;

int main() {
  int N;
  cin >> N;
  int ac = 0;
  int wa = 0;
  int tle = 0;
  int re = 0;
  string s[N];
  for (int i = 0; i < N; i++) {
    cin >> s[i];
  }
  for (int i = 0; i < N; i++) {
    if (s[i] == "AC")
      ac++;
    if (s[i] == "WA")
      wa++;
    if (s[i] == "TLE")
      tle++;
    if (s[i] == "RE")
      re++;
  }
  cout << "AC x " + ac << endl;
  cout << "WA x " + wa << endl;
  cout << "TLE x " + tle << endl;
  cout << "RE x " + re << endl;
}

Fixed submission:
#include <algorithm>
#include <iostream>
#include <math.h>
#include <string>
typedef long long ll;
using namespace std;

int main() {
  int N;
  cin >> N;
  int ac = 0;
  int wa = 0;
  int tle = 0;
  int re = 0;
  string s[N];
  for (int i = 0; i < N; i++) {
    cin >> s[i];
  }
  for (int i = 0; i < N; i++) {
    if (s[i] == "AC")
      ac++;
    if (s[i] == "WA")
      wa++;
    if (s[i] == "TLE")
      tle++;
    if (s[i] == "RE")
      re++;
  }
  cout << "AC x " << ac << endl;
  cout << "WA x " << wa << endl;
  cout << "TLE x " << tle << endl;
  cout << "RE x " << re << endl;
}
Problem p02613 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

int main() {
  int n;
  int ac, wa, tle, re;
  ac = wa = tle = re = 0;
  cin >> n;
  string s[10000];
  for (int i = 0; i < n; i++) {
    cin >> s[i];
    if (s[i] == "AC") {
      ac++;
    } else if (s[i] == "WA") {
      wa++;
    } else if (s[i] == "TLE") {
      tle++;
    } else if (s[i] == "RE") {
      re++;
    }
  }
  cout << "AC x " << ac << endl;
  cout << "WA x " << wa << endl;
  cout << "TLE x " << tle << endl;
  cout << "RE x " << re << endl;
}

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

int main() {
  int n;
  int ac, wa, tle, re;
  ac = wa = tle = re = 0;
  cin >> n;
  string s[100000];
  for (int i = 0; i < n; i++) {
    cin >> s[i];
    if (s[i] == "AC") {
      ac++;
    } else if (s[i] == "WA") {
      wa++;
    } else if (s[i] == "TLE") {
      tle++;
    } else if (s[i] == "RE") {
      re++;
    }
  }
  cout << "AC x " << ac << endl;
  cout << "WA x " << wa << endl;
  cout << "TLE x " << tle << endl;
  cout << "RE x " << re << endl;
}
Problem p02613 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>

using namespace std;

const int MOD = 1000000007;
const int MAX = 2147483647;
const double PI = 3.14159265358979323846;

int main() {
  int n;
  string a;
  int s[4];
  cin >> n;
  for (int i = 0; i < n; i++) {
    s[i] = 0;
  }
  for (int i = 0; i < n; i++) {
    cin >> a;
    if (a == "AC")
      s[0]++;
    if (a == "WA")
      s[1]++;
    if (a == "TLE")
      s[2]++;
    if (a == "RE")
      s[3]++;
  }

  cout << "AC x " << s[0] << endl;
  cout << "WA x " << s[1] << endl;
  cout << "TLE x " << s[2] << endl;
  cout << "RE x " << s[3] << endl;
}


Fixed submission:
#include <bits/stdc++.h>

using namespace std;

const int MOD = 1000000007;
const int MAX = 2147483647;
const double PI = 3.14159265358979323846;

int main() {
  int n;
  string a;
  int s[4];
  cin >> n;
  for (int i = 0; i < 4; i++) {
    s[i] = 0;
  }
  for (int i = 0; i < n; i++) {
    cin >> a;
    if (a == "AC")
      s[0]++;
    if (a == "WA")
      s[1]++;
    if (a == "TLE")
      s[2]++;
    if (a == "RE")
      s[3]++;
  }

  cout << "AC x " << s[0] << endl;
  cout << "WA x " << s[1] << endl;
  cout << "TLE x " << s[2] << endl;
  cout << "RE x " << s[3] << endl;
}
Problem p02613 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, AC, WA, TLE, RE;
  AC = WA = TLE = RE = 0;
  string S[10000];
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> S[i];
    if (S[i] == "AC")
      AC++;
    if (S[i] == "WA")
      WA++;
    if (S[i] == "TLE")
      TLE++;
    if (S[i] == "RE")
      RE++;
  }

  cout << "AC x " << AC << endl;
  cout << "WA x " << WA << endl;
  cout << "TLE x " << TLE << endl;
  cout << "RE x " << RE << endl;
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, AC, WA, TLE, RE;
  AC = WA = TLE = RE = 0;
  string S[100000];
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> S[i];
    if (S[i] == "AC")
      AC++;
    if (S[i] == "WA")
      WA++;
    if (S[i] == "TLE")
      TLE++;
    if (S[i] == "RE")
      RE++;
  }

  cout << "AC x " << AC << endl;
  cout << "WA x " << WA << endl;
  cout << "TLE x " << TLE << endl;
  cout << "RE x " << RE << endl;
  return 0;
}
Problem p02613 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

int main() {
  int N;
  cin >> N;

  vector<int> count(N, 0);
  for (int i = 0; i < N; i++) {
    string S;
    cin >> S;

    if (S == "AC") {
      count.at(0)++;
    } else if (S == "WA") {
      count.at(1)++;
    } else if (S == "TLE") {
      count.at(2)++;
    } else if (S == "RE") {
      count.at(3)++;
    }
  }

  printf("AC x %d\n", count.at(0));
  printf("WA x %d\n", count.at(1));
  printf("TLE x %d\n", count.at(2));
  printf("RE x %d\n", count.at(3));
}

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

int main() {
  int N;
  cin >> N;

  vector<int> count(4, 0);
  for (int i = 0; i < N; i++) {
    string S;
    cin >> S;

    if (S == "AC") {
      count.at(0)++;
    } else if (S == "WA") {
      count.at(1)++;
    } else if (S == "TLE") {
      count.at(2)++;
    } else if (S == "RE") {
      count.at(3)++;
    }
  }

  printf("AC x %d\n", count.at(0));
  printf("WA x %d\n", count.at(1));
  printf("TLE x %d\n", count.at(2));
  printf("RE x %d\n", count.at(3));
}
Problem p02613 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <iostream>
#include <math.h>
#include <string.h>
#include <string>
using namespace std;

void b_judge_status_summary(void) {
  int n;
  string s[10000];
  cin >> n;
  for (int i = 0; i < n; i++)
    cin >> s[i];
  int ac_cnt = 0;
  int wa_cnt = 0;
  int tle_cnt = 0;
  int re_cnt = 0;
  for (int i = 0; i < n; i++) {
    string ss = s[i];
    if (ss[0] == 'A')
      ac_cnt++;
    else if (ss[0] == 'W')
      wa_cnt++;
    else if (ss[0] == 'T')
      tle_cnt++;
    else
      re_cnt++;
  }

  cout << "AC x " << ac_cnt << endl;
  cout << "WA x " << wa_cnt << endl;
  cout << "TLE x " << tle_cnt << endl;
  cout << "RE x " << re_cnt << endl;
}

int main() {
  b_judge_status_summary();
  return 0;
}

Fixed submission:
#include <algorithm>
#include <iostream>
#include <math.h>
#include <string.h>
#include <string>
using namespace std;

void b_judge_status_summary(void) {
  int n;
  string s[100000];
  cin >> n;
  for (int i = 0; i < n; i++)
    cin >> s[i];
  int ac_cnt = 0;
  int wa_cnt = 0;
  int tle_cnt = 0;
  int re_cnt = 0;
  for (int i = 0; i < n; i++) {
    string ss = s[i];
    if (ss[0] == 'A')
      ac_cnt++;
    else if (ss[0] == 'W')
      wa_cnt++;
    else if (ss[0] == 'T')
      tle_cnt++;
    else
      re_cnt++;
  }

  cout << "AC x " << ac_cnt << endl;
  cout << "WA x " << wa_cnt << endl;
  cout << "TLE x " << tle_cnt << endl;
  cout << "RE x " << re_cnt << endl;
}

int main() {
  b_judge_status_summary();
  return 0;
}
Problem p02613 (C++)

Buggy submission (status: Runtime Error):
#include <cstdio>
#include <iostream>
#include <math.h>
using namespace std;
int main() {
  int n, w, a, t, r, i;
  t = r = a = w = 0;
  cin >> n;
  char s[10000][4];
  for (i = 0; i < n; i++) {
    scanf("%s", s[i]);
    if (s[i][0] == 'A') {
      a++;
    } else if (s[i][0] == 'W') {
      w++;
    } else if (s[i][0] == 'T') {
      t++;
    } else {
      r++;
    }
  }
  printf("AC x %d\n", a);
  printf("WA x %d\n", w);
  printf("TLE x %d\n", t);
  printf("RE x %d\n", r);
}

Fixed submission:
#include <cstdio>
#include <iostream>
#include <math.h>
using namespace std;
int main() {
  int n, w, a, t, r, i;
  t = r = a = w = 0;
  cin >> n;
  char s[n][4];
  for (i = 0; i < n; i++) {
    scanf("%s", s[i]);
    if (s[i][0] == 'A') {
      a++;
    } else if (s[i][0] == 'W') {
      w++;
    } else if (s[i][0] == 'T') {
      t++;
    } else {
      r++;
    }
  }
  printf("AC x %d\n", a);
  printf("WA x %d\n", w);
  printf("TLE x %d\n", t);
  printf("RE x %d\n", r);
}
Problem p02613 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>

using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pii;
typedef tuple<ll, ll, ll> ti;

#define REP(a, b, c) for (ll a = b; a < (c); a++)
#define PER(a, b, c) for (ll a = b; a >= (c); a--)

ll ii() {
  ll x;
  cin >> x;
  return x;
}
string is() {
  string x;
  cin >> x;
  return x;
}
ld id() {
  ld x;
  cin >> x;
  return x;
}
void oi(ll x) { cout << x; }
void od(ld x) { cout << fixed << setprecision(10) << x; }
void os(string x) { cout << x; }
void oe() { cout << endl; }
void oie(ll x) {
  oi(x);
  oe();
}
void ode(ld x) {
  od(x);
  oe();
}
void ose(string x) {
  os(x);
  oe();
}

ll mod = 1000000007;

int main() {
  vector<string> ss = {"AC", "WA", "TLE", "RE"};
  vector<ll> sm(4, 0);
  ll N = ii();
  REP(i, 0, N) {
    string s = is();
    REP(i, 0, 4) {
      if (ss[i] == s) {
        sm[i]++;
      }
    }
  }
  REP(i, 0, N) { cout << ss[i] << " x " << sm[i] << endl; }
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>

using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pii;
typedef tuple<ll, ll, ll> ti;

#define REP(a, b, c) for (ll a = b; a < (c); a++)
#define PER(a, b, c) for (ll a = b; a >= (c); a--)

ll ii() {
  ll x;
  cin >> x;
  return x;
}
string is() {
  string x;
  cin >> x;
  return x;
}
ld id() {
  ld x;
  cin >> x;
  return x;
}
void oi(ll x) { cout << x; }
void od(ld x) { cout << fixed << setprecision(10) << x; }
void os(string x) { cout << x; }
void oe() { cout << endl; }
void oie(ll x) {
  oi(x);
  oe();
}
void ode(ld x) {
  od(x);
  oe();
}
void ose(string x) {
  os(x);
  oe();
}

ll mod = 1000000007;

int main() {
  vector<string> ss = {"AC", "WA", "TLE", "RE"};
  vector<ll> sm(4, 0);
  ll N = ii();
  REP(i, 0, N) {
    string s = is();
    REP(i, 0, 4) {
      if (ss[i] == s) {
        sm[i]++;
      }
    }
  }
  REP(i, 0, 4) { cout << ss[i] << " x " << sm[i] << endl; }
  return 0;
}
Problem p02613 (C++)

Buggy submission (status: Runtime Error):
#include <iostream>
#include <map>

int main() {
  int n;
  std::cin >> n;
  std::map<std::string, int> mp;

  for (int i = 0; i < n; ++i) {
    std::string s;
    std::cin >> s;
    mp[s] += 1;
  }

  std::cout << "AC x " + mp["AC"] << '\n';
  std::cout << "WA x " + mp["WA"] << '\n';
  std::cout << "TLE x " + mp["TLE"] << '\n';
  std::cout << "RE x " + mp["RE"] << '\n';

  return 0;
}

Fixed submission:
#include <iostream>
#include <map>

int main() {
  int n;
  std::cin >> n;
  std::map<std::string, int> mp;

  for (int i = 0; i < n; ++i) {
    std::string s;
    std::cin >> s;
    mp[s] += 1;
  }

  std::cout << "AC x " << mp["AC"] << '\n';
  std::cout << "WA x " << mp["WA"] << '\n';
  std::cout << "TLE x " << mp["TLE"] << '\n';
  std::cout << "RE x " << mp["RE"] << '\n';

  return 0;
}
Problem p02613 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a;
  cin >> a;

  vector<string> vec(a);
  vector<int> ans(4);
  for (int i = 0; i < a; i++) {
    cin >> vec.at(i);
  }
  for (int i = 0; i < 4; i++) {
    if (vec.at(i) == "AC") {
      ans.at(0) += 1;
    } else if (vec.at(i) == "WA") {
      ans.at(1) += 1;
    } else if (vec.at(i) == "TLE") {
      ans.at(2) += 1;
    } else if (vec.at(i) == "RE") {
      ans.at(3) += 1;
    }
  }
  cout << "AC x " << ans.at(0) << endl;
  cout << "WA x " << ans.at(1) << endl;
  cout << "TLE x " << ans.at(2) << endl;
  cout << "RE x " << ans.at(3) << endl;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a;
  cin >> a;

  vector<string> vec(a);
  vector<int> ans(4);
  for (int i = 0; i < a; i++) {
    cin >> vec.at(i);
  }
  for (int i = 0; i < a; i++) {
    if (vec.at(i) == "AC") {
      ans.at(0) += 1;
    } else if (vec.at(i) == "WA") {
      ans.at(1) += 1;
    } else if (vec.at(i) == "TLE") {
      ans.at(2) += 1;
    } else if (vec.at(i) == "RE") {
      ans.at(3) += 1;
    }
  }
  cout << "AC x " << ans.at(0) << endl;
  cout << "WA x " << ans.at(1) << endl;
  cout << "TLE x " << ans.at(2) << endl;
  cout << "RE x " << ans.at(3) << endl;
}
Problem p02613 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
int main() {
  string s[100];
  int n, c1 = 0, c2 = 0, c3 = 0, c4 = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> s[i];
    if (s[i] == "AC")
      c1++;
    else if (s[i] == "WA")
      c2++;
    else if (s[i] == "TLE")
      c3++;
    else if (s[i] == "RE")
      c4++;
  }
  cout << "AC x " << c1 << endl
       << "WA x " << c2 << endl
       << "TLE x " << c3 << endl
       << "RE x " << c4 << endl;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  string s[100005];
  int n, c1 = 0, c2 = 0, c3 = 0, c4 = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> s[i];
    if (s[i] == "AC")
      c1++;
    else if (s[i] == "WA")
      c2++;
    else if (s[i] == "TLE")
      c3++;
    else if (s[i] == "RE")
      c4++;
  }
  cout << "AC x " << c1 << endl
       << "WA x " << c2 << endl
       << "TLE x " << c3 << endl
       << "RE x " << c4 << endl;
}
Problem p02613 (C++)

Buggy submission (status: Runtime Error):
/*
QUESTION    :

RULE        :

INPUT       :

OUTPUT      :
*/
/*
    int     :10^9
long long   :10^19
*/
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < (n); ++i)
#define repeq(i, a, n) for (int i = a; i <= (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  int n;
  cin >> n;
  string s;
  vector<int> c(n);
  rep(i, 0, n) {
    cin >> s;
    if (s == "AC") {
      c.at(0)++;
    }
    if (s == "WA") {
      c.at(1)++;
    }
    if (s == "TLE") {
      c.at(2)++;
    }
    if (s == "RE") {
      c.at(3)++;
    }
  }
  cout << "AC x " << c.at(0) << endl;
  cout << "WA x " << c.at(1) << endl;
  cout << "TLE x " << c.at(2) << endl;
  cout << "RE x " << c.at(3) << endl;

  return 0;
}

Fixed submission:
/*
QUESTION    :

RULE        :

INPUT       :

OUTPUT      :
*/
/*
    int     :10^9
long long   :10^19
*/
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < (n); ++i)
#define repeq(i, a, n) for (int i = a; i <= (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  int n;
  cin >> n;
  string s;
  vector<int> c(4);
  rep(i, 0, n) {
    cin >> s;
    if (s == "AC") {
      c.at(0)++;
    }
    if (s == "WA") {
      c.at(1)++;
    }
    if (s == "TLE") {
      c.at(2)++;
    }
    if (s == "RE") {
      c.at(3)++;
    }
  }
  cout << "AC x " << c.at(0) << endl;
  cout << "WA x " << c.at(1) << endl;
  cout << "TLE x " << c.at(2) << endl;
  cout << "RE x " << c.at(3) << endl;

  return 0;
}
Problem p02613 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <functional>
#include <iostream>
#include <string>
using namespace std;

#include <climits>
#include <iomanip>
#include <math.h>
#include <queue>
#include <vector>
using Graph = vector<vector<int>>;
const double PI = 3.14159265358979323846;

long long modpow(long long a, long long n, long long mod) {
  long long res = 1;
  while (n > 0) {
    if (n & 1)
      res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}

// 約数をベクトル形式で返す
vector<int> vect_yakusuu(int n) {
  vector<int> ret;
  for (int i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n)
        ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return ret;
}

int main() {

  long long N;
  string S[10100];
  int ans[5];

  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> S[i];
  }

  for (int i = 0; i < 4; i++) {
    ans[i] = 0;
  }

  for (int i = 0; i < N; i++) {
    if (S[i] == "AC") {
      ans[0]++;
    }
    if (S[i] == "WA") {
      ans[1]++;
    }
    if (S[i] == "TLE") {
      ans[2]++;
    }
    if (S[i] == "RE") {
      ans[3]++;
    }
  }

  cout << "AC x " << ans[0] << endl;
  cout << "WA x " << ans[1] << endl;
  cout << "TLE x " << ans[2] << endl;
  cout << "RE x " << ans[3] << endl;

  cin >> ans[0];

  return 0;
}

Fixed submission:
#include <algorithm>
#include <functional>
#include <iostream>
#include <string>
using namespace std;

#include <climits>
#include <iomanip>
#include <math.h>
#include <queue>
#include <vector>
using Graph = vector<vector<int>>;
const double PI = 3.14159265358979323846;

long long modpow(long long a, long long n, long long mod) {
  long long res = 1;
  while (n > 0) {
    if (n & 1)
      res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}

// 約数をベクトル形式で返す
vector<int> vect_yakusuu(int n) {
  vector<int> ret;
  for (int i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n)
        ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return ret;
}

int main() {

  long long N;
  string S[100100];
  int ans[5];

  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> S[i];
  }

  for (int i = 0; i < 4; i++) {
    ans[i] = 0;
  }

  for (int i = 0; i < N; i++) {
    if (S[i] == "AC") {
      ans[0]++;
    }
    if (S[i] == "WA") {
      ans[1]++;
    }
    if (S[i] == "TLE") {
      ans[2]++;
    }
    if (S[i] == "RE") {
      ans[3]++;
    }
  }

  cout << "AC x " << ans[0] << endl;
  cout << "WA x " << ans[1] << endl;
  cout << "TLE x " << ans[2] << endl;
  cout << "RE x " << ans[3] << endl;

  cin >> ans[0];

  return 0;
}
Problem p02613 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a = 0, b = 0, c = 0, d = 0, N;
  cin >> N;
  vector<string> vec(N);
  for (int i = 0; i < N; i++) {
    cin >> vec.at(i);
    if (vec.at(i) == "AC") {
      a += 1;
      continue;
    } else if (vec.at(i) == "WA") {
      b += 1;
      continue;
    } else if (vec.at(i) == "TLE") {
      c += 1;
      continue;
    } else {
      d += 1;
      continue;
    }
  }
  cout << "AC x " + a << endl;
  cout << "WA x " + b << endl;
  cout << "TLE x " + c << endl;
  cout << "RE x " + d << endl;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a = 0, b = 0, c = 0, d = 0, N;
  cin >> N;
  vector<string> vec(N);
  for (int i = 0; i < N; i++) {
    cin >> vec.at(i);
    if (vec.at(i) == "AC") {
      a += 1;
      continue;
    } else if (vec.at(i) == "WA") {
      b += 1;
      continue;
    } else if (vec.at(i) == "TLE") {
      c += 1;
      continue;
    } else {
      d += 1;
      continue;
    }
  }
  cout << "AC x " << a << endl;
  cout << "WA x " << b << endl;
  cout << "TLE x " << c << endl;
  cout << "RE x " << d << endl;
}
Problem p02613 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

int main() {
  int N;
  cin >> N;
  vector<string> result;
  for (int i = 0; i < N; i++) {
    cin >> result.at(i);
  }
  int a, b, c, d;
  a = 0;
  b = 0;
  c = 0;
  d = 0;
  for (int i = 0; i < N; i++) {
    if (result.at(i) == "AC") {
      a++;
    } else if (result.at(i) == "WA") {
      b++;
    } else if (result.at(i) == "TLE") {
      c++;
    } else {
      d++;
    }
  }
  cout << "AC x " << a << endl;
  cout << "WA x " << b << endl;
  cout << "TLE x " << c << endl;
  cout << "RE x " << d << endl;
}


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

int main() {
  int N;
  cin >> N;
  vector<string> result(N);
  for (int i = 0; i < N; i++) {
    cin >> result.at(i);
  }
  int a, b, c, d;
  a = 0;
  b = 0;
  c = 0;
  d = 0;
  for (int i = 0; i < N; i++) {
    if (result.at(i) == "AC") {
      a++;
    } else if (result.at(i) == "WA") {
      b++;
    } else if (result.at(i) == "TLE") {
      c++;
    } else {
      d++;
    }
  }
  cout << "AC x " << a << endl;
  cout << "WA x " << b << endl;
  cout << "TLE x " << c << endl;
  cout << "RE x " << d << endl;
}
Problem p02613 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
#define V(i) vector<i>
#define rep(i, n) for (__typeof(n) i = 0; i < n; i++)
#define crep(i, N, n) for (__typeof(n) i = N; i < n; i++)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define P(i, j) pair<i, j>
#define MP make_pair
#define MOD 1000000007
typedef long long ll;
typedef long l;
#define fio                                                                    \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(NULL);                                                               \
  cout.tie(NULL)
int main() {
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
  ll n;
  cin >> n;
  map<string, ll> mp;
  rep(i, n) {
    string s;
    cin >> s;
    mp[s]++;
  }
  cout << "AC x " << mp["AC"] << "\n";
  cout << "WA x " << mp["WA"] << "\n";
  cout << "TLE x " << mp["TLE"] << "\n";
  cout << "RE x " << mp["RE"] << "\n";

  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
#define V(i) vector<i>
#define rep(i, n) for (__typeof(n) i = 0; i < n; i++)
#define crep(i, N, n) for (__typeof(n) i = N; i < n; i++)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define P(i, j) pair<i, j>
#define MP make_pair
#define MOD 1000000007
typedef long long ll;
typedef long l;
#define fio                                                                    \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(NULL);                                                               \
  cout.tie(NULL)
int main() {
  // freopen("input.txt", "r", stdin);
  // freopen("output.txt", "w", stdout);
  ll n;
  cin >> n;
  map<string, ll> mp;
  rep(i, n) {
    string s;
    cin >> s;
    mp[s]++;
  }
  cout << "AC x " << mp["AC"] << "\n";
  cout << "WA x " << mp["WA"] << "\n";
  cout << "TLE x " << mp["TLE"] << "\n";
  cout << "RE x " << mp["RE"] << "\n";

  return 0;
}
Problem p02613 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
#define FASTIO                                                                 \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(0);
using namespace std;
using ii = pair<int, int>;
using ll = long long int;

int a, b, c, d;

int main() {
  FASTIO;
  int T;
  cin >> T;
  while (1) {
    string s;
    cin >> s;
    if (s == "AC")
      a++;
    else if (s == "WA")
      b++;
    else if (s == "TLE")
      c++;
    else
      d++;
  }

  cout << "AC x " << a << endl;
  cout << "WA x " << b << endl;
  cout << "TLE x " << c << endl;
  cout << "RE x " << d << endl;
  return 0;
}


Fixed submission:
#include <bits/stdc++.h>
#define FASTIO                                                                 \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(0);
using namespace std;
using ii = pair<int, int>;
using ll = long long int;

int a, b, c, d;

int main() {
  FASTIO;
  int T;
  cin >> T;
  while (T--) {
    string s;
    cin >> s;
    if (s == "AC")
      a++;
    else if (s == "WA")
      b++;
    else if (s == "TLE")
      c++;
    else
      d++;
  }

  cout << "AC x " << a << endl;
  cout << "WA x " << b << endl;
  cout << "TLE x " << c << endl;
  cout << "RE x " << d << endl;
  return 0;
}
Problem p02613 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

int main() {
  int N;
  cin >> N;
  string S;
  int A = 0, W = 0, T = 0, R = 0;
  for (int i = 0; i < N; i++) {
    cin >> S;
    if (S == "AC")
      A++;
    else if (S == "WA")
      W++;
    else if (S == "TLE")
      T++;
    else if (S == "RE")
      R++;
  }
  cout << "AC x " + A << endl;
  cout << "WA x " + W << endl;
  cout << "TLE x " + T << endl;
  cout << "RE x " + R << endl;
}

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

int main() {
  int N;
  cin >> N;
  string S;
  int A = 0, W = 0, T = 0, R = 0;
  for (int i = 0; i < N; i++) {
    cin >> S;
    if (S == "AC")
      A++;
    else if (S == "WA")
      W++;
    else if (S == "TLE")
      T++;
    else if (S == "RE")
      R++;
  }
  cout << "AC x " << A << endl;
  cout << "WA x " << W << endl;
  cout << "TLE x " << T << endl;
  cout << "RE x " << R << endl;
}
Problem p02613 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
#define Vsort(a) sort(a.bigin(), a.end())
#define rep(i, n) for (int i = 0; i < (n); i++)

using namespace std;
using ll = long long;

int main() {
  int n, ac = 0, wa = 0, tle = 0, re = 0;
  cin >> n;
  vector<string> s(n);
  for (int i = 0; i < n; i++) {
    cin >> s[i];
    if (s[i] == "AC") {
      ac++;
    } else if (s[i] == "WA") {
      wa++;
    } else if (s[i] == "TLE") {
      tle++;
    } else {
      re++;
    }
  }
  cout << "AC × " + ac << endl;
  cout << "WA × " + wa << endl;
  cout << "TLE × " + tle << endl;
  cout << "RE × " + re << endl;
  return 0;
}


Fixed submission:
#include <bits/stdc++.h>
#define Vsort(a) sort(a.bigin(), a.end())
#define rep(i, n) for (int i = 0; i < (n); i++)

using namespace std;
using ll = long long;

int main() {
  int n, ac = 0, wa = 0, tle = 0, re = 0;
  cin >> n;
  vector<string> s(n);
  for (int i = 0; i < n; i++) {
    cin >> s[i];
    if (s[i] == "AC") {
      ac++;
    } else if (s[i] == "WA") {
      wa++;
    } else if (s[i] == "TLE") {
      tle++;
    } else {
      re++;
    }
  }
  cout << "AC x " << ac << endl;
  cout << "WA x " << wa << endl;
  cout << "TLE x " << tle << endl;
  cout << "RE x " << re << endl;
  return 0;
}
Problem p02613 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
#define ll long long
#define db double
using namespace std;
map<string, int> mp;
int n;
string s;
int main() {
  cin >> n;
  while (n--)
    cin >> s, mp[s]++;
  cout << "AC x " + mp["AC"] << endl;
  cout << "WA x " + mp["WA"] << endl;
  cout << "TLE x " + mp["TLE"] << endl;
  cout << "RE x " + mp["RE"] << endl;
  return 0;
}


Fixed submission:
#include <bits/stdc++.h>
#define ll long long
#define db double
using namespace std;
map<string, int> mp;
int n;
string s;
int main() {
  cin >> n;
  while (n--)
    cin >> s, mp[s]++;
  cout << "AC x " << mp["AC"] << endl;
  cout << "WA x " << mp["WA"] << endl;
  cout << "TLE x " << mp["TLE"] << endl;
  cout << "RE x " << mp["RE"] << endl;
  return 0;
}
Problem p02613 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  string s;
  vector<int> a(4, 0);
  while (n--) {
    cin >> s;
    if (s == "AC")
      a[0]++;
    else if (s == "WA")
      a[1]++;
    else if (s == "TLE")
      a[2]++;
    else
      a[3]++;
  }
  cout << "AC x " << a[0] << '\n';
  cout << "WA x " << a[1] << '\n';
  cout << "TLE x " << a[2] << '\n';
  cout << "RE x " << a[3] << '\n';
  return 1;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  string s;
  vector<int> a(4, 0);
  while (n--) {
    cin >> s;
    if (s == "AC")
      a[0]++;
    else if (s == "WA")
      a[1]++;
    else if (s == "TLE")
      a[2]++;
    else
      a[3]++;
  }
  cout << "AC x " << a[0] << '\n';
  cout << "WA x " << a[1] << '\n';
  cout << "TLE x " << a[2] << '\n';
  cout << "RE x " << a[3] << '\n';
  return 0;
}
Problem p02614 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;

int main() {
  int h, w, k;
  cin >> h >> w >> k;

  vector<char> a(h * w);
  for (int i = 0; i < h * w; i++)
    cin >> a[i];

  vector<char> reset(h * w);
  for (int i = 0; i < h * w; i++)
    reset[i] = a[i];

  int count = 0;
  int ans = 0;

  for (int bit = 0; bit < (1 << h); bit++) {

    for (int bitw = 0; bitw < (1 << w); bitw++) {

      for (int i = 0; i < h; i++) {
        if (bit & (1 << i)) {
          for (int j = w * i; j < w * (i + 1); j++)
            a[j] = 'R';
        }
      }

      for (int i = 0; i < w; i++) {
        if (bitw & (1 << i)) {
          for (int j = i - 1; j <= h * w - 1; j += w)
            a[j] = 'R';
        }
      }

      for (int i = 0; i < h * w; i++) {
        if (a[i] == '#')
          count++;
      }
      if (count == k)
        ans++;
      count = 0;

      for (int i = 0; i < h * w; i++)
        a[i] = reset[i];
    }
  }

  cout << ans << endl;

  return 0;
}


Fixed submission:
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;

int main() {
  int h, w, k;
  cin >> h >> w >> k;

  vector<char> a(h * w);
  for (int i = 0; i < h * w; i++)
    cin >> a[i];

  vector<char> reset(h * w);
  for (int i = 0; i < h * w; i++)
    reset[i] = a[i];

  int count = 0;
  int ans = 0;

  for (int bit = 0; bit < (1 << h); bit++) {

    for (int bitw = 0; bitw < (1 << w); bitw++) {

      for (int i = 0; i < h; i++) {
        if (bit & (1 << i)) {
          for (int j = w * i; j < w * (i + 1); j++)
            a[j] = 'R';
        }
      }

      for (int i = 0; i < w; i++) {
        if (bitw & (1 << i)) {
          for (int j = i; j <= h * w; j += w)
            a[j] = 'R';
        }
      }

      for (int i = 0; i < h * w; i++) {
        if (a[i] == '#')
          count++;
      }
      if (count == k)
        ans++;
      count = 0;

      for (int i = 0; i < h * w; i++)
        a[i] = reset[i];
    }
  }

  cout << ans << endl;

  return 0;
}
Problem p02614 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
using i64 = int_fast64_t;

#define INF (i64)1e18
#define MOD (i64)(1e9 + 7)
#define REP(i, n) for (i64 i = 0; i < n; i++)
#define RANGE(i, a, b) for (i64 i = a; i < b; i++)
#define EACH(v, e, p) for_each(v.begin(), v.end(), [](auto &e) p)

int main() {
  int h, w, k;
  cin >> h >> w >> k;

  vector<vector<bool>> c(h, vector<bool>(w));
  REP(i, h) {
    string s;
    cin >> s;
    REP(j, w) { c[i][j] = s[j] == '#'; }
  }

  int ans = 0;
  for (int wbit = 0; wbit < (1 << w); ++wbit) {
    for (int hbit = 0; hbit < (1 << h); ++hbit) {
      int count = 0;
      for (int i = 0; i < w; i++) {
        for (int j = 0; j < h; j++) {
          if ((wbit & (1 << i)) && (hbit & (1 << j))) {
            if (c[i][j])
              count++;
          }
        }
      }
      if (count == k)
        ans++;
    }
  }
  cout << ans << endl;

  return 0;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
using i64 = int_fast64_t;

#define INF (i64)1e18
#define MOD (i64)(1e9 + 7)
#define REP(i, n) for (i64 i = 0; i < n; i++)
#define RANGE(i, a, b) for (i64 i = a; i < b; i++)
#define EACH(v, e, p) for_each(v.begin(), v.end(), [](auto &e) p)

int main() {
  int h, w, k;
  cin >> h >> w >> k;

  vector<vector<bool>> c(h, vector<bool>(w));
  REP(i, h) {
    string s;
    cin >> s;
    REP(j, w) { c[i][j] = s[j] == '#'; }
  }

  int ans = 0;
  for (int wbit = 0; wbit < (1 << w); ++wbit) {
    for (int hbit = 0; hbit < (1 << h); ++hbit) {
      int count = 0;
      for (int i = 0; i < w; i++) {
        for (int j = 0; j < h; j++) {
          if ((wbit & (1 << i)) && (hbit & (1 << j))) {
            if (c[j][i])
              count++;
          }
        }
      }
      if (count == k)
        ans++;
    }
  }
  cout << ans << endl;

  return 0;
}
Problem p02614 (C++)

Buggy submission (status: Runtime Error):
#include <iostream>
#include <vector>

int main() {
  int H, W, K;
  std::cin >> H >> W >> K;

  std::vector<std::vector<char>> c(W, std::vector<char>(H, 0));
  int blackCount = 0;
  std::vector<int> hBlackCount(H, 0);
  std::vector<int> vBlackCount(W, 0);
  for (int i = 0; i != H; i++) {
    for (int j = 0; j != W; j++) {
      std::cin >> c[i][j];
      if (c[i][j] == '#') {
        blackCount++;
        hBlackCount[i]++;
        vBlackCount[j]++;
      }
    }
  }

  int result = 0;
  for (int hBit = 0; hBit != 1 << H; hBit++) {
    std::vector<int> horizontal;
    for (int i = 0; i != H; i++) {
      if (hBit & (1 << i)) {
        horizontal.push_back(i);
      }
    }

    int black = blackCount;
    for (auto e : horizontal)
      black -= hBlackCount[e];

    for (int vBit = 0; vBit != 1 << W; vBit++) {
      std::vector<int> vertical;
      for (int j = 0; j != W; j++) {
        if (vBit & (1 << j)) {
          vertical.push_back(j);
        }
      }

      int black2 = black;
      for (auto e : vertical) {
        black2 -= vBlackCount[e];

        for (auto e2 : horizontal) {
          if (c[e2][e] == '#') {
            black2++;
          }
        }
      }

      if (black2 == K) {
        result++;
      }
    }
  }

  std::cout << result << std::endl;

  return 0;
}

Fixed submission:
#include <iostream>
#include <vector>

int main() {
  int H, W, K;
  std::cin >> H >> W >> K;

  std::vector<std::vector<char>> c(H, std::vector<char>(W, 0));
  int blackCount = 0;
  std::vector<int> hBlackCount(H, 0);
  std::vector<int> vBlackCount(W, 0);
  for (int i = 0; i != H; i++) {
    for (int j = 0; j != W; j++) {
      std::cin >> c[i][j];
      if (c[i][j] == '#') {
        blackCount++;
        hBlackCount[i]++;
        vBlackCount[j]++;
      }
    }
  }

  int result = 0;
  for (int hBit = 0; hBit != 1 << H; hBit++) {
    std::vector<int> horizontal;
    for (int i = 0; i != H; i++) {
      if (hBit & (1 << i)) {
        horizontal.push_back(i);
      }
    }

    int black = blackCount;
    for (auto e : horizontal)
      black -= hBlackCount[e];

    for (int vBit = 0; vBit != 1 << W; vBit++) {
      std::vector<int> vertical;
      for (int j = 0; j != W; j++) {
        if (vBit & (1 << j)) {
          vertical.push_back(j);
        }
      }

      int black2 = black;
      for (auto e : vertical) {
        black2 -= vBlackCount[e];

        for (auto e2 : horizontal) {
          if (c[e2][e] == '#') {
            black2++;
          }
        }
      }

      if (black2 == K) {
        result++;
      }
    }
  }

  std::cout << result << std::endl;

  return 0;
}
Problem p02614 (C++)

Buggy submission (status: Runtime Error):
#include <iostream>

int main() {
  int h, w, k, count = 0;
  std::cin >> h >> w >> k;
  char c[w + 1][h + 1];
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      std::cin >> c[i][j];
    }
  }

  for (int maskH = 0; maskH < (1 << h); maskH++) { // bit全探索 '1'の行を塗る
    for (int maskW = 0; maskW < (1 << w); maskW++) {
      int black = 0;
      for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
          if (((maskH >> i) & 1) == 1) {
            continue;
          } // i行目が赤なら飛ばす
          if (((maskW >> j) & 1) == 1) {
            continue;
          }
          if (c[i][j] == '#') {
            black++;
          }
        }
      }
      if (black == k) {
        count++;
      }
    }
  }

  std::cout << count << std::endl;

  return 0;
}


Fixed submission:
#include <iostream>

int main() {
  int h, w, k, count = 0;
  std::cin >> h >> w >> k;
  char c[100][100];
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      std::cin >> c[i][j];
    }
  }

  for (int maskH = 0; maskH < (1 << h); maskH++) { // bit全探索 '1'の行を塗る
    for (int maskW = 0; maskW < (1 << w); maskW++) {
      int black = 0;
      for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
          if (((maskH >> i) & 1) == 1) {
            continue;
          } // i行目が赤なら飛ばす
          if (((maskW >> j) & 1) == 1) {
            continue;
          }
          if (c[i][j] == '#') {
            black++;
          }
        }
      }
      if (black == k) {
        count++;
      }
    }
  }

  std::cout << count << std::endl;

  return 0;
}
Problem p02614 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
#define boost                                                                  \
  ios::sync_with_stdio(false);                                                 \
  cin.tie(0)
#define ll long long int
#define ld long double
#define mk make_pair
#define pb push_back
#define f first
#define s second
#define fo(i, a, b) for (i = a; i < b; i++)
#define foe(i, a, b) for (i = a; i <= b; i++)
#define all(x) x.begin(), x.end()
// #define vi               vector<int>
#define vl vector<long long int>
// #define pii          pair <int,int>
#define pll pair<long long int, long long int>
// #define vpii         vector< pair<int,int> >
#define vpll vector<pair<long long int, long long int>>
#define MOD 1000000007
using namespace std;
const int inf = INT_MAX;
const ll inf64 = LLONG_MAX;

char arr[6][6];
ll ans;
ll h, w, k;
ll work(ll a, ll b) {
  char temp[h][w];
  ll i, j;
  fo(i, 0, h) { fo(j, 0, w) temp[i][j] = arr[i][j]; }
  fo(i, 0, h) {
    if (a & (1 << i)) {
      fo(j, 0, w) temp[i][j] = '.';
    }
  }
  fo(i, 0, w) {
    if (b & (1 << i)) {
      fo(j, 0, h) temp[j][i] = '.';
    }
  }
  ll cnt = 0;
  fo(i, 0, h) {
    fo(j, 0, w) {
      if (temp[i][j] == '#')
        cnt++;
    }
  }
  if (cnt == k)
    ans++;
}

int main() {
  boost;
  cin >> h >> w >> k;
  ll i, j;
  fo(i, 0, h) fo(j, 0, w) cin >> arr[i][j];
  fo(i, 0, (1 << h)) {
    fo(j, 0, (1 << w)) { work(i, j); }
  }
  cout << ans;
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
#define boost                                                                  \
  ios::sync_with_stdio(false);                                                 \
  cin.tie(0)
#define ll long long int
#define ld long double
#define mk make_pair
#define pb push_back
#define f first
#define s second
#define fo(i, a, b) for (i = a; i < b; i++)
#define foe(i, a, b) for (i = a; i <= b; i++)
#define all(x) x.begin(), x.end()
// #define vi               vector<int>
#define vl vector<long long int>
// #define pii          pair <int,int>
#define pll pair<long long int, long long int>
// #define vpii         vector< pair<int,int> >
#define vpll vector<pair<long long int, long long int>>
#define MOD 1000000007
using namespace std;
const int inf = INT_MAX;
const ll inf64 = LLONG_MAX;

char arr[6][6];
ll ans;
ll h, w, k;
void work(ll a, ll b) {
  char temp[h][w];
  ll i, j;
  fo(i, 0, h) { fo(j, 0, w) temp[i][j] = arr[i][j]; }
  fo(i, 0, h) {
    if (a & (1 << i)) {
      fo(j, 0, w) temp[i][j] = '.';
    }
  }
  fo(i, 0, w) {
    if (b & (1 << i)) {
      fo(j, 0, h) temp[j][i] = '.';
    }
  }
  ll cnt = 0;
  fo(i, 0, h) {
    fo(j, 0, w) {
      if (temp[i][j] == '#')
        cnt++;
    }
  }
  if (cnt == k)
    ans++;
}

int main() {
  boost;
  cin >> h >> w >> k;
  ll i, j;
  fo(i, 0, h) fo(j, 0, w) cin >> arr[i][j];
  fo(i, 0, (1 << h)) {
    fo(j, 0, (1 << w)) { work(i, j); }
  }
  cout << ans;
  return 0;
}
Problem p02614 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
using namespace std;
using ll = unsigned long long;
using p = pair<int, int>;

int main() {
  int H, W, K;
  cin >> H >> W >> K;

  vector<vector<int>> m(W, vector<int>(H));

  const int black = 1;

  rep(y, 0, H) {
    string s;
    cin >> s;
    rep(x, 0, W) {
      char c = s[x];
      if (c == '#') {
        m[y][x] = black;
      }
    }
  }
  int ans = 0;
  rep(j, 0, 1 << H) {
    rep(i, 0, 1 << W) {
      int count = 0;
      rep(y, 0, H) {
        rep(x, 0, W) {
          if ((j >> y) & 1)
            continue;
          if ((i >> x) & 1)
            continue;

          if (m[y][x] == black)
            ++count;
        }
      }
      if (count == K) {
        ++ans;
      }
    }
  }

  cout << ans << endl;
  return 0;
}


Fixed submission:
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
using namespace std;
using ll = unsigned long long;
using p = pair<int, int>;

int main() {
  int H, W, K;
  cin >> H >> W >> K;

  vector<vector<int>> m(H, vector<int>(W));

  const int black = 1;

  rep(y, 0, H) {
    string s;
    cin >> s;
    rep(x, 0, W) {
      char c = s[x];
      if (c == '#') {
        m[y][x] = black;
      }
    }
  }
  int ans = 0;
  rep(j, 0, 1 << H) {
    rep(i, 0, 1 << W) {
      int count = 0;
      rep(y, 0, H) {
        rep(x, 0, W) {
          if ((j >> y) & 1)
            continue;
          if ((i >> x) & 1)
            continue;

          if (m[y][x] == black)
            ++count;
        }
      }
      if (count == K) {
        ++ans;
      }
    }
  }

  cout << ans << endl;
  return 0;
}
Problem p02614 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
int main(int argc, char const *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(0);
  int h, w, k;
  cin >> h >> w >> k;
  string grid[h];
  for (int i = 0; i < h; i++)
    cin >> grid[i];
  int res = 0;
  for (int mask = 0; mask < (1 << (h + w)); mask++) {
    int cnt = 0;
    for (int col = 0; col < w; col++) {
      for (int row = 0; row < h; row++) {
        if (grid[col][row] != '#')
          continue;
        if ((mask & ((1 << col) | (1 << (w + row)))) != 0)
          continue;
        cnt++;
      }
    }
    if (cnt == k)
      res++;
  }
  cout << res << endl;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
int main(int argc, char const *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(0);
  int h, w, k;
  cin >> h >> w >> k;
  string grid[h];
  for (int i = 0; i < h; i++)
    cin >> grid[i];
  int res = 0;
  for (int mask = 0; mask < (1 << (h + w)); mask++) {
    int cnt = 0;
    for (int col = 0; col < w; col++) {
      for (int row = 0; row < h; row++) {
        if (grid[row][col] != '#')
          continue;
        if ((mask & ((1 << col) | (1 << (w + row)))) != 0)
          continue;
        cnt++;
      }
    }
    if (cnt == k)
      res++;
  }
  cout << res << endl;
}
Problem p02614 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;

#define rep(i, n) for (int i = 0; i < (n); ++i)

int main() {
  int h, w, k;
  cin >> h >> w >> k;
  vector<string> s(h);
  rep(i, h) cin >> s[i];

  int ans = 0;
  rep(is, 1 << h) rep(js, 1 << w) {
    int cnt = 0;
    rep(i, h) rep(j, w) {
      if (is >> i & 1)
        continue;
      if (js >> j & 1)
        continue;
      if ('#' == s[is][js])
        ++cnt;
    }
    if (k == cnt)
      ++ans;
  }
  cout << ans << endl;
  return 0;
}

Fixed submission:
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;

#define rep(i, n) for (int i = 0; i < (n); ++i)

int main() {
  int h, w, k;
  cin >> h >> w >> k;
  vector<string> s(h);
  rep(i, h) cin >> s[i];

  int ans = 0;
  rep(is, 1 << h) rep(js, 1 << w) {
    int cnt = 0;
    rep(i, h) rep(j, w) {
      if (is >> i & 1)
        continue;
      if (js >> j & 1)
        continue;
      if ('#' == s[i][j])
        ++cnt;
    }
    if (k == cnt)
      ++ans;
  }
  cout << ans << endl;
  return 0;
}