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

#include <iostream>

using namespace std;

int main() {
  int i, m;
  char n;
  int s[13] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
      h[13] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
      c[13] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
      d[13] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
  cin >> i;
  for (int t = 0; t < i; t++) {
    cin >> n >> m;
    if (n == 'S')
      s[m - 1] = m;
    else if (n == 'H')
      h[m - 1] = m;
    else if (n == 'C')
      c[m - 1] = m;
    else if (n == 'D')
      d[m - 1] = m;
  }
  for (int t = 0; t < 13; t++) {
    if (s[t] == 0)
      cout << "S " << t + 1 << endl;
  }
  for (int t = 0; t < 13; t++) {
    if (h[t] == 0)
      cout << "H " << t + 1 << endl;
  }
  for (int t = 0; t < 13; t++) {
    if (c[t] == 0)
      cout << "C " << t + 1 << endl;
  }
  for (int t = 0; t < 13; t++) {
    if (d[t] == 0)
      cout << "D " << t + 1 << endl;
  }
  return 0;
}


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


Fixed submission:

#include <iostream>

using namespace std;

int main() {
  int n;
  cin >> n;
  char a[n][2];
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 2; j++) {
      cin >> a[i][j];
    }
  }
  int q[4][13];

  for (int i = 0; i < n; i++) {
    if (a[i][0] == 'S') {
      int t = a[i][1];
      q[0][t - 1] = 12;
    } else if (a[i][0] == 'H') {
      int t = a[i][1];
      q[1][t - 1] = 12;
    } else if (a[i][0] == 'C') {
      int t = a[i][1];
      q[2][t - 1] = 12;
    } else {
      int t = a[i][1];
      q[3][t - 1] = 12;
    }
  }
  for (int j = 0; j < 13; j++) {
    if (q[0][j] != 12)
      cout << "S"
           << " " << j + 1 << endl;
  }
  for (int j = 0; j < 13; j++) {
    if (q[1][j] != 12)
      cout << "H"
           << " " << j + 1 << endl;
  }
  for (int j = 0; j < 13; j++) {
    if (q[2][j] != 12)
      cout << "C"
           << " " << j + 1 << endl;
  }
  for (int j = 0; j < 13; j++) {
    if (q[3][j] != 12)
      cout << "D"
           << " " << j + 1 << endl;
  }
  return 0;
}
Problem p02408 (C++) — buggy submission, verdict: Runtime Error

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

int main() {
  int n, a;
  // boolean???0??§????????????
  //?????¨map??§????????¨?????????????????????????????????????????°??????????????§????????¨??????????°????????????????
  /*????????????????????????????????????????????????for??§????????????????????????????????¨??§???????????????????????¨??¨ture??\\???????\\´???????????¨??????
  ??????????????????????????¨??????????°????????????????*/
  bool cards[4][14] = {};
  char suit;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> suit >> a;
    if (suit == 'S') {
      cards[0][a] = 1;
    }
    if (suit == 'H') {
      cards[1][a] = 1;
    }
    if (suit == 'C') {
      cards[2][a] = 1;
    }
    if (suit == 'D') {
      cards[3][a] = 1;
    }
  }

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

  return 0;
}

Error: 0

Fixed submission:

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

int main() {
  int n, a;
  // boolean???0??§????????????
  //?????¨map??§????????¨?????????????????????????????????????????°??????????????§????????¨??????????°????????????????
  /*????????????????????????????????????????????????for??§????????????????????????????????¨??§???????????????????????¨??¨ture??\\???????\\´???????????¨??????
  ??????????????????????????¨??????????°????????????????*/
  bool cards[4][13] = {};
  char suit;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> suit >> a;
    if (suit == 'S') {
      cards[0][a] = 1;
    }
    if (suit == 'H') {
      cards[1][a] = 1;
    }
    if (suit == 'C') {
      cards[2][a] = 1;
    }
    if (suit == 'D') {
      cards[3][a] = 1;
    }
  }

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

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

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

int main() {
  int a, d;
  char b;
  bool c[4][14];
  for (int i = 0; i < 4; i++) {
    for (int j = 0; j < 14; j++) {
      c[i][j] = 0;
    }
  }
  cin >> a;
  for (int k = 0; k < a; k++) {
    cin >> b >> d;
    if (b == 'S') {
      c[0][d] = 1;
    } else if (b == 'H') {
      c[1][d] = 1;
    } else if (b == 'C') {
      c[2][d] = 1;
    } else if (b == 'D') {
      c[3][d] = 1;
    }
  }
  for (int m = 0; m < 4; m++) {
    for (int n = 1; n < 14; n++) {
      if (c[m][n] == 1) {
        continue;
      }
      if (c[m][n] == 0) {
        if (m == 0) {
          cout << "S"
               << " " << n << endl;
        } else if (m == 1) {
          cout << "H"
               << " " << n << endl;
        } else if (m == 2) {
          cout << "C"
               << " " << n << endl;
        } else if (m == 3) {
          cout << "D"
               << " " << n << endl;
        }
      }
    }
  }
  return 0;
}

