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

#include <algorithm>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iostream>
#define MAX 1000
#define TS 13
#define rep(i, a) for (i = 1; i <= a; i++)
using namespace std;
typedef pair<char, int> p;
int main(void) {
  int n, i, j;
  p card[53];
  int s[TS + 1], h[TS + 1], c[TS + 1], d[TS + 1];
  rep(i, TS) {
    s[i] = MAX;
    h[i] = MAX;
    c[i] = MAX;
    d[i] = MAX;
  }
  cin >> n;
  rep(i, n) cin >> card[i].first >> card[i].second;
  rep(i, n) {
    if (card[i].first == 'S')
      s[card[i].second] = card[i].second;
    else if (card[i].first == 'H')
      h[card[i].second] = card[i].second;
    else if (card[i].first == 'C')
      c[card[i].second] = card[i].second;
    else
      d[card[i].second] = card[i].second;
  }
  rep(i, TS) if (s[i] == MAX) cout << "S " << i << endl;
  rep(i, TS) if (h[i] == MAX) cout << "H " << i << endl;
  rep(i, TS) if (c[i] == MAX) cout << "C " << i << endl;
  rep(i, TS) if (d[i] == MAX) cout << "D " << i << endl;
  return 0;
}

Error: 0

Fixed submission:

#include <algorithm>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iostream>
#define MAX 1000
#define rep(i, a) for (i = 1; i <= a; i++)
using namespace std;
typedef pair<char, int> p;
int main(void) {
  int n, i, j;
  p card[53];
  int s[13], h[13], c[13], d[13];
  rep(i, 13) {
    s[i] = MAX;
    h[i] = MAX;
    c[i] = MAX;
    d[i] = MAX;
  }
  cin >> n;
  rep(i, n) cin >> card[i].first >> card[i].second;
  rep(i, n) {
    if (card[i].first == 'S')
      s[card[i].second] = card[i].second;
    else if (card[i].first == 'H')
      h[card[i].second] = card[i].second;
    else if (card[i].first == 'C')
      c[card[i].second] = card[i].second;
    else
      d[card[i].second] = card[i].second;
  }
  rep(i, 13) if (s[i] == MAX) cout << "S " << i << endl;
  rep(i, 13) if (h[i] == MAX) cout << "H " << i << endl;
  rep(i, 13) if (c[i] == MAX) cout << "C " << i << endl;
  rep(i, 13) if (d[i] == MAX) cout << "D " << i << endl;
  return 0;
}
Problem p02408 (C++) — buggy submission, verdict: Runtime Error

#include <cstdio>
#include <iostream>
using namespace std;
int main() {
  int n, y, a;
  char x, xx;
  int cards[4][14];
  for (int b = 0; b < 4; b++) {
    for (int c = 0; c < 14; c++) {
      cards[b][c] = 0;
    }
  }

  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    cin >> x >> y;
    if (x == 'S') {
      a = 0;
    }
    if (x == 'H') {
      a = 1;
    }
    if (x == 'C') {
      a = 2;
    }
    if (x == 'D') {
      a = 3;
    }
    cards[a][y] = 1;
  }
  for (int j = 0; j < 4; j++) {
    for (int l = 1; l < 14; l++) {
      if (cards[j][l] == 1) {
      } else {
        if (j == 0) {
          x = 'S';
        }
        if (j == 1) {
          x = 'H';
        }
        if (j == 2) {
          x = 'C';
        }
        if (j == 3) {
          x = 'D';
        }
        printf("%c %d\\n", x, l);
      }
    }
  }
}

Error: -11

Fixed submission:

#include <cstdio>

