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

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define REP(i, n) for (int i = 1; i <= n; i++)
typedef long long ll;

int main() {
  int n;
  cin >> n;
  int ans = 1000 - n % 1000;
  if (ans == 1000)
    ans = 0;
  cout << ans << endl;
  return 0;
}

Error: -11

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define REP(i, n) for (int i = 1; i <= n; i++)
typedef long long ll;

const ll MOD = 1000000007;

int main() {
  ll n, k;
  cin >> n >> k;
  vector<ll> plus;
  vector<ll> minus;
  rep(i, n) {
    ll a;
    cin >> a;
    if (a < 0) {
      minus.push_back(a);
    } else {
      plus.push_back(a);
    }
  }
  ll S = plus.size();
  ll T = minus.size();
  ll ans = 1;
  if (n == k) {
    rep(i, S) {
      ans *= plus[i];
      ans %= MOD;
    }
    rep(i, T) {
      ans *= minus[i];
      ans %= MOD;
    }
    if (ans < 0) {
      cout << ans + MOD << endl;
    } else {
      cout << ans << endl;
    }
  } else if (S == 0 && k % 2 == 1) {
    vector<ll> temp;
    rep(i, S) temp.push_back(plus[i]);
    rep(i, T) temp.push_back(-minus[i]);
    sort(temp.begin(), temp.end());
    rep(i, k) {
      ans *= temp[i];
      ans %= MOD;
    }
    cout << (-ans % MOD) + MOD << endl;
  } else {
    sort(plus.begin(), plus.end());
    sort(minus.rbegin(), minus.rend());
    vector<ll> temp;
    if (k % 2 == 1) {
      ans *= plus.back();
      plus.pop_back();
    }
    while (plus.size() >= 2) {
      ll x = plus.back();
      plus.pop_back();
      x *= plus.back();
      plus.pop_back();
      temp.push_back(x);
    }
    while (minus.size() >= 2) {
      ll x = minus.back();
      minus.pop_back();
      x *= minus.back();
      minus.pop_back();
      temp.push_back(x);
    }
    sort(temp.rbegin(), temp.rend());
    rep(i, k / 2) {
      ans *= temp[i] % MOD;
      ans %= MOD;
    }
    cout << ans << endl;
  }

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

#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int ans;
  ans = (1000 - n % 1000) % 1000;
  cout << ans << endl;
  return 0;
}

Error: -11

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  scanf("%lld", n);
  int ans = n % 1000;
  cout << ans << endl;
  return 0;
}
Problem p02612 (C++) — buggy submission, verdict: Runtime Error

// ABC173.cpp : このファイルには 'main'
// 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <iostream>
using namespace std;

int main() {
  int price, change, thousands;

  cin >> price;

  thousands = price / 1000;

  if (price % 1000 == 0) {
    cout << 0;
    return 0;
  } else {
    change = (thousands + 1) * 1000 - price;
    cout << change;
    return 0;
  }
}


Error: 100

Fixed submission:

// ABC173.cpp : このファイルには 'main'
// 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <iostream>
using namespace std;

int main() {
  int price, change, thousands;

  cin >> price;

  thousands = price / 1000;

  if (price % 1000 == 0) {
    cout << 0;
    return 0;
  } else {
    change = (thousands + 1) * 1000 - price;
    cout << change;
    return change;
  }
}
Problem p02612 (C++) — buggy submission, verdict: Runtime Error

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

int main() {
  int N;
  cin >> N;
  cout << (1000 - N % 1000) % 1000 << endl;
}

Error: WA

Fixed submission:

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

int main() {
  string S;
  cin >> S;
  cout << S.substr(S.length() - 3) << endl;
}
Problem p02612 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>

int main() {
  int a;
  std::cin >> a;
  while (1) {
    a -= 1000;
    if (a <= 0) {
      a *= -1;
      break;
    }
  }
  std::cout << a << std::endl;
}

Error: TLE

Fixed submission:

#include <iostream>

