prithivMLmods/Coder-Stat huggingface dataset:
Problem p02406 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
using namespace std;

int main() {
  int n;
  cin >> n;
  int i = 1;
  for (int i = 1; i <= n; i++) {
    int x = i;
    if (x % 3 == 0) {
      cout << " " << i;
      continue;
    }
    do {
      if (x % 10 == 3) {
        cout << " " << i;
        continue;
      }
      x /= 10;
    } while (x);
  }
  cout << endl;
}


Fixed submission:
#include <iostream>
using namespace std;

int main() {
  int n;
  cin >> n;
  int i = 1;
  for (int i = 1; i <= n; i++) {
    int x = i;
    if (x % 3 == 0) {
      cout << " " << i;
      continue;
    }
    do {
      if (x % 10 == 3) {
        cout << " " << i;
        break;
      }
      x /= 10;
    } while (x);
  }
  cout << endl;
}
Problem p02406 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
  int n;
  cin >> n;

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

    if (i % 3 == 0) {
      cout << " " << i;
    } else if (i % 10 == 3) {
      cout << " " << i;
    } else if ((i /= 10) % 10 == 3) {
      cout << " " << i;
    }
  }
  cout << endl;
}


Fixed submission:
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
  int n;
  cin >> n;

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

    if (i % 3 == 0) {
      cout << " " << i;
    } else if (i % 10 == 3) {
      cout << " " << i;
    } else if ((i / 10) % 10 == 3) {
      cout << " " << i;

    } else if ((i / 100) % 10 == 3) {
      cout << " " << i;
    } else if ((i / 1000) % 10 == 3) {
      cout << " " << i;
    }
  }
  cout << endl;
}
Problem p02406 (C++)

Buggy submission (status: Runtime Error):
#include <iostream>
#include <stdio.h>

int main(void) {

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

  int i = 1;
  while (++i <= n) {
    int x = i;
    if (x % 3 == 0) {
      std::cout << " " << i;
      continue;
    }

    while (x) {
      if (x % 10 == 3) {
        std::cout << " " << i;
        break;
      }
      x /= 10;
    }
  }
  std::cout << std::endl;

  return 0;
}


Fixed submission:
#include <iostream>
#include <stdio.h>

int main(void) {

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

  int i = 1;
  while (++i <= n) {
    int x = i;
    if (x % 3 == 0) {
      std::cout << " " << i;
      continue;
    }

    while (x) {
      if (x % 10 == 3) {
        std::cout << " " << i;
        break;
      }
      x /= 10;
    }
  }
  std::cout << std::endl;

  return 0;
}
Problem p02406 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
using namespace std;

bool has3(int x) {
  while (1) {
    if (x % 10 == 3)
      return true;
    x /= 10;
  }
  return false;
}

void call(int n) {
  for (int x = 1; x <= n; x++) {
    if (x % 3 == 0 || has3(x)) {
      cout << " " << x;
    }
  }
  cout << endl;
}

int main() {
  int n;
  cin >> n;
  call(n); // your code goes here
  return 0;
}

Fixed submission:
#include <iostream>
using namespace std;

bool has3(int x) {
  while (x) {
    if (x % 10 == 3)
      return true;
    x /= 10;
  }
  return false;
}

void call(int n) {
  for (int x = 1; x <= n; x++) {
    if (x % 3 == 0 || has3(x)) {
      cout << " " << x;
    }
  }
  cout << endl;
}

int main() {
  int n;
  cin >> n;
  call(n); // your code goes here
  return 0;
}
Problem p02406 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
using namespace std;
int main() {
  int a = 1, b, c, count = 0;
  cin >> b;
  for (; count < b; count++) {
    if (a % 3 == 0 || a % 10 == 3) {
      cout << ' ' << a;
    } else {
      for (c = 1; c != 0;) {
        c = a / 10;
        if (c % 10 == 3) {
          cout << ' ' << a;
          break;
        }
      }
    }
    a++;
  }
  cout << endl;
  return 0;
}

