Language: C++

#pragma GCC optimize(3)
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,sse4.1,sse4.2,popcnt,abm,mmx,avx,avx2,tune=native")#include<bits/stdc++.h>
#pragma GCC optimize(3)
#define ll long long
#define int long long
#define ljc 998244353
using namespace std;
inline ll read(){
	ll x=0,f=1;char ch=getchar();
	while (!isdigit(ch)){if (ch=='-') f=-1;ch=getchar();}
	while (isdigit(ch)){x=x*10ll+ch-'0';ch=getchar();}
	return x*f;
}
inline ll fast_pow(ll a,ll b,ll p){
    ll t=1;a%=p;
    while (b){
        if (b&1) t=t*a%p;
        b>>=1;a=a*a%p;
    }
    return t;
}
int A[101010][2];
int p[101010],tot,n,a[101010];
bool vis[101010];
map<int,int> cac,rev;
signed main(){
	n=read();
	for (int i=1;i<=n;i++) a[i]=read();
	for (int i=2;i<=100000;i++){
		if (!vis[i]) p[++tot]=i;
		for (int j=1;j<=tot;j++){
			if (1ll*p[j]*i>100000) break;
			vis[p[j]*i]=1;
			if (i%p[j]==0) break;
		}
	}	
	ll _=0;
  	int all=0,flag=0;
  	sort(a+1,a+1+n);
	for (int i=1;i<=n;i++){
		int tmp=a[i];
		for (int j=1;p[j]*p[j]<=tmp&&j<=tot;j++,all++){
			if (tmp==1) break;
          if (all>600000000){
          	flag=1;break;
          }
			if (tmp%p[j]==0){
				for (;tmp%p[j]==0&&tmp;tmp/=p[j]);
			}
		}
      if (flag==1) break;
	}
  all=0;
	for (int i=1;i<=n;i++){
		int tmp=a[i];
		for (int j=1;p[j]*p[j]<=tmp&&j<=tot;j++,all++){
          if (flag&&all>1000000){
          		all-=50;break;
          }
			if (tmp==1) break;
			if (tmp%p[j]==0){
				int cnt=0;
				for (;tmp%p[j]==0&&tmp;tmp/=p[j],cnt++);
				cnt%=3;
				if (A[i][0]) A[i][0]*=(cnt>0?p[j]:1)*(cnt>1?p[j]:1);
				else A[i][0]=(cnt>0?p[j]:0)*(cnt>1?p[j]:1);
				cnt=3-cnt;cnt%=3;
				if (A[i][1]) A[i][1]*=(cnt>0?p[j]:1)*(cnt>1?p[j]:1);
				else A[i][1]=(cnt>0?p[j]:0)*(cnt>1?p[j]:1);
			}
		}
		if (tmp>1&&tmp<=100000){
			if (A[i][0]) A[i][0]*=tmp;
			else A[i][0]=tmp;
			if (A[i][1]) A[i][1]*=tmp*tmp;
			else A[i][1]=tmp*tmp;
		}
		if (tmp>100000){
			_++;
		}else{
			cac[A[i][0]]++;
			rev[A[i][0]]=A[i][1];
			rev[A[i][1]]=A[i][0];		
		}
	}
	for (auto j:cac){
		if (j.first&&j.second){
			_+=max(j.second,cac[rev[j.first]]);	
			cac[rev[j.first]]=0;
		}
	}
	cout<<_+(cac[0]>0);
	return 0;
}

Compiler output:
a.cc:5:97: error: stray '#' in program
    5 | #pragma GCC target("sse,sse2,sse3,ssse3,sse4,sse4.1,sse4.2,popcnt,abm,mmx,avx,avx2,tune=native")#include<bits/stdc++.h>
      |                                                                                                 ^
a.cc:5:98: error: '#pragma GCC target' string is badly formed
    5 | #pragma GCC target("sse,sse2,sse3,ssse3,sse4,sse4.1,sse4.2,popcnt,abm,mmx,avx,avx2,tune=native")#include<bits/stdc++.h>
      |                                                                                                  ^~~~~~~
a.cc:5:98: error: '#pragma GCC target' string is badly formed
a.cc: In function 'long long int read()':
a.cc:12:28: error: 'getchar' was not declared in this scope
   12 |         ll x=0,f=1;char ch=getchar();
      |                            ^~~~~~~
a.cc:1:1: note: 'getchar' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | #pragma GCC optimize(3)
a.cc:13:17: error: 'isdigit' was not declared in this scope
   13 |         while (!isdigit(ch)){if (ch=='-') f=-1;ch=getchar();}
      |                 ^~~~~~~
a.cc:14:16: error: 'isdigit' was not declared in this scope
   14 |         while (isdigit(ch)){x=x*10ll+ch-'0';ch=getchar();}
      |                ^~~~~~~
a.cc: At global scope:
a.cc:28:1: error: 'map' does not name a type
   28 | map<int,int> cac,rev;
      | ^~~
a.cc: In function 'int main()':
a.cc:42:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   42 |         sort(a+1,a+1+n);
      |         ^~~~
      |         short
a.cc:84:25: error: 'cac' was not declared in this scope
   84 |                         cac[A[i][0]]++;
      |                         ^~~
a.cc:85:25: error: 'rev' was not declared in this scope
   85 |                         rev[A[i][0]]=A[i][1];
      |                         ^~~
a.cc:89:21: error: 'cac' was not declared in this scope
   89 |         for (auto j:cac){
      |                     ^~~
a.cc:91:45: error: 'rev' was not declared in this scope
   91 |                         _+=max(j.second,cac[rev[j.first]]);
      |                                             ^~~
a.cc:91:28: error: 'max' was not declared in this scope
   91 |                         _+=max(j.second,cac[rev[j.first]]);
      |                            ^~~
a.cc:95:9: error: 'cout' was not declared in this scope
   95 |         cout<<_+(cac[0]>0);
      |         ^~~~
a.cc:1:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | #pragma GCC optimize(3)
a.cc:95:18: error: 'cac' was not declared in this scope
   95 |         cout<<_+(cac[0]>0);
      |                  ^~~