int main() {
  int a;
  std::cin >> a;
  while (1) {
    a -= 1000;
    if (a < 0) {
      a *= -1;
    }
  }
  std::cout << a << std::endl;
}
Problem p02612 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>

int main() {
  int N = {};            // 商品代金
  int change = {};       // お釣り
  int Min_value = 1;     // 下限値
  int Max_value = 10000; // 上限値
  std::cin >> N;

  if (Min_value > N || N > Max_value) {
    std::cout << "予算を10000円を超えてます！" << std::endl;
  }

  while (N >= 1000) {
    if (N == 1000) {
      change = 0;
      std::cout << change << std::endl;
      return 0;
    }

    N = N - 1000;
  }

  change = 1000 - N;
  std::cout << change << std::endl;
}

Error: TLE

Fixed submission:

#include <iostream>

int main() {
  int N = {};            // 商品代金
  int change = {};       // お釣り
  int Min_value = 1;     // 下限値
  int Max_value = 10000; // 上限値
  std::cin >> N;

  if (Min_value > N || N > Max_value) {
    std::cout << "予算を10000円を超えてます！" << std::endl;
  }

  while (N >= 1000) {
    if (N == 1000) {
      change = 0;
      std::cout << change << std::endl;
      return 0;
    }

    N - 1000;
  }

  change = 1000 - N;
  std::cout << change << std::endl;
}
Problem p02612 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
using namespace std;

int main() {
  int n;
  int ans = 0;
  cin >> n;
  ans = n % 1000;
  if (ans == 0)
    cout << ans << endl;
  else
    cout << 1000 - ans << endl;
}

Error: TLE

Fixed submission:

#include <iostream>
using namespace std;

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

  while (1) {
    int i = 1;
    if (1000 * i - n >= 0) {
      re = 1000 * i - n;
      break;
    }
    i++;
  }

  cout << re << endl;
}
Problem p02612 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  if (n > 1000) {
    if (n % 1000 != 0)
      n = n % 1000;
    else {
      cout << 0;
      return 0;
    }
  }
  int c = 1000 - n;
  cout << c;
  return 0;
}


Error: TLE

Fixed submission:

#include <stdio.h>
int main() {
  int p, c = 0;
  scanf("%d", &p);
  for (c = 0; c < p; c = +1000) {
    c;
  }
  printf("%d", c - p);
}
Problem p02612 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int main() {
  int cost;
  cin >> cost;
  int money = 0;
  while (money < cost) {
    money += 1000;
  }
  cout << money - cost << endl;
}

Error: TLE

Fixed submission:

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

int main() {
  int cost;
  cin >> cost;
  int money = 0;
  while (money < cost) {
    money + 1000;
  }
  cout << money - cost << endl;
}
Problem p02612 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <stdio.h>
int main() {
  int a;
  scanf("%d", &a);
  printf("%d\\n", (1000 - (a - a / 1000 * 1000)) % 1000);
  return 0;
}

Error: TLE

Fixed submission:

#include <stdio.h>
int main() {
  int p, c;
  scanf("%d", &p);
  for (c = 0; c < p; c = +1000) {
    c;
  }
  printf("%d", c - p);
}
Problem p02612 (C++) — buggy submission, verdict: Runtime Error


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

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

  int k = N % 1000;
  if (k == 0) {
    cout << 0 << endl;
    return 0;
  }
  int p = 1000 - k;

  cout << p << endl;
  return 0;
}

Error: 100

Fixed submission:


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

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

  int k = N % 1000;
  if (k == 0) {
    return 0;
  }
  int p = 1000 - k;

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

#include <iostream>

using namespace std;

int main() {
  int pay;
  int out;

  std::cin >> pay;

  out = 1000 - (pay % 1000);

  if (out == 1000)
    cout << 0;
  else
    cout << out;
}

Error: 100

Fixed submission:

#include <iostream>

int main() {
  int ret;
  int pay;

  std::cin >> pay;

  ret = 1000 - (pay % 1000);

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

#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  cout << (1000 - n % 1000) % 1000;
  return 0;
}