Fixed submission:
#include <iostream>
using namespace std;
int main() {
  int a = 1, b, c, count = 0;
  cin >> b;
  for (; count < b; count++) {
    if (a % 3 == 0 || a % 10 == 3) {
      cout << ' ' << a;
    } else {
      for (c = a; c != 0;) {
        c /= 10;
        if (c % 10 == 3) {
          cout << ' ' << a;
          break;
        }
      }
    }
    a++;
  }
  cout << endl;
  return 0;
}
Problem p02406 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>

using namespace std;

void call(int n);

void call(int n) {
  int x;
  for (int i = 1; i <= n; i++) {
    x = i;
    if (x % 3 == 0) {
      cout << " " << i;
    } else {
      do {
        if (x % 10 == 3) {
          cout << " " << i;
          break;
        }
        x / 10;
      } while (x);
    }
  }
  cout << endl;
}

int main(void) {
  int n;
  cin >> n;
  call(n);
}

Fixed submission:
#include <iostream>

using namespace std;

void call(int n);

void call(int n) {
  int x;
  for (int i = 1; i <= n; i++) {
    x = i;
    if (x % 3 == 0) {
      cout << " " << i;
    } else {
      do {
        if (x % 10 == 3) {
          cout << " " << i;
          break;
        }
        x /= 10;
      } while (x);
    }
  }
  cout << endl;
}

int main(void) {
  int n;
  cin >> n;
  call(n);
}
Problem p02406 (C++)

Buggy submission (status: Runtime Error):
#include <iostream>
using namespace std;

void CHECK_NUM(int, int);
void INCLUDE3(int, int, int);
void END_CHECK_NUM(int, int);

int main() {
  int n;
  cin >> n;

  CHECK_NUM(n, 1);

  return 0;
}

void CHECK_NUM(int n, int i) {
  int x = i;
  if (x % 3 == 0) {
    cout << " " << i;
    END_CHECK_NUM(n, i);
  }
  INCLUDE3(x, i, n);
}

void INCLUDE3(int x, int i, int n) {
  if (x % 10 == 3) {
    cout << " " << i;
    END_CHECK_NUM(n, i);
  }
  x /= 10;
  if (x) {
    INCLUDE3(x, i, n);
  }
  END_CHECK_NUM(n, i);
}

void END_CHECK_NUM(int n, int i) {
  if (++i <= n) {
    CHECK_NUM(n, i);
  }
  cout << endl;

  exit(1);
}


Fixed submission:
#include <iostream>
using namespace std;

void CHECK_NUM(int, int);
void INCLUDE3(int, int, int);
void END_CHECK_NUM(int, int);

int main() {
  int n;
  cin >> n;

  CHECK_NUM(n, 1);

  return 0;
}

void CHECK_NUM(int n, int i) {
  int x = i;
  if (x % 3 == 0) {
    cout << " " << i;
    END_CHECK_NUM(n, i);
  }
  INCLUDE3(x, i, n);
}

void INCLUDE3(int x, int i, int n) {
  if (x % 10 == 3) {
    cout << " " << i;
    END_CHECK_NUM(n, i);
  }
  x /= 10;
  if (x) {
    INCLUDE3(x, i, n);
  }
  END_CHECK_NUM(n, i);
}

void END_CHECK_NUM(int n, int i) {
  if (++i <= n) {
    CHECK_NUM(n, i);
  }
  cout << endl;

  exit(EXIT_SUCCESS);
}
Problem p02406 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>

using namespace std;

void nabeatsu(int n) {
  int x;
  for (int i = 1; i <= n; i++) {
    x = i;
    if (x % 3 == 0) {
      cout << " " << i;
    } else if (x % 10 == 3) {
      cout << " " << i;
    } else {
      x /= 10;
      if (x % 10 == 3) {
        cout << " " << i;
      } else if (x / 10 % 10 == 3) {
        cout << " " << i;
      } else if (x / 100 % 10 == 3) {
        cout << " " << i;
      }
    }
  }
  cout << endl;
}
int main() {
  int n;
  cin >> n;
  nabeatsu(n);
  while (1) {
  }
  return 0;
}

Fixed submission:
#include <iostream>

using namespace std;

