Getting this error for n = 12000000 Cannot allocate memory

I am getting wrong answer for both of my test cases and getting error mentioned above in case of n mentioned above.

Hi Avin,
You don’t have to use DP here. According to question you have to just calculate the maximum of n and f (n / 2) + f (n / 3) + f (n / 4).

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.