For this Question: You are given a matrix Mat of m rows and n columns. The matrix is boolean so the elements of the matrix can only be either 0 or 1.
Now, if any row of the matrix contains a 1, then you need to fill that whole row with 1. After doing the mentioned operation, you need to print the modified matrix.The first line of input contains T denoting the number of test cases. T test cases follow.
The first line of each test case contains m and n denotes the number of rows and a number of columns.
Then next m lines contain n elements denoting the elements of the matrix.

Constraints:
1 &le; T &le; 20
1 &le; m, n &le; 700
Mat[I][j] ∈ {0,1}For each testcase, in a new line, print the modified matrix.Input:
1
5 4
1 0 0 0
0 0 0 0
0 1 0 0
0 0 0 0
0 0 0 1

Output:
1 1 1 1
0 0 0 0
1 1 1 1
0 0 0 0
1 1 1 1

Explanation:
Rows = 5 and columns = 4
The given matrix is
1 0 0 0
0 0 0 0
0 1 0 0
0 0 0 0
0 0 0 1
Evidently, the first row contains a 1 so fill the whole row with 1. The third row also contains a 1 so that row will be filled too. Finally, the last row contains a 1 and therefore it needs to be filled with 1 too.
The final matrix is
1 1 1 1
0 0 0 0
1 1 1 1
0 0 0 0
1 1 1 1, I have written this Solution Code: #include <bits/stdc++.h>
using namespace std;
#define N 1000
int a[N][N];


// Driver code
int main()
{


 int t;
 cin>>t;
 while(t--){
 int n,m;
 cin>>n>>m;
 bool b[n];
 for(int i=0;i<n;i++){
    b[i]=false;
 }
 for(int i=0;i<n;i++){
     for(int j=0;j<m;j++){
        cin>>a[i][j];
        if(a[i][j]==1){
            b[i]=true;
        }
     }
 }
 for(int i=0;i<n;i++){
        if(b[i]){
    for(int j=0;j<m;j++){
        cout<<1<<" ";
    }}
    else{
      for(int j=0;j<m;j++){
        cout<<0<<" ";
      }
    }
    cout<<endl;
 }

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