December Long problem MAXEP

Problem-https://www.codechef.com/DEC18B/problems/MAXEP
When exactly we get -1 as response?

When we try to perform a task but we don’t have enough coins to perform that or when we enter some out of range or values in wrong format(correct format being “1 y”).

And in case we run out of coins then we should not print final line with operation 3 since we don’t have value of x yet or we print operation 3 with last tried value of y?

edit: I looked up previous posts on this topic and it seems that there is no test case where if solved correctly we should run out of coins or get -1 as response?

got AC.For others still confused out there: If done properly you will never run out of coins or get -1 as response so rethink your approach if you are stuck thinking about how to handle these cases.