#include <bits/stdc++.h>
using namespace std;
int squares (int i) {
if (i & 1)
return i / 4 * 2 + 1;
else
return (i - 1) / 4 * 2 + 2;
}
int bishop_placements(int N, int K)
{
if (K > 2 * N - 1)
return 0;
vector<vector<int>> D(N * 2, vector<int>(K + 1));
for (int i = 0; i < N * 2; ++i)
D[i][0] = 1;
D[1][1] = 1;
for (int i = 2; i < N * 2; ++i)
for (int j = 1; j <= K; ++j)
D[i][j] = D[i-2][j] + D[i-2][j-1] * (squares(i) - j + 1);
int ans = 0;
for (int i = 0; i <= K; ++i)
ans += D[N*2-1][i] * D[N*2-2][K-i];
return ans;
}
int main() {
// your code goes here
cout << bishop_placements(3,2);
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgppbnQgc3F1YXJlcyAoaW50IGkpIHsKICAgIGlmIChpICYgMSkKICAgICAgICByZXR1cm4gaSAvIDQgKiAyICsgMTsKICAgIGVsc2UKICAgICAgICByZXR1cm4gKGkgLSAxKSAvIDQgKiAyICsgMjsKfQoKaW50IGJpc2hvcF9wbGFjZW1lbnRzKGludCBOLCBpbnQgSykKewogICAgaWYgKEsgPiAyICogTiAtIDEpCiAgICAgICAgcmV0dXJuIDA7CgogICAgdmVjdG9yPHZlY3RvcjxpbnQ+PiBEKE4gKiAyLCB2ZWN0b3I8aW50PihLICsgMSkpOwogICAgZm9yIChpbnQgaSA9IDA7IGkgPCBOICogMjsgKytpKQogICAgICAgIERbaV1bMF0gPSAxOwogICAgRFsxXVsxXSA9IDE7CiAgICBmb3IgKGludCBpID0gMjsgaSA8IE4gKiAyOyArK2kpCiAgICAgICAgZm9yIChpbnQgaiA9IDE7IGogPD0gSzsgKytqKQogICAgICAgICAgICBEW2ldW2pdID0gRFtpLTJdW2pdICsgRFtpLTJdW2otMV0gKiAoc3F1YXJlcyhpKSAtIGogKyAxKTsKCiAgICBpbnQgYW5zID0gMDsKICAgIGZvciAoaW50IGkgPSAwOyBpIDw9IEs7ICsraSkKICAgICAgICBhbnMgKz0gRFtOKjItMV1baV0gKiBEW04qMi0yXVtLLWldOwogICAgcmV0dXJuIGFuczsKfQoKaW50IG1haW4oKSB7CgkvLyB5b3VyIGNvZGUgZ29lcyBoZXJlCgljb3V0IDw8IGJpc2hvcF9wbGFjZW1lbnRzKDMsMik7CglyZXR1cm4gMDsKfQ==