intSolution::nchoc(int A, vector<int> &B){ priority_queue<int> q; for(auto b : B) q.push(b); longlong res = 0, mod = 1e9 + 7; while(A-- and q.size()) { int now = q.top(); q.pop(); res = (res + now) % mod; now /= 2; if(now) q.push(now); } return res; }