Question 1
Medium Given an n x m grid with rows 0..n-1 and columns 0..m-1, Alice starts at (n-1, 0) and must reach (n-1, m-1). Each move advances exactly one column and can be up-right, right, or down-right; moves that leave the grid are invalid. Count the paths, modulo 1,000,000,007. Follow-up 1: count the paths that visit all given checkpoints. Follow-up 2: checkpoints must be visited in the given order; because each move enters the next column, at most one checkpoint can be visited per column, so return 0 if they cannot be visited in strictly increasing column order. Optimize space.
Input: "n m c", then c lines "r col".
Constraints: 1 <= n, m <= 2000; 0 <= c <= m - 2.