alexjercan/bugnet huggingface dataset:
Problem p00497 (C++) — buggy submission, verdict: Memory Limit Exceeded

#include <algorithm>
#include <bitset>
#include <cfloat>
#include <climits>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;

int main() {
  int n, m;
  cin >> n >> m;
  n += 3;

  vector<vector<int>> s(n);
  for (int i = 0; i < n; ++i)
    s[i].assign(i + 2, 0);

  for (int i = 0; i < m; ++i) {
    int y, x, a;
    cin >> y >> x >> a;

    ++s[y][x];
    --s[y][x + 1];
    --s[y + a + 1][x];
    ++s[y + a + 2][x + 1];
    ++s[y + a + 1][x + a + 2];
    --s[y + a + 2][x + a + 2];
  }

  for (int i = 0; i < n - 1; ++i) {
    for (int j = 0; j < i + 2; ++j) {
      s[i + 1][j] += s[i][j];
    }
  }

  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < i + 1; ++j) {
      s[i][j + 1] += s[i][j];
    }
  }

  for (int i = -n; i < 2; ++i) {
    for (int j = 0; j < n - 1; ++j) {
      if (i + j >= 0)
        s[j + 1][i + j + 1] += s[j][i + j];
    }
  }

  int ret = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < i + 2; ++j) {
      if (s[i][j] > 0)
        ++ret;
    }
  }
  cout << ret << endl;

  return 0;
}

Error: MLE

Fixed submission:

#include <algorithm>
#include <bitset>
#include <cfloat>
#include <climits>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;

int main() {
  int n, m;
  cin >> n >> m;
  n += 2;

  vector<vector<int>> s(n, vector<int>(n, 0));
  vector<vector<int>> t(n, vector<int>(n, 0));

  for (int i = 0; i < m; ++i) {
    int y, x, a;
    cin >> y >> x >> a;

    ++s[y][x];
    --s[y + a + 1][x];
    --t[y][x + 1];
    ++t[y + a + 1][x + a + 2];
  }

  for (int i = 0; i < n - 1; ++i) {
    for (int j = 0; j < n; ++j) {
      s[i + 1][j] += s[i][j];
    }
  }

  for (int i = -n; i < n; ++i) {
    for (int j = 0; j < n - 1; ++j) {
      if (0 <= i + j && i + j + 1 < n)
        t[i + j + 1][j + 1] += t[i + j][j];
    }
  }

  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      s[i][j] += t[i][j];
    }
  }

  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n - 1; ++j) {
      s[i][j + 1] += s[i][j];
    }
  }

  int ret = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      if (s[i][j] > 0)
        ++ret;
    }
  }
  cout << ret << endl;

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

#include <algorithm>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <vector>

using namespace std;

const double EPS = (1e-10);
typedef long long ll;
typedef pair<int, int> pii;
bool EQ(double a, double b) { return abs((a) - (b)) < EPS; }
void fast_stream() { std::ios_base::sync_with_stdio(0); }

short dp[5002][5002];
void dfs(int x, int y, int depth) {
  if (dp[y][x] >= depth)
    return;
  dp[y][x] = depth;
  if (depth == 0)
    return;
  int ny = y + 1;
  int nx = x + 1;
  dfs(nx, ny, depth - 1);
  ny = y;
  dfs(nx, ny, depth - 1);
}

void solve() {
  memset(dp, -1, sizeof(dp));
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    int x, y, a;
    cin >> x >> y >> a;
    dp[x][y] = a;
    // dfs(x,y,a);
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= i; j++) {
      dp[i + 1][j + 1] = max(dp[i + 1][j + 1], (short)(dp[i][j] - 1));
      dp[i + 1][j] = max(dp[i + 1][j], (short)(dp[i][j] - 1));
    }
  }
  int cnt = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= i; j++) {
      if (dp[i][j] >= 0)
        cnt++;
    }
  }
  cout << cnt << endl;
}

int main() {

  solve();

  return 0;
}

Error: 0

Fixed submission:

#include <algorithm>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <vector>

using namespace std;

