Problem p03673 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;

const int inf = 99999999;
const ll linf = 999999999999999999;
const double pi = acos(-1);
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

#define p_queue(i) priority_queue<i>
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>>
#define P(p) cout << (p) << endl
#define rep(i, m, n) for (int i = (m); i < (int)(n); i++)
#define mod(i) ((i) % (ll)(1e9 + 7))
#define divm(a, b) (mod(a * modpow((ll)b, (ll)(1e9 + 5))))
#define rsort(a, b, c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.end(), v.begin());
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a, n, k) (lower_bound(a, a + n, k) - a)
#define vlb(a, k) (lower_bound(a.begin(), a.end(), k) - a.begin())
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define yes cout << "yes" << endl
#define no cout << "no" << endl
#define ret return

ll modpow(ll i, ll j) {
  ll tmp = 1;
  while (j) {
    if (j % 2)
      tmp = mod(tmp * i);
    i = mod(i * i);
    j /= 2;
  }
  return tmp;
}
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

///////////////////////////////////////////////////////////////////////////
int a[100005] = {};
int n;

int main() {
  cin >> n;
  rep(i, 0, n) cin >> a[i];

  for (int i = n - 1; i >= 0; i -= 2)
    cout << a[i] << " ";

  for (int i = (int)n % 2; i < n; i += 2)
    cout << a[i] << " ";
  cout << endl;

  return 0;
}

Fixed submission:
#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;

const int inf = 99999999;
const ll linf = 999999999999999999;
const double pi = acos(-1);
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

#define p_queue(i) priority_queue<i>
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>>
#define P(p) cout << (p) << endl
#define rep(i, m, n) for (int i = (m); i < (int)(n); i++)
#define mod(i) ((i) % (ll)(1e9 + 7))
#define divm(a, b) (mod(a * modpow((ll)b, (ll)(1e9 + 5))))
#define rsort(a, b, c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.end(), v.begin());
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a, n, k) (lower_bound(a, a + n, k) - a)
#define vlb(a, k) (lower_bound(a.begin(), a.end(), k) - a.begin())
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define yes cout << "yes" << endl
#define no cout << "no" << endl
#define ret return

ll modpow(ll i, ll j) {
  ll tmp = 1;
  while (j) {
    if (j % 2)
      tmp = mod(tmp * i);
    i = mod(i * i);
    j /= 2;
  }
  return tmp;
}
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

///////////////////////////////////////////////////////////////////////////
int a[2000005] = {};
int n;

int main() {
  cin >> n;
  rep(i, 0, n) cin >> a[i];

  for (int i = n - 1; i >= 0; i -= 2)
    cout << a[i] << " ";

  for (int i = (int)n % 2; i < n; i += 2)
    cout << a[i] << " ";
  cout << endl;

  return 0;
}