Language: C++

#include <iostream>
#include <vector>
#include <algorithm>

using int64 = long long;

using namespace std;
using int_vec = vector<int64>;

void heapify(int_vec& v, int i) {
    int max;

    auto h = v.size();
    auto l = i * 2 + 1;
    auto r = i * 2 + 2;
    if (l < h && v[l] > v[i]) {
        max = l;
    } else {
        max = i;
    }
    if (r < h && v[r] > v[max]) {
        max = r;
    }

    if (max != i) {
        swap(v[i], v[max]);
        heapify(v, max);
    }
}

int parent(int i) {
    return (i - 1) / 2;
}

void insert(int_vec& v, int64 x) {
    v.push_back(x);

    int i = v.size() - 1;
    while (i > 0 && v[parent(i)] < v[i]) {
        swap(v[parent(i)], v[i]);
        i = parent(i);
    }
}

int main() {
    int_vec v;

    while (1) {
        string s;
        cin >> s;
        if (s == "end")
            break;

        if (s == "insert") {
            int x;
            cin >> x;
            insert(v, x);
        } else if (s == "extract") {
#include <iostream>
#include <vector>
#include <algorithm>

using int64 = long long;

using namespace std;
using int_vec = vector<int64>;

void heapify(int_vec& v, int i) {
    int max;

    auto h = v.size();
    auto l = i * 2 + 1;
    auto r = i * 2 + 2;
    if (l < h && v[l] > v[i]) {
        max = l;
    } else {
        max = i;
    }
    if (r < h && v[r] > v[max]) {
        max = r;
    }

    if (max != i) {
        swap(v[i], v[max]);
        heapify(v, max);
    }
}

int parent(int i) {
    return (i - 1) / 2;
}

void insert(int_vec& v, int64 x) {
    v.push_back(x);

    int i = v.size() - 1;
    while (i > 0 && v[parent(i)] < v[i]) {
        swap(v[parent(i)], v[i]);
        i = parent(i);
    }
}

int main() {
    int_vec v;

    while (1) {
        string s;
        cin >> s;
        if (s == "end")
            break;

        if (s == "insert") {
            int x;
            cin >> x;
            insert(v, x);
        } else if (s == "extract") {
            /*
            cerr << "debug:";
            for (int i = 0; i < 5; ++i) {
                cerr << " " << v[i];
            }
            cerr << endl;
            */

            cout << v[0] << endl;
            for (auto i = 1; i < v.size(); ++i)
                v[i-1] = v[i];
            heapify(v, 0);
        }
    }

    return 0;
}
            cout << v[0] << endl;
            v.erase(v.begin());
            heapify(v, 0);
        }
    }

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:68:33: error: a function-definition is not allowed here before '{' token
   68 | void heapify(int_vec& v, int i) {
      |                                 ^
a.cc:89:19: error: a function-definition is not allowed here before '{' token
   89 | int parent(int i) {
      |                   ^
a.cc:93:34: error: a function-definition is not allowed here before '{' token
   93 | void insert(int_vec& v, int64 x) {
      |                                  ^
a.cc:103:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
  103 | int main() {
      |         ^~
a.cc:103:9: note: remove parentheses to default-initialize a variable
  103 | int main() {
      |         ^~
      |         --
a.cc:103:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:103:12: error: a function-definition is not allowed here before '{' token
  103 | int main() {
      |            ^