int main() {
  int n, y, a, b, c, d;
  char x;
  int cards[4][13];
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%c %d", &x, &y);
    if (x == 'S') {
      a == 0;
    }
    if (x == 'H') {
      a == 1;
    }
    if (x == 'C') {
      a == 2;
    }
    if (x == 'D') {
      a == 3;
    }
    cards[a][y] = 1;
  }
  for (int j = 0; j < 4; j++) {
    for (int l = 0; l < 13; l++) {
      if (cards[j][l] == 1) {
      } else {
        if (j == 0) {
          x = 'S';
        }
        if (j == 1) {
          x = 'H';
        }
        if (j == 2) {
          x = 'C';
        }
        if (j == 3) {
          x = 'D';
        }
        printf("%c %d", x, j);
      }
      printf("\\n");
    }
  }
}
Problem p02408 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
using namespace std;

int main() {
  bool x[4][13] = {0};
  int number, n, i, j;
  char mark;

  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> mark >> number;
    if (mark == 'S') {
      x[0][number] = 1;
    } else if (mark == 'H') {
      x[1][number] = 1;
    } else if (mark == 'C') {
      x[2][number] = 1;
    } else if (mark == 'D') {
      x[3][number] = 1;
    }
  }
  for (j = 0; j < 4; j++) {
    for (i = 1; i <= 13; i++) {

      if (x[j][i] == 0) {
        if (j == 0) {
          cout << "S " << i << endl;
        } else if (j == 1) {
          cout << "H " << i << endl;
        } else if (j == 2) {
          cout << "C " << i << endl;
        } else if (j == 3) {
          cout << "D " << i << endl;
        }
      }
    }
  }
  return 0;
}

Error: WA

Fixed submission:

#include <iostream>
using namespace std;

int main() {
  bool x[4][13];
  int number, n, i;
  char mark;

  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> mark >> number;
    if (mark == 'S') {
      x[0][number] = 1;
    } else if (mark == 'H') {
      x[1][number] = 1;
    } else if (mark == 'C') {
      x[2][number] = 1;
    } else if (mark == 'D') {
      x[3][number] = 1;
    }
  }

  for (i = 1; i <= 13; i++) {
    if (x[0][i] == 0) {
      cout << "S " << i << endl;
    }
  }
  for (i = 1; i <= 13; i++) {
    if (x[1][i] == 0) {
      cout << "H " << i << endl;
    }
  }
  for (i = 1; i <= 13; i++) {
    if (x[2][i] == 0) {
      cout << "C " << i << endl;
    }
  }
  for (i = 1; i <= 13; i++) {
    if (x[3][i] == 0) {
      cout << "D " << i << endl;
    }
  }
}
Problem p02408 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
int main() {
  char si;
  int n, mi;
  int v[4][14] = {0};
  std::cin >> n;
  for (int a = 0; a < n; a++) {
    std::cin >> si >> mi;
    if (si == 'S')
      v[0][mi] = 1;
    if (si == 'H')
      v[1][mi] = 1;
    if (si == 'C')
      v[2][mi] = 1;
    if (si == 'D')
      v[3][mi] = 1;
  }
  for (int s = 0; s < 4; s++) {
    for (int m = 0; m < 14; m++) {
      if (v[s][m] != 1 && m != 0) {
        if (s == 0)
          std::cout << "S " << m << std::endl;
        if (s == 1)
          std::cout << "H " << m << std::endl;
        if (s == 2)
          std::cout << "C " << m << std::endl;
        if (s == 3)
          std::cout << "D " << m << std::endl;
      }
    }
  }

  return 0;
}

Error: 0

Fixed submission:

