https://www.luogu.com.cn/problem/P1157
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> PII;
typedef vector<long long> VI;
#define rep(i,a,n) for (int i=a;i<=n;i++)
#define per(i,a,n) for (int i=a;i>=n;i--)
#define pb(i) push_back(i)
#define int long long
#define INF 0x3f3f3f3f
#define oz 998244353
#define endl '\n'
#define N 200010
const int mod = 1e9 + 7;
int p[N], si[N];
int find(int x) {
if (x != p[x]) p[x] = find(p[x]);
return p[x];
}
//size[find(b)] += size[find(a)];
//p[find(a)] = find(b);
int a[25];
int st[25]; // 0为考虑 1选 2不选
int n, r;
void dfs(int x, int y) {
if(n - x + 1 < r - y + 1)return ; //剪枝
if (y > r) {
rep(i, 1, n) {
if (st[i] == 1)cout << i << " ";
}
cout << endl;
return ;
}
st[x] = 1;
dfs(x + 1, y + 1);
st[x] = 0;
st[x] = 2;
dfs(x + 1, y);
st[x] = 0;
}
void solve() {
// int n, r;
cin >> n >> r;
rep(i, 1, n)a[i] = i;
dfs(1, 1);
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
int T = 1;
// cin >> T;
while (T --)
solve();
return 0;
}