const double EPS = (1e-10);
typedef long long ll;
typedef pair<int, int> pii;
bool EQ(double a, double b) { return abs((a) - (b)) < EPS; }
void fast_stream() { std::ios_base::sync_with_stdio(0); }

short dp[5001][5001];
void dfs(int x, int y, int depth) {
  if (dp[y][x] >= depth)
    return;
  dp[y][x] = depth;
  if (depth == 0)
    return;
  int ny = y + 1;
  int nx = x + 1;
  dfs(nx, ny, depth - 1);
  ny = y;
  dfs(nx, ny, depth - 1);
}

void solve() {
  memset(dp, -1, sizeof(dp));
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    int x, y, a;
    cin >> x >> y >> a;
    dp[x][y] = a;
    // dfs(x,y,a);
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= i; j++) {
      dp[i + 1][j + 1] = max(dp[i + 1][j + 1], (short)(dp[i][j] - 1));
      dp[i + 1][j] = max(dp[i + 1][j], (short)(dp[i][j] - 1));
    }
  }
  int cnt = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= i; j++) {
      if (dp[i][j] >= 0)
        cnt++;
    }
  }
  cout << cnt << endl;
}

int main() {

  solve();

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

#include <algorithm>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <vector>

using namespace std;

const double EPS = (1e-10);
typedef long long ll;
typedef pair<int, int> pii;
bool EQ(double a, double b) { return abs((a) - (b)) < EPS; }
void fast_stream() { std::ios_base::sync_with_stdio(0); }

short dp[5001][5001];
void dfs(int x, int y, int depth) {
  if (dp[y][x] >= depth)
    return;
  dp[y][x] = depth;
  if (depth == 0)
    return;
  int ny = y + 1;
  int nx = x + 1;
  dfs(nx, ny, depth - 1);
  ny = y;
  dfs(nx, ny, depth - 1);
}

void solve() {
  memset(dp, -1, sizeof(dp));
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    int x, y, a;
    cin >> x >> y >> a;
    dfs(x, y, a);
  }
  int cnt = 0;
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j <= n; j++) {
      if (dp[j][i] >= 0)
        cnt++;
    }
  }
  cout << cnt << endl;
}
int main() {

  solve();

  return 0;
}

Error: MLE

Fixed submission:

#include <algorithm>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <vector>

using namespace std;

const double EPS = (1e-10);
typedef long long ll;
typedef pair<int, int> pii;
bool EQ(double a, double b) { return abs((a) - (b)) < EPS; }
void fast_stream() { std::ios_base::sync_with_stdio(0); }

int dp[5001][5001];
void dfs(int x, int y, int depth) {
  if (dp[y][x] >= depth)
    return;
  dp[y][x] = depth;
  if (depth == 0)
    return;
  int ny = y + 1;
  int nx = x + 1;
  dfs(nx, ny, depth - 1);
  ny = y;
  dfs(nx, ny, depth - 1);
}

void solve() {
  memset(dp, -1, sizeof(dp));
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    int x, y, a;
    cin >> x >> y >> a;
    dfs(x, y, a);
  }
  int cnt = 0;
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j <= n; j++) {
      if (dp[j][i] >= 0)
        cnt++;
    }
  }
  cout << cnt << endl;
}

