#include
#include<math.h>
#include
#include
#include
#include
using namespace std;
int arrayProduct(int a[], int n)
{
return accumulate(a, a + n, 1, multiplies());
}
int main()
{
int a[100],n,p,q[100],r[100],ans;
int smallest = INT_MAX;
cin>>n;
for(int i=0;i<n;i++)
{
cin>>a[i];
}
p = arrayProduct(a, n);
for(int i=0;i<n;i++)
{
q[i]= pow((a[i]),(n));
}
sort(q,q+n);
for(int i=0;i<n;i++)
{
if(q[i]>p)
{
r[i]=q[i];
}
}
for(int i=0;i<n;i++)
{
if(r[i]<smallest && r[i]>0)
{
smallest=r[i];
}
}
ans = pow((smallest),(1.0/n));
cout<<endl;
cout<<ans;
}
My code is working on other compilers properly but is showing a run time error in hackerblocks