Language: C++

#include <bits/stdc++.h>

typedef long long ll;
typedef long double lb;

#define ff first
#define ss second
#define pb push_back
#define mp make_pair

using namespace std;

const int N = 1e6 + 69, mod = 1e9 + 7;
const ll INFLL = 1e18;
const int INF = 1e9;

ll n, C;
ll height[200005];


struct bla{
        int k = INF; ll b;
        int left = INF, right = INF;
};

int tot = 1;
bla tree[N*2];

lb cross(lb k1, lb b1, lb k2, lb b2){
        return (b2 - b1) / (k1 - k2);
}

ll point(ll x, ll k, ll b){
        return x*k + b;
}

void upd(int node, int l, int r, ll new_k, ll new_b){
        //cout << node << " " << l << " " << r << " " << tree[node].left << " " << tree[node].right << endl;

        if(tree[node].k == INF){
                tree[node].k = new_k;
                tree[node].b = new_b;
                return ;
        }

        if(l == r){
                lb y = point(l,tree[node].k,tree[node].b);
                lb y1 = point(l,new_k,new_b);
                if(y > y1){
                        tree[node].k = new_k;
                        tree[node].b = new_b;
                }
                return ;
        }


        ll old_k = tree[node].k; ll old_b = tree[node].b;

        lb cross_point = cross(new_k, new_b, old_k, old_b);

        if(lb < l){
                return ;
        }

        if(lb > r){
                tree[node].k = new_k;
                tree[node].b = new_b;
                return ;
        }

        int mid = ((l + r) >> 1);

        if(tree[node].left == INF){
                tree[node].left = ++tot;
                tree[node].right = ++tot;
        }

        if(mid >= cross_point){
                tree[tree[node].right].k = old_k;
                tree[tree[node].right].b = old_b;
                upd(tree[node].left, l, mid, new_k, new_b);
        } else {
                tree[tree[node].left].k = new_k;
                tree[tree[node].left].b = new_b;
                upd(tree[node].right, mid + 1, r, new_k, new_b);
        }
}


ll get(int node, int l, int r, ll x){

        //cout << node << " " << l << " " << r <<" "<< x << endl;
        if(tree[node].left == INF){
                return point(x,tree[node].k,tree[node].b);
        }

        int mid = ((l+r) >> 1);

        ll y = point(x,tree[node].k,tree[node].b);

        if(mid >= x){
                ll y1 = get(tree[node].left, l, mid, x);
                //cout << y << " " << y1 << endl;
                return min(y, y1);
        } else {
                ll y1 = get(tree[node].right, mid+1, r, x);
                //cout << y << " " << y1 << endl;
                return min(y, y1);
        }
}

int main(){

        ios::sync_with_stdio(0);

        cin >> n >> C;

        for(int i = 1 ; i <= n; i++){
                cin >> height[i];
        }

        upd(1, 1, N, -2*height[1], height[1]*height[1]);

        for(int i = 2; i <= n; i++){
                ll answer = get(1, 1, N, height[i]);

                //cout <<"answer : " << answer << endl;
                //cout << height[i]*height[i] << endl;
                answer += height[i]*height[i] + C;
                if(i == n) {

                        cout << answer << endl;
                        return 0;
                }

                //cout << "update ------------------" << endl;

                upd(1, 1, N, -2*height[i], height[i]*height[i] + answer);

                //cout << endl;
        }




}



Compiler output:
a.cc: In function 'void upd(int, int, int, ll, ll)':
a.cc:61:12: error: 'lb' {aka 'long double'} is not a template
   61 |         if(lb < l){
      |            ^~
a.cc:61:18: error: expected primary-expression before ')' token
   61 |         if(lb < l){
      |                  ^
a.cc:65:15: error: expected unqualified-id before '>' token
   65 |         if(lb > r){
      |               ^