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

#include <bits/stdc++.h>

using namespace std;

int main() {

  int n;
  map<string, int> a;

  cin >> n;

  for (size_t i = 0; i < n; i++) {
    string s;
    cin >> s;
    a[s]++;
  }

  cout << "AC x " << a["AC"] << "\\n"
       << "WA x " << a["WA"] << "\\n"
       << "TLE x " << a["TLE"] << "\\n"
       << "RE x " << a["RE"];

  return 0;
}

Error: WA

Fixed submission:

#include <iostream>
#include <string>

using namespace std;

int main() {
  int arr_size, AC_count = 0, WA_count = 0, TLE_count = 0, RE_count = 0;
  string array[100], in;
  cin >> arr_size;
  for (int i = 0; i < arr_size; i++) {
    cin >> array[i];
    if (array[i] == "AC")
      AC_count++;
    else if (array[i] == "WA")
      WA_count++;
    else if (array[i] == "TLE")
      TLE_count++;
    else if (array[i] == "RE")
      RE_count++;
  }
  cout << "AC X " << AC_count << endl
       << "WE X " << WA_count << endl
       << "TLE X " << TLE_count << endl
       << "AC X " << RE_count << endl;
}
Problem p02613 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
int main() {
  int ac = 0, wa = 0, tle = 0, re = 0;
  int n;
  cin >> n;
  while (n) {
    string s;
    cin >> s;
    if (s == "AC")
      ac++;
    else if (s == "WA")
      wa++;
    else if (s == "TLE")
      tle++;
    else
      re++;
    n--;
  }
  cout << "AC x " << ac << endl;
  cout << "WA x " << wa << endl;
  cout << "TLE x " << tle << endl;
  cout << "RE x " << re << endl;
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
int main() {
  int ac = 0, wa = 0, tle = 0, re = 0;
  int n;
  cin >> n;
  while (n) {
    string s;
    cin >> s;
    if (s == "AC")
      ac++;
    else if (s == "WA")
      wa++;
    else if (s == "TLE")
      tle++;
    else
      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, verdict: Runtime Error

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

int main() {
  int n;
  int ac = 0, wa = 0, tle = 0, re = 0;
  cin >> n;

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

Error: WA

Fixed submission:

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

int main() {
  int n;
  int ac = 0, wa = 0, tle = 0, re = 0;
  cin >> n;

  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 × " + ac << endl;
  cout << "WA × " + wa << endl;
  cout << "TLE × " + tle << endl;
  cout << "RE × " + re << endl;
}
Problem p02613 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
#define endl '\\n';

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

Error: -6
terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc


Fixed submission:

#include <iostream>
#include <string>
using namespace std;
int main() {
  string ac = "AC";
  string WA = "WA";
  string TLE = "TLE";
  string RE = "RE";
  int n, a = 0, w = 0, t = 0, r = 0;
  string *ar = new string[n];
  cin >> n;
  for (int i = 0; i < n; i++)
    cin >> ar[i];
  for (int i = 0; i < n; i++) {
    if (ar[i] == "AC") {
      a++;
    } else if (ar[i] == "WA") {
      w++;
    } else if (ar[i] == "TLE") {
      t++;
    } else if (ar[i] == "RE") {
      r++;
    }
  }
  cout << ac << " "
       << "x"
       << " " << a << endl;
  cout << WA << " "
       << "x"
       << " " << w << endl;
  cout << TLE << " "
       << "x"
       << " " << t << endl;
  cout << RE << " "
       << "x"
       << " " << r << endl;
  return 0;
}
Problem p02613 (C++) — buggy submission, verdict: Runtime Error

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

int main() {
  int N;
  cin >> N;
  string s[4] = {"AC", "WA", "TLE", "RE"};
  int c[4] = {0, 0, 0, 0};
  while (N--) {
    string x;
    cin >> x;
    if (x == s[1])
      c[1]++;
    else if (x == s[0])
      c[0]++;
    else if (x == s[2])
      c[2]++;
    else if (x == s[3])
      c[3]++;
  }
  cout << s[0] << " x " << c[0] << endl;
  cout << s[1] << " x " << c[1] << endl;
  cout << s[2] << " x " << c[2] << endl;
  cout << s[3] << " x " << c[3] << endl;
  return 0;
}


Error: WA

Fixed submission:

#include <iostream>
#include <string>
using namespace std;
int main() {
  string s;
  int i, N, first = 0, sec = 0, third = 0, fourth = 0;
  cin >> N;
  for (i = 0; i < N * 2; i++) {
    cin >> s[i];
    switch (s[i]) {
    case 'C': {
      first++;
      break;
    }
    case 'T': {
      sec++;
      break;
    }
    case 'W': {
      third++;
      break;
    }
    case 'R': {
      fourth++;
      break;
    }
    }
  }

  cout << "AC x " << first << endl;

  cout << "WA x " << third << endl;
  cout << "TLE x " << sec << endl;
  cout << "RE x " << fourth;

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

#include <stdio.h>
int main() {
  int N;
  scanf("%d", &N);
  char S[10];

  int AC = 0;
  int WA = 0;
  int TLE = 0;
  int RE = 0;

  for (int i = 0; i < N; i++) {
    scanf("%s", S);
    if (S[0] == 'A') {
      AC++;
    } else if (S[0] == 'W') {
      WA++;
    } else if (S[0] == 'T') {
      TLE++;
    } else if (S[0] == 'R') {
      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;
}

Error: -6
*** stack smashing detected ***: terminated


Fixed submission:

#include <stdio.h>
int main() {
  // N test cases
  // each case, theres a string for the verdict of it
  // find the values of AC, WA, TLE, and RE
  // 1<N<1e5
  int n;
  scanf("%d", &n);

  int AC = 0;
  int WA = 0;
  int TLE = 0;
  int RE = 0;

  for (int i = 0; i < n; i++) {
    char str[5];

    scanf("%s", &str[i]);
    switch (str[0]) { // biar dia bacanya chara pertama aja
    case 'A':         // switch cmn bisa 1 chara ya casenya
      AC++;
      break;
    case 'W':
      WA++;
      break;
    case 'T':
      TLE++;
      break;
    case 'R':
      RE++;
      break;
    }
  }
  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 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main(void) {
  int N;
  cin >> N;
  vector<string> result(N);

  for (int i = 0; i < N; i++) {
    cin >> result.at(i);
  }

  int AC = 0, WA = 0, TLE = 0, RE = 0;

  for (int i = 0; i < N; i++) {
    if (result.at(i) == "AC")
      AC++;
    if (result.at(i) == "WA")
      WA++;
    if (result.at(i) == "TLE")
      TLE++;
    if (result.at(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;
}

Error: -6
terminate called after throwing an instance of 'std::out_of_range'
  what():  vector::_M_range_check: __n (which is 0) >= this->size() (which is 0)


Fixed submission:

#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main(void) {
  int N;
  vector<string> result;
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> result.at(i);
  }

  int AC = 0, WA = 0, TLE = 0, RE = 0;

  for (int i = 0; i < N; i++) {
    if (result.at(i) == "AC")
      AC++;
    if (result.at(i) == "WA")
      WA++;
    if (result.at(i) == "TLE")
      TLE++;
    if (result.at(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, verdict: Runtime Error

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

int main(void) {
  int i, j;
  int ac = 0;
  int tle = 0;
  int wa = 0;
  int re = 0;
  cin >> i;

  string d[i];

  for (j = 0; j < i; j++) {
    cin >> d[j];
  }
  for (int k = 0; k < i; k++) {
    if (d[k] == "AC") {
      ac++;
    } else if (d[k] == "WA") {
      wa++;
    } else if (d[k] == "TLE") {
      tle++;
    } else if (d[k] == "RE") {
      re++;
    }
  }

  cout << "AC x " << ac << endl;
  cout << "WA x " << wa << endl;
  cout << "TLE x " << tle << endl;
  cout << "RE x " << re << endl;
}


Error: -11

Fixed submission:

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

int main(void) {
  int i, j;
  int ac = 0;
  int tle = 0;
  int wa = 0;
  int re = 0;
  cin >> i;
  if (0 < i && i < 100001) {
    string d[i];
    for (j = 0; j < i; j++) {
      cin >> d[i];
    }
    for (int k = 0; k < i; k++) {
      if (d[k] == "AC") {
        ac++;
      } else if (d[k] == "WA") {
        wa++;
      } else if (d[k] == "TLE") {
        tle++;
      } else if (d[k] == "re") {
        re++;
      }
    }

    cout << "AC × " << ac << endl;
    cout << "WA × " << wa << endl;
    cout << "TLE × " << tle << endl;
    cout << "RE × " << re << endl;
  }
  return 0;
}
Problem p02613 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>

using namespace std;

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

  string S[N];
  map<string, int> ans_num;
  string ans[] = {"AC", "WA", "TLE", "RE"};
  for (int i = 0; i < 4; i++) {
    ans_num[ans[i]] = 0;
  }

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

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

  return 0;
}

Error: -11

Fixed submission:

#include <bits/stdc++.h>

using namespace std;

int main() {
  int N;
  string S[N];
  cin >> N;
  map<string, int> ans_num;
  string ans[] = {"AC", "WA", "TLE", "RE"};
  for (int i = 0; i < 4; i++) {
    ans_num[ans[i]] = 0;
  }

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

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

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

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

#define ll long long
#define PI acos(-1.0)
#define FOR(I, A, B) for (int I = (A); I < (B); ++I)

int main() {
  int N;
  string str;
  cin >> N;
  vector<int> s(4, 0);
  for (int i = 0; i < N; ++i) {
    cin >> str;
    if (str == "AC") {
      s[0]++;
    } else if (str == "WA") {
      s[1]++;
    } else if (str == "TLE") {
      s[2]++;
    } else {
      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;
}

Error: 0

Fixed submission:

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

int main() {
  int N, yen = 0;
  string str;
  cin >> N;
  vector<int> s(N, 0);
  for (int i = 0; i < N; ++i) {
    cin >> str;
    if (str == "AC") {
      s[0]++;
    } else if (str == "WA") {
      s[1]++;
    } else if (str == "TLE") {
      s[2]++;
    } else {
      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, verdict: Runtime Error

#include <cstring>
#include <iostream>

using namespace std;

int main() {
  int n, f[1000] = {0}, a[100];
  string b;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> b;
    a[i] = b[0];
    f[a[i]]++;
  }
  cout << "AC x " << f['A'] << endl;
  cout << "WA x " << f['W'] << endl;
  cout << "TLE x " << f['T'] << endl;
  cout << "RE x " << f['R'] << endl;
}

Error: 0

Fixed submission:

#include <iostream>
using namespace std;
int main() {
  int n;
  cin >> n;
  int p = 0, q = 0, r = 0, s = 0;
  string a[100];
  for (int i = 0; i < n; i++) {
    cin >> a[i];

    if (a[i] == "AC") {
      p++;
    }
    if (a[i] == "WA") {
      q++;
    }
    if (a[i] == "TLE") {
      r++;
    }
    if (a[i] == "RE") {
      s++;
    }
  }
  cout << "AC x " << p << endl;
  cout << "WA x " << q << endl;

  cout << "TLE x " << r << endl;

  cout << "RE x " << s << endl;
}
Problem p02613 (C++) — buggy submission, verdict: Runtime Error

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

int main(void) {
  int N;
  int count[4];
  cin >> N;
  string judge;
  for (int i = 0; i < N; i++) {
    string t;
    cin >> t;
    judge += t[0];
  }

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

  for (int i = 0; i < N; i++) {
    if (judge[i] == 'A')
      count[0]++;
    else if (judge[i] == 'W')
      count[1]++;
    else if (judge[i] == 'T')
      count[2]++;
    else {
      count[3]++;
    }
  }

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

  return 0;
}


Error: 0

Fixed submission:

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

int main(void) {
  int N;
  int count[4];
  cin >> N;
  string judge;
  for (int i = 0; i < N; i++) {
    string t;
    cin >> t;
    judge += t[0];
  }
  for (int i = 0; i < N; i++) {
    count[i] = 0;
  }

  for (int i = 0; i < N; i++) {
    if (judge[i] == 'A')
      count[0]++;
    else if (judge[i] == 'W')
      count[1]++;
    else if (judge[i] == 'T')
      count[2]++;
    else if (judge[i] == 'R')
      count[3]++;
  }

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

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

#include <bits/stdc++.h>
#include <math.h>
using namespace std;
const double pi = acos(-1.0);
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int max(int a, int b) {
  if (a > b) {
    return a;
  }
  return b;
}
int min(int a, int b) {
  if (a < b) {
    return a;
  }
  return b;
}
int main(void) {
  long int n;
  cin >> n;
  string str[100200];
  rep(i, n) { cin >> str[i]; }
  long int a, b, c, d;
  a = 0;
  b = 0;
  c = 0;
  d = 0;
  for (int i = 0; i < n; ++i) {
    if (str[i] == "AC")
      a++;
    if (str[i] == "WA")
      b++;
    if (str[i] == "TLE")
      c++;
    if (str[i] == "RE")
      d++;
  }
  cout << "AC x " << a << endl;
  cout << "WA x " << b << endl;
  cout << "TLE x " << c << endl;
  cout << "RE x " << d << endl;
}


Error: 0

Fixed submission:

#include <bits/stdc++.h>
#include <math.h>
using namespace std;
const double pi = acos(-1.0);
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int max(int a, int b) {
  if (a > b) {
    return a;
  }
  return b;
}
int min(int a, int b) {
  if (a < b) {
    return a;
  }
  return b;
}
int main(void) {
  long int n;
  cin >> n;
  string str[10020];
  rep(i, n) { cin >> str[i]; }
  long int a, b, c, d;
  a = 0;
  b = 0;
  c = 0;
  d = 0;
  for (int i = 0; i < n; ++i) {
    if (str[i] == "AC")
      a++;
    if (str[i] == "WA")
      b++;
    if (str[i] == "TLE")
      c++;
    if (str[i] == "RE")
      d++;
  }
  cout << "AC x " << a << endl;
  cout << "WA x " << b << endl;
  cout << "TLE x " << c << endl;
  cout << "RE x " << 0 << endl;
}
Problem p02613 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
#include <vector>
using namespace std;
int main() {
  int N, c1 = 0, c2 = 0, c3 = 0, c4 = 0;
  cin >> N;
  vector<string> S(N);

  for (int i = 0; i < N; i++) {
    cin >> S[i];
    if (S[i].compare("AC") == 0)
      c1++;
    if (S[i].compare("WA") == 0)
      c2++;
    if (S[i].compare("TLE") == 0)
      c3++;
    if (S[i].compare("RE") == 0)
      c4++;
  }
  cout << "AC "
       << "x " << c1 << endl;
  cout << "WA "
       << "x " << c2 << endl;
  cout << "TLE "
       << "x " << c3 << endl;
  cout << "RE "
       << "x " << c4 << endl;
  return 0;
}

Error: -11

Fixed submission:

#include <iostream>
#include <vector>
using namespace std;
int main() {
  int N, c1 = 0, c2 = 0, c3 = 0, c4 = 0;
  vector<string> S;
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> S[i];
    if (S[i] == "AC")
      c1++;
    if (S[i] == "WA")
      c2++;
    if (S[i] == "TLE")
      c3++;
    if (S[i] == "RE")
      c4++;
  }
  cout << "AC "
       << "x " << c1 << endl;
  cout << "WA "
       << "x " << c2 << endl;
  cout << "TLE "
       << "x " << c3 << endl;
  cout << "RE "
       << "x " << c4 << endl;
  return 0;
}
Problem p02613 (C++) — buggy submission, verdict: Runtime Error

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

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

#include <algorithm>
#include <iostream>
#include <string>
#define ll long long
using namespace std;
int main() {
  string s;
  ll n;
  string ac = "AC";
  ll cac = 0;
  string wa = "WA";
  ll cwa = 0;
  string tle = "TLE";
  ll ctle = 0;
  string re = "RE";
  ll cre = 0;
  cin >> n;
  for (ll i = 0; i < n; ++i) {
    cin >> s;
    if (s == ac) {
      cac++;
    } else if (s == wa) {
      cwa++;
    } else if (s == tle) {
      ctle++;
    } else if (s == re) {
      cre++;
    }
  }
  cout << ac << " x " << cac << endl;
  cout << wa << " x " << cwa << endl;
  cout << tle << " x " << ctle << endl;
  cout << re << " x " << cre << endl;
}

Error: -11

Fixed submission:

#include <iostream>

using namespace std;

int main() {
  int n, a = 0, b = 0, c = 0, d = 0;
  cin >> n;
  string arr[n];
  for (int i = 0; i < n; i++)
    cin >> arr[n];

  for (int i = 0; i < n; i++) {
    if (arr[i] == "AC")
      a += 1;
    if (arr[i] == "WA")
      b += 1;
    if (arr[i] == "TLE")
      c += 1;
    if (arr[i] == "RE")
      d += 1;
  }
  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, verdict: Runtime Error

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


Error: 0

Fixed submission:

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

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

int main() {
  int n;
  cin >> n;
  string str;
  unordered_map<string, int> result{
      {"AC", 0},
      {"WA", 0},
      {"TLE", 0},
      {"RE", 0},
  };
  for (int i = 0; i < n; i++) {
    cin >> str;
    result.at(str)++;
  }
  cout << "AC x " << result.at("AC") << endl;
  cout << "WA x " << result.at("WA") << endl;
  cout << "TLE x " << result.at("TLE") << endl;
  cout << "RE x " << result.at("RE") << endl;
}

Error: WA

Fixed submission:

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

int main() {
  int n;
  cin >> n;
  string str;
  unordered_map<string, int> result{
      {"AC", 0},
      {"WA", 0},
      {"TLE", 0},
      {"LE", 0},
  };
  for (int i = 0; i < n; i++) {
    cin >> str;
    result.at(str)++;
  }
  cout << "AC x " << result.at("AC") << endl;
  cout << "WA x " << result.at("WA") << endl;
  cout << "TLE x " << result.at("TLE") << endl;
  cout << "LE x " << result.at("LE") << endl;
}