sigsegv error help

i cannot understand the sigsegv problem help

#include<bits/stdc++.h>
using namespace std;
#define P 100 

	
static int A[P][P],T,N,M,R,C1,C2;

int maxHist(int row[])
{
    
 
    stack<int> result;
    int top_val;   
    int max_area = 0;
    int area = 0;    
    int i = 0;
    while (i <= N)
    {
       
        if (result.empty() || row[result.top()] <= row[i])
            result.push(i++);
 
        else
        {
            top_val = row[result.top()];
            result.pop();
            area = top_val * i;
 
            if (!result.empty())
                area = top_val * (i - result.top() - 1 );
            max_area = max(area, max_area);
        }
    }
 
    while (!result.empty())
    {
        top_val = row[result.top()];
        result.pop();
        area = top_val * i;
        if (!result.empty())
            area = top_val * (i - result.top() - 1 );
 
        max_area = max(area, max_area);
    }
    return max_area;
}
int maxRectangle(int A[][P])
{
    int result = maxHist(A[0]);
 

    for (int i = 2; i <= R; i++)
    {
 
        for (int j = 1; j <=N; j++)
 

            if (A[i][j]) A[i][j] += A[i - 1][j];
 
 

        result = max(result, maxHist(A[i]));
    }
 
    return result;
}
 

int main()
{
	cin>>T;
	
	int count[T];
	int q=0;
	
	
	for(int i =1;i<=3;i++)
	{
		for(int j = 1 ;j <= N;j++)
		{
			A[i][j] = 0;
		}
	}
	
	for(int i =1; i<=T;i++)
	{
	
	cin>>N;
	
	cin>>M;
	for(int j=1;j<=M;j++)
	{
	
		cin>>R;
	
		cin>>C1;
	
		cin>>C2;
		for(int k = C1 ; k <= C2 ; k++ )
		{
			A[R][k] = 1;			//a[1][2]= 1;    a[1][3] = 1; 
		}	
	} 		
	
	count[q] = maxRectangle(A);
	q++;
	for(int i =1;i<=3;i++)
	{
		for(int j = 1 ;j <= N;j++)
		{
			A[i][j] = 0;
		}
	}
	}
	for(int w = 0; w < q ; w++)
	{
		cout<<count[w];
		cout<<"\n";
	}
    return 0;
}

Problem link please.