#include <iostream>
int main() {
  char si;
  int n, mi;
  int v[4][13] = {};
  std::cin >> n;
  for (int a = 0; a < n; a++) {
    std::cin >> si >> mi;
    if (si == 'S')
      v[0][mi] = 1;
    if (si == 'H')
      v[1][mi] = 1;
    if (si == 'C')
      v[2][mi] = 1;
    if (si == 'D')
      v[3][mi] = 1;
  }
  for (int s = 0; s < 4; s++) {
    for (int m = 0; m < 14; m++) {
      if (v[s][m] != 1 && m != 0) {
        if (s == 0)
          std::cout << "S " << m << std::endl;
        if (s == 1)
          std::cout << "H " << m << std::endl;
        if (s == 2)
          std::cout << "C " << m << std::endl;
        if (s == 3)
          std::cout << "D " << m << std::endl;
      }
    }
  }

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

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

int main() {
  bool card[4][13] = {false};
  int n, o, p;
  string x;

  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x >> o;
    if (x == "S") {
      card[0][o - 1] = true;
    } else if (x == "H") {
      card[1][o - 1] = true;
    } else if (x == "C") {
      card[2][o - 1] = true;
    } else if (x == "D") {
      card[3][o - 1] = true;
    }
  }

  for (int i = 0; i < 4; i++) {
    for (int j = 0; j < 13; j++) {
      if (card[i][j] == false) {
        if (i == 0) {
          cout << "S " << j + 1 << endl;
        } else if (i == 1) {
          cout << "H " << j + 1 << endl;
        } else if (i == 2) {
          cout << "C " << j + 1 << endl;
        } else if (i == 3) {
          cout << "D " << j + 1 << endl;
        }
      }
    }
  }
}


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


Fixed submission:

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

int main() {
  bool card[3][12] = {false};
  int n, o, p;
  string x;

  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x >> o;
    if (x == "S") {
      card[0][o - 1] = true;
    } else if (x == "H") {
      card[1][o - 1] = true;
    } else if (x == "C") {
      card[2][o - 1] = true;
    } else if (x == "D") {
      card[3][o - 1] = true;
    }
  }

  for (int i = 0; i < 4; i++) {
    for (int j = 0; j < 13; j++) {
      if (card[i][j] == false) {
        if (i == 0) {
          cout << "S " << j + 1 << endl;
        } else if (i == 1) {
          cout << "H " << j + 1 << endl;
        } else if (i == 2) {
          cout << "C " << j + 1 << endl;
        } else if (i == 3) {
          cout << "D " << j + 1 << endl;
        }
      }
    }
  }
}
Problem p02408 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
using namespace std;
int main() {
  char ch;
  int n, m;
  bool ar[4][13];
  for (int i = 0; i < 4; i++) {
    for (int j = 0; j < 13; j++)
      ar[i][j] = false;
  }
  cin >> m;
  while (m-- > 0) {
    cin >> ch >> n;
    switch (ch) {
    case 'S':
      ar[0][n - 1] = true;
      break;
    case 'C':
      ar[2][n - 1] = true;
      break;
    case 'D':
      ar[3][n - 1] = true;
      break;
    case 'H':
      ar[1][n - 1] = true;
      break;
    }
  }
  for (int i = 0; i < 4; i++) {
    for (int j = 0; j < 13; j++)
      if (ar[i][j] == false) {
        if (i == 0)
          cout << "S ";
        else if (i == 1)
          cout << "H ";
        else if (i == 2)
          cout << "C ";
        else
          cout << "D ";
        cout << j + 1 << endl;
        ;
      }
  }
  return 0;
}

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


Fixed submission:

