Devu and Flowers
HardRating 2300CodeforcesCombinatorics & Modular Arithmetic
Approach hintTry it first, then revealHide
Without upper limits this is stars and bars. Apply inclusion-exclusion over the 2^n subsets of boxes that exceed their limit; C(N, n - 1) with huge N but tiny n - 1 is a product of n - 1 terms times an inverse factorial.