1 / 4
Aug 2007

I believe that my solution is right, so i think i have a stupid bug.
If the output is -1, my program will halt and print nothing.
Please help me out.

Code deleted after i know the way to go.

You can't make a function call itself recursively 80000 times, theres no way near enough space for that. Why are you using recursion at all?