giving one test case wrong
Book allocation problem
you have use int or sometime long long it is confusing and also the cause of error
i have replace all with long long int and the it pass all testcases
modified Code
i hope this help
if you have more doubts regarding this feel free to ask
if your doubt is resolved mark it as resolved from your doubt section inside your course