My approach for this question is -

1 - Use **sieve of eratosthenes** for Unique Prime factor for any Number : -

prime = [1] * (10 ** 5 + 5)

```
divPrime = [0]*(10**5+5)
prime[0] = 0
prime[1] = 0
prime[2] = 1
for i in range(2, 10 ** 5 + 5):
if prime[i] == 1:
divPrime[i]+=1
b.append(i)
for j in range(2 * i, 10 ** 5 + 5, i):
prime[j] = 0
divPrime[j]+=1
```

No of Unique Prime Factor of any Number stored in divPrime Array

2- *iterate i loop form 2 to max(a) and if element of Input array is divided by i then count+=1 *

3 -ans will be the calculate by *ans = max(ans,divPrime[i]***count)*

but above approach give me 30 points .

How to optimize this code ?

Code Link - https://www.codechef.com/viewsolution/21692429