Getting WA while submitting Hostel Visit

Hello, I am trying to solve the Hostel Visit question. I am submitting code here -> https://ideone.com/19oCdG

It’s giving correct output for the test cases I have tried. But failing on submissions. Please check and let me know whats the error.

Hello @snitin315

a) image

use long long to avoid overflow

b) image

why passing 2 ?
u need to pass k-1

Hey @aman212yadav, thanks for your response I corrected the mistakes and now 4 out of 5 tests are passing.

@snitin315
i guess pbds dont allow duplicates thats why it some test cases are not passing.

use some other datastructure like max heap.