#include <iostream>
using namespace std;
int main() {
  char ch;
  int n, m;
  bool ArrS[13], ArrC[13], ArrD[13], ArrH[13];
  for (int i = 1; i <= 13; i++) {
    ArrS[i] != false;
    ArrH[i] != false;
    ArrD[i] != false;
    ArrC[i] != false;
  }
  cin >> m;
  while (m-- > 0) {
    cin >> ch >> n;
    switch (ch) {
    case 'S':
      ArrS[n] = true;
      break;
    case 'C':
      ArrC[n] = true;
      break;
    case 'D':
      ArrD[n] = true;
      break;
    case 'H':
      ArrH[n] = true;
      break;
    }
  }
  for (int i = 1; i <= 13; i++) {
    if (ArrS[i] != true)
      cout << "S " << i << endl;
  }
  for (int i = 1; i <= 13; i++) {

    if (ArrH[i] != true)
      cout << "H " << i << endl;
  }
  for (int i = 1; i <= 13; i++) {

    if (ArrC[i] != true)
      cout << "C " << i << endl;
  }
  for (int i = 1; i <= 13; i++) {
    if (ArrD[i] != true)
      cout << "D " << i << endl;
  }
  return 0;
}
Problem p02408 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
using namespace std;
int main() {
  int n, x;
  int card[5][14];
  cin >> n;
  char a;

  for (int i = 1; i <= 4; i++) {
    for (int j = 1; j <= 13; j++) {
      card[i][j] = 0;
    }
  }
  for (int i = 1; i <= n; i++) {
    cin >> a >> x;
    if (a == 'S') {
      card[1][x] = 1;
    } else if (a == 'H') {
      card[2][x] = 1;
    } else if (a == 'C') {
      card[3][x] = 1;
    } else if (a == 'D') {
      card[4][x] = 1;
    }
  }
  for (int i = 1; i <= 4; i++) {
    for (int j = 1; j <= 13; j++) {
      if (card[i][j] == 0) {
        if (i == 1) {
          cout << 'S' << " " << j << endl;
        } else if (i == 2) {
          cout << 'H' << " " << j << endl;
        } else if (i == 3) {
          cout << 'C' << " " << j << endl;
        } else if (i == 4) {
          cout << 'D' << " " << j << endl;
        }
      }
    }
  }

  return 0;
}


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


Fixed submission:

#include <iostream>
using namespace std;
int main() {
  int n, x;
  int card[4][13] = {{}};
  cin >> n;
  for (int i = 0; i < 5; i++) {
    for (int j = 0; j < 14; j++) {
      card[i][j] = false;
    }
  }
  char y;
  for (int i = 0; i < n; i++) {
    cin >> y >> x;
    if (y == 'S') {
      card[0][x - 1] = true;
    } else if (y == 'H') {
      card[1][x - 1] = true;
    } else if (y == 'C') {
      card[2][x - 1] = true;
    } else if (y == 'D') {
      card[3][x - 1] = true;
    }
  }
  for (int i = 0; i < 5; i++) {
    for (int j = 0; j < 14; j++) {
      if (card[i][j] != 1) {
        if (i == 0) {
          cout << 'S' << " " << j << endl;
        } else if (i == 1) {
          cout << 'H' << " " << j << endl;
        } else if (i == 2) {
          cout << 'C' << " " << j << endl;
        } else if (i == 3) {
          cout << 'D' << " " << j << endl;
        }
      }
    }
  }
  return 0;
}
Problem p02408 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
using namespace std;
int main() {
  int a[5][30];
  for (int i = 0; i < 4; i++) {
    for (int j = 0; j < 13; j++) {
      a[i][j] = 0;
    }
  }
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int x;
    char o;

    cin >> o >> x;
    x--;
    if (o == 'S') {
      a[0][x] = 1;
    }
    if (o == 'H') {
      a[1][x] = 1;
    }
    if (o == 'C') {
      a[2][x] = 1;
    }
    if (o == 'D') {
      a[3][x] = 1;
    }
  }

  for (int i = 0; i < 4; i++) {
    for (int j = 0; j < 13; j++) {
      if (a[i][j] == 0) {
        if (i == 0)
          cout << 'S' << ' ' << j + 1 << endl;
        if (i == 1)
          cout << 'H' << ' ' << j + 1 << endl;
        if (i == 2)
          cout << 'C' << ' ' << j + 1 << endl;
        if (i == 3)
          cout << 'D' << ' ' << j + 1 << endl;
      }
    }
  }

  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>
