I have been solving the questionZOMOCAV.

My Code is running on my local machine correctly for simple test cases. But it gives runtime error(SIGABRT) on CodeChef and on GeeksForGeeks IDE.

I am not able to figure out the error in my Code.

```
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
void updateDiff(std::vector<int> &Diff, const std::vector<int> &C, int N)
{
for (int i = 1; i <=N; ++i)
{
Diff[max(1,i-C[i])]+=1;
Diff[min(N,i+C[i])+1]-=1;
}
}
void finalArr(std::vector<int> &Diff, int N)
{
for (int i = 2; i <=N; ++i)
Diff[i]=Diff[i-1]+Diff[i];
}
string issufficient(const std::vector<int> &Diff, const std::vector<int> &H, int N)
{
for (int i = 1; i <=N; ++i)
{
if(Diff[i]!=H[i])
return "NO";
}
return "YES";
}
int main()
{
//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);
int test_cases; scanf("%d",&test_cases);
int N;
std::vector<int> C(1000,0); std::vector<int> H(1000,0);
std::vector<int> Diff(1000,0);
for (int i = 0; i < test_cases; ++i)
{
scanf("%d",&N);
for (int j = 1; j <=N; ++j)
scanf("%d",&C[j]);
for (int j = 1; j <=N; ++j)
scanf("%d",&H[j]);
updateDiff(Diff,C, N);
finalArr(Diff,N);
sort(Diff.begin(), Diff.begin()+N+1);
sort(H.begin(),H.begin()+N+1);
cout<<issufficient(Diff,H,N)<<endl;
//Changed Diff vector back to original having 0's everywhere
std::fill(Diff.begin(),Diff.end(),0);
}
}
```