I observed that people have made a text submission for this problem. I have figured out the solution, but my code is just slightly more than than 50000 Bytes for n=10000, hence it is exceeding the memory limit.
I am just printing 10000 separate lines in my text file. Please tell is there any alternative to this.
Dont answer this question if it is against the codechef’s code of conduct.