Language: C++

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int inf_int = 1e9 + 100;
const ll inf_ll = 5e18;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef long double dbl;
#define pb push_back
const double pi = 3.1415926535898;
#define dout if(debug) cout
#define fi first
#define se second
#define sp setprecision
#define sz(a) (int(a.size()))
#define all(a) a.begin(),a.end()
bool debug = 0;
const int MAXN = 2e5 + 100;
const int LOG = 20;
const int mod = 1e9 + 7;
const int MX = 1e7 + 100;
typedef long long li;
const li MOD = 1000000000949747713ll;

struct point {
    ll k, b;
    point(){
        k = b = 0;
    }
};

struct vertex {
    point p;
    vertex *l, *r;

    vertex() {
        l = r = NULL;
    }
};

vertex mem[MX];
int top_mem = 0;

inline vertex* get_new(point &cur) {
    mem[top_mem].p = cur;
    return &mem[top_mem++];
}

ll calc(point &p, ll x) {
    return p.k * x + p.b;
}

vertex *update(vertex *v, int tl, int tr, point cur) {
    if (!v)
        return get_new(cur);
    if (tl == tr) {
        if (calc(cur, tl) < calc(v->p, tl)) {
            v->p = cur;
        }
        return v;
    } else {
        int tm = (tl + tr) >> 1;
        if (calc(cur, tm) < calc(v->p, tm)) {
            swap(v->p, cur);
        }

        if (calc(cur, tl) < calc(v->p, tl)) {
            v->l = update(v->l, tl, tm, cur);
        } else {
            v->r = update(v->r, tm + 1, tr, cur);
        }
        return v;
    }
}

ll get(vertex *v, int tl, int tr, int x) {
    if (!v)
        return inf_ll;
    if (tl == tr) {
        return calc(v->p, x);
    } else {
        int tm = (tl + tr) >> 1;
        ll cur = calc(v->p, x);
        if (tl <= tm) {
            return min(cur, get(v->l, tl, tm, x));
        } else {
            return min(cur, get(v->r, tm + 1, tr, x) );
        }
    }
}


ll h[MAXN];

ll dp[MAXN];

void solve() {
    int n;
    ll c;
    cin >> n >> c;
    vertex *root = NULL;
    for (int i = 1; i <= n; ++i) {
        cin >> h[i];
    }
    int mx = 1e6;
    point p = {-2 * h[1], 1ll * h[1] * h[1]};
    root = update(root, 1, mx, p);

    for (int i = 2; i <= n; ++i) {
        dp[i] = c + h[i] * h[i];
        dout << i <<" - "<<dp[i]<<endl;
        dp[i] += get(root, 1, mx, h[i]);

        point p = {-2 * h[i], dp[i] + h[i] * h[i]};
        root = update(root, 1, mx,p);

        dout << i<<" - "<<dp[i]<<endl;
    }
    cout << dp[n];


}

signed main() {
#ifdef zxc
    debug = 1;
    freopen("../input.txt", "r", stdin);
#else

#endif //zxc
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cout.setf(ios::fixed);
    cout.precision(20);

    int t = 1;

    while (t--)
        solve();
    dout << endl << (1.0 * clock() / CLOCKS_PER_SEC) << endl;
}


Compiler output:
a.cc: In function 'void solve()':
a.cc:108:44: error: could not convert '{(-2 * h[1]), ((1 * h[1]) * h[1])}' from '<brace-enclosed initializer list>' to 'point'
  108 |     point p = {-2 * h[1], 1ll * h[1] * h[1]};
      |                                            ^
      |                                            |
      |                                            <brace-enclosed initializer list>
a.cc:116:50: error: could not convert '{(-2 * h[i]), (dp[i] + (h[i] * h[i]))}' from '<brace-enclosed initializer list>' to 'point'
  116 |         point p = {-2 * h[i], dp[i] + h[i] * h[i]};
      |                                                  ^
      |                                                  |
      |                                                  <brace-enclosed initializer list>