#include <bits/stdc++.h> #define int long long using namespace std; #define FOR(i, n) for(i = 0; i < n; ++i) typedef vector <int> vi; typedef pair<int, int> iPair; const int MOD = 1e9+7; int getNum(int n, int k) { int number = n; int result = 1; for(int i = 2; i <= sqrt(n); ++i) { int c = 0; while (number % i == 0) { number /= i; c++; } c %= k; int prod = 1; for(int j = 0; j < c; ++j) { prod *= i; } result *= prod; } if(number != 1) { int prod = 1; int c = 1; for(int j = 0; j < c; ++j) { prod *= number; } result *= prod; } return result; } int getComplement(int n, int k) { int number = n; int result = 1; for(int i = 2; i <= sqrt(n); ++i) { int c = 0; while (number % i == 0) { number /= i; c++; } c %= k; c = (k - c) % k; int prod = 1; for(int j = 0; j < c; ++j) { prod *= i; if(prod > 100000) return 0; } result *= prod; } if(number != 1) { int prod = 1; int c = k - 1; for(int j = 0; j < c; ++j) { prod *= number; if(prod > 100000) return 0; } result *= prod; } if(result > 100000) return 0; return result; } int32_t main() { ios_base::sync_with_stdio(false);cin.tie(NULL); int t = 1; int i,j; // cin>>t; while(t--) { int n, k; cin >> n >> k; vi arr(n); FOR(i, n) cin >> arr[i]; int count = 0; map <int, int> m; int perfect = 0; FOR(i, n) { int num = getNum(arr[i], k); int comp = getComplement(num, k); count += m[comp]; if(comp != 1) m[num]++; if(comp == 1) { count += perfect; perfect++; } } cout<<count; } } return 0;