Problem p03421 (C++)

Buggy submission (status: Runtime Error):
#include <bits/extc++.h>
#ifdef _debug
#define dout(i) cout << #i << ' ' << i << ' '
#else
#include <bits/stdc++.h>
#define dout(i) 0 && 0
#endif
#pragma GCC optimize("unroll-loops,no-stack-protector,O3")
#define eout(i)                                                                \
  {                                                                            \
    cout << (i) << '\n';                                                       \
    exit(0);                                                                   \
  }
#define priority_queue __gnu_pbds::priority_queue
#define unordered_map __gnu_pbds::gp_hash_table
#define rep(a, b)                                                              \
  {                                                                            \
    for (int _i = a; _i > 0; --_i) {                                           \
      b;                                                                       \
    }                                                                          \
  }
#define multe                                                                  \
  int _T;                                                                      \
  for (cin >> _T; _T--;)
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ul = unsigned;
using db = double;
using __gnu_pbds::null_type;
template <typename T> void read(int n, T s) {
  while (n--)
    cin >> *s, ++s;
}
template <typename T> void write(int n, T s) {
  while (n--)
    cout << *s << " \n"[n == 0], ++s;
}
template <typename T>
using rbtree =
    __gnu_pbds::tree<T, __gnu_pbds::null_type, less<T>, __gnu_pbds::rb_tree_tag,
                     __gnu_pbds::tree_order_statistics_node_update>;
template <typename T>
inline ostream &operator<<(ostream &ou, const vector<T> &a) {
  for (auto it = a.begin(); it != a.end(); ++it)
    ou << (it != a.begin() ? " " : "") << *it;
  return ou;
}
template <typename T1, typename T2>
inline istream &operator>>(istream &in, pair<T1, T2> &a) {
  return in >> a.first >> a.second;
}
template <typename T1, typename T2>
inline ostream &operator<<(ostream &ou, const pair<T1, T2> &b) {
  return ou << b.first << ' ' << b.second;
}
template <typename T>
inline long long pow(long long v, long long t, const T &p) {
  long long res = 1;
  for (; t; t >>= 1, v = v * v % p)
    if (t & 1)
      res = res * v % p;
  return res;
}
ll n, a, b;
ll sig(ll v) { return (v * (v - 1)) / 2; }
signed main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  cin >> n >> a >> b;
  if (n < a + b - 1 || n > max(sig(a) + sig(b), a * b))
    eout(-1);
  assert(false);
}

Fixed submission:
#include <bits/extc++.h>
#ifdef _debug
#define dout(i) cout << #i << ' ' << i << ' '
#else
#include <bits/stdc++.h>
#define dout(i) 0 && 0
#endif
#pragma GCC optimize("unroll-loops,no-stack-protector,O3")
#define eout(i)                                                                \
  {                                                                            \
    cout << (i) << '\n';                                                       \
    exit(0);                                                                   \
  }
#define priority_queue __gnu_pbds::priority_queue
#define unordered_map __gnu_pbds::gp_hash_table
#define rep(a, b)                                                              \
  {                                                                            \
    for (int _i = a; _i > 0; --_i) {                                           \
      b;                                                                       \
    }                                                                          \
  }
#define multe                                                                  \
  int _T;                                                                      \
  for (cin >> _T; _T--;)
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ul = unsigned;
using db = double;
using __gnu_pbds::null_type;
template <typename T> void read(int n, T s) {
  while (n--)
    cin >> *s, ++s;
}
template <typename T> void write(int n, T s) {
  while (n--)
    cout << *s << " \n"[n == 0], ++s;
}
template <typename T>
using rbtree =
    __gnu_pbds::tree<T, __gnu_pbds::null_type, less<T>, __gnu_pbds::rb_tree_tag,
                     __gnu_pbds::tree_order_statistics_node_update>;
template <typename T>
inline ostream &operator<<(ostream &ou, const vector<T> &a) {
  for (auto it = a.begin(); it != a.end(); ++it)
    ou << (it != a.begin() ? " " : "") << *it;
  return ou;
}
template <typename T1, typename T2>
inline istream &operator>>(istream &in, pair<T1, T2> &a) {
  return in >> a.first >> a.second;
}
template <typename T1, typename T2>
inline ostream &operator<<(ostream &ou, const pair<T1, T2> &b) {
  return ou << b.first << ' ' << b.second;
}
template <typename T>
inline long long pow(long long v, long long t, const T &p) {
  long long res = 1;
  for (; t; t >>= 1, v = v * v % p)
    if (t & 1)
      res = res * v % p;
  return res;
}
ll n, a, b;
ll sig(ll v) { return (v * (v - 1)) / 2; }
signed main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  cin >> n >> a >> b;
  if (n < a + b - 1 || n > max(sig(a) + sig(b), a * b))
    eout(-1);
  if (a * b >= n) {
    vector<pair<int, int>> res(b);
    res[0] = {n - a + 1, n};
    for (int sum = n - a, i = 1; i < b; ++i) {
      res[i] = {res[i - 1].first - min(a, sum - (b - i - 1)),
                res[i - 1].first - 1};
      sum -= res[i].second - res[i].first + 1;
    }
    for (auto o : res) {
      while (o.first <= o.second)
        cout << o.first++ << ' ';
    }
  } else {
    eout(-1);
    // assert(false)
    vector<pair<int, int>> res;
    int sum = 0;
  }
}