Does someone has an idea why this submission 49746866 gets WA test 3 (with 17M memory) while this one 49746950 gets MLE in the same test (with 256M Memory) where the only difference in the power function (Iterative vs Recursive)?

In iterative code, you defined p as unsigned int, but in recursive one it is int, so, if we suppose that temp can be negative (because of a wrong in range query, for example), there will be no issues in iterative code, but there will be infinite calls in recursive code (because p < 0).