Language: C++

#include<bits/stdc++.h>
using namespace std;

typedef long long LL;
vector<LL> primes;
const LL CBRT = 2200;
LL cb[CBRT];
const LL LIM = 1e11+5;


void sieve() {
    vector<bool> isp(CBRT, 1);
    for (LL i=2; i<CBRT; i++)
        if (isp[i]) {
            primes.push_back(i);
            for (LL j=2*i; j<CBRT; j+=i)
                isp[j] = 0;
        }
    for (LL i=0; i<CBRT; i++)  cb[i] = 1LL*i*i*i;
}

pair<LL, LL> process(LL x) {
    if (x == 1)     return {1, 1};

    for (LL p:primes)
        while (x%cb[p]==0)  x/=cb[p];

    LL a = x;

    for (LL i=1; i<CBRT; i++)
        if (cb[i]%a==0)
            return {a, cb[i]/a};

    return {a, LIM};
}

const LL N = 1e5+7;
LL a[N], b[N];

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);

    sieve();

    LL n;
    cin>>n;

    map<LL, LL> cnt;
    map<LL, LL> opp;

    for (LL i=1; i<=n; i++) {
        LL x;
        cin>>x;

        auto pr = process(x);
        a[i] = pr.first;
        b[i] = pr.second;

        cnt[a[i]]++;
        opp[a[i]] = b[i];
        opp[b[i]] = a[i];
    }
    cnt[LIM] = 0;

    LL ans = 0;
    for (auto pr: opp) {
        LL a = pr.first, b = pr.second;
        if (a == LIM)   continue;
        if (a == b)     ans += min(1, cnt[a]+cnt[b]);
        else if (a < b) ans += max(cnt[a], cnt[b]);
    }
    cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:70:35: error: no matching function for call to 'min(int, std::map<long long int, long long int>::mapped_type)'
   70 |         if (a == b)     ans += min(1, cnt[a]+cnt[b]);
      |                                ~~~^~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:70:35: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'std::map<long long int, long long int>::mapped_type' {aka 'long long int'})
   70 |         if (a == b)     ans += min(1, cnt[a]+cnt[b]);
      |                                ~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:70:35: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   70 |         if (a == b)     ans += min(1, cnt[a]+cnt[b]);
      |                                ~~~^~~~~~~~~~~~~~~~~~