Rain Water Harvesting

My code shows wrong output.Here is the link of my code

hello @naazsayma123
a) increase ur array size becuase n can be upto 10^6.
image

b) use long long dattype to store ur answer.