http://chuyentin.pro/
#include <bits/stdc++.h>
using namespace std;
int a[101];
void solve(int idx, int n, int sum){
if (sum == n) {
for (int i=1;i < idx;i++) cout << a[i] << ' ';
cout << endl;
}
if (sum < n) {
for (int i=a[idx-1] + 1;i<= n;i++) {
if (sum + i > n) break;
a[idx] = i;
solve(idx+1, n, sum + i);
}
}
}
int main(){
int n;
cin >> n;
a[0] = 0;
solve(1, n, 0);
return 0;
}