Language: C++

#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>

using namespace std;

#define cerr if (false) cerr

const int MAXN = 1e5 + 239;
const ll INF = 1e10 + 239;

int prime[MAXN];
vector<int> primes;

void init() {
    fill(prime, prime + MAXN, 1);
    for (int i = 2; i < MAXN; i++) {
        if (prime[i]) {
            for (int j = 2 * i; j < MAXN; j += i) {
                prime[j] = 0;
            }
            primes.push_back(i);
        }
    }
}

ll no_cubic(ll x) {
    for (ll i = 2; i * i * i <= x; i++) {
        while (x % (i * i * i) == 0) {
            x /= (i * i * i);
        }
    }
    return x;
}

ll get_pair(ll x) {
    ll sq = 1;
    for (auto t : primes) {
        if (x % ((ll)t * t) == 0) {
            sq *= t;
        }
        if (x < ((ll)t * t)) {
            break;
        }
    }
    ll sl = x / (sq * sq);
    ll ans = sq * sl;
    if (ans > INF / sl) {
        return -1;
    } else {
        return ans * sl;
    }
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    init();

    int n;
    cin >> n;
    map<ll, int> cnt;
    for (int i = 0; i < n; i++) {
        ll x;
        cin >> x;
        x = no_cubic(x);
        cnt[x]++;
    }
    auto get_cnt = [&](ll x) {
        if (cnt.count(x)) {
            return cnt[x];
        } else {
            return (int)0;
        }
    };
    int ans = 0;
    if (cnt.count(1)) {
        ans++;
        cnt.erase(1);
    }
    set<pair<ll, ll>> seen;
    for (auto uu : cnt) {
        ll f, no_need;
        tie(f, no_need) = uu;
        ll pr = get_pair(f);
        if (pr == -1) {
            ans += cnt[f];
            continue;
        }
        ll a = pr;
        ll b = f;
        if (a > b) {
            swap(a, b);
        }
        if (!seen.count({a, b})) {
            ans += max(get_cnt(a), get_cnt(b));
            seen.insert({a, b});
        }
    } 
    cout << ans << endl;
}

Compiler output:
a.cc:26:7: error: 'll' does not name a type
   26 | const ll INF = 1e10 + 239;
      |       ^~
a.cc:43:1: error: 'll' does not name a type
   43 | ll no_cubic(ll x) {
      | ^~
a.cc:52:1: error: 'll' does not name a type
   52 | ll get_pair(ll x) {
      | ^~
a.cc: In function 'int main()':
a.cc:79:9: error: 'll' was not declared in this scope
   79 |     map<ll, int> cnt;
      |         ^~
a.cc:79:16: error: template argument 1 is invalid
   79 |     map<ll, int> cnt;
      |                ^
a.cc:79:16: error: template argument 3 is invalid
a.cc:79:16: error: template argument 4 is invalid
a.cc:81:11: error: expected ';' before 'x'
   81 |         ll x;
      |           ^~
      |           ;
a.cc:82:16: error: 'x' was not declared in this scope
   82 |         cin >> x;
      |                ^
a.cc:83:13: error: 'no_cubic' was not declared in this scope
   83 |         x = no_cubic(x);
      |             ^~~~~~~~
a.cc:86:24: error: 'll' is not a type
   86 |     auto get_cnt = [&](ll x) {
      |                        ^~
a.cc: In lambda function:
a.cc:87:17: error: request for member 'count' in 'cnt', which is of non-class type 'int'
   87 |         if (cnt.count(x)) {
      |                 ^~~~~
a.cc:88:23: error: invalid types 'int[int]' for array subscript
   88 |             return cnt[x];
      |                       ^
a.cc: In function 'int main()':
a.cc:94:13: error: request for member 'count' in 'cnt', which is of non-class type 'int'
   94 |     if (cnt.count(1)) {
      |             ^~~~~
a.cc:96:13: error: request for member 'erase' in 'cnt', which is of non-class type 'int'
   96 |         cnt.erase(1);
      |             ^~~~~
a.cc:98:20: error: template argument 1 is invalid
   98 |     set<pair<ll, ll>> seen;
      |                    ^~
a.cc:98:20: error: template argument 2 is invalid
a.cc:98:20: error: template argument 3 is invalid
a.cc:99:20: error: 'begin' was not declared in this scope; did you mean 'std::begin'?
   99 |     for (auto uu : cnt) {
      |                    ^~~
      |                    std::begin
In file included from /usr/include/c++/14/string:53,
                 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/range_access.h:114:37: note: 'std::begin' declared here
  114 |   template<typename _Tp> const _Tp* begin(const valarray<_Tp>&) noexcept;
      |                                     ^~~~~
a.cc:99:20: error: 'end' was not declared in this scope; did you mean 'std::end'?
   99 |     for (auto uu : cnt) {
      |                    ^~~
      |                    std::end
/usr/include/c++/14/bits/range_access.h:116:37: note: 'std::end' declared here
  116 |   template<typename _Tp> const _Tp* end(const valarray<_Tp>&) noexcept;
      |                                     ^~~
a.cc:100:11: error: expected ';' before 'f'
  100 |         ll f, no_need;
      |           ^~
      |           ;
a.cc:101:13: error: 'f' was not declared in this scope
  101 |         tie(f, no_need) = uu;
      |             ^
a.cc:101:16: error: 'no_need' was not declared in this scope
  101 |         tie(f, no_need) = uu;
      |                ^~~~~~~
a.cc:102:11: error: expected ';' before 'pr'
  102 |         ll pr = get_pair(f);
      |           ^~~
      |           ;
a.cc:103:13: error: 'pr' was not declared in this scope
  103 |         if (pr == -1) {
      |             ^~
a.cc:107:11: error: expected ';' before 'a'
  107 |         ll a = pr;
      |           ^~
      |           ;
a.cc:108:11: error: expected ';' before 'b'
  108 |         ll b = f;
      |           ^~
      |           ;
a.cc:109:13: error: 'a' was not declared in this scope
  109 |         if (a > b) {
      |             ^
a.cc:109:17: error: 'b' was not declared in this scope
  109 |         if (a > b) {
      |                 ^
a.cc:112:19: error: request for member 'count' in 'seen', which is of non-class type 'int'
  112 |         if (!seen.count({a, b})) {
      |                   ^~~~~
a.cc:112:26: error: 'a' was not declared in this scope
  112 |         if (!seen.count({a, b})) {
      |                          ^
a.cc:112:29: error: 'b' was not declared in this scope
  112 |         if (!seen.count({a, b})) {
      |                             ^
a.cc:114:18: error: request for member 'insert' in 'seen', which is of non-class type 'int'
  114 |             seen.insert({a, b});
      |                  ^~~~~~