
The first line contains ‘T’, denoting the number of test cases.
The first line of each test case contains two space-separated integers, ‘N’ and ‘M’, denoting the number of rows and the number of columns respectively.
Each of the next ‘N’ lines of the test case contains ‘M’ space-separated integers denoting ‘M’ integers of every row respectively.
For each test case, print the resultant matrix.
You are not required to print the expected output or take the matrix input; it has already been taken care of. Just implement the function.
1 <= T <= 10
1 <= N <= 10^3
1 <= M <= 10^3
-10^5 <= input[i][j] <= 10^5
Time Limit: 1 sec
The key here is to traverse all the lines sequentially, and for each line, we calculate the required sum at the given index.
The steps are as follows: