Language: C++

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

#define Int register int
#define int long long
#define MAXN 100005

int n,ans,s[MAXN];
map <int,int> tot;
map <int,bool> vis;

template <typename T> inline void read (T &t){t = 0;char c = getchar();int f = 1;while (c < '0' || c > '9'){if (c == '-') f = -f;c = getchar();}while (c >= '0' && c <= '9'){t = (t << 3) + (t << 1) + c - '0';c = getchar();} t *= f;}
template <typename T,typename ... Args> inline void read (T &t,Args&... args){read (t);read (args...);}
template <typename T> inline void write (T x){if (x < 0){x = -x;putchar ('-');}if (x > 9) write (x / 10);putchar (x % 10 + '0');}

int cnt,prime[MAXN],visit[MAXN];

void Euler (int up){
	for (Int i = 2;i <= up;++ i){
		if (!visit[i]) prime[++ cnt] = i;
		for (Int j = 1;j <= cnt && i * prime[j] <= up;++ j){
			visit[i * prime[j]] = 1;
			if (i % prime[j] == 0) break; 
		}
	}
}

signed main(){
	read (n);Euler (1e5);
	for (Int i = 1;i <= n;++ i){
		read (s[i]);
		for (Int p = 2;p * p * p <= s[i];++ p) while (s[i] % (p * p * p) == 0) s[i] /= p * p * p; 
		if (s[i] != 1) tot[s[i]] ++;
		else ans = 1;
	}
	for (Int i = 1;i <= n;++ i) 
		if (vis[s[i]] || s[i] == 1) continue;
		else{
			int now = s[i],nowto = 1;
			for (Int j = 1;j <= cnt && prime[j] * prime[j] <= now;++ j)
				if (now % (prime[j] * prime[j]) == 0){
					now /= prime[j] * prime[j],nowto *= prime[j];
				}
			nowto *= now * now;
			vis[s[i]] = vis[nowto] = 1,ans += max (tot[s[i]],tot[nowto]);
		}
	write (ans),putchar ('\n');
	return 0;
}

Compiler output:
a.cc: In function 'void Euler(long long int)':
a.cc:19:18: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   19 |         for (Int i = 2;i <= up;++ i){
      |                  ^
a.cc:20:22: error: reference to 'visit' is ambiguous
   20 |                 if (!visit[i]) prime[++ cnt] = i;
      |                      ^~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:80,
                 from a.cc:1:
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:16:21: note:                 'long long int visit [100005]'
   16 | int cnt,prime[MAXN],visit[MAXN];
      |                     ^~~~~
a.cc:21:26: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   21 |                 for (Int j = 1;j <= cnt && i * prime[j] <= up;++ j){
      |                          ^
a.cc:22:25: error: reference to 'visit' is ambiguous
   22 |                         visit[i * prime[j]] = 1;
      |                         ^~~~~
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:16:21: note:                 'long long int visit [100005]'
   16 | int cnt,prime[MAXN],visit[MAXN];
      |                     ^~~~~
a.cc: In function 'int main()':
a.cc:30:18: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   30 |         for (Int i = 1;i <= n;++ i){
      |                  ^
a.cc:32:26: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   32 |                 for (Int p = 2;p * p * p <= s[i];++ p) while (s[i] % (p * p * p) == 0) s[i] /= p * p * p;
      |                          ^
a.cc:36:18: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   36 |         for (Int i = 1;i <= n;++ i)
      |                  ^
a.cc:40:34: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   40 |                         for (Int j = 1;j <= cnt && prime[j] * prime[j] <= now;++ j)
      |                                  ^