void nabeatsu(int n) {
  int x;
  for (int i = 1; i <= n; i++) {
    x = i;
    if (x % 3 == 0) {
      cout << " " << i;
    } else if (x % 10 == 3) {
      cout << " " << i;
    } else {
      x /= 10;
      if (x % 10 == 3) {
        cout << " " << i;
      } else if (x / 10 % 10 == 3) {
        cout << " " << i;
      } else if (x / 100 % 10 == 3) {
        cout << " " << i;
      }
    }
  }
  cout << endl;
}
int main() {
  int n;
  cin >> n;
  nabeatsu(n);
  return 0;
}
Problem p02406 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>

int main() {
  int n;
  std::cin >> n;
  for (int i = 1; i <= n; i++) {
    int x = i;
    if (i % 3 == 0) {
      std::cout << " " << i;
      continue;
    } else
      while (x) {
        if (x % 10 == 3) {
          std::cout << " " << i;
          continue;
        }
        x /= 10;
      }
  }
  std::cout << std::endl;
  return 0;
}

Fixed submission:
#include <iostream>

int main() {
  int n;
  std::cin >> n;
  for (int i = 1; i <= n; i++) {
    int x = i;
    if (i % 3 == 0) {
      std::cout << " " << i;
      continue;
    } else
      while (x) {
        if (x % 10 == 3) {
          std::cout << " " << i;
          break;
        }
        x /= 10;
      }
  }
  std::cout << std::endl;
  return 0;
}
Problem p02406 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;

int main() {
  int a;
  cin >> a;
  for (int i = 1; i <= a; i++) {
    if (i % 3 == 0) {
      cout << " " << i;
    } else {
      for (int j = 0;; j++) {
        if (i == 0)
          break;
        if (i % 10 == 3) {
          cout << " " << i;
        } else {
          i = i / 10;
        }
      }
    }
  }
  return 0;
}

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

int main() {
  int a;
  cin >> a;
  for (int i = 1; i <= a; i++) {
    if (i % 3 == 0) {
      cout << " " << i;
    } else if (i % 10 == 3) {
      cout << " " << i;
    } else if ((i / 10) % 10 == 3) {
      cout << " " << i;
    } else if ((i / 100) % 10 == 3) {
      cout << " " << i;
    } else if ((i / 1000) % 10 == 3) {
      cout << " " << i;
    }
    if (i == a) {
      cout << "\n";
    }
  }
  return 0;
}
Problem p02406 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iomanip>
#include <iostream>
using namespace std;

int main() {
  int n, x;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    if (i % 3 == 0) {
      cout << " " << i;
    } else {
      x = i;
      while (x > 0) {
        if (x % 10 == 3) {
          cout << " " << i;
        } else {
          x = x / 10;
        }
      }
    }
  }
  cout << endl;
}

Fixed submission:
#include <iomanip>
#include <iostream>
using namespace std;

int main() {
  int n, x;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    if (i % 3 == 0) {
      cout << " " << i;
    } else {
      x = i;
      while (x > 0) {
        if (x % 10 == 3) {
          cout << " " << i;
          break;
        } else {
          x = x / 10;
        }
      }
    }
  }
  cout << endl;
}
Problem p02407 (Python)

Buggy submission (status: Runtime Error):
n = int(input)
lst = list(map(int, input().split()))
print(" ".join(lst[::-1]))


Fixed submission:
input()
print(" ".join(input().split()[::-1]))
Problem p02407 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <stdlib.h>
#include <string>
#include <vector>
using namespace std;

int main() {
  int n, m;
  int maximum;
  int a[1000];
  while (true) {
    cin >> n >> m;
    if (n == 0 && m == 0)
      break;
    maximum = 0;
    for (int j = 0; j < n; j++) {
      cin >> a[j];
    }
    for (int j = 0; j < n - 1; j++) {
      for (int t = j + 1; t < n; t++) {
        if (a[j] + a[t] <= m) {
          maximum = max(maximum, a[j] + a[t]);
        }
      }
    }
    if (maximum == 0) {
      cout << "NONE" << endl;
    } else {
      cout << maximum << endl;
    }
  }
}