int main() {

  solve();

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

#include <algorithm>
#include <climits>
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
using namespace std;

vector<short> plus_[5001], minus_[5001];

int main() {
  int N, M, A, B, X;
  cin >> N >> M;
  for (int i = 0; i <= N; i++) {
    plus_[i].assign(i + 2, 0);
    minus_[i].assign(i + 2, 0);
  }
  for (int i = 0; i < M; i++) {
    cin >> A >> B >> X;
    A--;
    B--;
    plus_[A][B]++;
    plus_[A + X + 1][B]--;
    minus_[A][B]--;
    minus_[A + X + 1][B + X + 1]++;
  }
  for (int i = 0; i < N; i++) {
    int sum = 0;
    for (int j = 0; j < N - i; j++) {
      sum += plus_[j + i][i];
      plus_[j + i][i] = sum;
    }
  }
  for (int i = 0; i < N; i++) {
    int sum = 0;
    for (int j = 0; j < N - i; j++) {
      sum += minus_[i + j][j];
      minus_[i + j][j] = sum;
    }
  }

  int ans = 0;
  for (int i = 0; i < N; i++) {
    int sum = 0;
    for (int j = 0; j <= i; j++) {
      sum += plus_[i][j];
      if (sum > 0)
        ans++;
      sum += minus_[i][j];
    }
  }
  printf("%d\\n", ans);
  return 0;
}

Error: MLE

Fixed submission:

#include <algorithm>
#include <climits>
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
using namespace std;

vector<int> plus_[5001], minus_[5001];

int main() {
  int N, M, A, B, X;
  cin >> N >> M;
  for (int i = 0; i <= N; i++) {
    plus_[i].assign(i + 2, 0);
    minus_[i].assign(i + 2, 0);
  }
  for (int i = 0; i < M; i++) {
    cin >> A >> B >> X;
    A--;
    B--;
    plus_[A][B]++;
    plus_[A + X + 1][B]--;
    minus_[A][B]--;
    minus_[A + X + 1][B + X + 1]++;
  }
  for (int i = 0; i < N; i++) {
    int sum = 0;
    for (int j = 0; j < N - i; j++) {
      sum += plus_[j + i][i];
      plus_[j + i][i] = sum;
    }
  }
  for (int i = 0; i < N; i++) {
    int sum = 0;
    for (int j = 0; j < N - i; j++) {
      sum += minus_[i + j][j];
      minus_[i + j][j] = sum;
    }
  }

  int ans = 0;
  for (int i = 0; i < N; i++) {
    int sum = 0;
    for (int j = 0; j <= i; j++) {
      sum += plus_[i][j];
      if (sum > 0)
        ans++;
      sum += minus_[i][j];
    }
  }
  printf("%d\\n", ans);
  return 0;
}
Problem p00499 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <stdio.h>
int main(void) {
  int a[101], temp = 0, ruio = 0;
  for (int i = 1; i <= 5; i++) {
    scanf("%d", &a[i]);
  }
  while (a[2] > 0 || a[3] > 0) {
    a[2] -= a[4];
    a[3] -= a[5];
    ruio++;
  }
  printf("%d\\n", a[1] - ruio);
  return 0;
}

Error: TLE

Fixed submission:

#include <stdio.h>
int main(void) {
  int a[101], temp = 0, ruio = 0;
  for (int i = 1; i <= 5; i++) {
    scanf("%d", &a[i]);
  }
  if (a[4] < a[5]) {
    a[4] = a[5];
  }
  temp = a[2] + a[3];
  while (temp > 0) {
    temp - a[4];
    ruio++;
  }
  printf("%d\\n", a[1] - ruio);
  return 0;
}
Problem p00499 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>

using namespace std;

int main() {

  int A, B, C, D, L;
  int date_langue, date_math, date_play;
  int tmp;

  while (1) {
    cin >> L >> A >> B >> C >> D;

    date_langue = A / C;

    tmp = A % C;
    if (tmp > 0)
      date_langue++;

    date_math = B / D;
    tmp = B % D;
    if (tmp > 0)
      date_math++;

    if (date_langue > date_math) {
      date_play = L - date_langue;
    } else
      date_play = L - date_math;

    cout << date_play << endl;
    break;
  }
}


Error: TLE

Fixed submission:

#include <iostream>

using namespace std;

int main() {

  int A, B, C, D, L;
  int date_langue, date_math, date_play;
  int tmp;

  while (1) {
    cin >> L >> A >> B >> C >> D;

    date_langue = A / C;

    tmp = A % C;
    if (tmp > 0)
      date_langue++;

    date_math = B / D;
    tmp = B % D;
    if (tmp > 0)
      date_math++;

    if (date_langue > date_math) {
      date_play = L - date_langue;
    } else
      date_play = L - date_math;

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

#include <algorithm>
#include <functional>
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <vector>

using namespace std;

int main(void) {
  int n, a[200][200], G[200][200];
  cin >> n;

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

  for (int j = 0; j < 3; j++) {
    for (int i = 0; i < n; i++) {
      for (int k = 0; k < n; k++) {
        if (a[i][j] == a[k][j] && i != k) {
          G[i][j] = 0;
          break;
        } else {
          G[i][j] = 0;
          G[i][j] = a[i][j];
        }
      }
    }
  }

  for (int i = 0; i < n; i++) {
    cout << G[i][0] + G[i][1] + G[i][2] << endl;
  }
}

Error: 0

Fixed submission:

#include <algorithm>
#include <functional>
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <vector>

using namespace std;

int main(void) {
  int n, a[100][100], G[100][100];
  cin >> n;

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

  for (int j = 0; j < 3; j++) {
    for (int i = 0; i < n; i++) {
      for (int k = 0; k < n; k++) {
        if (a[i][j] == a[k][j] && i != k) {
          G[i][j] = 0;
          break;
        } else {
          G[i][j] = 0;
          G[i][j] = a[i][j];
        }
      }
    }
  }

  for (int i = 0; i < n; i++) {
    cout << G[i][0] + G[i][1] + G[i][2] << endl;
  }
}
Problem p00500 (C++) — buggy submission, verdict: Runtime Error

//
//  main.cpp

#include <iostream>
using namespace std;

int main() {
  int check[201];
  int who[201];
  int matrix[201][3];
  int point[201];
  for (int i = 0; i < 201; i++) {
    check[i] = 0;
    who[i] = -1;
    point[i] = 0;
    for (int j = 0; j < 3; j++) {
      matrix[i][j] = 0;
    }
  }
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 3; j++) {
      cin >> matrix[i][j];
    }
  }

  for (int j = 0; j < 3; j++) {
    for (int i = 0; i < 201; i++) {
      check[matrix[i][j]]++;
      who[matrix[i][j]] = i;
    }
    for (int i = 0; i < 201; i++) {
      if (check[i] == 1) {
        point[who[i]] += i;
      }
    }
    for (int i = 0; i < 201; i++) {
      check[i] = who[i] = 0;
    }
  }

  for (int i = 0; i < n; i++) {
    cout << point[i] << endl;
  }

  return 0;
}

Error: 0

Fixed submission:

//
//  main.cpp

#include <iostream>
using namespace std;

int main() {
  int check[101];
  int who[101];
  int matrix[101][3];
  int point[101];
  for (int i = 0; i < 101; i++) {
    check[i] = 0;
    who[i] = -1;
    point[i] = 0;
    for (int j = 0; j < 3; j++) {
      matrix[i][j] = 0;
    }
  }
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 3; j++) {
      cin >> matrix[i][j];
    }
  }

  for (int j = 0; j < 3; j++) {
    for (int i = 0; i < n; i++) {
      check[matrix[i][j]]++;
      who[matrix[i][j]] = i;
    }
    for (int i = 0; i < 101; i++) {
      if (check[i] == 1) {
        point[who[i]] += i;
      }
    }
    for (int i = 0; i < 101; i++) {
      check[i] = who[i] = 0;
    }
  }

  for (int i = 0; i < n; i++) {
    cout << point[i] << endl;
  }

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

