What is wrong in this code ? Link: https://ideone.com/EfLq4a
Change
cout<<(dp(0,0)+(ll)2*n)<<" "<<freqCache[0][0]<<"\n";
to
cout<<(dp(0,0)+(ll)2*n)<<" "; cout<<freqCache[0][0]<<"\n";
and then explain why it makes a difference.