Failing test case in SMART ROBBERY

QUES -https://hack.codingblocks.com/app/contests/1783/1336/problem
ANS -https://ide.codingblocks.com/s/341591

sample is giving correct result

but all test case are failing
can any one help