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

#include <algorithm>
#include <iostream>
#include <string>
#include <utility>
#include <vector>
int n;
std::vector<std::pair<std::string, int>> cards;

void regcards(std::string str, int x) {
  cards.push_back(std::make_pair(str, x));
}
int main() {
  for (int i = 0; i < 4; ++i) {
    for (int j = 1; j <= 13; ++j) {
      switch (i) {
      case 0:
        regcards("S", j);
        break;
      case 1:
        regcards("H", j);
        break;
      case 2:
        regcards("C", j);
        break;
      case 3:
        regcards("D", j);
        break;
      }
    }
  }
  std::cin >> n;
  for (int i = 0; i < n; ++i) {
    std::string str;
    int x;
    std::cin >> str >> x;
    for (auto it = cards.begin(); it < cards.end(); ++it) {
      if (*it == std::make_pair(str, x))
        cards.erase(it);
    }
  }
  if (cards.empty()) {
    return 0;
  }
  for (auto v : cards) {
    std::cout << v.first << " " << v.second << std::endl;
  }
  return 0;
}

Error: -11

Fixed submission:

#include <algorithm>
#include <iostream>
#include <string>
#include <utility>
#include <vector>
int n;
std::vector<std::pair<std::string, int>> cards;

void regcards(std::string str, int x) {
  cards.push_back(std::make_pair(str, x));
}
int main() {
  for (int i = 0; i < 4; ++i) {
    for (int j = 1; j <= 13; ++j) {
      switch (i) {
      case 0:
        regcards("S", j);
        break;
      case 1:
        regcards("H", j);
        break;
      case 2:
        regcards("C", j);
        break;
      case 3:
        regcards("D", j);
        break;
      }
    }
  }
  std::cin >> n;
  for (int i = 0; i < n; ++i) {
    std::string str;
    int x;
    std::cin >> str >> x;
    for (auto it = cards.begin(); it != cards.end(); ++it) {
      if (*it == std::make_pair(str, x))
        cards.erase(it);
    }
  }
  if (cards.empty()) {
    std::cout << std::endl;
    return 0;
  }
  for (auto v : cards) {
    std::cout << v.first << " " << v.second << std::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; //??¨??¨???????´????false??????

  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: 0

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 = 1; r <= 13; r++)
      cards[s][r] = 0; //??¨??¨???????´????false??????

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

#include <stdio.h>
#include <vector>

int main() {
  bool poss[4][14];
  for (int i = 0; i < 4; i++) {
    for (int j = 0; j < 14; j++) {
      poss[i][j] = false;
    }
  }

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

  for (int i = 0; i < n; i++) {
    char mark;
    int num;
    scanf(" %c %d", &mark, &num);
    switch (mark) {
    case 'S':
      poss[0][num] = true;
      break;
    case 'H':
      poss[1][num] = true;
      break;
    case 'C':
      poss[2][num] = true;
      break;
    case 'D':
      poss[3][num] = true;
      break;
    }
  }
  for (int i = 1; i <= 13; i++) {
    if (!poss[0][i]) {
      printf("S %d\\n", i);
    }
  }
  for (int i = 1; i <= 13; i++) {
    if (!poss[1][i]) {
      printf("H %d\\n", i);
    }
  }
  for (int i = 1; i <= 13; i++) {
    if (!poss[2][i]) {
      printf("C %d\\n", i);
    }
  }
  for (int i = 1; i <= 13; i++) {
    if (!poss[3][i]) {
      printf("D %d\\n", i);
    }
  }
  return 0;
}

Error: WA

Fixed submission:

#include <stdio.h>
#include <vector>

int main() {
  bool poss[4][14];
  for (int i = 0; i < 4; i++) {
    for (int j = 0; j < 13; j++) {
      poss[i][j] = false;
    }
  }

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

  for (int i = 0; i < n; i++) {
    char mark;
    int num;
    scanf(" %c &d", &mark, &num);
    switch (mark) {
    case 'S':
      poss[0][num] = true;
      break;
    case 'H':
      poss[1][num] = true;
      break;
    case 'C':
      poss[2][num] = true;
      break;
    case 'D':
      poss[3][num] = true;
      break;
    }
  }
  for (int i = 1; i <= 13; i++) {
    if (!poss[0][i]) {
      printf("S %d\\n", i);
    }
  }
  for (int i = 1; i <= 13; i++) {
    if (!poss[1][i]) {
      printf("H %d\\n", i);
    }
  }
  for (int i = 1; i <= 13; i++) {
    if (!poss[2][i]) {
      printf("C %d\\n", i);
    }
  }
  for (int i = 1; i <= 13; i++) {
    if (!poss[3][i]) {
      printf("D %d\\n", i);
    }
  }
  return 0;
}
Problem p02408 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
using namespace std;

int changeNum(char c) {
  switch (c) {
  case 'S':
    return 0;
  case 'H':
    return 1;
  case 'C':
    return 2;
  case 'D':
    return 3;
  }
}

int main(void) {
  int n, suit, num;
  bool card[4][13];
  cin >> n;

  for (int i = 0; i < 4; i++) {
    for (int j = 0; j < 13; j++) {
      card[i][j] = false;
    }
  }

  char c;
  for (int i = 0; i < n; i++) {
    cin >> c >> num;
    card[changeNum(c)][num - 1] = true;
  }

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

  return 0;
}

Error: 1

Fixed submission:

#include <iostream>
using namespace std;

int changeNum(char c) {
  switch (c) {
  case 'S':
    return 0;
  case 'H':
    return 1;
  case 'C':
    return 2;
  case 'D':
    return 3;
  }
}

int main(void) {
  int n, suit, num;
  bool card[4][13];
  cin >> n;

  for (int i = 0; i < 4; i++) {
    for (int j = 0; j < 13; j++) {
      card[i][j] = false;
    }
  }

  char c;
  for (int i = 0; i < n; i++) {
    cin >> c >> num;
    card[changeNum(c)][num - 1] = true;
  }

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

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

#include <iostream>
using namespace std;

int main() {
  char x, l;
  int cards[4][13], y, z, n, j, k;
  cin >> n;
  for (j = 0; j < 4; j++) {
    for (k = 0; k < 13; k++) {
      cards[j][k] = 0;
    }
  }

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

Error: -11

Fixed submission:

#include <iostream>
using namespace std;

int main() {
  int cards[4][13], x, y, z, n, j, k, l;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x >> y;
    if (x == 'S')
      z = 0;
    else if (x == 'H')
      z = 1;
    else if (x == 'C')
      z = 2;
    else
      z = 3;
    cards[z][y] = 1;
  }
  for (j = 0; j < 4; j++) {
    for (k = 0; k < 13; k++) {
      if (cards[j][k] == 0) {
        if (j == 0)
          l = 'S';
        else if (j == 1)
          l = 'H';
        else if (j == 2)
          l = 'C';
        else
          l = 'D';
        cout << l << " " << k + 1 << endl;
      }
    }
  }
}
Problem p02408 (C++) — buggy submission, verdict: Runtime Error

#include <algorithm>
#include <cmath>
#include <cstdint>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <vector>

using namespace std;

int suitToIndex(char c) {
  switch (c) {
  default:
  case 'S':
    return 0;
  case 'H':
    return 1;
  case 'C':
    return 2;
  case 'D':
    return 3;
  }
}

char suits[4] = {'S', 'H', 'C', 'D'};

int main() {
  bool found[4][13] = {};
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    char suit;
    int rank;
    cin >> suit >> rank;
    found[suitToIndex(suit)][rank - 1] = true;
  }
  for (int suitIndex = 0; suitIndex < 4; ++suitIndex) {
    for (int rank = 1; rank <= 13; ++rank) {
      if (!found[suitIndex][rank - 1]) {
        cout << suits[suitIndex] << " " << rank << endl;
        ;
      }
    }
  }
}

Error: 0

Fixed submission:

#include <algorithm>
#include <cmath>
#include <cstdint>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <vector>

using namespace std;

int suitToIndex(char c) {
  switch (c) {
  default:
  case 'S':
    return 0;
  case 'H':
    return 1;
  case 'C':
    return 2;
  case 'D':
    return 3;
  }
}

char suits[4] = {'S', 'H', 'C', 'D'};

int main() {
  bool found[4][13] = {};
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    char suit;
    int rank;
    cin >> suit >> rank;
    found[suitToIndex(suit)][rank] = true;
  }
  for (int suitIndex = 0; suitIndex < 4; ++suitIndex) {
    for (int rank = 1; rank <= 13; ++rank) {
      if (!found[suitIndex][rank]) {
        cout << suits[suitIndex] << " " << rank << endl;
        ;
      }
    }
  }
}
Problem p02408 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
using namespace std;
int main() {

  int S[13], H[13], C[13], D[13], N, num;
  char mark;
  cin >> N;
  for (int i = 0; i < 13; i++)
    S[i] = 0, H[i] = 0, C[i] = 0, D[i] = 0;
  for (int i = 0; i < N; i++) {
    cin >> mark >> num;
    if (mark == 'S')
      S[num - 1] = 1;
    if (mark == 'H')
      H[num - 1] = 1;
    if (mark == 'C')
      C[num - 1] = 1;
    if (mark == 'D')
      D[num - 1] = 1;
  }

  for (int i = 0; i < 13; i++)
    if (S[i] == 0)
      cout << "S " << i + 1 << endl;
  for (int i = 0; i < 13; i++)
    if (H[i] == 0)
      cout << "H " << i + 1 << endl;
  for (int i = 0; i < 13; i++)
    if (C[i] == 0)
      cout << "C " << i + 1 << endl;
  for (int i = 0; i < 13; i++)
    if (D[i] == 0)
      cout << "D " << i + 1 << endl;

  return 0;
}


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


