Problem p03807 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define pii pair<int, int>
#define piii pair<int, pii>
#define mp make_pair
#define pb push_back
#define ALL(a) (a).begin(), (a).end()
#define FST first
#define SEC second
const int INF = (INT_MAX / 2);
const ll LLINF = (LLONG_MAX / 2);
const double eps = 1e-5;
const double PI = M_PI;
#define DEB cerr << "!" << endl
#define SHOW(a, b) cerr << (a) << " " << (b) << endl
#define SHOWARRAY(ar, i, j)                                                    \
  REP(a, i)                                                                    \
      REP(b, j) cerr << ar[a][b]                                               \
                     << ((b == j - 1) ? ((a == i - 1) ? ("\n\n") : ("\n"))     \
                                      : (" "))
#define DIV 1000000007
inline ll pow(ll x, ll n, ll m) {
  ll r = 1;
  while (n > 0) {
    if ((n & 1) == 1)
      r = r * x % m;
    x = x * x % m;
    n >>= 1;
  }
  return r % m;
}
using namespace std;

int main() {
  int n;
  cin >> n;
  int t_2 = 0, t_1 = 0;
  rep(i, n) {
    int in;
    cin >> in;
    if (in % 2 == 0)
      t_2++;
    else
      t_1++;
  }
  if (n == 2 && t_1 == 2) {
    cout << "YES" << endl;
  } else if (t_1 % 2 == 1) {
    cout << "NO" << endl;
  } else if ((t_1 / 2 + t_2) % 2 == 1) {
    cout << "NO" << endl;
  } else {
    return -1;
    cout << "YES" << endl;
  }
  return 0;
}

Fixed submission:
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define pii pair<int, int>
#define piii pair<int, pii>
#define mp make_pair
#define pb push_back
#define ALL(a) (a).begin(), (a).end()
#define FST first
#define SEC second
const int INF = (INT_MAX / 2);
const ll LLINF = (LLONG_MAX / 2);
const double eps = 1e-5;
const double PI = M_PI;
#define DEB cerr << "!" << endl
#define SHOW(a, b) cerr << (a) << " " << (b) << endl
#define SHOWARRAY(ar, i, j)                                                    \
  REP(a, i)                                                                    \
      REP(b, j) cerr << ar[a][b]                                               \
                     << ((b == j - 1) ? ((a == i - 1) ? ("\n\n") : ("\n"))     \
                                      : (" "))
#define DIV 1000000007
inline ll pow(ll x, ll n, ll m) {
  ll r = 1;
  while (n > 0) {
    if ((n & 1) == 1)
      r = r * x % m;
    x = x * x % m;
    n >>= 1;
  }
  return r % m;
}
using namespace std;

int main() {
  int n;
  cin >> n;
  int t_2 = 0, t_1 = 0;
  rep(i, n) {
    int in;
    cin >> in;
    if (in % 2 == 0)
      t_2++;
    else
      t_1++;
  }
  SHOW(t_1, t_2);
  ll ans = t_1 + t_2 * 2;
  cout << ((ans % 2) ? ("NO") : ("YES")) << endl;
  return 0;
}