Fixed submission:
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <stdlib.h>
#include <string>
#include <vector>
using namespace std;

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++)
    cin >> a[i];
  for (int i = n - 1; 0 < i; i--)
    cout << a[i] << " ";
  cout << a[0] << endl;
}
Problem p02407 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
int a[105];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++)
    cin >> a[i];
  for (int i = n - 1; i > 0; i++)
    cout << a[i] << " ";
  cout << a[0] << endl;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int a[105];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++)
    cin >> a[i];
  for (int i = n - 1; i > 0; i--)
    cout << a[i] << " ";
  cout << a[0] << endl;
}
Problem p02407 (C++)

Buggy submission (status: Runtime Error):
#include <iostream>
#include <vector>
#define loop(i, a, b) for (int i = a; i < b; i++)
#define rep(i, a) loop(i, 0, a)
using namespace std;
int main() {
  int n;
  vector<int> in(n);
  rep(i, n) cin >> in[i];
  rep(i, n - 1) cout << in[n - i - 1] << " ";
  cout << in[0] << endl;
}

Fixed submission:
#include <iostream>
#include <vector>
#define loop(i, a, b) for (int i = a; i < b; i++)
#define rep(i, a) loop(i, 0, a)
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> in(n);
  rep(i, n) cin >> in[i];
  rep(i, n - 1) cout << in[n - i - 1] << " ";
  cout << in[0] << endl;
}
Problem p02407 (C++)

Buggy submission (status: Runtime Error):
#include <iostream>
using namespace std;
int main(void) {
  int n, a[5] = {0};
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = n - 1; i >= 0; i--) {
    if (i == n - 1) {
      cout << a[i];
    } else {
      cout << " " << a[i];
    }
  }
  cout << endl;
}


Fixed submission:
#include <iostream>
using namespace std;
int main(void) {
  int n, a[100] = {0};
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = n - 1; i >= 0; i--) {
    if (i == n - 1) {
      cout << a[i];
    } else {
      cout << " " << a[i];
    }
  }
  cout << endl;
}
Problem p02407 (C++)

Buggy submission (status: Runtime Error):
#include <iostream>
#include <vector>
using namespace std;

int main() {
  int n;
  cin >> n;
  vector<int> numbers(n - 1);
  for (int i = 0; i < n; i++) {
    cin >> numbers[i];
  }
  for (int i = n; i > 1; i--) {
    cout << numbers[i - 1] << ' ';
  }
  cout << numbers[0] << endl;

  return 0;
}

Fixed submission:
#include <iostream>
#include <vector>
using namespace std;

int main() {
  int n;
  cin >> n;
  vector<int> numbers(n);
  for (int i = 0; i < n; i++) {
    cin >> numbers[i];
  }
  for (int i = n; i > 1; i--) {
    cout << numbers[i - 1] << ' ';
  }
  cout << numbers[0] << endl;

  return 0;
}
Problem p02407 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
#include <stdio.h>

using namespace std;

int main() {
  int n;
  cin >> n;
  int a[100];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (i == n - 1) {
      cout << a[i];
      for (i = n - 2; i >= 0; i--) {
        cout << " " << a[i];
      }
    }
  }
  return 0;
}


Fixed submission:
#include <iostream>
#include <stdio.h>

using namespace std;

int main() {
  int n;
  cin >> n;
  int a[100];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (i == n - 1) {
      cout << a[i];
      for (i = n - 2; i >= 0; i--) {
        cout << " " << a[i];
      }
      cout << endl;
      break;
    }
  }
  return 0;
}
Problem p02407 (Python)

