Practice · 2 of 3
Binomials
CHALLENGE
Difficulty: advanced+25 XP
**Problem.** Line 1: q. Each line: n r. Print C(n, r) mod 1e9+7. **Constraints:** 1 ≤ q ≤ 200000; 0 ≤ r ≤ n ≤ 10^6. Factorial + inverse-array precompute; per-query Pascal is the trap.
Press Submit to check your solution.
Back to lesson: Practice: Number Trio