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

#include <iostream>

int main() {
  int n, r;
  char m;
  std::cin >> n;
  bool a[4][13]{};
  for (int i = 0; i != n; ++i) {
    std::cin >> m >> r;
    switch (m) {
    case 'S':
      a[0][r - 1] = true;
      break;
    case 'H':
      a[1][r - 1] = true;
      break;
    case 'C':
      a[2][r - 1] = true;
      break;
    case 'D':
      a[3][r - 1] = true;
      break;
    }
  }
  for (int i = 0; i != 4; ++i) {
    for (int j = 0; j != 13; ++j) {
      switch (i) {
      case 0:
        if (!a[i][j])
          std::cout << 'S' << ' ' << j + 1 << '\\n';
        break;
      case 1:
        if (!a[i][j])
          std::cout << 'H' << ' ' << j + 1 << '\\n';
        break;
      case 2:
        if (!a[i][j])
          std::cout << 'C' << ' ' << j + 1 << '\\n';
        break;
      case 3:
        if (!a[i][j])
          std::cout << 'D' << ' ' << j + 1 << '\\n';
        break;
      }
    }
  }
}

Error: TLE

Fixed submission:

#include <iostream>

int main() {
  int n, r;
  char m;
  std::cin >> n;
  bool a[4][13]{};
  for (int i = 0; i != n; ++n) {
    std::cin >> m >> r;
    switch (m) {
    case 'S':
      a[0][r - 1] = true;
      break;
    case 'H':
      a[1][r - 1] = true;
      break;
    case 'C':
      a[2][r - 1] = true;
      break;
    case 'D':
      a[3][r - 1] = true;
      break;
    }
  }
  for (int i = 0; i != 4; ++i) {
    for (int j = 0; j != 13; ++j) {
      switch (i) {
      case 0:
        if (a[i][j])
          std::cout << 'S' << ' ' << j + 1;
        break;
      case 1:
        if (a[i][j])
          std::cout << 'H' << ' ' << j + 1;
        break;
      case 2:
        if (a[i][j])
          std::cout << 'C' << ' ' << j + 1;
        break;
      case 3:
        if (a[i][j])
          std::cout << 'D' << ' ' << j + 1;
        break;
      }
      std::cout << '\\n';
    }
  }
}
Problem p02408 (C++) — buggy submission, verdict: Runtime Error

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

int main() {

  int n;

  cin >> n;

  int card[4][13] = {};

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

    string suit;

    int num;

    cin >> suit >> num;

    if (suit == "S")
      card[0][num - 1] = 1;
    if (suit == "H")
      card[1][num - 1] = 1;
    if (suit == "C")
      card[2][num - 1] = 1;
    if (suit == "D")
      card[3][num - 1] = 1;
  }

  string str[4] = {"S", "H", "C", "D"};
  for (int i = 0; i < 4; i++) {
    for (int j = 0; j < 13; j++) {
      if (card[i][j] == 1)
        continue;
      cout << str[i] << " " << j + 1 << endl;
    }
  }

  return 0;
}


Error: WA

Fixed submission:

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

int main() {

  int n;

  cin >> n;

  int card[4][13] = {};

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

    string suit;

    int num;

    cin >> suit >> num;

    if (suit == "S")
      card[0][num - 1] = 1;
    if (suit == "H")
      card[0][num - 1] = 1;
    if (suit == "C")
      card[2][num - 1] = 1;
    if (suit == "D")
      card[3][num - 1] = 1;
  }

  string str[4] = {"S", "H", "C", "D"};
  for (int i = 0; i < 4; i++) {
    for (int j = 1; j < 14; j++) {
      if (card[i][j] == 1)
        continue;
      cout << str[i] << " " << j + 1 << endl;
    }
  }

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

#include <stdio.h>

