implementation

#include <iostream>
#include <vector>
#define repeat(i,n) for (int i = 0; (i) < int(n); ++(i))
#define repeat_from(i,m,n) for (int i = (m); (i) < int(n); ++(i))
#define repeat_reverse(i,n) for (int i = (n)-1; (i) >= 0; --(i))
using namespace std;
template <class T> void setmin(T & a, T const & b) { if (b < a) a = b; }
template <typename X, typename T> auto vectors(X x, T a) { return vector<T>(x, a); }
template <typename X, typename Y, typename Z, typename... Zs> auto vectors(X x, Y y, Z z, Zs... zs) { auto cont = vectors(y, z, zs...); return vector<decltype(cont)>(x, cont); }
const vector<int> inf { int(1e9+7) };
int main() {
int n, d, k; cin >> n >> d >> k;
auto dp = vectors(d+1, k+1, inf);
dp[0][0] = {};
repeat_from (a,1,n+1) {
repeat_reverse (i,d) if (i+a < d+1) {
repeat (j,k) {
vector<int> it = dp[i][j];
it.push_back(a);
setmin(dp[i+a][j+1], it);
}
}
}
if (dp[d][k] == inf) {
cout << -1 << endl;
} else {
repeat (i, dp[d][k].size()) {
if (i) cout << ' ';
cout << dp[d][k][i];
}
cout << endl;
}
return 0;
}