Fixed submission:

#include <iostream>
using namespace std;
int main() {

  int S[13], H[13], C[13], D[13], N, num;
  char mark;
  cin >> N;
  for (int i = 0; i < N; i++)
    S[i] = 0, H[i] = 0, C[i] = 0, D[i] = 0;
  for (int i = 0; i < N; i++) {
    cin >> mark >> num;
    if (mark == 'S')
      S[num - 1] = 1;
    if (mark == 'H')
      H[num - 1] = 1;
    if (mark == 'C')
      C[num - 1] = 1;
    if (mark == 'D')
      D[num - 1] = 1;
  }

  for (int i = 0; i < 13; i++)
    if (S[i] == 0)
      cout << "S " << i + 1 << endl;
  for (int i = 0; i < 13; i++)
    if (H[i] == 0)
      cout << "H " << i + 1 << endl;
  for (int i = 0; i < 13; i++)
    if (C[i] == 0)
      cout << "C " << i + 1 << endl;
  for (int i = 0; i < 13; i++)
    if (D[i] == 0)
      cout << "D " << i + 1 << endl;

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

#include <iostream>
#include <string>

using namespace std;

int main() {
  int n, num;
  int a[100][100] = {0};
  cin >> n;
  for (int i = 0; i < n; i++) {
    string SHCD;
    cin >> SHCD >> num;
    int x;
    if (SHCD == "S") {
      x = 0;
    } else if (SHCD == "H") {
      x = 1;
    } else if (SHCD == "C") {
      x = 2;
    } else if (SHCD == "D") {
      x = 3;
    }
    a[x][num] = 1;
  }
  for (int j = 0; j < 4; j++) {
    for (int k = 1; k < 14; k++) {
      if (!a[j][k]) {
        string shcd;
        if (j == 0) {
          shcd = "S";
        } else if (j == 1) {
          shcd = "H";
        } else if (j == 2) {
          shcd = "C";
        } else if (j == 3) {
          shcd = "D";
        }
        cout << shcd << " " << k << endl;
      }
    }
  }
}

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


Fixed submission:

#include <iostream>
#include <string>

using namespace std;

int main() {
  int n, num;
  int a[3][13];
  cin >> n;
  for (int i = 0; i < n; i++) {
    string SHCD;
    cin >> SHCD >> num;
    int x;
    if (SHCD == "S") {
      x = 0;
    } else if (SHCD == "H") {
      x = 1;
    } else if (SHCD == "C") {
      x = 2;
    } else if (SHCD == "D") {
      x = 3;
    }
    a[x][num] = 1;
  }
  for (int j = 0; j < 4; j++) {
    for (int k = 1; k < 14; k++) {
      if (a[j][k] != 1) {
        string SHCD;
        if (j == 0) {
          SHCD = "S";
        } else if (j == 1) {
          SHCD = "H";
        } else if (j == 2) {
          SHCD = "C";
        } else if (j == 3) {
          SHCD = "D";
        }
        cout << SHCD << " " << k << endl;
      }
    }
  }
}
Problem p02408 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
using namespace std;
int main() {
  int n;
  cin >> n;
  string a;
  int b;
  int cards[4][13];
  for (int k = 0; k < 4; k++) {
    for (int t = 0; t < 13; t++) {
      cards[k][t] = 0;
    }
  }
  for (int s = 0; s < n; s++) {
    cin >> a >> b;

    if (a == "S") {
      cards[0][b - 1] = 1;
    } else if (a == "H") {
      cards[1][b - 1] = 1;
    } else if (a == "C") {
      cards[2][b - 1] = 1;
    } else if (a == "D") {
      cards[3][b - 1] = 1;
    }
  }
  for (int i = 0; i < 4; i++) {
    for (int j = 0; j < 13; j++) {
      if (cards[i][j] != 1) {
        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: 0

Fixed submission:

#include <iostream>

using namespace std;

int main() {
  int n;
  cin >> n;
  string a;
  int b;
  int cards[4][13];
  for (int s = 0; s < n; s++) {
    cin >> a >> b;

    if (a == "S") {
      cards[0][b] = 1;
    } else if (a == "H") {
      cards[1][b] = 1;
    } else if (a == "C") {
      cards[2][b] = 1;
    } else if (a == "D") {
      cards[3][b] = 1;
    }
  }

  for (int i = 0; i < 4; i++) {
    for (int j = 1; j <= 13; j++) {
      if (cards[i][j] != 1) {
        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;
        }
      }
    }
  }
}
Problem p02408 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int main() {
  vector<int> S(13, 0);
  vector<int> H(13, 0);
  vector<int> C(13, 0);
  vector<int> D(13, 0);
  int n;
  char c;
  int num;
  cin >> n;

  for (int i = 0; i < n; i++) {
    cin >> c >> num;
    switch (c) {
    case 'S':
      S[num - 1] = 1;
      break;
    case 'H':
      H[num - 1] = 1;
      break;
    case 'C':
      C[num - 1] = 1;
      break;
    case 'D':
      D[num - 1] = 1;
      break;
    }
  }

  for (int i = 0; i < 13; i++) {
    if (S[i] == 0) {
      n = i + 1;
      cout << "S"
           << " " << n << endl;
    }
  }
  for (int i = 0; i < 13; i++) {
    if (H[i] == 0) {
      n = i + 1;
      cout << "H"
           << " " << n << endl;
    }
  }
  for (int i = 0; i < 13; i++) {
    if (C[i] == 0) {
      n = i + 1;
      cout << "C"
           << " " << n << endl;
    }
  }
  for (int i = 0; i < 13; i++) {
    if (D[i] == 0) {
      n = i + 1;
      cout << "D"
           << " " << n << endl;
    }
  }
}

Error: TLE

Fixed submission:

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

int main() {
  vector<int> S(13, 0);
  vector<int> H(13, 0);
  vector<int> C(13, 0);
  vector<int> D(13, 0);
  int n;
  char c;
  int num;
  cin >> n;

  for (int i = 0; i < n; i++) {
    cin >> c >> num;
    switch (c) {
    case 'S':
      S[num - 1] = 1;
      break;
    case 'H':
      H[num - 1] = 1;
      break;
    case 'C':
      C[num - 1] = 1;
      break;
    case 'D':
      D[num - 1] = 1;
      break;
    }
  }

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

#include <iostream>
using namespace std;
int main() {
  int n, x = 0, a[4][13] = {0};
  char ch;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> ch >> x;
    if (ch == 'S') {
      a[0][x - 1] = 1;
    }
    if (ch == 'H') {
      a[1][x - 1] = 2;
    }
    if (ch == 'C') {
      a[2][x - 1] = 3;
    }
    if (ch == 'D') {
      a[3][x - 1] = 4;
    }
  }
  for (int s = 0; s < 4; s++) {
    for (int k = 1; k < 14; k++) {

      if (a[s][k - 1] == 0 && s == 0) {
        cout << "S " << k << endl;
      }
      if (a[s][k - 1] == 0 && s == 1) {
        cout << "H " << k << endl;
      }
      if (a[s][k - 1] == 0 && s == 2) {
        cout << "C " << k << endl;
      }
      if (a[s][k - 1] == 0 && s == 3) {
        cout << "D " << k << endl;
      }
    }
  }

  return 0;
}


Error: WA

Fixed submission:

#include <iostream>
using namespace std;
int main(void) {

  // 変数宣言&初期化
  char spel; // 絵柄代入用
  int num[52], total = 0, i = 0, j = 0;
  bool card[4][13];

  cin >> total;

  // 入力
  for (i = 0; i < total; i++) {
    cin >> spel >> num[i];
  }

  //
  for (i = 0; i < total; i++) {
    if (spel == 'S') {
      card[0][num[i]] = true;
    }

    if (spel == 'H') {
      card[1][num[i]] = true;
    }

    if (spel == 'C') {
      card[2][num[i]] = true;
    }

    if (spel == 'D') {
      card[3][num[i]] = true;
    }
  }

  // 不足しているカードの特定
  for (j = 0; j < 4; j++) {

    for (i = 0; i < 14; i++) {

      if (card[j][i] == false && i != 0) {

        // 絵柄特定
        if (j == 0) {
          cout << "S " << i << endl;
        }

        if (j == 1) {
          cout << "H " << i << endl;
        }

        if (j == 2) {
          cout << "C " << i << endl;
        }

        if (j == 3) {
          cout << "D " << i << endl;
        }
      }
    }
  }

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

#include <iostream>
using namespace std;

int main() {
  int n;
  char suits[4] = {'S', 'H', 'C', 'D'};
  bool d[4][13] = {false};

  cin >> n;

  for (int i = 0; i < n; i++) {
    char mark;
    int A;

    cin >> mark >> A;

    if (mark == suits[0])
      d[0][A - 1] = true;
    else if (mark == suits[1])
      d[1][A - 1] = true;
    else if (mark == suits[2])
      d[2][A - 1] = true;
    else if (mark == suits[3])
      d[3][A - 1] = true;
  }

  for (int i = 0; i < 4; i++) {
    for (int j = 0; j < 13; j++) {
      if (d[i][j] == false)
        cout << suits[i] << " " << j + 1 << "\\n";
    }
  }

  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>
using namespace std;

int main() {
  int n;
  char suits[4] = {'S', 'H', 'C', 'D'};
  bool d[4][13] = {false};

  cin >> n;

  while (1) {
    for (int i = 0; i < n; i++) {
      char mark;
      int A;

      cin >> mark >> A;

      if (mark == suits[0])
        d[0][A - 1] = true;
      else if (mark == suits[1])
        d[1][A - 1] = true;
      else if (mark == suits[2])
        d[2][A - 1] = true;
      else if (mark == suits[3])
        d[3][A - 1] = true;
    }

    for (int i = 0; i < 4; i++) {
      for (int j = 0; j < 13; j++) {
        if (d[i][j] == false)
          cout << suits[i] << " " << j + 1 << "\\n";
      }
    }
  }

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

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

int main() {
  int n;
  cin >> n;
  bool cards[53] = {};
  char mark;
  int num;

  for (int i = 0; i < n; i++) {
    cin >> mark >> num;

    switch (mark) {
    case 'S':
      break;
    case 'H':
      num += 13;
      break;
    case 'C':
      num += 26;
      break;
    case 'D':
      num += 39;
      break;
    }
    cards[num] = num;
  }

  for (int i = 1; i <= 52; i++) {
    if (cards[i] == 0) {
      switch ((i - 1) / 13) {
      case 0:
        mark = 'S';
        break;
      case 1:
        mark = 'H';
        break;
      case 2:
        mark = 'C';
        break;
      case 3:
        mark = 'D';
        break;
      }
      cout << mark << " " << (i - ((i - 1) / 13) * 13) << endl;
    }
  }
  return 0;
}

Error: 0

Fixed submission:

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

int main() {
  int n;
  cin >> n;
  int cards[52] = {};
  char mark;
  int num;

  for (int i = 0; i < n; i++) {
    cin >> mark >> num;

    switch (mark) {
    case 'S':
      break;
    case 'H':
      num += 13;
      break;
    case 'C':
      num += 26;
      break;
    case 'D':
      num += 39;
      break;
    }
    cards[num] = num;
  }

  for (int i = 1; i <= 52; i++) {
    if (cards[i] == 0) {
      switch ((i - 1) / 13) {
      case 0:
        mark = 'S';
        break;
      case 1:
        mark = 'H';
        break;
      case 2:
        mark = 'C';
        break;
      case 3:
        mark = 'D';
        break;
      }
      cout << mark << " " << (i - ((i - 1) / 13) * 13) << endl;
    }
  }
  return 0;
}