What's the error although output is correct

code is https://ide.codingblocks.com/s/253333

you have not provide space after comma
see the sample output carefully

also there is one more mistake
try for this input
3 5
1 2 3 4 5
6 7 8 9 10
11 12 13 14 15

this is because the while loop condition may fail inside loop so one check should be present inside loop

Modified Code