Code is not being submitted

it does not show anything wether i have passed testcases or not .
code:->
#include
using namespace std;
int main(){
int n;
cin >> n;
int arr[n];
int l[10000];
int r[10000];

for (int  i = 0; i < n; i++)
{
    cin >> arr[i];
}
l[0] = arr[0];
r[n-1] = arr[n-1];
for (int i = 1; i < n; i++)
{
    l[i] = max(l[i - 1], arr[i]);
}

for (int j = n - 2; j >=0;j--){
    r[j] = max(r[j + 1], arr[j]) ;
}

int water = 0;
for (int i = 0; i < n;i++){
    water = water + (min(l[i], r[i]) - arr[i]);

}

cout << water << endl;
return 0;

}

@yamangoyal100_ff74db54bdf01539 try again their was issue with server

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.