using namespace std;
int main() {
  int a[5][30];
  for (int i = 0; i < 4; i++) {
    for (int j = 0; j < 13; j++) {
      a[i][j] = 0;
    }
  }
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int x;
    char o;

    cin >> o >> x;
    x = x - 1;
    if (o == 'S') {
      a[0][x] = 1;
    }
    if (o == 'H') {
      a[1][x] = 1;
    }
    if (o == 'C') {
      a[2][x] = 1;
    }
    if (o == 'D') {
      a[3][x];
    }
  }

  for (int i = 0; i < 4; i++) {
    for (int j = 0; j = 13; j++) {
      if (a[i][j] == 0) {
        if (i == 0)
          cout << 'S' << ' ' << j + 1 << endl;
        if (i == 1)
          cout << 'H' << ' ' << j + 1 << endl;
        if (i == 2)
          cout << 'C' << ' ' << j + 1 << endl;
        if (i == 3)
          cout << 'D' << ' ' << j + 1 << endl;
      }
    }
  }

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

#include <iostream>
using namespace std;
int main() {
  int n, b;
  char a;
  cin >> n;
  int card[4][14];
  for (int i = 0; i < 4; i++) {
    for (int j = 1; j < 14; j++) {
      card[i][j] = 0;
    }
  }
  for (int i = 0; i < n; i++) {
    cin >> a >> b;
    if (a == 'S')
      card[0][b] = 1;
    else if (a == 'H')
      card[1][b] = 1;
    else if (a == 'C')
      card[2][b] = 1;
    else
      card[3][b] = 1;
  }

  for (int i = 0; i < 4; i++) {
    for (int j = 1; j < 14; j++) {
      char d;
      if (card[i][j])
        continue;
      if (i == 0)
        d = 'S';
      else if (i == 1)
        d = 'H';
      else if (i == 2)
        d = 'C';
      else
        d = 'D';
      cout << d << ' ' << j << endl;
    }
  }

  return 0;
}


Error: WA

Fixed submission:

#include <iostream>
using namespace std;
int main() {
  int n, a, b;
  cin >> n;
  int card[4][14];

  for (int i = 1; i <= n; i++) {
    cin >> a >> b;
    int c;
    if (a == 'S')
      c = 0;
    else if (a == 'H')
      c = 1;
    else if (a == 'C')
      c = 2;
    else
      c = 3;
    card[a][c] = true;
  }
  for (int i = 0; i < 4; i++) {
    for (int j = 1; i < 14; i++) {
      char c;
      if (i == 0)
        c = 'S';
      else if (i == 1)
        c = 'H';
      else if (i == 2)
        c = 'C';
      else
        c = 'D';
      if (card[i][j] == true)
        continue;
      else
        cout << c << ' ' << j << endl;
    }
  }

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

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_6_B
#include <iostream>
#include <string>
using namespace std;

int main() {
  int n, buf_n;
  cin >> n;
  string S = "S", H = "H", C = "C", D = "D";
  string buf_s;

  int cards[4][13];
  for (int i = 0; i < 4; i++) {
    for (int j = 0; j < 13; j++) {
      cards[i][j] = 0; //????????\\??£???????????¶???????????¨???
    }
  }

  for (int i = 0; i < n; i++) {
    cin >> buf_s >> buf_n;
    if (buf_s == S) {
      cards[0][buf_n - 1] = 1;
    }
    if (buf_s == H) {
      cards[1][buf_n - 1] = 1;
    }
    if (buf_s == C) {
      cards[2][buf_n - 1] = 1;
    }
    if (buf_s == D) {
      cards[3][buf_n - 1] = 1;
    }
  }

  for (int j = 0; j < 13; j++) {
    if (cards[0][j] == 0) {
      cout << S << " " << j + 1 << endl;
    }
  }
  for (int j = 0; j < 13; j++) {
    if (cards[1][j] == 0) {
      cout << H << " " << j + 1 << endl;
    }
  }
  for (int j = 0; j < 13; j++) {
    if (cards[2][j] == 0) {
      cout << C << " " << j + 1 << endl;
    }
  }
  for (int j = 0; j < 13; j++) {
    if (cards[3][j] == 0) {
      cout << D << " " << j + 1 << endl;
    }
  }
}

Error: 0

Fixed submission:

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_6_B
#include <iostream>
#include <string>
using namespace std;

int main() {
  int n, buf_n;
  cin >> n;
  string S = "S", H = "H", C = "C", D = "D";
  string buf_s;

  int cards[4][13];
  for (int i = 0; i < 4; i++) {
    for (int j = 1; j < 14; j++) {
      cards[i][j] = 0; //????????\\??£???????????¶???????????¨???
    }
  }

  for (int i = 0; i < n; i++) {
    cin >> buf_s >> buf_n;
    if (buf_s == S) {
      cards[0][buf_n] = 1;
    }
    if (buf_s == H) {
      cards[1][buf_n] = 1;
    }
    if (buf_s == C) {
      cards[2][buf_n] = 1;
    }
    if (buf_s == D) {
      cards[3][buf_n] = 1;
    }
  }

  for (int j = 1; j < 14; j++) {
    if (cards[0][j] == 0) {
      cout << S << " " << j << endl;
    }
  }
  for (int j = 1; j < 14; j++) {
    if (cards[1][j] == 0) {
      cout << H << " " << j << endl;
    }
  }
  for (int j = 1; j < 14; j++) {
    if (cards[2][j] == 0) {
      cout << C << " " << j << endl;
    }
  }
  for (int j = 1; j < 14; j++) {
    if (cards[3][j] == 0) {
      cout << D << " " << j << endl;
    }
  }
}
Problem p02408 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
#include <stdio.h>
using namespace std;

int main(void) {
  int n;
  int set[52] = {};
  cin >> n;
  for (int i = 0; i < n; i++) {
    char suit;
    int rank;
    cin >> suit >> rank;
    int suit2Num;
    switch (suit) {
    case 'S':
      suit2Num = 0;
      break;
    case 'H':
      suit2Num = 1;
      break;
    case 'C':
      suit2Num = 2;
      break;
    case 'D':
      suit2Num = 3;
      break;
    default:
      break;
    }
    set[13 * suit2Num + (rank - 1)] = 1;
  }
  char num2Suit[4] = {'S', 'H', 'C', 'D'};
  for (int i = 0; i < 52; i++) {
    if (!set[i]) {
      char suitAns = num2Suit[i / 13];
      int rankAns = i % 13 + 1;
      cout << suitAns << " " << rankAns << endl;
    }
  }
  return 0;
}


Error: WA

Fixed submission:

#include <iostream>
#include <stdio.h>
using namespace std;

int main(void) {
  int n;
  int set[52] = {};
  cin >> n;
  for (int i = 0; i < n; i++) {
    char suit;
    int rank;
    cin >> suit >> rank;
    int suit2Num;
    switch (suit2Num) {
    case 'S':
      suit2Num = 0;
      break;
    case 'H':
      suit2Num = 1;
      break;
    case 'C':
      suit2Num = 2;
      break;
    case 'D':
      suit2Num = 3;
      break;
    default:
      break;
    }
    set[13 * suit2Num + (rank - 1)] = 1;
  }
  char num2Suit[4] = {'S', 'H', 'C', 'D'};
  for (int i = 0; i < n; i++) {
    if (set[i]) {
      char suitAns = i / 13;
      int rankAns = i % 13 + 1;
      cout << suitAns << " " << rankAns << endl;
    }
  }
  return 0;
}
Problem p02408 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
#include <stdio.h>
using namespace std;
int main(void) {
  char a[52], x[52] = {};
  int y[52], n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> y[i];
    if (a[i] == 'S') {
      x[4 * y[i] - 4] = 1;
    } else if (a[i] == 'H') {
      x[4 * y[i] - 1] = 1;
    } else if (a[i] == 'C') {
      x[4 * y[i] - 2] = 1;
    } else {
      x[4 * y[i] - 3] = 1;
    }
  }
  for (int i = 1; i <= 13; i++) {
    if (x[4 * i - 4] == 0)
      cout << 'S' << " " << i << endl;
  }
  for (int i = 1; i <= 13; i++) {
    if (x[4 * i - 1] == 0)
      cout << 'H' << " " << i << endl;
  }
  for (int i = 1; i <= 13; i++) {
    if (x[4 * i - 2] == 0)
      cout << 'C' << " " << i << endl;
  }
  for (int i = 1; i <= 13; i++) {
    if (x[4 * i - 3] == 0)
      cout << 'D' << " " << i << endl;
  }
  return 0;
}


