Problem p02741 (C++)

Buggy submission (status: Runtime Error):
/*
─────────────────────
───────────████████──
──────────███▄███████
──────────███████████
──────────███████████
──────────██████─────
──────────█████████──
█───────███████──────
██────████████████───
███──██████████──█───
███████████████──────
███████████████──────
─█████████████───────
──███████████────────
────████████─────────
─────███──██─────────
─────██────█─────────
─────█─────█─────────
─────██────██────────
─────────────────────
*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define int long long
#define read(a)                                                                \
  int a;                                                                       \
  cin >> a;
#define readarr(a, n)                                                          \
  int a[(n) + 1] = {};                                                         \
  fori(i, 1, (n)) { cin >> a[i]; }
#define readmat(a, n, m)                                                       \
  int a[n + 1][m + 1] = {};                                                    \
  fori(i, 1, n) { fori(j, 1, m) cin >> a[i][j]; }
#define pb push_back
#define fi first
#define se second
#define rz resize
#define sz(s) (int)(s.size())
#define fori(i, a, b) for (int i = (a); i <= (b); i++)
#define ford(i, a, b) for (int i = (a); i >= (b); i--)
#define sort1(v) sort(v.begin(), v.end())
#define endl '\n'

using namespace std;
using namespace __gnu_pbds;

typedef tree<long long, null_type, less<long long>, rb_tree_tag,
             tree_order_statistics_node_update>
    ordered_set;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pair<int, int>> vpi;
typedef vector<vector<int>> vvi;

const int INF = 4e18;
const int mod = 1e9 + 7;

signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);

#ifndef ONLINE_JUDGE
  freopen("INPUT.txt", "r", stdin);
  freopen("OUTPUT.txt", "w", stdout);
  freopen("OUTPUT_ERROR.txt", "w", stderr);
#endif

  // start from here

  int a[] = {1, 1, 1, 2, 1, 2, 1, 5,  2, 2, 1, 5, 1, 2, 1, 14,
             1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  read(k);
  cout << a[k - 1];

  return 0;
}


Fixed submission:
/*
─────────────────────
───────────████████──
──────────███▄███████
──────────███████████
──────────███████████
──────────██████─────
──────────█████████──
█───────███████──────
██────████████████───
███──██████████──█───
███████████████──────
███████████████──────
─█████████████───────
──███████████────────
────████████─────────
─────███──██─────────
─────██────█─────────
─────█─────█─────────
─────██────██────────
─────────────────────
*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define int long long
#define read(a)                                                                \
  int a;                                                                       \
  cin >> a;
#define readarr(a, n)                                                          \
  int a[(n) + 1] = {};                                                         \
  fori(i, 1, (n)) { cin >> a[i]; }
#define readmat(a, n, m)                                                       \
  int a[n + 1][m + 1] = {};                                                    \
  fori(i, 1, n) { fori(j, 1, m) cin >> a[i][j]; }
#define pb push_back
#define fi first
#define se second
#define rz resize
#define sz(s) (int)(s.size())
#define fori(i, a, b) for (int i = (a); i <= (b); i++)
#define ford(i, a, b) for (int i = (a); i >= (b); i--)
#define sort1(v) sort(v.begin(), v.end())
#define endl '\n'

using namespace std;
using namespace __gnu_pbds;

typedef tree<long long, null_type, less<long long>, rb_tree_tag,
             tree_order_statistics_node_update>
    ordered_set;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pair<int, int>> vpi;
typedef vector<vector<int>> vvi;

const int INF = 4e18;
const int mod = 1e9 + 7;

signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);

  // start from here

  int a[] = {1, 1, 1, 2, 1, 2, 1, 5,  2, 2, 1, 5, 1, 2, 1, 14,
             1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  read(k);
  cout << a[k - 1];

  return 0;
}