Buggy submission (status: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
a.reverse()
print(" ".join(a))


Fixed submission:
n = int(input())
a = list(input().split())
a.reverse()
print(" ".join(a))
Problem p02407 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <cstdio>
#include <iostream>
using namespace std;
#define MAX 100

int main(void) {
  int n, a[MAX], i = 0;
  do {
    cin >> n;
  } while (n > MAX || n < 0);

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

  while (1) {
    printf("%d", a[n - i]);
    if (i == n)
      break;
    printf(" ");
  }
  printf("\n");
  return 0;
}

Fixed submission:
#include <cstdio>
#include <iostream>
using namespace std;
#define MAX 100

int main(void) {
  int n, a[MAX], i = 0;
  do {
    cin >> n;
  } while (n > MAX || n < 0);

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

  while (1) {
    printf("%d", a[n - i - 1]);
    if (i++ == n - 1)
      break;
    printf(" ");
  }
  printf("\n");
  return 0;
}
Problem p02407 (C++)

Buggy submission (status: Runtime Error):
#include <iostream>
// #include <stdio.h>
using namespace std;

int main() {
  int n, m;
  int a[10];
  cin >> n;
  // a = (int *)malloc(sizeof(int) * n);

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

  for (int i = n - 1; i > 0; i--) {
    cout << a[i] << " ";
  }
  cout << a[0];
  cout << endl;
  return 0;
}

Fixed submission:
#include <iostream>
// #include <stdio.h>
using namespace std;

int main() {
  int n, m;
  int a[1000];
  cin >> n;
  // a = (int *)malloc(sizeof(int) * n);

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

  for (int i = n - 1; i > 0; i--) {
    cout << a[i] << " ";
  }
  cout << a[0];
  cout << endl;
  return 0;
}
Problem p02407 (C++)

Buggy submission (status: Runtime Error):
#include <stdio.h>

int main(void) {
  int i, n;
  int arr[] = {};

  scanf("%d", &n);

  for (i = 0; i < n; i++) {
    scanf("%d", &arr[i]);
  }

  for (i = 0; i < (n / 2); i++) {
    int temp = arr[i];
    arr[i] = arr[(n - 1) - i];
    arr[(n - 1) - i] = temp;
  }

  for (i = 0; i < n; i++) {
    if (i) {
      printf(" ");
    }
    printf("%d", arr[i]);
  }
  printf("\n");
  return 0;
}

Fixed submission:
#include <stdio.h>

int main(void) {
  int i, n;
  int arr[100] = {0};

  scanf("%d", &n);

  for (i = 0; i < n; i++) {
    scanf("%d", &arr[i]);
  }

  for (i = 0; i < (n / 2); i++) {
    int temp = arr[i];
    arr[i] = arr[(n - 1) - i];
    arr[(n - 1) - i] = temp;
  }

  for (i = 0; i < n; i++) {
    if (i) {
      printf(" ");
    }
    printf("%d", arr[i]);
  }
  printf("\n");
  return 0;
}
Problem p02407 (C++)

Buggy submission (status: Runtime Error):
#include <stdio.h>

int main(void) {
  int i, n;
  scanf("%d", &n);
  int a[n];
  for (i = 0; i < n; ++i)
    scanf("%d", a[i]);
  for (i = n - 1; i >= 0; --i) {
    if (i)
      printf("%d ", a[i]);
    else
      printf("%d\n", a[i]);
  }
  return 0;
}


Fixed submission:
#include <stdio.h>

int main(void) {
  int i, n;
  scanf("%d", &n);
  int a[n];
  for (i = 0; i < n; ++i)
    scanf("%d", &a[i]);
  for (i = n - 1; i >= 0; --i) {
    if (i)
      printf("%d ", a[i]);
    else
      printf("%d\n", a[i]);
  }
  return 0;
}
Problem p02407 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <iostream>
#define _USE_MATH_DEFINES
#include <functional>
#include <math.h>
#include <stdio.h>
#include <vector>
using namespace std;

int n;
vector<int> v;
int main() {
  cin >> n;

  for (int i = 0; i < n; ++i) {
    int buf;
    cin >> buf;
    v.push_back(buf);
  }

  // sort(v.begin(), v.end(), greater<int>());

  vector<int>::reverse_iterator it, end;
  for (it = v.rbegin(), end = v.rend(); it != end; --it) {
    cout << (*it) << " ";
  }
  cout << endl;

  return 0;
}

Fixed submission:
#include <algorithm>
#include <iostream>
#define _USE_MATH_DEFINES
#include <functional>
#include <math.h>
#include <stdio.h>
#include <vector>
using namespace std;

int n;
vector<int> v;
int main() {
  cin >> n;

  for (int i = 0; i < n; ++i) {
    int buf;
    cin >> buf;
    v.push_back(buf);
  }

  // sort(v.begin(), v.end(), greater<int>());

  vector<int>::reverse_iterator it, end;
  for (it = v.rbegin(), end = v.rend(); it != end; ++it) {
    if (it == v.rbegin())
      cout << (*it);
    else
      cout << " " << (*it);
  }
  cout << endl;

  return 0;
}
Problem p02407 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <stdio.h>

int main() {

  int n = 0;
  scanf("%d", &n);
  int a[n + 1];
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  for (int i = n - 1; i = 1; i--) {
    printf("%d ", a[i]);
  }
  printf("%d\n", a[0]);
  return 0;
}


Fixed submission:
#include <stdio.h>

int main() {

  int n = 0;
  scanf("%d", &n);
  int a[n + 1];
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  for (int i = n - 1; i >= 1; i--) {
    printf("%d ", a[i]);
  }
  printf("%d\n", a[0]);
  return 0;
}
Problem p02407 (C++)

Buggy submission (status: Runtime Error):
#include <cstdio>
int main(void) {
  int n;
  int a[1000];
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  for (int i = n - 1; i > 0; i++) {
    printf("%d ", a[i]);
  }
  printf("%d\n", a[0]);
  return 0;
}

Fixed submission:
#include <cstdio>
int main(void) {
  int n;
  int a[1000];
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  for (int i = n - 1; i > 0; i--) {
    printf("%d ", a[i]);
  }
  printf("%d\n", a[0]);
  return 0;
}
Problem p02408 (C++)

Buggy submission (status: Runtime Error):
#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;
}