Error: 0

Fixed submission:

#include <iostream>
#include <stdio.h>
using namespace std;
int main(void) {
  char a[52], x[52] = {};
  int y[52], n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> y[i];
    if (a[i] == 'S') {
      x[4 * y[i]] = 1;
    } else if (a[i] == 'H') {
      x[4 * y[i] - 1] = 1;
    } else if (a[i] == 'C') {
      x[4 * y[i] - 2] = 1;
    } else {
      x[4 * y[i] - 3] = 1;
    }
  }
  for (int i = 1; i <= 13; i++) {
    if (x[4 * i] == 0)
      cout << 'S' << " " << i << endl;
  }
  for (int i = 1; i <= 13; i++) {
    if (x[4 * i - 1] == 0)
      cout << 'H' << " " << i << endl;
  }
  for (int i = 1; i <= 13; i++) {
    if (x[4 * i - 2] == 0)
      cout << 'C' << " " << i << endl;
  }
  for (int i = 1; i <= 13; i++) {
    if (x[4 * i - 3] == 0)
      cout << 'D' << " " << i << endl;
  }
  return 0;
}
Problem p02408 (C++) — buggy submission, verdict: Runtime Error

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

int main() {
  int n, r, i, j;
  char x;
  cin >> n;
  bool a[4][13];
  for (int z = 0; z < 4; z++) {
    for (int Z = 0; Z < 13; Z++) {
      a[z][Z] = false;
    }
  }
  for (int g = 0; g < n; g++) {
    cin >> x >> r;
    if (x == 'S')
      i = 0;
    if (x == 'H')
      i = 1;
    if (x == 'C')
      i = 2;
    if (x == 'D')
      i = 3;
    j = r - 1;
    a[i][j] = true;
  }
  for (int t = 0; t < 13; t++) {
    if (a[0][t] == false)
      cout << 'S' << ' ' << t + 1 << endl;
  }
  for (int u = 0; u < 13; u++) {
    if (a[1][u] == false)
      cout << 'H' << ' ' << u + 1 << endl;
  }
  for (int v = 0; v < 13; v++) {
    if (a[2][v] == false)
      cout << 'C' << ' ' << v + 1 << endl;
  }
  for (int w = 0; w < 13; w++) {
    if (a[3][w] == false)
      cout << 'D' << ' ' << w + 1 << endl;
  }
  return 0;
}


Error: WA

Fixed submission:

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

int main() {
  int n;
  cin >> n;
  char x;
  int r;
  bool a[4][13];
  int i, j;
  for (int z = 0; z < 3; z++) {
    for (int Z = 0; Z < 12; Z++) {
      a[Z][z] = false;
    }
  }

  for (int g = 0; g < n; g++) {
    cin >> x >> r;
    if (x == 'S')
      i = 0;
    if (x == 'H')
      i = 1;
    if (x == 'C')
      i = 2;
    if (x == 'D')
      i = 3;
    j = r - 1;
    a[i][j] = true;
  }
  for (int t = 0; t < 13; t++) {
    if (a[0][t] == false)
      cout << 'S' << ' ' << t + 1 << endl;
  }
  for (int u = 0; u < 13; u++) {
    if (a[1][u] == false)
      cout << 'H' << ' ' << u + 1 << endl;
  }
  for (int v = 0; v < 13; v++) {
    if (a[2][v] == false)
      cout << 'C' << ' ' << v + 1 << endl;
  }
  for (int w = 0; w < 13; w++) {
    if (a[3][w] == false)
      cout << 'D' << ' ' << w + 1 << endl;
  }
  return 0;
}