C++ || priority queue
\nclass Solution {\npublic:\n    int fillCups(vector<int>& a) {\n        int n = a.size();\n        \n        priority_queue<int> pq;\n        \n        for(aut
```\nclass Solution {\npublic:\n    int fillCups(vector<int>& a) {\n        int n = a.size();\n        \n        priority_queue<int> pq;\n        \n        for(auto &x: a){\n            if(x != 0) pq.push(x);\n        }\n        int ans = 0;\n        while(pq.size() >= 2){\n            int x = pq.top();\n            pq.pop();\n            int y = pq.top();\n            pq.pop();\n            \n            ans++;\n            \n            if(x-1 != 0) pq.push(x-1);\n            if(y-1 != 0) pq.push(y-1); \n        }\n        \n        if(!pq.empty()) ans += pq.top();\n        \n        return ans;\n    }\n};\n```\n*note : There are only 3 elements in array*\n\n**M2**\n```\nclass Solution {\npublic:\n    int fillCups(vector<int>& a) {\n        sort(a.begin(),a.end());\n        int sum=a[0]+a[1]+a[2];\n        if(a[1]+a[0]>=a[2])sum=(sum+1)/2;\n        else sum=a[2];return sum;\n    }\n};\n```\n\n**M3**\n```\nclass Solution {\npublic:\n    int fillCups(vector<int>& amount) {\n        int ans=0;\n        while(1) {\n            sort(amount.begin(), amount.end());\n            if (amount.back()<=0)\n                break;\n            \n            amount[1]--, amount[2]--;\n            ans++;\n        }\n        return ans;\n    }\n};\n```
['C', 'Heap (Priority Queue)']