SIMPLE MAX-HEAP C++ COMMENTED SOLUTION
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\n\n\nclass Solution {\npublic:\n    int fillCups(vector<int>& amount){\n        // Create a max heap to always process the type of cup with the maximum remaining amount first\n        priority_queue<int> maxHeap;\n         for(auto&a : amount){\n            if(a > 0) maxHeap.push(a);\n        }\n        int sec = 0;\n        // Process the heap until all cups are filled\n        while(!maxHeap.empty()){\n            int first = 0;\n            int  second = 0;\n            // Take the top element (the largest one) \n            if(!maxHeap.empty()){\n                first = maxHeap.top();\n                maxHeap.pop();\n            }             // we can fill 2 cups at a time\n            // Take the next top element if available\n            if (!maxHeap.empty()) {\n                second = maxHeap.top();\n                maxHeap.pop();\n            }\n            // Increment the number of seconds\n            sec++;\n            // Decrease the count of these types and push back if still needed\n            if (--first > 0) maxHeap.push(first);\n            if (--second > 0) maxHeap.push(second);\n        }\n        \n        return sec;\n    }\n};\n```
['C++']