pls tell me how to approach in a right direction
here’s my code
#include<bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define fast std::ios::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define clr0(a) memset((a), 0, sizeof(a))
#define clr1(a) memset((a), -1, sizeof(a))
#define srtin1 cin.ignore ( std::numeric_limitsstd::streamsize::max(), ‘\n’ );
#define strin2 getline(cin, text);
#define ll long long
#define test cout<<“archit\n”
#define debug(x) cout<<x<<" "
#define debug1(x) cout<<x<<"\n"
#define debug2(x,y) cout<<x<<" “<<y<<”\n"
#define debug3(x, y, z) cout<<x<<" “<<y<<” “<<z<<”\n"
#define pb push_back
#define pi pair<int,int>
#define fi first
#define si second
#define mod (ll)1000000007
#define mxn 1000005
#define ordered_set tree<int, null_type,less, rb_tree_tag,tree_order_statistics_node_update>
using namespace std;
//using namespace boost::multiprecision;
using namespace __gnu_pbds;
map<ll, ll>mp;
ll solve(ll n)
{
if(n == 0){
return 0;
}
if(n == 1){
return 1;
}
if(mp.count(n) > 0){
return mp[n];
}
ll ans=0;
if(n%2 == 0){
ans = solve(n/2);
}
if(n%3 == 0){
ans+=(solve(n/3));
}
if(n%4 == 0){
ans+=(solve(n/4));
}
return mp[n] = max(n, ans);
}
int main()
{
mp.clear();
ll n; cin>>n;
cout<<solve(n);
return 0;
}