I think @mogers has the right approach, but the computation is not quite right.
You have local variables in your (machine) code. Although not visible at the C+±Level, the machine code will need locals to store the intermediate results (the values of f which are used as parameters in successive function calls.
For each function call you will have to store administrative stuff like the return value, return address and other stuff. It obviously depends on the compiler and the machine architecture. My guess would be that ideone uses at least 4, propably 8 (the standard linux value ) of max stack memory.
For making an estimate it depends on the max amount of stack allowed. For codechef and sphere it’s relatively small. So trouble will start at about 10^5 recursive calls (as in your case). Some sites use large values of stack size (>100MB). In this case you can go up to 10^6. If you need more function calls your algorithm is probably not the right one anyway.