Fixed submission:
#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;
}
Problem p02408 (C++)

Buggy submission (status: Runtime Error):
#include <iostream>
using namespace std;
int main() {
  int cards[4][13] = {};
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    char c;
    int a;
    cin >> c >> a;
    for (int j = 0; j < n; j++) {
      if (c == 'S') {
        cards[0][a] = 1;
      } else if (c == 'H') {
        cards[1][a] = 1;
      } else if (c == 'C') {
        cards[2][a] = 1;
      } else {
        cards[3][a] = 1;
      }
    }
  }
  for (int k = 0; k <= 3; k++) {
    for (int l = 1; l <= 13; l++) {
      if (cards[k][l] == 0) {
        if (k == 0) {
          cout << "S " << l << endl;
        }
        if (k == 1) {
          cout << "H " << l << endl;
        }
        if (k == 2) {
          cout << "C " << l << endl;
        }
        if (k == 3) {
          cout << "D " << l << endl;
        }
      }
    }
  }
  return 0;
}


Fixed submission:
#include <iostream>
using namespace std;
int main() {
  int cards[4][14] = {};
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    char c;
    int a;
    cin >> c >> a;
    for (int j = 0; j < n; j++) {
      if (c == 'S') {
        cards[0][a] = 1;
      } else if (c == 'H') {
        cards[1][a] = 1;
      } else if (c == 'C') {
        cards[2][a] = 1;
      } else {
        cards[3][a] = 1;
      }
    }
  }
  for (int k = 0; k <= 3; k++) {
    for (int l = 1; l <= 13; l++) {
      if (cards[k][l] == 0) {
        if (k == 0) {
          cout << "S " << l << endl;
        }
        if (k == 1) {
          cout << "H " << l << endl;
        }
        if (k == 2) {
          cout << "C " << l << endl;
        }
        if (k == 3) {
          cout << "D " << l << endl;
        }
      }
    }
  }
  return 0;
}
Problem p02408 (C++)

Buggy submission (status: Runtime Error):
#include <iostream>
using namespace std;
int main() {
  char ch, card[4][13] = {false};
  int n, i, a, j, k;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> ch >> a;
    if (ch == 'S') {
      card[0][a] = true;
    }
    if (ch == 'H') {
      card[1][a] = true;
    }
    if (ch == 'C') {
      card[2][a] = true;
    }
    if (ch == 'D') {
      card[3][a] = true;
    }
  }
  for (j = 0; j < 4; j++) {
    for (k = 1; k < 14; k++) {
      if (!card[j][k]) {
        if (j == 0) {
          cout << 'S' << " " << k << endl;
        }
        if (j == 1) {
          cout << 'H' << " " << k << endl;
        }
        if (j == 2) {
          cout << 'C' << " " << k << endl;
        }
        if (j == 3) {
          cout << 'D' << " " << k << endl;
        }
      }
    }
  }
  return 0;
}


