Language: C++

#include <bits/stdc++.h>
using namespace std;
const ll is_query = -(1LL<<62);
struct Line {
    ll m, b;
    mutable function<const Line*()> succ;
    bool operator<(const Line& rhs) const {
        if (rhs.b != is_query) return m < rhs.m;
        const Line* s = succ();
        if (!s) return 0;
        ll x = rhs.m;
        return b - s->b < (s->m - m) * x;
    }
};
struct HullDynamic : public multiset<Line> { // will maintain upper hull for maximum
    bool bad(iterator y) {
        auto z = next(y);
        if (y == begin()) {
            if (z == end()) return 0;
            return y->m == z->m && y->b <= z->b;
        }
        auto x = prev(y);
        if (z == end()) return y->m == x->m && y->b <= x->b;
        return (long double)(x->b - y->b)*(z->m - y->m) >= (long double)(y->b - z->b)*(y->m - x->m);
    }
    void insert_line(ll m, ll b) {
        auto y = insert({ m, b });
        y->succ = [=] { return next(y) == end() ? 0 : &*next(y); };
        if (bad(y)) { erase(y); return; }
        while (next(y) != end() && bad(next(y))) erase(next(y));
        while (y != begin() && bad(prev(y))) erase(prev(y));
    }
    ll eval(ll x) {
        auto l = *lower_bound((Line) { x, is_query });
        return l.m * x + l.b;
    }
};
int main(){
  int n; long long c; cin >> n >> c;
  vector<long long> h(n); for(auto & i : h) cin >> i;
  vector<long long> f(n);
  HullDynamic magic;
  magic.insert(- 2 * h[n - 1], h[n - 1] * h[n - 1] + c);
  for(int i = n - 2; i >= 0; i--){
    long long best = magic.eval(h[i]);
    f[i] = best + h[i] * h[i];
    magic.insert(- 2 * h[i], h[i] * h[i] + c + f[i]);
  }
  cout << f[0] << endl;
  return 0;
}

Compiler output:
a.cc:3:7: error: 'll' does not name a type
    3 | const ll is_query = -(1LL<<62);
      |       ^~
a.cc:5:5: error: 'll' does not name a type
    5 |     ll m, b;
      |     ^~
a.cc: In member function 'bool Line::operator<(const Line&) const':
a.cc:8:17: error: 'const struct Line' has no member named 'b'
    8 |         if (rhs.b != is_query) return m < rhs.m;
      |                 ^
a.cc:8:22: error: 'is_query' was not declared in this scope
    8 |         if (rhs.b != is_query) return m < rhs.m;
      |                      ^~~~~~~~
a.cc:8:39: error: 'm' was not declared in this scope; did you mean 'tm'?
    8 |         if (rhs.b != is_query) return m < rhs.m;
      |                                       ^
      |                                       tm
a.cc:8:47: error: 'const struct Line' has no member named 'm'
    8 |         if (rhs.b != is_query) return m < rhs.m;
      |                                               ^
a.cc:11:9: error: 'll' was not declared in this scope
   11 |         ll x = rhs.m;
      |         ^~
a.cc:12:16: error: 'b' was not declared in this scope
   12 |         return b - s->b < (s->m - m) * x;
      |                ^
a.cc:12:23: error: 'const struct Line' has no member named 'b'
   12 |         return b - s->b < (s->m - m) * x;
      |                       ^
a.cc:12:31: error: 'const struct Line' has no member named 'm'
   12 |         return b - s->b < (s->m - m) * x;
      |                               ^
a.cc:12:35: error: 'm' was not declared in this scope; did you mean 'tm'?
   12 |         return b - s->b < (s->m - m) * x;
      |                                   ^
      |                                   tm
a.cc:12:40: error: 'x' was not declared in this scope
   12 |         return b - s->b < (s->m - m) * x;
      |                                        ^
