#include using namespace std; int n; long long max(long long a,long long b){ if(a>b)return a; return b; } unordered_mapdp; vector getFactorization(long long n) { int count = 0; vectorprimes; // count the number of times 2 divides while (!(n % 2)) { n >>= 1; // equivalent to n=n/2; count++; } // if 2 divides it if (count) primes.push_back(2); // check for all the possible numbers that can // divide it for (long long i = 3; i <= sqrt(n); i += 2) { count = 0; while (n % i == 0) { count++; n = n / i; } if (count) primes.push_back(i); } // if n at the end is a prime number. if (n > 2) primes.push_back(n); return primes;} long long cal(long long n){ long long ans=0; if(dp[n]!=0)return dp[n]; if(n==1)return 1; vector primes=getFactorization(n); for(int i=0;i>n; vectora(n); long long z=0; for(int i=0;i>a[i];z=max(z,a[i]);} long long total=0; for(int i=0;i