Sell All the Cars getting wrong

i have checked my code and even compared it with other codes but cannot find what is giving the wrong answer

https://www.codechef.com/viewsolution/32264439

I dont exactly know what that “modulo 1,000,000,0071,000,000,007 (109+7109+7)” means. Also, all the other answers have included algorithm header file and i dont know what its for.

So pls enlighten me guys. :sweat_smile: :sweat_smile:

Algorithm header file is for sorting.
sort the array…ans would be
arr[0] + max(0,arr[1]-1) + max(0,arr[2]-2) … and so on
you should take modulo at every step.
(a+b+c…)%mod=(a%mod + b%mod +c%mod…)%mod
https://www.codechef.com/viewsolution/32270162
link to corrected submission…notice the changes :slightly_smiling_face:

see first of all the biggest problem in your code is modular addition.and to know what is modulo 10^9+7 refer this link What is modulo 10^9+7 and try for yourself you will definitely come to know and second problem is you have to answer for each test case on different line…Hope it helps…