Can anyone help me understand what's wrong with my code?


#1

int Solution::nchoc(int A, vector &B) {
priority_queue q;
int sum = 0;
int mod = 10e9 + 7;
for(auto x:B){q.push(x);}
while(A){
int k = q.top();
sum= sum + k;
q.pop();
q.push(k/2);
A–;
}
return sum%mod;
}


#2

Declare your variables as long long instead of integer type.