Language: C++

#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
typedef long long LL;
LL a[110000];
vector<LL> p1, p2;

map<LL,int> r;
void gen(LL k){
	if(r.find(k) == r.end()){
		r[k] = rand() << 12 + rand();
	}
}
int main(){
	srand(150);
	int n;
	cin >> n;
	for(int i = 0; i < n; i++) cin >> a[i];
	map<LL,int> d;
	int n1 = 0;
	vector<int> q;
	for(int j = 2; j < 2200; j++){
		int ok = 1;
		for(int z = 2; z*z <= j; z++){
			if(j % z == 0){
				ok = 0;
				break;
			}
		}
		if(ok) q.push_back(j);
	}
	for(int z = 0; z < n; z++){
		p1.clear();
		p2.clear();
		for(int i = 0; i < q.size(); i++){
			LL j = q[i];
			LL p = j*j*j;
			while(a[z] % p == 0){
				a[z] /= p;
			}
			p = j;
			if(a[z] % (p*p) == 0){
				p2.push_back(p);
				a[z] /= (p*p);
			}
			if(a[z] % (p) == 0){
				p1.push_back(p);
				a[z] /= (p);
			}
		}
		if(a[z] > 1){
			LL c = sqrt(a[z]);
			if(c*c == a[z]){
				p2.push_back(c);
			} else {
				p1.push_back(a[z]);
			}
		}
		if(p1.empty() && p2.empty()){
			n1 = 1;
			continue;
		}
		for(int i = 0; i < p1.size(); i++){
			a *= p1[i];
		}
		for(int i = 0; i < p2.size(); i++){
			b *= p2[i];
		}
		gen(a);
		gen(b);
		h1 = r[a];
		h2 = r[b];
		//cout << h1-h2 << endl;
		d[h1-h2]++;
		d[h2-h1]++;
		d[h2-h1]--;
	}
	LL ans = 0;
	for(map<LL,int>::iterator it = d.begin(); it != d.end(); it++){
		ans += max(d[it->first],d[-it->first]);
	}
	ans /= 2;
	ans += n1;
	cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:64:27: error: invalid operands of types 'LL [110000]' {aka 'long long int [110000]'} and '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to binary 'operator*'
   64 |                         a *= p1[i];
a.cc:64:27: note:   in evaluation of 'operator*=(LL [110000] {aka long long int [110000]}, __gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type {aka long long int})'
a.cc:67:25: error: 'b' was not declared in this scope
   67 |                         b *= p2[i];
      |                         ^
a.cc:69:21: error: invalid conversion from 'LL*' {aka 'long long int*'} to 'LL' {aka 'long long int'} [-fpermissive]
   69 |                 gen(a);
      |                     ^
      |                     |
      |                     LL* {aka long long int*}
a.cc:9:13: note:   initializing argument 1 of 'void gen(LL)'
    9 | void gen(LL k){
      |          ~~~^
a.cc:70:21: error: 'b' was not declared in this scope
   70 |                 gen(b);
      |                     ^
a.cc:71:17: error: 'h1' was not declared in this scope; did you mean 'n1'?
   71 |                 h1 = r[a];
      |                 ^~
      |                 n1
a.cc:71:23: error: ambiguous overload for 'operator[]' (operand types are 'std::map<long long int, int>' and 'LL [110000]' {aka 'long long int [110000]'})
   71 |                 h1 = r[a];
      |                       ^
In file included from /usr/include/c++/14/map:63,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:152,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_map.h:504:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](const key_type&) [with _Key = long long int; _Tp = int; _Compare = std::less<long long int>; _Alloc = std::allocator<std::pair<const long long int, int> >; mapped_type = int; key_type = long long int]' (near match)
  504 |       operator[](const key_type& __k)
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_map.h:504:7: note:   conversion of argument 1 would be ill-formed:
a.cc:71:24: error: invalid conversion from 'LL*' {aka 'long long int*'} to 'std::map<long long int, int>::key_type' {aka 'long long int'} [-fpermissive]
   71 |                 h1 = r[a];
      |                        ^
      |                        |
      |                        LL* {aka long long int*}
/usr/include/c++/14/bits/stl_map.h:524:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](key_type&&) [with _Key = long long int; _Tp = int; _Compare = std::less<long long int>; _Alloc = std::allocator<std::pair<const long long int, int> >; mapped_type = int; key_type = long long int]' (near match)
  524 |       operator[](key_type&& __k)
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_map.h:524:7: note:   conversion of argument 1 would be ill-formed:
a.cc:71:24: error: invalid conversion from 'LL*' {aka 'long long int*'} to 'std::map<long long int, int>::key_type' {aka 'long long int'} [-fpermissive]
   71 |                 h1 = r[a];
      |                        ^
      |                        |
      |                        LL* {aka long long int*}
a.cc:72:17: error: 'h2' was not declared in this scope; did you mean 'p2'?
   72 |                 h2 = r[b];
      |                 ^~
      |                 p2