Language: C++

#include <iostream>
#include <queue>
#include <map>
#include <list>
#include <vector>
#include <string>
#include <stack>
#include <limits>
#include <cassert>
#include <fstream>
#include <cstring>
#include <bitset>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <cstdio>
#include <ciso646>

using namespace std;

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)

#define inf 0x3f3f3f3f
#define INF INT_MAX/3
#define PB push_back
#define MP make_pair
#define ALL(a) (a).begin(),(a).end()
#define SET(a,c) memset(a,c,sizeof a)
#define CLR(a) memset(a,0,sizeof a)
#define pii pair<int,int>
#define pcc pair<char,char>
#define pic pair<int,char>
#define pci pair<char,int>
#define VS vector<string>
#define VI vector<int>
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define MIN(a,b) (a>b?b:a)
#define MAX(a,b) (a>b?a:b)
#define pi 2*acos(0.0)
#define INFILE() freopen("in0.txt","r",stdin)
#define OUTFILE()freopen("out0.txt","w",stdout)
#define in scanf
#define out printf
#define ll long long
#define ull unsigned long long
#define eps 1e-14
#define FST first
#define SEC second

class prime {
private:
public:
	std::vector<ull> primes;
	std::vector<bool> isPrime;
	prime(ull num) {
		isPrime.resize(num + 1);
		fill(isPrime.begin(), isPrime.end(), true);
		ull ma = sqrt(num) + 1;
		isPrime[0] = isPrime[1] = false;
		ull cnt = 0;
		for (ull i = 2; i <= ma; ++i) if (isPrime[i]) {
			for (ull j = 2; i*j <= num; ++j) {
				isPrime[i*j] = false;
				cnt++;
			}
		}
		primes.reserve(cnt);
		for (ull i = 0; i<isPrime.size(); ++i) if (isPrime[i]) {
			primes.push_back(i);
		}
	}

	bool IsPrime(ull num) {
		if (num < isPrime.size()) return isPrime[num];
		for (auto p : primes) {
			if (num%p == 0) return false;
		}
		ull ma = sqrt(num) + 1;
		for (ull i = primes.back(); i <= ma; i += 2) {
			if (num%i == 0) return false;
		}
		return true;
	}

	std::vector<ull> GetFactor(ull num) {
		std::vector<ull> res;
		ull ma = sqrt(num) + 1;
		ull sma = std::min(ma, (ull)isPrime.size() - 1);
		while (num != 1) {
			for (auto a : primes) {
				if (num % a == 0) {
					res.push_back(a);
					num /= a;
				}
			}
			break;
		}
		assert(num);
		return res;
	}

	std::map<ull, ull> GetFactorMap(ull num) {
		std::map<ull, ull> res;
		ull ma = sqrt(num) + 1;
		ull sma = std::min(ma, (ull)isPrime.size() - 1);
		ull index = 0;
		while (num >= primes[index]*primes[index]) {
			ull a = primes[index];
			if (num%a == 0) {
				res[a]++;
				num /= a;
			}
			else {
				++index;
			}
		}
		if (num != 1) res[num]++;
		return res;
	}
};

int main() {
	int N; cin >> N;
	prime p(sqrt(1e10));

	vector<ull> S(N); for (auto &a : S) cin >> a;

	int res = 0;

	map<ull, pair<ull, ull> > cnt; //first: norm, second: pair
	for (auto &s : S) {
		auto fac = p.GetFactorMap(s);
		ull norm = 1, pair = 1;
		for (auto f : fac) {
			int n = f.first;
			int c = f.second % 3;
			if (c == 1) {
				norm *= n;
				pair *= n*n;
			}
			else if (c == 2) {
				norm *= n*n;
				pair *= n;
			}
		}
		if (norm == 1) res = 1;
		else {
			if (norm < pair) cnt[norm].first++;
			else cnt[pair].second++;
		}
	}

	for (auto c : cnt) {
		res += max(c.second.first, c.second.second);
	}

	cout << res << endl;
	return 0;
}

Compiler output:
a.cc: In constructor 'prime::prime(long long unsigned int)':
a.cc:61:26: error: 'sqrt' was not declared in this scope
   61 |                 ull ma = sqrt(num) + 1;
      |                          ^~~~
a.cc: In member function 'bool prime::IsPrime(long long unsigned int)':
a.cc:81:26: error: 'sqrt' was not declared in this scope
   81 |                 ull ma = sqrt(num) + 1;
      |                          ^~~~
a.cc: In member function 'std::vector<long long unsigned int> prime::GetFactor(long long unsigned int)':
a.cc:90:26: error: 'sqrt' was not declared in this scope
   90 |                 ull ma = sqrt(num) + 1;
      |                          ^~~~
a.cc: In member function 'std::map<long long unsigned int, long long unsigned int> prime::GetFactorMap(long long unsigned int)':
a.cc:107:26: error: 'sqrt' was not declared in this scope
  107 |                 ull ma = sqrt(num) + 1;
      |                          ^~~~
a.cc: In function 'int main()':
a.cc:127:17: error: 'sqrt' was not declared in this scope
  127 |         prime p(sqrt(1e10));
      |                 ^~~~