I have a solution for the problem:https://www.codechef.com/ZCOPRAC/submit/ZCO14003 it runs well in code chef ide but it appears to be wrong after the submit.It passes few test cases but not all. can anyone help me!

here’s my code:

```
#include <stdio.h>
int main(void) {
long long int n,list[100000000],temp,values[50000],i,j,arr[500000],size;
scanf("%11d",&n);
for(i=0;i<n;i++)
{
scanf("%11d",&list[i]);
}
for(i=0;i<n-1;i++)
{
for(j=0;j<n-1;j++)
{
if(list[j]>list[j+1])
{
temp=list[j];
list[j]=list[j+1];
list[j+1]=temp;
}
}
}
temp=0;
size=n;
while(size>=0)
{
values[temp]=size;
size--;
temp++;
}
for(i=0;i<n;i++)
{
arr[i]=list[i]*values[i];
}
for(i=0;i<n-1;i++)
{
for(j=0;j<n-1;j++)
{
if(arr[j]>arr[j+1])
{
temp=arr[j];
arr[j]=arr[j+1];
arr[j+1]=temp;
}
}
}
printf("%d",arr[n-1]);
return 0;
}
```