This problem appeared in the 2018 ACM ICPC Dhaka Regional (Preliminary round). This turned out to be quiet easy as more then 100 teams were able to solve it. Lets read the statement first:
Let’s learn about Staircase Nim by solving move the coins problem that appeared in HackerRank April World Codesprint. Among the problems I have ever created, its one of my favorites. If you don’t want to solve that problem but want to learn about staircase-nim, just read the first part of this blog.