Language: C++

#include <iostream>
#include <fstream>
#include <sstream>

#include <vector>
#include <set>
#include <bitset>
#include <map>
#include <deque>
#include <string>

#include <algorithm>
#include <numeric>

#include <cstdio>
#include <cassert>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>

#define pb push_back
#define pbk pop_back
#define mp make_pair
#define fs first
#define sc second
#define all(x) (x).begin(), (x).end()
#define foreach(i, a) for (__typeof((a).begin()) i = (a).begin(); i != (a).end(); ++i)
#define len(a) ((int) (a).size())

#ifdef CUTEBMAING
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define eprintf(...) 42
#endif

using namespace std;

typedef long long int64;
typedef long double ld;
typedef unsigned long long lint;

const int inf = (1 << 30) - 1;
const int64 linf = (1ll << 62) - 1;
const int N = 1e6 + 100;

int64 n, a;
int64 dp[N];

int main() {
#ifdef XCODE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    cin >> n >> a;
    vector<int64> dv;
    for (int64 i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            dv.pb(i);
            dv.pb(n / i);
        }
    }
    sort(all(dv)), dv.resize(unique(all(dv)) - dv.begin());
    fill_n(dp, len(dv), linf);
    dp[0] = 0;
    for (int i = 0; i < len(dv); i++) {
        for (int j = i + 1; j < len(dv); j++) {
            if (dv[j] % dv[i] != 0) {
                continue;
            }
            dp[j] = min(dp[j], dp[i] + (dv[j] / dv[i]) + a);
        }
    }
    cout << max(0, dp[len(dv) - 1] - a) << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:74:16: error: no matching function for call to 'max(int, int64)'
   74 |     cout << max(0, dp[len(dv) - 1] - a) << endl;
      |             ~~~^~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:74:16: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'int64' {aka 'long long int'})
   74 |     cout << max(0, dp[len(dv) - 1] - a) << endl;
      |             ~~~^~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:12:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:74:16: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   74 |     cout << max(0, dp[len(dv) - 1] - a) << endl;
      |             ~~~^~~~~~~~~~~~~~~~~~~~~~~~