p483.ans1
======================
5 2 1 3

=================
p483.ans2
======================
6 4

=================
p483.cpp
======================
#include <bits/stdc++.h>

using namespace std;

template<typename T1, typename T2>
ostream& operator<<(ostream& out, const pair<T1, T2>& x) {
    return out << x.first << ' ' << x.second;
}

template<typename T1, typename T2>
istream& operator>>(istream& in, pair<T1, T2>& x) {
    return in >> x.first >> x.second;
}

template<typename T>
istream& operator>>(istream& in, vector<T>& a) {
    for(auto& x: a) {
        in >> x;
    }
    return in;
};

template<typename T>
ostream& operator<<(ostream& out, const vector<T>& a) {
    for(auto x: a) {
        out << x << ' ';
    }
    return out;
};

int n, h;

void read() { cin >> n >> h; }

void solve() {
    // The solution is fairly simple - we can notice that the structure we build
    // increases with "triangles". The first one is of size 1, then 3, then 5
    // and so on. This means that there are at most O(sqrt(n)) pumpkins that
    // will be killed, and we can directly simulate the solution. To be more
    // precise, we can find the first pumpkin that will be killed in O(h) =
    // O(sqrt(n)) by looping through the "triangles". Note that h = O(sqrt(n))
    // because it is guaranteed there is at least one number in the output.

    // 1 + 3 + ... + 2h+1 = (h+1)^2
    int pos = max((h + 1) * (h + 1), 1), l = h + 1;
    vector<int> front, back;

    back.push_back(pos);
    while(pos + l <= n) {
        pos = pos + l;
        if(pos <= n) {
            front.push_back(pos);
        }
        pos = pos + l;
        if(pos <= n) {
            back.push_back(pos);
        }
        l++;
    }

    reverse(front.begin(), front.end());
    cout << front << back << '\n';
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int T = 1;
    // cin >> T;
    for(int test = 1; test <= T; test++) {
        read();
        // cout << "Case #" << test << ": ";
        solve();
    }

    return 0;
}

=================
p483.in1
======================
5 0

=================
p483.in2
======================
6 1

=================
statement.txt
======================
483. Jealous Cucumber
Time limit per test: 0.25 second(s)
Memory limit: 65536 kilobytes
input: standard
output: standard

Mr. Cucumber was annoyed by pumpkins' dominance in Vegetable Land every Halloween and today he decided to restore justice. He took N peaceful pumpkins hostages and brought them to the hatch of his hutch. Then he numbered the hostages from 1 to N and started throwing them into the hatch one by one (from the 1-st to the N-th), waiting every time until previous hostage falls down. Cucumber's hutch is both-side infinite horizontally, and it has height N. The hutch was empty when Cucumber came. When a pumpkin is thrown into the hatch it has coordinates (0,N). Then it falls by the following rules:

let (x,y) denote current pumpkin's coordinates.
if position (x,y-1) is empty, pumpkin moves there,
else if position (x-1,y) is empty and position (x-1,y-1) is empty too, pumpkin moves to position (x-1,y-1),
else if position (x+1,y) is empty and position (x+1,y-1) is empty too, pumpkin moves to position (x+1,y-1)

Pumpkin moves until it reaches the bottom of the hutch (i.e. its y-coordinate equals to 0) or it can't move anymore.

After that crafty villain demanded Vegetable Land's government to appoint him symbol of Halloween in an hour, otherwise he was going to shoot pumpkins in the hutch in such a way that every pumpkin which y-coordinate equals to H dies.

Some of the hostages taken by Mr. Cucumber are Very Important Pumpkins (VIP), so the government wants to know the exact numbers of pumpkins who are going to be killed to make its decision.

Input
Input contains two integers separated by a single space: N and H (1 ≤ N ≤ 109), (0 ≤ H ≤ 109) — the number of Mr. Cucumber's hostages and y-position of endangered pumpkins.

Output
Print numbers of pumpkins who are going to be killed from the leftmost to the rightmost one, separating them by spaces. It is guaranteed that output will contain at least one number.

Example(s)
sample input
sample output
5 0
5 2 1 3

sample input
sample output
6 1
6 4



=================
