c++ easy
\nclass Solution {\npublic:\n    int fillCups(vector<int>& amount) {\n  /*      [5,4,4]\nOutput: 7\n\n    5    4    4\n    c    w    h\n    4    4    3\n    3  
```\nclass Solution {\npublic:\n    int fillCups(vector<int>& amount) {\n  /*      [5,4,4]\nOutput: 7\n\n    5    4    4\n    c    w    h\n    4    4    3\n    3    3    3\n    2    2    3\n    2    1    2\n    1    1    1\n    0    0    1\n    0    0    0 \n    pq=   5   4   4\n    cnt=1 pq=  4   4  3\n    cnt=2 pq=  3   3  3 \n    cnt=3 pq   3   2   2 \n    cnt=4 pq=  2   2   1\n    cnt=5 pq=  1   1   1\n    cnt=6 pq=  1   0   0\n    cnt=7 pq = 0   0   0\n    \n    \n    */\n\n        // we must track of top two frequent nubmers pop them reduce them by one and push them again\n        int cnt=0;\n        priority_queue<int> pq;\n        for(auto i:amount)\n            pq.push(i);\n        while(pq.top()>0){\n            \n            int x=pq.top();\n            pq.pop();\n            int y=pq.top();\n            pq.pop();\n            cnt++;\n            pq.push(x-1);\n           pq.push(y-1);\n            \n        }\n        return cnt;\n    \n    }\n};\n```
['Heap (Priority Queue)']