Error: WA

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
int nothing() {
  int nuu;
  return 1;
}
void reder_cuture_life() { nothing(); }
int codery_eee() {
  int x;
  cin >> x;
  reder_cuture_life();
  return x;
}
int biaoerzi(int v_34) { cout << v_34 % 1000; }
void farz(int mmmmmmmmmm) { biaoerzi(mmmmmmmmmm); }
void jieli_zuzu_pinkpint(int x) {
  int a = x, b = a, c = b, d = c, e = d, f = e;
  farz(x);
}
int yuuuuuuuuuuuuuuu(int a, int b) { return a % b; }
void pankinf(int x) {
  x = 1000 - yuuuuuuuuuuuuuuu(x, 1000);
  jieli_zuzu_pinkpint(x);
}
void yaoduozuo_youduozuo() {
  int n = codery_eee();
  pankinf(n);
}
int main() {
  yaoduozuo_youduozuo();
  return 0;
}
Problem p02612 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define all(x) (x).begin(), (x).end()
#define desc greater<int>()

void solve() {
  int n;
  cin >> n;
  int ans = 1000 - n % 1000;
  cout << ans % 1000;
}
int main() {
  /*
      string temp;
      int t;
      cin >> t;
      getline(cin, temp);
      while (t--){
          solve();
      }
  */
  solve();
  return 0;
}


Error: 1

Fixed submission:

#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define all(x) (x).begin(), (x).end()
#define desc greater<int>()

void solve() {
  int n;
  cin >> n;
  int ans = 1000 - n % 1000;
  cout << ans;
}
int main() {
  /*
      string temp;
      int t;
      cin >> t;
      getline(cin, temp);
      while (t--){
          solve();
      }
  */
  solve();
  return 1;
}
Problem p02612 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
using namespace std;

int main() {
  int cost;
  cin >> cost;
  int change;
  if (cost % 1000) {
    change = 1000 - cost % 1000;
  } else {
    change = 0;
  }

  cout << change;

  return 0;
}

Error: 132

Fixed submission:

#include <iostream>
using namespace std;

int main() {
  int cost;
  cin >> cost;
  if (cost < 1000)
    return 1000 - cost;
  else
    return cost % 1000;
  return 0;
}
Problem p02612 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <stdio.h>

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

  int res = (N % 1000 == 0) ? 0 : ((N / 1000) + 1) * 1000 - N;
  printf("%d\\n", res);

  return 0;
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, x = 0, z;

  cin >> n;

  while (1000 * x < n)

    cout << ((1000 * x) - n) << endl;

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

#include <iostream>
using namespace std;

