[Community Puzzle] MAGICAL FROG

Coding Games and Programming Challenges to Code Better

Send your feedback or ask for help here!

Created by @berqiamouad,validated by @ninja1964,@Klimpergeist and @yveslacroix83400.
If you have any issues, feel free to ping them.

This is an interesting puzzle, but a bit hard to debug if you get different values then what was expected.
Could you please add some more test cases (with relatively small n and k values)?