Comments

o,It's my fault. But I cannot understand this code

why need we mod n in (i + a[i] % n + n) % n; and why i in [0, n — 1]

I think there is something wrong with the Div2 C for it's type. $$$(k+a_k){\bmod n}$$$ instead of $$$k+a_{k\bmod n}$$$

And does anybody tell me why k is in[0,n — 1]?