int main() {
  int i, a, b;

  cin >> a;
  if (a <= 1000)
    cout << 1000 - a;
  else {
    while (1) {
      if (a <= 1000) {
        cout << 1000 - a;
        break;
      } else {
        a = a - 1000;
      }
    }
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>
using namespace std;

int main() {
  int i, a, b;

  cin >> a;
  if (a <= 1000)
    cout << 1000 - a;
  else {
    while (1) {
      if (a <= 1000)
        cout << 1000 - a;
      else {
        a = a - 1000;
      }
    }
  }
  return 0;
}
Problem p02612 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
using namespace std;

int main() {
  int n;
  cin >> n;
  if (n % 1000 != 0) {
    n %= 1000;
    cout << 1000 - n;
  } else
    cout << 0;
}


Error: TLE

Fixed submission:

#include <iostream>
using namespace std;

int main() {
  int n;
  while (cin >> n, n) {
    if (n % 1000 != 0) {
      n %= 1000;
      cout << 1000 - n;
    } else
      cout << 0;
  }
}
Problem p02612 (C++) — buggy submission, verdict: Runtime Error

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

int main() {
  int n;
  int r;
  cin >> n;

  if (n % 1000 == 0) {
    cout << 0 << endl;
  } else {
    r = 1000 - (n % 1000);
    cout << r << endl;
  }
}

Error: -8

Fixed submission:

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

int main() {
  int n;
  int r;
  cin >> n;

  if (n % 0 == 0) {
    cout << 0 << endl;
    return 0;
  }

  r = 1000 - (n % 1000);

  cout << r << endl;
}
Problem p02612 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>

using namespace std;
#define PI 3.1415926535897932384626
#define ll long long
#define ull unsigned long long

#define all(x) x.begin(), x.end()
#define fo(i, n) for (i = 0; i < n; i++)
#define sortall(x) sort(all(x))

#define vi vector<int>
#define vs vector<string>
typedef pair<string, int> psi;
typedef pair<char, int> pci;
typedef pair<int, int> pii;
typedef vector<psi> vpsi;
typedef vector<psi> vpci;
typedef vector<pii> vpii;
typedef vector<vi> vvi;
//=======================

const int MOD = 1'000'000'007;
const int N = 2e6 + 13;

//=======================
vi g[N];
int a[N];
int n, m, k;
//=======================

void solve() { cin >> n; }

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  cin >> t;
  while (t >= 1000) {
    t -= 1000;
  }
  if (t != 0) {
    t = abs(t - 1000);
  }
  cout << t << endl;
}

Error: 0

Fixed submission:

#include <bits/stdc++.h>

using namespace std;
#define PI 3.1415926535897932384626
#define ll long long
#define ull unsigned long long

#define all(x) x.begin(), x.end()
#define fo(i, n) for (i = 0; i < n; i++)
#define sortall(x) sort(all(x))

#define vi vector<int>
#define vs vector<string>
typedef pair<string, int> psi;
typedef pair<char, int> pci;
typedef pair<int, int> pii;
typedef vector<psi> vpsi;
typedef vector<psi> vpci;
typedef vector<pii> vpii;
typedef vector<vi> vvi;
//=======================

const int MOD = 1'000'000'007;
const int N = 2e6 + 13;

//=======================
vi g[N];
int a[N];
int n, m, k;
//=======================

void solve() { cin >> n; }

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  cin >> t;
  while (t >= 1000) {
    t -= 1000;
  }
  cout << (1000 % t == 0 ? 0 : 1000 % t) << endl;
}
Problem p02613 (C++) — buggy submission, verdict: Runtime Error

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

Error: 0

Fixed submission:

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

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

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

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

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


Fixed submission:

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

int main() {
  long long n;
  vector<string> s(n);
  cin >> n;
  for (int i = 0; i < n; i++)
    cin >> s.at(i);
  cout << "AC x ";
  cout << count(s.begin(), s.end(), "AC") << endl;
  cout << "WA x ";
  cout << count(s.begin(), s.end(), "WA") << endl;
  cout << "TLE x ";
  cout << count(s.begin(), s.end(), "TLE") << endl;
  cout << "RE x ";
  cout << count(s.begin(), s.end(), "RE") << endl;
}
Problem p02613 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
#include <string>
using namespace std;
int main() {
  long long n, a = 0, w = 0, t = 0, r = 0;
  string ar;
  cin >> n;
  for (long long i = 0; i < n; i++) {
    cin >> ar;
    if (ar == "AC") {
      a++;
    } else if (ar == "WA") {
      w++;
    } else if (ar == "TLE") {
      t++;
    } else if (ar == "RE") {
      r++;
    }
  }
  cout << "AC"
       << " "
       << "x"
       << " " << a << endl;
  cout << "WA"
       << " "
       << "x"
       << " " << w << endl;
  cout << "TLE"
       << " "
       << "x"
       << " " << t << endl;
  cout << "RE"
       << " "
       << "x"
       << " " << r << endl;
  return 0;
}

Error: -11

Fixed submission:

#include <iostream>
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 <stdio.h>

int main() {
  int N, dec[4] = {0};
  scanf("%d", &N);

  for (int i = 0; i < N; i++) {
    char S[5];
    scanf("%s", S);
    switch (S[0]) {
    case 'A':
      dec[0]++;
      break;
    case 'W':
      dec[1]++;
      break;
    case 'T':
      dec[2]++;
      break;
    case 'R':
      dec[3]++;
      break;
    }
  }
  printf("AC x %d\\n", dec[0]);
  printf("WA x %d\\n", dec[1]);
  printf("TLE x %d\\n", dec[2]);
  printf("RE x %d\\n", dec[3]);

  return 0;
}

