// Code quesiton 1
int n;cin >> n;
vector<int> vect(n);
for(int i=0;i<n;i++) {
cin >> vect[i];
}
map<int,int> mp;
for(auto var:vect) mp[var]++;
int ans=0;
for(auto var:mp) {
int num=var.first;
int freq=var.second;
while(freq--) {
ans+=num;
num=ceil((float)num/2);
}
}
cout << ans << endl;
Code Question 2
void solve()
{
int n;
cin>>n;
vector<int> a(n,0);
for(int i = 0;i<n;i++){
cin>>a[i];
}
vector<int> len(n,0);
len[n-1] = 0;
for(int i = n-2;i>=0;i--){
if(a[i]>=a[i+1]){
len[i] = len[i+1] + 1;
}
}
auto p = max_element(len.begin(),len.end());
int max_ele = *p;
int start = 0;
int end = 0;
for(int i = 0;i<n;i++){
if(len[i] == max_ele){
start = i;
end = i+len[i];
}
}
for(int i = start;i<=end;i++){
cout<<a[i]<<" ";
}
cout<<endl;
}