For this Question: Given a binary matrix, your task is to calculate the maximum area of a rectangle formed by only 1's in it.First line contains two integers number of rows N and number of columns M.
Next N lines contain M integers with each integer being either 0 or 1

Constraints:-
1 <= N, M <=1000Print the maximum area of rectangle.Sample Input 1:
4 4 
0 1 1 0 
1 1 1 1 
1 1 1 1 
1 1 0 0

Sample Output 1:
8

Explanation
The max size rectangle is 
1 1 1 1
1 1 1 1
and its area is 4*2 = 8

Sample Input 2:-
1 4
1 1 1 1

Sample Output 2:-
4, I have written this Solution Code: #include "bits/stdc++.h"
#pragma GCC optimize "03"
using namespace std;
 
#define int long long int
#define ld long double
#define pi pair<int, int>
#define pb push_back
#define fi first
#define se second
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#ifndef LOCAL
#define endl '\n'
#endif
 
const int N = 1e3 + 5;
const int mod = 1e9 + 7;
const int inf = 1e9 + 9;

int p[N][N], l[N], r[N];

signed main() {
	IOS;
	int n, m;
	cin >> n >> m;
	for(int i = 1; i <= n; i++){
		for(int j = 1; j <= m; j++){
			cin >> p[i][j];
			if(p[i][j])
				p[i][j] += p[i-1][j];
		}
	}	
	int ans = 0;
	for(int i = 1; i <= n; i++){
		memset(l, 0, sizeof l);
		memset(r, 0, sizeof r);
		stack<int> s;
		p[i][0] = p[i][m+1] = -1;
		s.push(0);
		for(int j = 1; j <= m; j++){
			while(!s.empty() && p[i][s.top()] >= p[i][j])
				s.pop();
			l[j] = s.top();
			s.push(j);
		}
		while(!s.empty())
			s.pop();
		s.push(m+1);
		for(int j = m; j >= 1; j--){
			while(!s.empty() && p[i][s.top()] >= p[i][j])
				s.pop();
			r[j] = s.top();
			s.push(j);
		}
		for(int j = 1; j <= m; j++)
			ans = max(ans, p[i][j]*(r[j]-l[j]-1));
	}
	cout << ans;
	return 0;
}, In this Programming Language: C++, Now tell me if this Code is compilable or not?