Fixed submission:
#include <iostream>
using namespace std;
int main() {
  char ch, card[4][14] = {false};
  int n, i, a, j, k;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> ch >> a;
    if (ch == 'S') {
      card[0][a] = true;
    }
    if (ch == 'H') {
      card[1][a] = true;
    }
    if (ch == 'C') {
      card[2][a] = true;
    }
    if (ch == 'D') {
      card[3][a] = true;
    }
  }
  for (j = 0; j < 4; j++) {
    for (k = 1; k < 14; k++) {
      if (!card[j][k]) {
        if (j == 0) {
          cout << 'S' << " " << k << endl;
        }
        if (j == 1) {
          cout << 'H' << " " << k << endl;
        }
        if (j == 2) {
          cout << 'C' << " " << k << endl;
        }
        if (j == 3) {
          cout << 'D' << " " << k << endl;
        }
      }
    }
  }
  return 0;
}
Problem p02408 (C++)

Buggy submission (status: Runtime Error):
#include <iostream>
using namespace std;
int main() {
  int n, x;
  int card[4][13] = {0};
  char t;
  cin >> n;

  for (int i = 0; i < n; i++) {
    cin >> t >> x;
    switch (t) {
    case 'S':
      card[0][x] = 1;
      break;
    case 'H':
      card[1][x] = 1;
      break;
    case 'C':
      card[2][x] = 1;
      break;
    case 'D':
      card[3][x] = 1;
      break;
    }
  }
  for (int i = 0; i < 4; i++) {
    for (int j = 1; j <= 13; j++) {
      if (card[i][j] == 0) {
        switch (i) {
        case 0:
          cout << 'S' << ' ' << j << endl;
          break;
        case 1:
          cout << 'H' << ' ' << j << endl;
          break;
        case 2:
          cout << 'C' << ' ' << j << endl;
          break;
        case 3:
          cout << 'D' << ' ' << j << endl;
          break;
        }
      }
    }
  }
  return 0;
}


Fixed submission:
#include <iostream>
using namespace std;
int main() {
  int n, x;
  int card[5][14] = {0};
  char t;
  cin >> n;

  for (int i = 0; i < n; i++) {
    cin >> t >> x;
    switch (t) {
    case 'S':
      card[0][x] = 1;
      break;
    case 'H':
      card[1][x] = 1;
      break;
    case 'C':
      card[2][x] = 1;
      break;
    case 'D':
      card[3][x] = 1;
      break;
    }
  }
  for (int i = 0; i < 4; i++) {
    for (int j = 1; j <= 13; j++) {
      if (card[i][j] == 0) {
        switch (i) {
        case 0:
          cout << 'S' << ' ' << j << endl;
          break;
        case 1:
          cout << 'H' << ' ' << j << endl;
          break;
        case 2:
          cout << 'C' << ' ' << j << endl;
          break;
        case 3:
          cout << 'D' << ' ' << j << endl;
          break;
        }
      }
    }
  }
  return 0;
}
Problem p02408 (C++)

Buggy submission (status: Runtime Error):
#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;
}

Fixed submission:
#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;
}
Problem p02408 (C++)

Buggy submission (status: Runtime Error):
#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;
}

Fixed submission:
#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;
}
Problem p02408 (C++)

Buggy submission (status: Runtime Error):
#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;
}

Fixed submission:
#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;
}
Problem p02408 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <iostream>
#define _USE_MATH_DEFINES
#include <functional>
#include <map>
#include <math.h>
#include <stdio.h>
#include <vector>
using namespace std;

int n;
bool list[4][13];
vector<int> v;
map<char, int> m;
int main() {
  m['S'] = 0;
  m['H'] = 1;
  m['C'] = 2;
  m['D'] = 3;

  cin >> n;

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

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

  return 0;
}

Fixed submission:
#include <algorithm>
#include <iostream>
#define _USE_MATH_DEFINES
#include <functional>
#include <map>
#include <math.h>
#include <stdio.h>
#include <vector>
using namespace std;

