Why i am getting SIGSEGV error in this code . it is working properly in other ides

i am fed up with this error. my coding is giving right output but when i try to submit it is showing SIGSEGV error

#include <iostream>
#include<vector>

using namespace std;

int main()
{
    int T,i,N,M,Q,j,k,NEW[300][300],X,Y;
    cin>>T;
    
    while(T--)
    {
        cin>>N>>M>>Q;
        
        
        
        
         
        for(i=1;i<=N;++i)
        {
            for(j=1;j<=M;++j)
            {
               NEW[i][j]=0; 
            }
        }
        
        
        for(i=1;i<=Q;++i)
        {
            cin>>X>>Y;
            
            
        for(k=X;k<=X;k++)
        {
            for(j=1;j<=M;j++)
            {
                NEW[k][j]+=1;
            }
        }
        
        for(j=Y;j<=Y;j++)
        {
            for(k=1;k<=N;k++)
            {
                NEW[k][j]+=1;
            }
        }
        
        }
       
      
       
        
       
        int c;
        c=0;
        
        for(i=1;i<=N;++i)
        {
            for(j=1;j<=M;++j)
            {
               if(NEW[i][j]%2!=0)
               {
                   c++;
               }
            }
        }
        
        cout<<c<<" \n";
        
    }

    return 0;
}```

this error is really irritating

can you post your advice again?

guys i got the answer the array indexing should start from 0 not from 1 .