Reverse k elements of queue

This is the link of the question https://hack.codingblocks.com/app/contests/1331/746/problem and here is my solution https://ide.codingblocks.com/s/276150 the output is correct but my solution is not being accepted…