Hi,
So seems like @superty also can't understand the solution. A bit disturbed by that, I decided to look it up. Kudos for ambiguous language, there.
`right[r][c][x]` is the number of ways to reach `r, c`, where the last move was a right, and that contiguous sequence of right moves was at most `x` in length. Now, for a particular `r, c`, with at most `x` contiguous sequence of right moves done last, you can either come from the left cell with `x - 1` right-contiguous moves done at most, OR, you can come from the left cell with any number of down-contiguous moves. I hope that's clear---it's tough to explain, but I tried.
The answer simply ~~because ~~becomes `down[R][C][d] + right[R][C][d]`.
Cheers.