It runs fine but on submit it shows error RE (SIGSEGV)

it runs fine. bit when I submit it. it throws a error (SIGSEGV) . can anyone help me with it

#include
using namespace std;

int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int T;
cin >> T;
for (int i=0; i<T;i++){
int N,M;
cin >> N>> M;
int sum = 0;
int Ope[M][2];
int A[N];
int x,y;
for (int p=0; p < M; p++){

      cin >> x >> y;
      Ope[p][0]=x;
      Ope[p][1]=y;
    
  }

  for (int q=0; q<N;q++ ){
      A[q]=0;
  }
  for (int e=0;e<M;e++){
      for (int w=1;w<N+1;w++){
          if(w % Ope[e][1] != 0 && A[w-1]==0){
              A[w-1]=Ope[e][0];
              sum += Ope[e][0];
          }
      }
  }
   
   cout << sum <<"\n";
}

return 0;

}

Which Problem are you trying to solve?

array filling from aug long challange. I know its not correct answer. I need to sort the array (Ope) in descending order.

Same, been trying to submit for 3 days, keeps giving same error RE (SIGSEGV)