WA in CARSELL - please help

I can not understand where the problem lies.
Contest Code:PRACTICE

Problem Code:CARSELL
public static void main(String[] args)
{
int n;
Scanner s = new Scanner(System.in);
//System.out.println(“enter value of t”);
int t = s.nextInt();
int[] result=new int[t];
for (int i =0;i<t;i++)
{
//System.out.println(“enter value of n”);
n = s.nextInt();
int[] price = new int[n];
//System.out.println(“enter “+n+” number of values”);
for (int j=0;j<n;j++)
{
price[j]= s.nextInt();
}
result[i] =profit(price);

}
for(int i:result) {
	System.out.println(i);
}
s.close();

}
static int profit(int[] price)
{
int sum =0;
for(int i =0;i<price.length;i++)
{if(price[0]==0)
price[0]=1;
int p=price[i]-i;
if(price[i]<=0)
{
sum+=0;
}
else
{
sum+=p;
}
}
return sum;
}

You have to sell the cars in a way such that your profit is maximized. You don’t need to sell ith car on ith day. You can sell them in any order.