I wrote this code for zco practice problem SMARTPHONE and I am not getting where my code is wrong

I have checked with plenty of data and ain’t getting the one which is not fitting into it.

my code –

#include

using namespace std;

int max_revenue(int arr[],int n ){

int max{arr[0]*n};
for (int i{0}; i<n; ++i){
if ((arr[i]*(n-i))>max){

max = arr[i]*(n-i);

}

}return max;

}

int main(){

int n{};

cin >> n;

int arr[n];

```
for (int i{0}; i<n; ++i){
cin >>arr[i];
}
for (int i{1}; i<n; ++i){
int current {arr[i]};
int j {i-1};
while (arr[j]>current && j>=0){
arr[j+1] = arr[j];
j--;
}
arr[j+1] = current;
}
cout << max_revenue(arr,n)<<endl;
return 0;
```

}