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

using namespace std;

int main()
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;

  for (int q=0; q<N;q++ ){
  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){
              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)