Error: TLE

Fixed submission:

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

int main() {
  int a, d;
  char b;
  bool c[4][14];
  for (int i = 0; i < 4; i++) {
    for (int j = 0; j < 14; i++) {
      c[i][j] = 0;
    }
  }
  cin >> a;
  for (int k = 0; k < a; k++) {
    cin >> b >> d;
    if (b == 'S') {
      c[0][d] = 1;
    } else if (b == 'H') {
      c[1][d] = 1;
    } else if (b == 'C') {
      c[2][d] = 1;
    } else if (b == 'K') {
      c[3][d] = 1;
    }
  }
  for (int m = 0; m < 4; m++) {
    for (int n = 1; n < 14; n++) {
      if (c[m][n] == 1) {
        continue;
      }
      if (c[m][n] == 0) {
        if (m == 0) {
          cout << "S"
               << " " << n << endl;
        } else if (m == 1) {
          cout << "H"
               << " " << n << endl;
        } else if (m == 2) {
          cout << "C"
               << " " << n << endl;
        } else if (m == 3) {
          cout << "K"
               << " " << n << endl;
        }
      }
    }
  }
  return 0;
}
Problem p02408 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
#include <string>

using namespace std;

int main() {
  int cards[4][14];
  int x, n;
  string a;

  for (int l = 0; l < 4; l++) {
    for (int m = 0; m < 14; m++) {
      cards[l][m] = 0;
    }
  }

  cin >> n;

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

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

  return 0;
}


Error: WA

Fixed submission:

#include <iostream>
#include <string>

using namespace std;