#include <algorithm>
#include <iostream>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <vector>
using namespace std;
int main() {
  int n, Na[200], Nb[200], Nc[200], Ma[200], Mb[200], Mc[200];
  cin >> n;

  for (int i = 0; i < n; i++) {
    int a, b, c;
    cin >> a >> b >> c;
    int A = a, B = b, C = c;

    Ma[i] = a;
    Mb[i] = b;
    Mc[i] = c;

    for (int j = 0; j < i; j++) {
      if (a == Ma[j]) {
        Na[j] = 0;
        A = 0;
      }
      if (b == Mb[j]) {
        Nb[j] = 0;
        B = 0;
      }
      if (c == Mc[j]) {
        Nc[j] = 0;
        C = 0;
      }
    }
    Na[i] = A;
    Nb[i] = B;
    Nc[i] = C;
  }

  for (int i = 0; i < n; i++) {
    cout << Na[i] + Nb[i] + Nc[i] << endl;
  }
  return 0;
}


Error: -11

Fixed submission:

#include <algorithm>
#include <iostream>
#include <queue>
#include <string>
#include <utility>
#include <vector>
using namespace std;
int main() {

  int n;
  cin >> n;

  vector<int> NUMfir;
  vector<int> NUMsec;
  vector<int> NUMthi;
  int COUfir[100];
  int COUsec[100];
  int COUthi[100];

  for (int i = 0; i < n; i++) {
    int fir, sec, thi;
    cin >> fir >> sec >> thi;
    NUMfir[i] = fir;
    NUMsec[i] = sec;
    NUMthi[i] = thi;
  }

  for (int i = 0; i < 100; i++) {
    COUfir[i] = 0;
    COUsec[i] = 0;
    COUthi[i] = 0;
  }

  for (int i = 0; i < 100; i++) {
    for (int j = 0; j < n; j++) {
      if (NUMfir[j] == i + 1)
        COUfir[i]++;
      if (NUMsec[j] == i + 1)
        COUsec[i]++;
      if (NUMthi[j] == i + 1)
        COUthi[i]++;
    }
  }

  for (int i = 0; i < 100; i++) {
    for (int j = 0; j < n; j++) {
      if (COUfir[i] > 1) {
        if (NUMfir[j] == i + 1)
          NUMfir[i] = 0;
      }
      if (COUsec[i] > 1) {
        if (NUMsec[j] == i + 1)
          NUMsec[i] = 0;
      }
      if (COUthi[i] > 1) {
        if (NUMthi[j] == i + 1)
          NUMthi[i] = 0;
      }
    }
  }

  for (int i = 0; i < n; i++) {
    int x;
    x = NUMfir[i] + NUMsec[i] + NUMthi[i];
    cout << x << endl;
  }
}
Problem p00500 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
using namespace std;
int main() {
  int n, h, j, i;
  cin >> n;
  int number[3][n], sum[n];
  for (i = 0; i < n; i++) {
    for (j = 0; j < 3; j++) {
      cin >> number[j][i];
    }
    sum[i] = number[0][i] + number[1][i] + number[2][i];
  }

  for (i = 0; i < n; i++) {     //?????°
    for (j = 0; j < 3; j++) {   //?/3
      for (h = 0; h < n; h++) { //??????????±?
        if (number[j][i] == number[j][h] && i != h) {
          sum[i] -= number[j][i];
          h = n;
        }
      }
    }
    cout << sum[i] << endl;
  }
  return 0;
}

