#include <stdio.h>
#include <stdlib.h>
#define MAX 100
int t[MAX+1];
int sz = 0;
void swap(int *x, int *y){
int tmp = *x;
*x = *y;
*y = tmp;
}
void heap_up(int idx){
while(idx>1&&t[idx]>t[idx/2]){
swap(&t[idx], &t[idx/2]);
idx=idx/2;
}
}
void heap_down(int idx){
int max_idx, left, right;
max_idx=idx;
left=2*idx;
right=2*idx+1;
if(left<=sz && t[left]>t[max_idx]){
max_idx=left;
}
if(right<=sz && t[right]>t[max_idx]){
max_idx=right;
}
if(max_idx!=idx){
swap(&t[idx], &t[max_idx]);
heap_down(max_idx);
}
}
void insert(int defense){
t[++sz]=defense;
heap_up(sz);
}
int pop_max(){
int max_defense=t[1];
t[1]=t[sz--];
heap_down(1);
return max_defense;
}
int solve(){
int ret=0;
int i, n, q, d_i;
for(i=1;i<=n;i++){
insert(d_i);
}
for(i=0; i<q; i++){
int max_defense=pop_max();
int reduced_defense=max_defense/2;
insert(reduced_defense);
}
for(i=1; i<=sz; i++){
ret+=t[i];
}
return ret;
}
//メイン関数はいじらなくて良い
int main(void){
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdGRsaWIuaD4KCiNkZWZpbmUgTUFYIDEwMAoKaW50IHRbTUFYKzFdOyAKaW50IHN6ID0gMDsKCnZvaWQgc3dhcChpbnQgKngsIGludCAqeSl7CiAgICBpbnQgdG1wID0gKng7CiAgICAqeCA9ICp5OwogICAgKnkgPSB0bXA7Cn0KCnZvaWQgaGVhcF91cChpbnQgaWR4KXsKCXdoaWxlKGlkeD4xJiZ0W2lkeF0+dFtpZHgvMl0pewoJCXN3YXAoJnRbaWR4XSwgJnRbaWR4LzJdKTsKCQlpZHg9aWR4LzI7Cgl9Cn0KCnZvaWQgaGVhcF9kb3duKGludCBpZHgpewoJaW50IG1heF9pZHgsIGxlZnQsIHJpZ2h0OwoJbWF4X2lkeD1pZHg7CglsZWZ0PTIqaWR4OwoJcmlnaHQ9MippZHgrMTsKCQoJaW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