# Please anyone help me with why this happens

The question url is this NIGHTS WATCH Q1: https://www.codechef.com/LTIME68B/problems/WTCH https://ide.geeksforgeeks.org/Y4U8qx #include<bits/stdc++.h> using namespace std; int main(){ int t; cin>>t; while(t>0){ t--; int n; cin>>n; int arr[n]; int indi=0,count=0; for(int i=0;i<n;i++) cin>>arr[i]; for(int i=0;i<n;i++){ if(i==0 && arr[0]==0 && arr[1]==0){ {arr[0]=1; count++; cout<<count; continue; } if(arr[i-1]==0&&arr[i+1]==0 && arr[i]==0 && i!=n-1){ {arr[i]=1; count++; cout<<count; } if(i==n-1 && arr[i-1]==0){ arr[i-1]=1; count++; cout<<count; } } } } cout<<count; } } I am not getting the desired out put the question link is provided on the top. Please tell me what is the mistake thanks in advanced.