Problem p02759 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
#define M 1000000007
#define pb emplace_back
#define f first
#define s second
#define rep(i, st, ed) for (ll i = st; i < ed; ++i)
#define repn(i, st, ed) for (ll i = st; i <= ed; ++i)
#define repb(i, ed, st) for (ll i = ed; i >= st; --i)
#define all(v) v.begin(), v.end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define PI acosl(-1.0)
#define mp(a, b) make_pair(a, b)
#define eps 1e-9
#define FAST                                                                   \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(0);                                                                  \
  cout.tie(0);
typedef long long ll;
template <class T> void chmax(T &a, T b) {
  if (a < b)
    a = b;
}
template <class T> void chmin(T &a, T b) {
  if (a > b)
    a = b;
}
const int N = 1e5 + 10;
const ll INF = 1LL << 60;
ll iv[N];
ll powM(ll a, ll b) {
  ll res = 1;
  for (; b; a = a * a % M, b /= 2)
    if (b & 1)
      res = res * a % M;
  return res;
}
ll nckbig(int n, int k) {
  ll ans = 1;
  for (int i = 1; i <= k; ++i) {
    ans = ans * (n - i + 1) % M * iv[i] % M;
  }
  return ans;
}
void caliv() {
  iv[1] = 1;
  for (int i = 2; i < N; i++) {
    iv[i] = M - M / i * iv[M % i] % M;
  }
}
ll f1[N], f2[N];
void calf() {
  f1[0] = f2[0] = 1;
  for (int i = 2; i < N; ++i) {
    f1[i] = f1[i - 1] * i % M;
    f2[i] = f2[i - i] * iv[i] % M;
  }
}
ll nck(int n, int k) { return f1[n] * f2[n - k] % M * f2[k] % M; }
ll npk(int n, int k) { return f1[n] * f2[n - k] % M; }
void Rnck(int big) {
  if (big) {
    caliv();
  } else {
    calf();
  }
}

void solve() {
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
  int x;
  cin >> x;
  int ans = x / 2 + x % 2;
  cout << ans << endl;
}

int main() {
  FAST ll Tests = 1;
  // cin>>Tests;
  while (Tests--) {
    solve();
  }
  return 0;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
#define M 1000000007
#define pb emplace_back
#define f first
#define s second
#define rep(i, st, ed) for (ll i = st; i < ed; ++i)
#define repn(i, st, ed) for (ll i = st; i <= ed; ++i)
#define repb(i, ed, st) for (ll i = ed; i >= st; --i)
#define all(v) v.begin(), v.end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define PI acosl(-1.0)
#define mp(a, b) make_pair(a, b)
#define eps 1e-9
#define FAST                                                                   \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(0);                                                                  \
  cout.tie(0);
typedef long long ll;
template <class T> void chmax(T &a, T b) {
  if (a < b)
    a = b;
}
template <class T> void chmin(T &a, T b) {
  if (a > b)
    a = b;
}
const int N = 1e5 + 10;
const ll INF = 1LL << 60;
ll iv[N];
ll powM(ll a, ll b) {
  ll res = 1;
  for (; b; a = a * a % M, b /= 2)
    if (b & 1)
      res = res * a % M;
  return res;
}
ll nckbig(int n, int k) {
  ll ans = 1;
  for (int i = 1; i <= k; ++i) {
    ans = ans * (n - i + 1) % M * iv[i] % M;
  }
  return ans;
}
void caliv() {
  iv[1] = 1;
  for (int i = 2; i < N; i++) {
    iv[i] = M - M / i * iv[M % i] % M;
  }
}
ll f1[N], f2[N];
void calf() {
  f1[0] = f2[0] = 1;
  for (int i = 2; i < N; ++i) {
    f1[i] = f1[i - 1] * i % M;
    f2[i] = f2[i - i] * iv[i] % M;
  }
}
ll nck(int n, int k) { return f1[n] * f2[n - k] % M * f2[k] % M; }
ll npk(int n, int k) { return f1[n] * f2[n - k] % M; }
void Rnck(int big) {
  if (big) {
    caliv();
  } else {
    calf();
  }
}

void solve() {
  // #ifndef ONLINE_JUDGE
  // 	freopen("input.txt", "r", stdin);
  // 	freopen("output.txt", "w", stdout);
  // #endif
  int x;
  cin >> x;
  int ans = x / 2 + x % 2;
  cout << ans << endl;
}

int main() {
  FAST ll Tests = 1;
  // cin>>Tests;
  while (Tests--) {
    solve();
  }
  return 0;
}