Error: WA

Fixed submission:

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

  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() {
  // 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);
    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;
}

Error: WA

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);
  char str[5];

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

  for (int i = 0; i < n; i++) {
    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 <stdio.h>
#include <string.h>

int main() {
  int a;

  scanf("%d", &a);

  char b[a + 1];
  int ac = 0, wa = 0, tle = 0, re = 0;

  for (int i = 0; i < a; i++) {

    scanf("%s", &b);

    if (b[0] == 'A') {

      ac++;
    } else if (b[0] == 'W') {

      wa++;
    } else if (b[0] == 'T') {

      tle++;
    } else if (b[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: 0

Fixed submission:

#include <stdio.h>
#include <string.h>

int main() {
  int N;
  int AC = 0, WA = 0, TLE = 0, RE = 0;
  scanf("%d", &N);
  char a[50][N];
  for (int i = 0; i < N; i++) {
    scanf("%s", &a[i]);
    if (strcmp(a[i], "AC") == 0) {
      AC++;
    }
    if (strcmp(a[i], "WA") == 0) {
      WA++;
    }
    if (strcmp(a[i], "TLE") == 0) {
      TLE++;
    }
    if (strcmp(a[i], "RE") == 0) {
      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 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
#include <iostream>
#include <sstream>
using namespace std;
const int N = 1e5 + 7, M = 1e7, OO = 0x3f3f3f3f;
#define endl '\\n'
#define ll long long
#define loop(i, n) for (int i = 0; i < int(n); ++i)
#define rloop(i, n) for (int i = int(n); i >= 0; --i)
#define range(i, a, b) for (int i = int(a); i <= int(b); i++)
#define p(a) printf("%d ", a)
#define S(n) scanf("%d", &n)
int main() {
  map<string, int> mp;
  mp["AC"] = 0;
  mp["WA"] = 0;
  mp["TLE"] = 0;
  mp["RE"] = 0;
  int n;
  S(n);
  string s;
  loop(i, n) {
    cin >> s;
    mp[s]++;
  }
  printf("AC x %d\\n", mp["AC"]);
  printf("WA x %d\\n", mp["WA"]);
  printf("TLE x %d\\n", mp["TLE"]);
  printf("RE x %d\\n", mp["RE"]);

  return 0;
}

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;
    else if (arr[i] == "WA")
      b += 1;
    else if (arr[i] == "TLE")
      c += 1;
    else if (arr[i] == "RE")
      d += 1;
  }
  cout << "AC x " << a << endl
       << "WA x " << b << endl
       << "TLE x " << c << endl
       << "RE x " << d << endl;
  return 0;
}
Problem p02613 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
#include <map>
#include <string>

using namespace std;

map<string, int> mymap;
int main() {
  int N;
  cin >> N;
  mymap["AC"] = 0;
  mymap["WA"] = 0;
  mymap["TLE"] = 0;
  mymap["RE"] = 0;
  for (int i = 0; i < N; i++) {
    string s;
    cin >> s;
    mymap[s]++;
  }
  cout << "AC"
       << " x " << mymap["AC"] << endl;
  cout << "WA"
       << " x " << mymap["WA"] << endl;
  cout << "TLE"
       << " x " << mymap["TLE"] << endl;
  cout << "RE"
       << " x " << mymap["RE"] << endl;
  return 0;
}

Error: WA

Fixed submission:

#include <iostream>

using namespace std;
int main() {
  int n, m = 0, e = 0, b = 0, d = 0;
  string a[100];
  cin >> n;

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

  for (int i = 0; i < n; i++) {
    if (a[i] == "AC") {
      m++;
    } else if (a[i] == "TLE") {
      e++;
    } else if (a[i] == "WA") {
      b++;
    } else {
      d++;
    }
  }
  cout << "AC x" << m << endl;
  cout << "WA x" << b << endl;
  cout << "TLE x" << e << endl;
  cout << "RE x " << d << endl;

  return 0;
}