Simple Approach || Priority_Queue || Explanation || c++
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```\nclass Solution {\npublic:\n// AT PARTICULAR INSTANCE WE  TAKE GREATEST 2 ELEMENT AND DECRESE ITS VALUE BY 1 AND AGAIN PUSHED IN THE QUEUE\n// THEREFORE IF THE SIZE OF QUEUE IS 1 THEN WE CANT TAKE OUT TWO ELEMENT THEREFORE WE HAVE TO RUN THE LOOP TILL\n// SIZE IS GREATER THAN 2. AFTER DECREASING IF THE VALUE IS EQUAL TO ZERO THEN WE WILL NOT PUSH IN THE QUEUE\n// ALL THOUGH THE NUMBER OF WATER IS COMPLETED. \n    int fillCups(vector<int>& amount) {\n        priority_queue<int>pq;\n        for(int i=0;i<3;i++)\n        {\n            if(amount[i]!=0) // [5,0,0,] TO AVOID THIS TYPE OF CASES. IF WE DONOT DO THIS STEP THEN SIZE OF \n            pq.push(amount[i]);// QUEUE IS 3 THEN THE LOOP HAS BEEN STARTED AND AFTER TAKING TWO VALUE AND \n        }               // DECREASED THAT VALUE WE GET (4,-1) AND THEN INSERTED IN QUEUE THEN THE DECRESED VALUE \n        int count=0; // WILL NEVER BE ZERO AND HENCE THE SIZE WILL NOT DECREASES ....INFINTE LOOP OCCUR\n        while(pq.size()>1)\n        {\n            int top1 = pq.top();\n            pq.pop();\n            int top2 = pq.top();\n            pq.pop();\n            top1-=1;\n            top2-=1;\n            if(top1!=0)\n            pq.push(top1);\n            if(top2!=0)\n            pq.push(top2);\n            count++; \n        }\n        if(!pq.empty()) return count+pq.top();\n        return count;\n\n          OR  \n\n        priority_queue<int>pq(amount.begin(),amount.end());\n        int count=0;\n        while(pq.top()!=0)\n        {\n            int t1=pq.top();\n            pq.pop();\n            int t2=pq.top();\n            pq.pop();\n            pq.push(t1-1);\n            pq.push(t2-1);\n            count++;\n        }\n        return count;\n    }\n};\n```
['C++']