Python Sol Amiiii


#1
def nchoc(self, A, B):
        import heapq
        count=0
        if(len(B)==0):
            return 0
        B = [ -x for x in B]
        heapq.heapify(B)
        while(A>0):            
            t=heapq.heappop(B)
            count+=t
            heapq.heappush(B,-1*(-1*t//2))
            A-=1
        return (-1*count)%(10**9+7)