proc getchar_unlocked():char {. importc:"getchar_unlocked",header: "" .} proc scan(): int = while true: let k = getchar_unlocked() if k < '0': break result = 10 * result + k.ord - '0'.ord let n = scan() # 21 let k = scan() # 21:[1~3] -> 0 4 8 12 16 20 # 22:[1~3] -> 1 5 9 13 17 21 let s = (n-1) mod (k+1) let d = k + 1 for i in 0..= n: break