Problem p03035 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
#define fastio()                                                               \
  ios_base::sync_with_stdio(0);                                                \
  cin.tie(0);                                                                  \
  cout.tie(0)
#define loop(i, a, b) for (int i = a; i < b; i++)
#define test()                                                                 \
  int t;                                                                       \
  cin >> t;                                                                    \
  loop(test, 1, t + 1)
#define pb push_back
#define eb emplace_back
#define mkp make_pair
#define nl cout << "\n"
#define sp cout << " "
#define F first
#define S second
#define vi vector<int>
#define vl vector<ll>
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vii vector<pii>
#define vll vector<pll>
#define MOD 1000000007
#define all(x) x.begin(), x.end()

template <class C> void min_self(C &a, C b) { a = min(a, b); }
template <class C> void max_self(C &a, C b) { a = max(a, b); }

void mod(ll &n, ll m = MOD) { n %= m, n += m, n %= m; }

const int MAXN = 1e5 + 5;
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};

int main() {
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
  fastio();

  int a, b, ans = 0;
  cin >> a >> b;

  if (a <= 5) {
    ans = 0;
  } else if (a <= 12) {
    ans = b / 2;
  } else
    ans = b;
  cout << ans, nl;

  cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
#define fastio()                                                               \
  ios_base::sync_with_stdio(0);                                                \
  cin.tie(0);                                                                  \
  cout.tie(0)
#define loop(i, a, b) for (int i = a; i < b; i++)
#define test()                                                                 \
  int t;                                                                       \
  cin >> t;                                                                    \
  loop(test, 1, t + 1)
#define pb push_back
#define eb emplace_back
#define mkp make_pair
#define nl cout << "\n"
#define sp cout << " "
#define F first
#define S second
#define vi vector<int>
#define vl vector<ll>
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vii vector<pii>
#define vll vector<pll>
#define MOD 1000000007
#define all(x) x.begin(), x.end()

template <class C> void min_self(C &a, C b) { a = min(a, b); }
template <class C> void max_self(C &a, C b) { a = max(a, b); }

void mod(ll &n, ll m = MOD) { n %= m, n += m, n %= m; }

const int MAXN = 1e5 + 5;
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};

int main() {
  fastio();

  int a, b, ans = 0;
  cin >> a >> b;

  if (a <= 5) {
    ans = 0;
  } else if (a <= 12) {
    ans = b / 2;
  } else
    ans = b;
  cout << ans, nl;

  cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
  return 0;
}