For this Question: Given a binary square matrix of size N*N and an integer K, your task is to print the maximum side of sub square matrix containing at most K 1's.The first line of input contains two integers N and K, Next N lines contain N space-separated integers depicting the values of the matrix.

<b>Constraints:</b>
1 < = N < = 500
1 < = K < = 100000 
0 < = Matrix[][] < = 1Print the maximum side.Sample Input:-
3 2
1 1 1
1 0 1
1 1 0 

Sample Output:-
2

Explanation:-
0 1
1 0 
is the required sub matrix.

Sample Input:-
2 1
1 0
0 1

Sample Output:-
1, I have written this Solution Code: 
// author-Shivam gupta

#include <bits/stdc++.h>


using namespace std;

#define MEM(a, b) memset(a, (b), sizeof(a))

#define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)

#define IN(A, B, C) assert( B <= A && A <= C)

#define MP make_pair
#define FOR(i,a) for(int i=0;i<a;i++)

#define FOR1(i,j,a) for(int i=j;i<a;i++)

#define EB emplace_back

#define INF (int)1e9

#define EPS 1e-9

#define PI 3.1415926535897932384626433832795

#define MOD 1000000007

#define read(type) readInt<type>()
#define max1 1001
#define out(x) cout<<x<<'\n'
#define out1(x) cout<<x<<" "
#define END cout<<'\n'
#define int long long
void fast(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
}

int a[max1][max1],b[max1][max1];
signed main(){

fast();
int n,k;
cin>>n>>k;

for(int i=0;i<=n;i++){
    a[i][0]=0;
    a[0][i]=0;
}
FOR(i,n){
    FOR(j,n){
    cin>>b[i][j];
    }
}
for(int i=1;i<=n;i++){
    for(int j=1;j<=n;j++){
        a[i][j]=a[i][j-1]+b[i-1][j-1];
    }
}
for(int i=1;i<=n;i++){
    for(int j=1;j<=n;j++){
        a[i][j]=a[i-1][j]+a[i][j];
  //     out1(a[i][j]);
    }
    //END;
}
int ans=0;
int cnt=0;
for(int i=1;i<=n;i++){
    for(int j=1;j<=n;j++){

        for(int l=0;l<=min(n-i,n-j);l++){

              cnt=a[i-1][j-1]+a[i+l][j+l]-a[i+l][j-1]-a[i-1][j+l];
              if(cnt<=k){
                ans=max(ans,l+1);
              }
        }
    }
}
out(ans);


}
, In this Programming Language: C++, Now tell me if this Code is compilable or not?