Book allocation problem

time limit exceeded
can you plz suggest why this happens

you are not decrementing t , thus while loop will run indefinitely

still time limit exceeded

have you resolved your doubt ?? if yes then ignore the message