int n;
bool list[4][13];
vector<int> v;
map<char, int> m;
int main() {
  m['S'] = 0;
  m['H'] = 1;
  m['C'] = 2;
  m['D'] = 3;

  cin >> n;

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

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

  return 0;
}
Problem p02408 (C++)

Buggy submission (status: Runtime Error):
#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;
}

Fixed submission:
#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;
}
Problem p02408 (C++)

Buggy submission (status: Runtime Error):
#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;
}


Fixed submission:
#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;
}
Problem p02408 (Python)

Buggy submission (status: Runtime Error):
suit = {"S": 0, "H": 1, "C": 2, "D": 3}
suit_keys = list(suit.keys())
deck = [[suit_keys[i] + " " + str(j + 1) for j in range(13)] for i in range(4)]
for _ in range(int(input())):
    card = input().split()
    deck[suit[card[0]]][int(card[1])] = ""
for i in range(4):
    for j in deck[i]:
        if j != "":
            print(j)


Fixed submission:
suit = {"S": 0, "H": 1, "C": 2, "D": 3}
suit_keys = list(suit.keys())
deck = [[suit_keys[i] + " " + str(j + 1) for j in range(13)] for i in range(4)]
for _ in range(int(input())):
    card = input().split()
    deck[suit[card[0]]][int(card[1]) - 1] = ""
for i in range(4):
    for j in deck[i]:
        if j != "":
            print(j)
Problem p02408 (C++)

Buggy submission (status: 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 < 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;
}


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 < 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;
}
Problem p02408 (C++)

Buggy submission (status: Runtime Error):
#include <stdio.h>
int main(void) {
  int a, s[5][13], d = 0, f, g, h, j, i;
  char z[2];
  for (i = 1; i <= 13; i++) {
    s[1][i] = 0;
    s[2][i] = 0;
    s[3][i] = 0;
    s[4][i] = 0;
  }
  scanf("%d", &a);
  for (i = 1; i <= a; i++) {
    scanf(" %c %d", &z[1], &d);
    //	printf("%d %d\n",i,d);
    if (z[1] == 'S') {
      s[1][d] = 1;
    } else if (z[1] == 'H') {
      s[2][d] = 1;
    } else if (z[1] == 'C') {
      s[3][d] = 1;
    } else if (z[1] == 'D') {
      s[4][d] = 1;
    }
  }
  for (i = 1; i <= 4; i++) {
    for (j = 1; j <= 13; j++) {
      if (s[i][j] == 0) {
        if (i == 1)
          printf("S %d\n", j);
        if (i == 2)
          printf("H %d\n", j);
        if (i == 3)
          printf("C %d\n", j);
        if (i == 4)
          printf("D %d\n", j);
      }
    }
  }
  return 0;
}

Fixed submission:
#include <stdio.h>
int main(void) {
  int a, s[5][14], d = 0, f, g, h, j, i;
  char z[2];
  for (i = 1; i <= 13; i++) {
    s[1][i] = 0;
    s[2][i] = 0;
    s[3][i] = 0;
    s[4][i] = 0;
  }
  scanf("%d", &a);
  for (i = 1; i <= a; i++) {
    scanf(" %c %d", &z[1], &d);
    //	printf("%d %d\n",i,d);
    if (z[1] == 'S') {
      s[1][d] = 1;
    } else if (z[1] == 'H') {
      s[2][d] = 1;
    } else if (z[1] == 'C') {
      s[3][d] = 1;
    } else if (z[1] == 'D') {
      s[4][d] = 1;
    }
  }
  for (i = 1; i <= 4; i++) {
    for (j = 1; j <= 13; j++) {
      if (s[i][j] == 0) {
        if (i == 1)
          printf("S %d\n", j);
        if (i == 2)
          printf("H %d\n", j);
        if (i == 3)
          printf("C %d\n", j);
        if (i == 4)
          printf("D %d\n", j);
      }
    }
  }
  return 0;
}
Problem p02408 (C++)

Buggy submission (status: Runtime Error):
#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;
        }
      }
    }
  }
}


Fixed submission:
#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;
        }
      }
    }
  }
}
Problem p02408 (C++)

Buggy submission (status: 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 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 0;
}
Problem p02408 (C++)

Buggy submission (status: Runtime Error):
#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;
}

Fixed submission:
#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;
}