Even after passing all the test cases ,I am getting a WA in the problem and I am unable to figure out the error

```
long long int a[1000000],dp[1000000];
int main()
{
long long int t;
cin>>t;
long long int n,i;
long long int j=1;
while(t--)
{
cin>>n;
for(i=0;i<n;i++)
{
cin>>a[i];
}
dp[0]=a[0];
dp[1]=max(a[0],a[1]);
for(i=2;i<n;i++)
{
dp[i]=max(dp[i-1],a[i]+dp[i-2]);
}
if(n==0)
cout<<"Case "<<j<<": 0"<<"\n";
else
cout<<"Case "<<j<<": "<<dp[i-1]<<"\n";
j++;
}
return 0;
}
```