#include #include #include #include #include #include #include using namespace std; #define int long long #define endl "\n" const long long INF = (long long)1e18; const long long MOD = 1'000'000'007; string yn(bool f){return f?"Yes":"No";} string YN(bool f){return f?"YES":"NO";} signed main(){ cin.tie(0); ios::sync_with_stdio(false); cout<> ans(MAX, vector(MAX, false)); vector conh(MAX), conw(MAX); cin>>N>>K; assert(N >= 1 && N <= 1000 && K >= 1 && K <= N); for(int i = 0; ;i++){ for(int j = i; j >= 0; j--){ int y = j; int x = i; if(conh[y] < K && conw[x] < K && con < N && !ans[y][x]){ conh[y]++; conw[x]++; ans[y][x] = true; con++; } swap(y,x); if(conh[y] < K && conw[x] < K && con < N && !ans[y][x]){ conh[y]++; conw[x]++; ans[y][x] = true; con++; } } M = i; if(con >= N) break; } cout<