Language: C++

#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <array>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <cmath>
#include <climits>
#include <cstdio>
#include <iomanip>
#include <utility>

using namespace std;
typedef long long int ll;

ll pow4(ll _x, ll _n)
{
    int ret = 1;
    while (0 < _n)
    {
        if ((_n % 2) == 0)
        {
            _x *= _x;
            _n >>= 1;
        }
        else
        {
            ret *= _x;
            --_n;
        }
    }
    return ret;
}

int main(int argc, char const *argv[])
{
    ll n, m;
    cin >> n >> m;
    vector<ll> a(n);
    for (ll i = 0; i < n; i++)
    {
        cin >> a[i];
    }

    if (n == 1)
    {
        // for (ll i = 0; (a[0] > 0 && i < m); i++)
        // {
        //     a[0] /= 2;
        // }
        cout << (a[0] / pow4(2, m))<< endl;
        exit(0);
    }

    sort(a.begin(), a.end());

    for (ll i = 0; i < m; i++)
    {
        ll temp = a[n - 1];
        a.erase(a.end() - 1);
        temp /= 2;
        while (i < m && temp >= a.back())
        {
            temp /= 2;
            i++;
        }
        if (temp <= a.front())
        {
            a.insert(a.begin(), temp);pow()
        }
        else
        {
            auto it = lower_bound(a.begin(), a.end(), temp);
            a.insert(it, temp);
        }
    }

    ll sum = 0;
    for (auto p : a)
    {
        sum += p;
    }
    cout << sum << endl;
}


Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:73:42: error: no matching function for call to 'pow()'
   73 |             a.insert(a.begin(), temp);pow()
      |                                       ~~~^~
In file included from a.cc:11:
/usr/include/c++/14/cmath:1074:5: note: candidate: 'template<class _Tp, class _Up> constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type std::pow(_Tp, _Up)'
 1074 |     pow(_Tp __x, _Up __y)
      |     ^~~
/usr/include/c++/14/cmath:1074:5: note:   candidate expects 2 arguments, 0 provided
In file included from /usr/include/features.h:523,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/os_defines.h:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/c++config.h:683,
                 from /usr/include/c++/14/bits/requires_hosted.h:31,
                 from /usr/include/c++/14/iostream:38,
                 from a.cc:1:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:173:1: note: candidate: 'double pow(double, double)'
  173 | __MATHCALL_VEC (pow,, (_Mdouble_ __x, _Mdouble_ __y));
      | ^~~~~~~~~~~~~~
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:173:1: note:   candidate expects 2 arguments, 0 provided
/usr/include/c++/14/cmath:380:3: note: candidate: 'constexpr long double std::pow(long double, long double)'
  380 |   pow(long double __x, long double __y)
      |   ^~~
/usr/include/c++/14/cmath:380:3: note:   candidate expects 2 arguments, 0 provided
/usr/include/c++/14/cmath:376:3: note: candidate: 'constexpr float std::pow(float, float)'
  376 |   pow(float __x, float __y)
      |   ^~~
/usr/include/c++/14/cmath:376:3: note:   candidate expects 2 arguments, 0 provided