Language: C++

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

const int N = 100005;
int n;
vector<int> primes;
map<vector<pair<int,int>>,int> mp;

bool isPrime(int n) {
    for (int i = 2; i * i <= n; ++i)
        if (n % i == 0) 
            return false;
    return true;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    for (int i = 2; i < 100000; ++i) {
        if (isPrime(i)) 
            primes.push_back(i);
    }
    cin >> n;
    vector<pair<int,int>> cur;
    int add = 0;
    int result = 0;
    for (int i = 0; i < n; ++i) {
        long long x;
        cin >> x;
        cur.clear();
        for (auto& y : primes) {
            if (y > 5000) break;
            int cnt = 0;
            while (x % y == 0) {
                x /= y;
                ++cnt;
            }
            cnt %= 3;
            if (cnt > 0) {
                cur.emplace_back(y, cnt);
            }
        }
        if (x > 1) {
            if (x > 100000) {
                ++result;
                continue;
            }
            if (binary_search(primes.begin(), primes.end(), x)) {
                cur.emplace_back((int)x, 1);  
                ++mp[cur];
                continue;
            }
            int y = sqrt(x + 0.5) + 0.5
            if (1LL * y * y != x) {
                ++result;
            } else {
                cur.emplace_back(y, 2);
                ++mp[cur];
            }
        } else {
            if (cur.empty()) {
                add = 1;
                continue;
            }
            ++mp[cur];
        }
    }
    result += add;	
	result *= 2;
    for (auto& x : mp) {
        cur.clear();
        vector<pair<int,int>> now = x.first;
        for (auto& y : now) 
            cur.emplace_back(y.first, 3 - y.second);
        if (mp.count(cur)e
            result += max(mp[now], mp[cur]);
        else
            result += 2 * x.second;
    }
    result /= 2;
    cout << result << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:54:13: error: expected ',' or ';' before 'if'
   54 |             if (1LL * y * y != x) {
      |             ^~
a.cc:56:15: error: expected '}' before 'else'
   56 |             } else {
      |               ^~~~
a.cc:43:20: note: to match this '{'
   43 |         if (x > 1) {
      |                    ^
a.cc:57:34: error: 'y' was not declared in this scope
   57 |                 cur.emplace_back(y, 2);
      |                                  ^
a.cc:60:11: error: 'else' without a previous 'if'
   60 |         } else {
      |           ^~~~
a.cc:63:17: error: continue statement not within a loop
   63 |                 continue;
      |                 ^~~~~~~~
a.cc: At global scope:
a.cc:68:5: error: 'result' does not name a type
   68 |     result += add;
      |     ^~~~~~
a.cc:69:9: error: 'result' does not name a type
   69 |         result *= 2;
      |         ^~~~~~
a.cc:70:5: error: expected unqualified-id before 'for'
   70 |     for (auto& x : mp) {
      |     ^~~
a.cc:80:5: error: 'result' does not name a type
   80 |     result /= 2;
      |     ^~~~~~
a.cc:81:5: error: 'cout' does not name a type
   81 |     cout << result << endl;
      |     ^~~~
a.cc:82:5: error: expected unqualified-id before 'return'
   82 |     return 0;
      |     ^~~~~~
a.cc:83:1: error: expected declaration before '}' token
   83 | }
      | ^