Https://cses.fi/problemset/task/1084/

https://cses.fi/paste/69fd1810b6927c73164517/
Here is my submission
its failing on a single test case →

5 2 2
2 2 2 40 50
40 50

Would you mind sharing the problem link ?

It’s in the heading btw the name of the problem is APARTMENT of CSES problem set