int main() {
  int cards[4][13], num, n, m, i, j;
  char mark;

  for (i = 0; i < 4; i++)
    for (j = 0; j < 13; j++)
      cards[i][j] = -1;

  scanf("%d", &n);

  for (i = 0; i < n * 2; i++) {
    scanf("%c", &mark);
    scanf("%d", &num);
    if (mark == 'S')
      cards[0][num - 1] = 0;
    else if (mark == 'H')
      cards[1][num - 1] = 0;
    else if (mark == 'C')
      cards[2][num - 1] = 0;
    else if (mark == 'D')
      cards[3][num - 1] = 0;
  }

  for (i = 0; i < 4; i++)
    for (j = 0; j < 13; j++) {
      if (cards[i][j] == -1) {
        if (i == 0)
          printf("S %d\\n", j + 1);
        else if (i == 1)
          printf("H %d\\n", j + 1);
        else if (i == 2)
          printf("C %d\\n", j + 1);
        else if (i == 3)
          printf("D %d\\n", j + 1);
      }
    }

  return 0;
}

Error: -11

Fixed submission:

#include <stdio.h>

int main(void) {
  int a, b, n[4][13], i, j;
  char mark;

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

  scanf("%d", a);

  for (i = 0; i < a; i++) {
    scanf("%c %d", &mark, &b);
    switch (mark) {
    case 'S':
      n[0][b] = 0;
    case 'H':
      n[1][b] = 0;
    case 'C':
      n[2][b] = 0;
    case 'D':
      n[3][b] = 0;
    }
  }

  for (i = 0; i < 4; i++) {
    for (j = 0; j < 13; j++) {
      if (n[i][j] != 0) {
        switch (i) {
        case 0:
          printf("S %d\\n", n[0][j]);
        case 1:
          printf("H %d\\n", n[1][j]);
        case 2:
          printf("C %d\\n", n[2][j]);
        case 3:
          printf("D %d\\n", n[3][j]);
        }
      }
    }
  }

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

#include <iostream>
using namespace std;

int main() {
  int n, b;
  bool cards[4][14];
  char a;

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

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

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

  return 0;
}


Error: WA

Fixed submission:

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

int main(void) {
  int n, b, cards[4][13] = {0};
  char a;

  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a >> b;
    switch (a) {
    case 'S':
      cards[0][b] = true;
    case 'H':
      cards[1][b] = true;
    case 'C':
      cards[2][b] = true;
    case 'D':
      cards[3][b] = true;
    }
  }

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

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

#include <iostream>

using namespace std;

int main() {

  int cards[4][13];

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

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

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

Error: TLE

Fixed submission:

#include <iostream>

using namespace std;

int main() {

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

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

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

#include <iostream>
using namespace std;

int main() {
  int card[52] = {0};
  int total, number;
  char type;
  cin >> total;
  for (int i = 0; i < total; i++) {
    cin >> type >> number;
    if (type == 'S') {
      card[number - 1] = {1};
    }
    if (type == 'H') {
      card[number + 12] = {1};
    }
    if (type == 'C') {
      card[number + 25] = {1};
    }
    if (type == 'D') {
      card[number + 38] = {1};
    }
  }
  for (int i = 0; i < 52; i++) {
    if (card[i] == 0) {
      if (i < 13) {
        cout << "S"
             << " " << i + 1 << endl;
      }
      if (i >= 13 && i < 26) {
        cout << "H"
             << " " << i - 12 << endl;
      }
      if (i >= 26 && i < 39) {
        cout << "C"
             << " " << i - 25 << endl;
      }
      if (i >= 39 && i < 52) {
        cout << "D"
             << " " << i - 38 << endl;
      }
    }
  }
}


Error: 0

Fixed submission:

#include <iostream>
using namespace std;

int main() {
  int card[51] = {0};
  int total, number;
  char type;
  cin >> total;
  for (int i = 0; i < total; i++) {
    cin >> type >> number;
    if (type == 'S') {
      card[number - 1] = {1};
    }
    if (type == 'H') {
      card[number + 12] = {1};
    }
    if (type == 'C') {
      card[number + 25] = {1};
    }
    if (type == 'D') {
      card[number + 38] = {1};
    }
  }
  for (int i = 0; i < 52; i++) {
    if (card[i] == 0) {
      if (i < 13) {
        cout << "S"
             << " " << i + 1 << endl;
      }
      if (i >= 13 && i < 26) {
        cout << "H"
             << " " << i - 12 << endl;
      }
      if (i >= 26 && i < 39) {
        cout << "C"
             << " " << i - 25 << endl;
      }
      if (i >= 39 && i < 52) {
        cout << "D"
             << " " << i - 38 << endl;
      }
    }
  }
}
Problem p02408 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <cstdio>
#include <iostream>
using namespace std;
#define MAX 52

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

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

  do {
    cin >> n;
  } while (n < 0 || n > MAX);

  int i = 0;

  while (1) {

    cin >> stamp >> rank;

    switch (stamp) {
    case 'S':
      cards[0][rank - 1] = true;
      break;
    case 'H':
      cards[1][rank - 1] = true;
      break;
    case 'C':
      cards[2][rank - 1] = true;
      break;
    case 'D':
      cards[3][rank - 1] = true;
      break;
    default:
      break;
    }
    if (i++ == n - 1)
      break;
  }

  for (int j = 0; j < 4; j++) {
    for (int i = 0; i < 13; i++) {
      if (cards[j][i] == false) {
        switch (j) {
        case 0:
          printf("S ");
          break;
        case 1:
          printf("H ");
          break;
        case 2:
          printf("C ");
          break;
        case 3:
          printf("D ");
          break;
        default:
          break;
        }
        printf("%d\\n", i + 1);
      }
    }
  }

  return 0;
}

Error: TLE

Fixed submission:

#include <cstdio>
#include <iostream>
using namespace std;
#define MAX 52

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

  do {
    cin >> n;
  } while (n < 0 || n > MAX);

  int i = 0;

  while (1) {

    cin >> stamp >> rank;

    switch (stamp) {
    case 'S':
      cards[0][rank - 1] = true;
      break;
    case 'H':
      cards[1][rank - 1] = true;
      break;
    case 'C':
      cards[2][rank - 1] = true;
      break;
    case 'D':
      cards[3][rank - 1] = true;
      break;
    default:
      break;
    }
    if (i++ == rank - 1)
      break;
  }

  for (int i = 0; i < rank; i++) {
    for (int j = 0; j < 4; j++) {
      if (cards[j][i] == true) {
        switch (j) {
        case 0:
          printf("S ");
          break;
        case 1:
          printf("H ");
          break;
        case 2:
          printf("C ");
          break;
        case 3:
          printf("D ");
          break;
        default:
          break;
        }
        printf("%d\\n", i);
      }
    }
  }

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

#include <iostream>
#include <stdio.h>
using namespace std;
int main() {
  int n = 0, no;
  char mark;
  int card[4][15];
  cin >> n;
  for (int i = 0; n > i; i++) {
    cin >> mark;
    cin >> no;
    switch (mark) {
    case 'S':
      card[0][no] = 99;
      break;
    case 'H':
      card[1][no] = 99;
      break;
    case 'C':
      card[2][no] = 99;
      break;
    case 'D':
      card[3][no] = 99;
      break;
    }
  }
  for (int i = 0; i < 4; i++) {
    for (int n = 1; n <= 13; n++) {
      if (card[i][n] != 99) {
        switch (i) {
        case 0:
          cout << "S " << n << endl;
          break;
        case 1:
          cout << "H " << n << endl;
          break;
        case 2:
          cout << "C " << n << endl;
          break;
        case 3:
          cout << "D " << n << endl;
          break;
        }
      }
    }
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>
#include <stdio.h>
using namespace std;
int main() {
  int n = 0, no;
  char mark;
  int card[4][13];
  cin >> n;
  for (int i = n; n > i; i++) {
    cin >> mark;
    cin >> no;
    switch (mark) {
    case 'S':
      card[0][no] = 99;
      break;
    case 'H':
      card[1][no] = 99;
      break;
    case 'D':
      card[2][no] = 99;
      break;
    case 'C':
      card[3][no] = 99;
      break;
    }
  }
  for (int i = 0; i < 4; i++) {
    for (int n = 0; n < 13;) {
      if (card[i][n] != 99) {
        switch (i) {
        case 0:
          cout << "S " << n << endl;
          break;
        case 1:
          cout << "H " << n << endl;
          break;
        case 2:
          cout << "D " << n << endl;
          break;
        case 3:
          cout << "C " << n << endl;
          break;
        }
      }
    }
  }
  return 0;
}
Problem p02408 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
using namespace std;
int main() {
  int cards[4][13] = {0};
  int num, i, x, y;
  char ch;
  cin >> num;
  for (i = 0; i < num; i++) {
    cin >> ch >> y;
    if (ch == 'S')
      x = 0;
    else if (ch == 'H')
      x = 1;
    else if (ch == 'C')
      x = 2;
    else
      x = 3;
    cards[x][y - 1] = 1;
  }
  int j, k;
  for (j = 0; j < 4; j++) {
    for (k = 0; k < 13; k++) {
      if (cards[j][k] != 1) {
        if (j == 0)
          cout << "S " << k + 1 << endl;
        else if (j == 1)
          cout << "H " << k + 1 << endl;
        else if (j == 2)
          cout << "C " << k + 1 << endl;
        else
          cout << "D " << k + 1 << endl;
      }
    }
  }
  return 0;
}


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


Fixed submission:

#include <iostream>
using namespace std;
int main() {
  int cards[3][12] = {0};
  int num, i, x, y;
  char ch;
  cin >> num;
  for (i = 0; i < num; i++) {
    cin >> ch >> y;
    if (ch == 'S')
      x = 0;
    else if (ch == 'H')
      x = 1;
    else if (ch == 'C')
      x = 2;
    else
      x = 3;
    cards[x][y - 1] = 1;
  }
  int j, k;
  for (j = 0; j < 4; j++) {
    for (k = 0; k < 13; k++) {
      if (cards[j][k] != 1) {
        if (j == 0)
          cout << "S " << k + 1 << endl;
        else if (j == 1)
          cout << "H " << k + 1 << endl;
        else if (j == 2)
          cout << "C " << k + 1 << endl;
        else
          cout << "D " << k + 1 << endl;
      }
    }
  }
  return 0;
}
Problem p02408 (C++) — buggy submission, verdict: Runtime Error

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

int card[4][13] = {};

int main() {
  int n;
  char mark;
  int number;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> mark >> number;
    switch (mark) {
    case 'S':
      card[0][number - 1] = 1;
      break;
    case 'H':
      card[1][number - 1] = 1;
      break;
    case 'C':
      card[2][number - 1] = 1;
      break;
    case 'D':
      card[3][number - 1] = 1;
      break;
    }
  }
  //
  for (int i = 0; i < 13; i++) {
    if (card[0][i] != 1) {
      cout << "S " << i + 1 << endl;
    }
  }
  for (int i = 0; i < 13; i++) {
    if (card[1][i] != 1) {
      cout << "H " << i + 1 << endl;
    }
  }
  for (int i = 0; i < 13; i++) {
    if (card[2][i] != 1) {
      cout << "C " << i + 1 << endl;
    }
  }
  for (int i = 0; i < 13; i++) {
    if (card[3][i] != 1) {
      cout << "D " << i + 1 << endl;
    }
  }
  return 0;
}

Error: 0

Fixed submission:

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

int main() {
  int n;
  int a[4][13] = {};
  char b1;
  int b2;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> b1 >> b2;
    if (b1 == 'S') {
      a[0][b2] = 1;
    } else if (b1 == 'H') {
      a[1][b2] = 1;
    } else if (b1 == 'C') {
      a[2][b2] = 1;
    } else {
      a[3][b2] = 1;
    }
  }
  //
  for (int i = 1; i <= 13; i++) {
    if (a[0][i] != 1) {
      cout << "S " << i << endl;
    }
  }
  for (int i = 1; i <= 13; i++) {
    if (a[1][i] != 1) {
      cout << "H " << i << endl;
    }
  }
  for (int i = 1; i <= 13; i++) {
    if (a[2][i] != 1) {
      cout << "C " << i << endl;
    }
  }
  for (int i = 1; i <= 13; i++) {
    if (a[3][i] != 1) {
      cout << "D " << i << endl;
    }
  }
  return 0;
}
Problem p02408 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
using namespace std;
int main() {
  int a[4][14], n, i, k, j, x;
  char t;
  for (k = 1; k <= 13; k++) {
    a[0][k] = 0;
    a[1][k] = 0;
    a[2][k] = 0;
    a[3][k] = 0;
  }
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> t >> x;
    if (t == 'S') {
      a[0][x] = 1;
    } else if (t == 'H') {
      a[1][x] = 1;
    } else if (t == 'C') {
      a[2][x] = 1;
    } else if (t == 'D') {
      a[3][x] = 1;
    }
  }
  for (j = 1; j <= 13; j++) {
    if (a[0][j] == false) {
      cout << "S"
           << " " << j << endl;
    }
  }
  for (j = 1; j <= 13; j++) {
    if (a[1][j] == false) {
      cout << "H"
           << " " << j << endl;
    }
  }
  for (j = 1; j <= 13; j++) {
    if (a[2][j] == false) {
      cout << "C"
           << " " << j << endl;
    }
  }
  for (j = 1; j <= 13; j++) {
    if (a[3][j] == false) {
      cout << "D"
           << " " << j << endl;
    }
  }
  return 0;
}

Error: 0

Fixed submission:

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

#include <iostream>

using namespace std;

int main() {

  int A[20][5];
  int n, N;
  char S;

  for (int i = 0; i < 20; i++)
    for (int j = 0; j < 5; j++)
      A[i][j] = 0;

  cin >> n;

  for (int i = 0; i < n; i++) {
    cin >> S >> N;

    if (S == 'S')
      A[N - 1][0] = 1;

    else if (S == 'H')
      A[N - 1][1] = 1;

    else if (S == 'C')
      A[N - 1][2] = 1;

    else
      A[N - 1][3] = 1;
  }

  for (int j = 0; j < 4; j++)
    for (int i = 0; i < 13; i++) {

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

  return 0;
}


Error: WA

Fixed submission:

#include <iostream>

using namespace std;

int main() {

  int A[20][5];
  int n, N;
  char S;

  for (int i = 0; i < 20; i++)
    for (int j = 0; j < 5; j++)
      A[i][j] = 0;

  cin >> n;

  for (int i = 0; i < n; i++) {
    cin >> S >> N;

    if (S == 'S')
      A[N][0] = 1;

    else if (S == 'H')
      A[N][1] = 1;

    else if (S == 'C')
      A[N][2] = 1;

    else
      A[N][3] = 1;
  }

  for (int j = 0; j < 4; j++)
    for (int i = 0; i < 13; i++) {

      if (A[j][i] == 0)
        if (j == 0)
          cout << "S " << i + 1 << endl;
      if (j == 1)
        cout << "H " << i + 1 << endl;
      if (j == 2)
        cout << "C " << i + 1 << endl;
      if (j == 3)
        cout << "D " << i + 1 << endl;
    }

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

//============================================================================
// Name        : ITP_1_6_B.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

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

int main() {
  int total, num;
  char mark, marks[4] = {'S', 'H', 'C', 'D'};
  vector<vector<int>> a(4, vector<int>(13));
  for (int i = 0; i < 4; ++i) {
    for (int j = 0; j < 13; ++j) {
      a[i][j] = 0;
    }
  }
  cin >> total;
  for (int i = 0; i < total; ++i) {
    cin >> mark >> num;
    switch (mark) {
    case 'S':
      a[0][num - 1] = 1;
      break;
    case 'H':
      a[1][num - 1] = 1;
      break;
    case 'C':
      a[2][num - 1] = 1;
      break;
    case 'D':
      a[3][num - 1] = 1;
      break;
    }
  }
  for (int i = 0; i < 4; ++i) {
    for (int j = 0; j < 13; ++j) {
      if (a[i][j] == 0) {
        printf("%c %d\\n", marks[i], j + 1);
      }
    }
  }
  return 0;
}

Error: TLE

Fixed submission:

//============================================================================
// Name        : ITP_1_6_B.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

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

int main() {
  int total, num;
  char mark, marks[4] = {'S', 'H', 'C', 'D'};
  int a[4][13];
  for (int i = 0; i < 4; ++i) {
    for (int j = 0; i < 13; ++j) {
      a[i][j] = 0;
    }
  }
  cin >> total;
  for (int i = 0; i < total; ++i) {
    cin >> mark >> num;
    switch (mark) {
    case 'S':
      a[0][num] = 1;
      break;
    case 'H':
      a[1][num] = 1;
      break;
    case 'C':
      a[2][num] = 1;
      break;
    case 'D':
      a[3][num] = 1;
      break;
    }
  }
  for (int i = 0; i < 4; ++i) {
    for (int j = 0; j < 13; ++j) {
      if (a[i][j] == 0) {
        printf("%c %d", marks[i], j + 1);
      }
    }
  }
  return 0;
}