int main() {
  int cards[4][13];
  int x, n;
  string a;

  cin >> n;

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

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

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

#include <iostream>
using namespace std;

int main() {
  bool cards[4][14];
  int n, rank;
  char suit;

  for (int s = 0; s < 4; s++)
    for (int r = 1; r <= 13; r++)
      cards[s][r] = 0;

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

  for (int s = 0; s < 4; s++) {
    for (int r = 1; r <= 13; r++) {
      if (cards[s][r])
        continue;
      if (s == 0)
        suit = 'S';
      if (s == 1)
        suit = 'H';
      if (s == 2)
        suit = 'C';
      if (s == 3)
        suit = 'D';
      cout << suit << " " << r << endl;
    }
  }

  return 0;
}


Error: WA

Fixed submission:

#include <iostream>
using namespace std;

int main() {
  bool cards[4][13];
  int n, rank;
  char suit;

  for (int s = 0; s < 4; s++)
    for (int r = 0; r < 13; r++)
      cards[s][r] = 0;

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

  for (int s = 0; s < 4; s++) {
    for (int r = 0; r <= 13; r++) {
      if (cards[s][r])
        continue;
      if (s == 0)
        suit = 'S';
      if (s == 1)
        suit = 'H';
      if (s == 2)
        suit = 'C';
      if (s == 3)
        suit = 'D';
      cout << suit << " " << r << endl;
    }
  }

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

#include <iostream>
using namespace std;
int main() {
  char c;
  int k;
  int a[53] = {0};
  cin >> a[0];
  for (int i = 1; i <= a[0]; i++) {
    cin >> c >> k;
    if (c == 'S')
      a[k] = 1;
    if (c == 'H')
      a[13 + k] = 1;
    if (c == 'C')
      a[26 + k] = 1;
    if (c == 'D')
      a[39 + k] = 1;
  }
  for (int i = 1; i < 53; i++) {
    if (a[i] == 0) {
      if (i < 14)
        cout << "S " << i << endl;
      if (13 < i && i < 27)
        cout << "H " << i - 13 << endl;
      if (26 < i && i < 40)
        cout << "C " << i - 26 << endl;
      if (39 < i)
        cout << "D " << i - 39 << endl;
    }
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>
using namespace std;
int main() {
  char c;
  int k;
  int a[53] = {0};
  cin >> a[0];
  for (int i = 0; i < a[0]; i++) {
    cin >> c >> k;
    if (c == 'S')
      a[k] = 1;
    if (c == 'H')
      a[13 + k] = 1;
    if (c == 'C')
      a[26 + k] = 1;
    if (c == 'D')
      a[39 + k] = 1;
  }
  for (int i = 1; i < 52; i++) {
    if (a[i] == 0) {
      if (i < 14)
        cout << "S " << i << endl;
      if (13 < i && i < 27)
        cout << "H " << --i % 13 + 1 << endl;
      if (26 < i && i < 40)
        cout << "C " << --i % 13 + 1 << endl;
      if (39 < i)
        cout << "D " << --i % 13 + 1 << endl;
    }
  }
  return 0;
}
Problem p02408 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
using namespace std;

int main() {
  int s[14];
  int h[14];
  int c[14];
  int d[14];
  int n, m;
  char cr;
  for (int i = 1; i <= 13; i++)
    s[i] = 0;
  for (int i = 1; i <= 13; i++)
    h[i] = 0;
  for (int i = 1; i <= 13; i++)
    c[i] = 0;
  for (int i = 1; i <= 13; i++)
    d[i] = 0;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> cr >> m;
    switch (cr) {
    case 'S':
      s[m] = 1;
      break;
    case 'H':
      h[m] = 1;
      break;
    case 'C':
      c[m] = 1;
      break;
    case 'D':
      d[m] = 1;
      break;
    }
  }
  for (int i = 1; i <= 13; i++)
    if (s[i] == 0)
      cout << 'S' << ' ' << i << endl;
  for (int i = 1; i <= 13; i++)
    if (h[i] == 0)
      cout << 'H' << ' ' << i << endl;
  for (int i = 1; i <= 13; i++)
    if (c[i] == 0)
      cout << 'C' << ' ' << i << endl;
  for (int i = 1; i <= 13; i++)
    if (d[i] == 0)
      cout << 'D' << ' ' << i << endl;
}


Error: 0

Fixed submission:

#include <iostream>
using namespace std;

int main() {
  int s[13];
  int h[13];
  int c[13];
  int d[13];
  int n, m;
  char cr;
  for (int i = 1; i <= 13; i++)
    s[i] = 0;
  for (int i = 1; i <= 13; i++)
    h[i] = 0;
  for (int i = 1; i <= 13; i++)
    c[i] = 0;
  for (int i = 1; i <= 13; i++)
    d[i] = 0;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> cr >> m;
    switch (cr) {
    case 'S':
      s[m] = 1;
      break;
    case 'H':
      h[m] = 1;
      break;
    case 'C':
      c[m] = 1;
      break;
    case 'D':
      d[m] = 1;
      break;
    }
  }
  for (int i = 1; i <= 13; i++)
    if (s[i] == 0)
      cout << 'S' << ' ' << i << endl;
  for (int i = 1; i <= 13; i++)
    if (h[i] == 0)
      cout << 'H' << ' ' << i << endl;
  for (int i = 1; i <= 13; i++)
    if (c[i] == 0)
      cout << 'C' << ' ' << i << endl;
  for (int i = 1; i <= 13; i++)
    if (d[i] == 0)
      cout << 'D' << ' ' << i << endl;
}
Problem p02408 (C++) — buggy submission, verdict: Runtime Error

#include <algorithm>
#include <iostream>

using namespace std;

int main() {

  int n;

  bool S[13], H[13], C[13], D[13];
  fill(S, S + 13, false);
  fill(H, H + 13, false);
  fill(C, C + 13, false);
  fill(D, D + 13, false);

  std::cin >> n;

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

    std::cin >> a >> b;

    switch (a) {
    case 'S':
      S[b - 1] = true;
      break;
    case 'H':
      H[b - 1] = true;
      break;
    case 'C':
      C[b - 1] = true;
      break;
    case 'D':
      D[b - 1] = true;
      break;
    }
  }

  // std::cout << "XXXXXXXXXXXXXXXXXXXXX\\n";

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

  return 0;
}


Error: -11

Fixed submission:

#include <stdio.h>
int main(void) {
  int a, b, c[52], d, e, k[52], z, w = 0, r = 1, g = 1, j = 1, y = 1;
  char s[52], m[52];
  int i = 0;
  int u = 0;
  scanf("%d", &a);
  for (b = 0; b < a; b++) {
    scanf("%c %d", s[b], c[b]);
  }
  for (e = 0; e < 4; e++) {
    for (d = 0; d < a; d++) {
      if (e == 0) {

        if (s[d] == 'S' && c[d] == g) {
        } else {
          s[i] = 'S';
          c[u] = g;
          i++;
          u++;
          w++;
        }
      } else if (e == 1) {

        if (s[d] == 'H' && c[d] == r) {
        } else {
          s[i] = 'H';
          c[u] = r;
          i++;
          u++;
          w++;
        }
      } else if (e == 2) {

        if (s[d] == 'C' && c[d] == j) {
        } else {
          s[i] = 'C';
          c[u] = j;
          i++;
          u++;
          w++;
        }
      } else {

        if (s[d] == 'D' && c[d] == y) {

        } else {
          s[i] = 'D';
          c[u] = y;
          i++;
          u++;
          w++;
        }
      }
    }
  }
  for (z = 0; z < w; z++) {
    printf("%c %d\\n", s[z], c[z]);
  }
  return 0;
}
Problem p02408 (C++) — buggy submission, verdict: Runtime Error

#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>

int main(void) {
  int i, j, n, num;
  int Scard[14] = {0}, Hcard[14] = {0}, Ccard[14] = {0}, Dcard[14] = {0};
  char mark = '0';

  scanf("%d", &n);
  getchar();

  for (j = 0; j < n; j++) {

    scanf("%c %d", &mark, &num);
    getchar();

    if (mark == 'S') {
      Scard[num] = 1;
    } else if (mark == 'H') {
      Hcard[num] = 1;
    } else if (mark == 'C') {
      Ccard[num] = 1;
    } else if (mark == 'D') {
      Dcard[num] = 1;
    }
  }

  for (i = 1; i <= 13; i++) {
    if (Scard[i] == 0) {
      printf("S %d\\n", i);
    }
  }
  for (i = 1; i <= 13; i++) {
    if (Hcard[i] == 0) {
      printf("H %d\\n", i);
    }
  }
  for (i = 1; i <= 13; i++) {
    if (Ccard[i] == 0) {
      printf("C %d\\n", i);
    }
  }
  for (i = 1; i <= 13; i++) {
    if (Dcard[i] == 0) {
      printf("D %d\\n", i);
    }
  }

  return 0;
}

Error: -11

Fixed submission:

#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>

int main(void) {
  int i, n, num;
  int Scard[14] = {0}, Hcard[14] = {0}, Ccard[14] = {0}, Dcard[14] = {0};
  char mark = '0';

  scanf("%d", &n);

  for (i = 0; i < n; i++) {
    scanf("%s %d", mark, &num);
    if (mark == 'S') {
      Scard[num] = 1;
    } else if (mark == 'H') {
      Hcard[num] = 1;
    } else if (mark == 'C') {
      Ccard[num] = 1;
    } else if (mark == 'D') {
      Dcard[num] = 1;
    }
  }

  for (i = 1; i <= 13; i++) {
    if (Scard[i] != 1) {
      printf("S %d", i);
    }
  }
  for (i = 1; i <= 13; i++) {
    if (Hcard[i] != 1) {
      printf("H %d", i);
    }
  }
  for (i = 1; i <= 13; i++) {
    if (Ccard[i] != 1) {
      printf("C %d", i);
    }
  }
  for (i = 1; i <= 13; i++) {
    if (Dcard[i] != 1) {
      printf("D %d", i);
    }
  }

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

#include <iostream>
using namespace std;

int main() {
  int cards[4][14];
  for (int i = 0; i < 4; i++) {
    for (int j = 1; j <= 13; j++) {
      cards[i][j] = 1;
    }
  }

  int n, rank;
  char mark;
  cin >> n;

  for (int x = 1; x <= n; x++) {
    cin >> mark >> rank;

    if (mark == 'S') {
      cards[0][rank] = 0;
    }
    if (mark == 'H') {
      cards[1][rank] = 0;
    }
    if (mark == 'C') {
      cards[2][rank] = 0;
    }
    if (mark == 'D') {
      cards[3][rank] = 0;
    }
  }

  for (int i = 0; i < 4; i++) {
    for (int j = 1; j <= 13; j++) {
      if (cards[i][j] == 0) {
        continue;
      }

      if (i == 0)
        mark = 'S';
      if (i == 1)
        mark = 'H';
      if (i == 2)
        mark = 'C';
      if (i == 3)
        mark = 'D';

      cout << mark << " " << j << endl;
    }
  }

  return 0;
}

Error: 0

Fixed submission:

#include <iostream>
using namespace std;

int main() {
  bool cards[4][13];
  for (int i = 0; i < 4; i++) {
    for (int j = 1; j <= 13; j++) {
      cards[i][j] = 1;
    }
  }

  int n, rank;
  char mark;
  cin >> n;

  for (int x = 1; x <= n; x++) {
    cin >> mark >> rank;

    if (mark == 'S') {
      cards[0][rank] = 0;
    }
    if (mark == 'H') {
      cards[1][rank] = 0;
    }
    if (mark == 'C') {
      cards[2][rank] = 0;
    }
    if (mark == 'D') {
      cards[3][rank] = 0;
    }
  }

  for (int i = 0; i < 4; i++) {
    for (int j = 1; j <= 13; j++) {
      if (cards[i][j] == 0) {
        continue;
      }

      if (i == 0)
        mark = 'S';
      if (i == 1)
        mark = 'H';
      if (i == 2)
        mark = 'C';
      if (i == 3)
        mark = 'D';

      cout << mark << " " << j << endl;
    }
  }

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

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

int main(void) {
  int n, r, number;
  int a[4][13];
  char R;

  // 配列初期化
  for (int i = 0; i < 4; i++) {
    for (int j = 0; j < 13; j++) {
      a[i][j] = 0;
    }
  }
  cin >> n;
  for (int m = 0; m < n; m++) {
    cin >> R >> number;
    if (R == 'S') {
      r = 0;
    } else if (R == 'H') {
      r = 1;
    } else if (R == 'C') {
      r = 2;
    } else if (R == 'D') {
      r = 3;
    }

    a[r][number - 1] = 1;
  }

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

Error: WA

Fixed submission:

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

int main(void) {
  int n, r;
  int a[4][13];
  string rank;

  // 配列初期化
  for (int i = 0; i < 4; i++) {
    for (int j = 0; i < 13; i++) {
      a[i][j] = 0;
    }
  }
  cin >> n;
  for (int m = 0; m < n; m++) {
    cin >> rank >> n;
    if (rank == "S") {
      r = 0;
    } else if (rank == "H") {
      r = 1;
    } else if (rank == "C") {
      r = 2;
    } else if (rank == "D") {
      r = 3;
    }

    a[r][n] = 1;
  }
  for (int i = 0; i < 4; i++) {
    for (int j = 0; j < 13; j++) {
      if (a[i][j] != 1) {
        if (i == 0) {
          rank == "S";
        }
        if (i == 1) {
          rank == "H";
        }
        if (i == 0) {
          rank == "C";
        }
        if (i == 0) {
          rank == "D";
        }
        cout << rank << " " << j << endl;
      }
    }
  }
  return 0;
}
Problem p02408 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
using namespace std;
int main() {
  int n, N;
  char K;
  cin >> n;
  bool cards[4][14];
  for (int i = 0; i < 4; i++) {
    for (int j = 1; j <= 13; j++) {
      cards[i][j] = 0;
    }
  }
  for (int i = 0; i < n; i++) {
    cin >> K >> N;
    if (K == 'S') {
      cards[0][N] = 1;
    }
    if (K == 'H') {
      cards[1][N] = 1;
    }
    if (K == 'C') {
      cards[2][N] = 1;
    }
    if (K == 'D') {
      cards[3][N] = 1;
    }
  }
  for (int i = 0; i < 4; i++) {
    for (int j = 1; j <= 13; j++) {
      if (cards[i][j]) {
        continue;
      }
      if (i == 0) {
        K = 'S';
      }
      if (i == 1) {
        K = 'H';
      }
      if (i == 2) {
        K = 'C';
      }
      if (i == 3) {
        K = 'D';
      }
      cout << K << " " << j << endl;
    }
  }
  return 0;
}


Error: 0

Fixed submission:

#include <iostream>
using namespace std;
int main() {
  int n, N;
  char K;
  cin >> n;
  bool cards[4][13];
  for (int i = 0; i < 4; i++) {
    for (int j = 1; j <= 13; j++) {
      cards[i][j] = 0;
    }
  }
  for (int i = 0; i < n; i++) {
    cin >> K >> N;
    if (K == 'S') {
      cards[0][N] = 1;
    }
    if (K == 'H') {
      cards[1][N] = 1;
    }
    if (K == 'C') {
      cards[2][N] = 1;
    }
    if (K == 'D') {
      cards[3][N] = 1;
    }
  }
  for (int i = 0; i < 4; i++) {
    for (int j = 1; j <= 13; j++) {
      if (cards[i][j]) {
        continue;
      }
      if (i == 0) {
        K = 'S';
      }
      if (i == 1) {
        K = 'H';
      }
      if (i == 2) {
        K = 'C';
      }
      if (i == 3) {
        K = 'D';
      }
      cout << K << " " << j << endl;
    }
  }
  return 0;
}