1 2 3 4 5 6 7 8 9 10
ll calc_binom(ll N, ll K) { ll r = 1, d; if (K > N) return 0; for (d = 1; d <= K; d++) { r *= N--; r /= d; } return r; }