a.cc: At global scope:
a.cc:26:22: error: 'll' has not been declared
   26 |     void insert_line(ll m, ll b) {
      |                      ^~
a.cc:26:28: error: 'll' has not been declared
   26 |     void insert_line(ll m, ll b) {
      |                            ^~
a.cc:33:5: error: 'll' does not name a type
   33 |     ll eval(ll x) {
      |     ^~
a.cc: In member function 'bool HullDynamic::bad(std::multiset<Line>::iterator)':
a.cc:20:23: error: 'const struct Line' has no member named 'm'
   20 |             return y->m == z->m && y->b <= z->b;
      |                       ^
a.cc:20:31: error: 'const struct Line' has no member named 'm'
   20 |             return y->m == z->m && y->b <= z->b;
      |                               ^
a.cc:20:39: error: 'const struct Line' has no member named 'b'
   20 |             return y->m == z->m && y->b <= z->b;
      |                                       ^
a.cc:20:47: error: 'const struct Line' has no member named 'b'
   20 |             return y->m == z->m && y->b <= z->b;
      |                                               ^
a.cc:23:35: error: 'const struct Line' has no member named 'm'
   23 |         if (z == end()) return y->m == x->m && y->b <= x->b;
      |                                   ^
a.cc:23:43: error: 'const struct Line' has no member named 'm'
   23 |         if (z == end()) return y->m == x->m && y->b <= x->b;
      |                                           ^
a.cc:23:51: error: 'const struct Line' has no member named 'b'
   23 |         if (z == end()) return y->m == x->m && y->b <= x->b;
      |                                                   ^
a.cc:23:59: error: 'const struct Line' has no member named 'b'
   23 |         if (z == end()) return y->m == x->m && y->b <= x->b;
      |                                                           ^
a.cc:24:33: error: 'const struct Line' has no member named 'b'
   24 |         return (long double)(x->b - y->b)*(z->m - y->m) >= (long double)(y->b - z->b)*(y->m - x->m);
      |                                 ^
a.cc:24:40: error: 'const struct Line' has no member named 'b'
   24 |         return (long double)(x->b - y->b)*(z->m - y->m) >= (long double)(y->b - z->b)*(y->m - x->m);
      |                                        ^
a.cc:24:47: error: 'const struct Line' has no member named 'm'
   24 |         return (long double)(x->b - y->b)*(z->m - y->m) >= (long double)(y->b - z->b)*(y->m - x->m);
      |                                               ^
a.cc:24:54: error: 'const struct Line' has no member named 'm'
   24 |         return (long double)(x->b - y->b)*(z->m - y->m) >= (long double)(y->b - z->b)*(y->m - x->m);
      |                                                      ^
a.cc:24:77: error: 'const struct Line' has no member named 'b'
   24 |         return (long double)(x->b - y->b)*(z->m - y->m) >= (long double)(y->b - z->b)*(y->m - x->m);
      |                                                                             ^
a.cc:24:84: error: 'const struct Line' has no member named 'b'
   24 |         return (long double)(x->b - y->b)*(z->m - y->m) >= (long double)(y->b - z->b)*(y->m - x->m);
      |                                                                                    ^
a.cc:24:91: error: 'const struct Line' has no member named 'm'
   24 |         return (long double)(x->b - y->b)*(z->m - y->m) >= (long double)(y->b - z->b)*(y->m - x->m);
      |                                                                                           ^
a.cc:24:98: error: 'const struct Line' has no member named 'm'
   24 |         return (long double)(x->b - y->b)*(z->m - y->m) >= (long double)(y->b - z->b)*(y->m - x->m);
      |                                                                                                  ^
a.cc: In member function 'void HullDynamic::insert_line(int, int)':
a.cc:27:24: error: no matching function for call to 'HullDynamic::insert(<brace-enclosed initializer list>)'
   27 |         auto y = insert({ m, b });
      |                  ~~~~~~^~~~~~~~~~
In file included from /usr/include/c++/14/set:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:158,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_multiset.h:553:9: note: candidate: 'template<class _InputIterator> void std::multiset<_Key, _Compare, _Alloc>::insert(_InputIterator, _InputIterator) [with _Key = Line; _Compare = std::less<Line>; _Alloc = std::allocator<Line>]'
  553 |         insert(_InputIterator __first, _InputIterator __last)
      |         ^~~~~~
/usr/include/c++/14/bits/stl_multiset.h:553:9: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_multiset.h:504:7: note: candidate: 'std::multiset<_Key, _Compare, _Alloc>::iterator std::multiset<_Key, _Compare, _Alloc>::insert(const value_type&) [with _Key = Line; _Compare = std::less<Line>; _Alloc = std::allocator<Line>; iterator = std::_Rb_tree<Line, Line, std::_Identity<Line>, std::less<Line>, std::allocator<Line> >::const_iterator; value_type = Line]'
  504 |       insert(const value_type& __x)
      |       ^~~~~~
/usr/include/c++/14/bits/stl_multiset.h:504:32: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const std::multiset<Line>::value_type&' {aka 'const Line&'}
  504 |       insert(const value_type& __x)
      |              ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_multiset.h:509:7: note: candidate: 'std::multiset<_Key, _Compare, _Alloc>::iterator std::multiset<_Key, _Compare, _Alloc>::insert(value_type&&) [with _Key = Line; _Compare = std::less<Line>; _Alloc = std::allocator<Line>; iterator = std::_Rb_tree<Line, Line, std::_Identity<Line>, std::less<Line>, std::allocator<Line> >::const_iterator; value_type = Line]'
  509 |       insert(value_type&& __x)
      |       ^~~~~~
/usr/include/c++/14/bits/stl_multiset.h:509:27: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::multiset<Line>::value_type&&' {aka 'Line&&'}
  509 |       insert(value_type&& __x)
      |              ~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_multiset.h:534:7: note: candidate: 'std::multiset<_Key, _Compare, _Alloc>::iterator std::multiset<_Key, _Compare, _Alloc>::insert(const_iterator, const value_type&) [with _Key = Line; _Compare = std::less<Line>; _Alloc = std::allocator<Line>; iterator = std::_Rb_tree<Line, Line, std::_Identity<Line>, std::less<Line>, std::allocator<Line> >::const_iterator; const_iterator = std::_Rb_tree<Line, Line, std::_Identity<Line>, std::less<Line>, std::allocator<Line> >::const_iterator; value_type = Line]'
  534 |       insert(const_iterator __position, const value_type& __x)
      |       ^~~~~~
/usr/include/c++/14/bits/stl_multiset.h:534:7: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_multiset.h:539:7: note: candidate: 'std::multiset<_Key, _Compare, _Alloc>::iterator std::multiset<_Key, _Compare, _Alloc>::insert(const_iterator, value_type&&) [with _Key = Line; _Compare = std::less<Line>; _Alloc = std::allocator<Line>; iterator = std::_Rb_tree<Line, Line, std::_Identity<Line>, std::less<Line>, std::allocator<Line> >::const_iterator; const_iterator = std::_Rb_tree<Line, Line, std::_Identity<Line>, std::less<Line>, std::allocator<Line> >::const_iterator; value_type = Line]'
  539 |       insert(const_iterator __position, value_type&& __x)
      |       ^~~~~~
/usr/include/c++/14/bits/stl_multiset.h:539:7: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_multiset.h:565:7: note: candidate: 'void std::multiset<_Key, _Compare, _Alloc>::insert(std::initializer_list<_Tp>) [with _Key = Line; _Compare = std::less<Line>; _Alloc = std::allocator<Line>]'
  565 |       insert(initializer_list<value_type> __l)
      |       ^~~~~~
/usr/include/c++/14/bits/stl_multiset.h:565:43: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::initializer_list<Line>'
  565 |       insert(initializer_list<value_type> __l)
      |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_multiset.h:585:7: note: candidate: 'std::multiset<_Key, _Compare, _Alloc>::iterator std::multiset<_Key, _Compare, _Alloc>::insert(node_type&&) [with _Key = Line; _Compare = std::less<Line>; _Alloc = std::allocator<Line>; iterator