When to Recursion approach vs Iteration approach

should one use iterative method for order 10^18 calls than recursion. What is the limit upto which recursion can be used so that we dont get TLE/MLE.
This doubt is reference to Codeforces Div 2 Round 643 where i used recursion and got MLE but same iterative sol got AC
https://codeforces.com/contest/1355/problem/A