It's a very fancy question in linear algebra mathematics of finding the row reduced echelon form and i have implemented the code to find the same in python. The code is preety long and maybe diffficult to understand. My code passed all the testcases for the certain range of inputs/counstraints. As provided by our TA's and Prof. yes the code can reproduce wrong results but can be correct by making the matrix augmented/deaugmented as per the question.
IMPORTANT you can hardcode the input in the file and then can feed to the terminal or directly by decommenting the upper part you can provide the input on TERMINAL.
Thankyou!
Happy coding