Error: -11

Fixed submission:

#include <iostream>
using namespace std;
int main() {
  int p, i, j;
  cin >> p;
  int a[p], b[p], c[p], sum[p];
  for (i = 0; i < p; i++)
    cin >> a[i] >> b[i] >> c[i];
  for (i = 0; i < p; i++) {
    for (j = 0; j < p; i++) {
      if (a[i] == a[j])
        a[i] = 0;
    }
  }
  for (i = 0; i < p; i++) {
    for (j = 0; j < p; i++) {
      if (b[i] == b[j])
        b[i] = 0;
    }
  }
  for (i = 0; i < p; i++) {
    for (j = 0; j < p; i++) {
      if (c[i] == c[j])
        c[i] = 0;
    }
  }
  for (i = 0; i < p; i++)
    cout << a[i] + b[i] + c[i] << endl;
  return 0;
}
Problem p00500 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
#include <vector>
using namespace std;
bool check(vector<int>, int);
int main() {
  int n, num[1001][5], score[1001] = {0};
  bool bo = false;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> num[i][0] >> num[i][1] >> num[i][2];
  }
  for (int i = 0; i < 3; ++i) {
    for (int j = 0; j < n; ++j) {
      for (int k = 0; k < n; ++k) {
        if (j == k) {
          continue;
        }
        if (num[j][i] == num[k][i]) {
          bo = true;
        }
      }
      if (!bo) {
        score[j] += num[j][i];
      }
      bo = false;
    }
  }
  for (int i = 0; i < n; ++i) {
    cout << score[i] << endl;
  }
  return 0;
}

Error: 0

Fixed submission:

#include <iostream>
#include <vector>
using namespace std;
bool check(vector<int>, int);
int main() {
  int n, num[101][3], score[101] = {0};
  bool bo = false;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> num[i][0] >> num[i][1] >> num[i][2];
  }
  for (int i = 0; i < 3; ++i) {
    for (int j = 0; j < n; ++j) {
      for (int k = 0; k < n; ++k) {
        if (j == k) {
          continue;
        }
        if (num[j][i] == num[k][i]) {
          bo = true;
        }
      }
      if (!bo) {
        score[j] += num[j][i];
      }
      bo = false;
    }
  }
  for (int i = 0; i < n; ++i) {
    cout << score[i] << endl;
  }
  return 0;
}
Problem p00500 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
using namespace std;
struct digit {
  int first;
  int second;
  int third;
};
int main() {
  int n, score[200] = {0};
  digit number[200];
  cin >> n;
  for (int i = 0; i < n; i++)
    cin >> number[i].first >> number[i].second >> number[i].third;
  digit sign[200];
  for (int i = 0; i < n; i++) {
    sign[i].first = sign[i].second = sign[i].third = 0;
    for (int j = 0; j < n; j++) {
      if (i != j && number[i].first == number[j].first)
        sign[i].first = 1;
      if (i != j && number[i].second == number[j].second)
        sign[i].second = 1;
      if (i != j && number[i].third == number[j].third)
        sign[i].third = 1;
    }
    if (!sign[i].first)
      score[i] += number[i].first;
    if (!sign[i].second)
      score[i] += number[i].second;
    if (!sign[i].third)
      score[i] += number[i].third;
  }
  for (int i = 0; i < n; i++)
    cout << score[i] << endl;
  return 0;
}

Error: 0

Fixed submission:

#include <iostream>
using namespace std;
struct digit {
  int first;
  int second;
  int third;
};
int main() {
  int n, score[100] = {0};
  digit number[100];
  cin >> n;
  for (int i = 0; i < n; i++)
    cin >> number[i].first >> number[i].second >> number[i].third;
  digit sign[100];
  for (int i = 0; i < n; i++) {
    sign[i].first = sign[i].second = sign[i].third = 0;
    for (int j = 0; j < n; j++) {
      if (i != j && number[i].first == number[j].first)
        sign[i].first = 1;
      if (i != j && number[i].second == number[j].second)
        sign[i].second = 1;
      if (i != j && number[i].third == number[j].third)
        sign[i].third = 1;
    }
    if (!sign[i].first)
      score[i] += number[i].first;
    if (!sign[i].second)
      score[i] += number[i].second;
    if (!sign[i].third)
      score[i] += number[i].third;
  }
  for (int i = 0; i < n; i++)
    cout << score[i] << endl;
  return 0;
}
Problem p00500 (C++) — buggy submission, verdict: Runtime Error

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iostream>
#include <map>
#include <stack>
#include <string>
#include <vector>
using namespace std;

#define PI 4 * atan(1);

int main() {
  int card[200][3] = {0};
  int n, score[200] = {0};
  cin >> n;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 3; j++) {
      cin >> card[i][j];
    }
  }
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < n; j++) {
      int cnt = 0;
      for (int k = 0; k < n; k++) {
        if (card[j][i] == card[k][i] && j != k) {
          cnt++;
        }
      }
      if (cnt == 0)
        score[j] += card[j][i];
    }
  }
  for (int i = 0; i < n; i++) {
    cout << score[i] << endl;
  }
}

Error: 0

Fixed submission:

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iostream>
#include <map>
#include <stack>
#include <string>
#include <vector>
using namespace std;

#define PI 4 * atan(1);

int main() {
  int card[200][3] = {0};
  int n, score[100] = {0};
  cin >> n;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 3; j++) {
      cin >> card[i][j];
    }
  }
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < n; j++) {
      int cnt = 0;
      for (int k = 0; k < n; k++) {
        if (card[j][i] == card[k][i] && j != k) {
          cnt++;
        }
      }
      if (cnt == 0)
        score[j] += card[j][i];
    }
  }
  for (int i = 0; i < n; i++) {
    cout << score[i] << endl;
  }
}