<commit_before><commit_msg>82.46 points<commit_after>#include <cmath>
#include <cstdio>
#include <vector>
#include <map>
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <fstream>
#include <limits.h>

#define DEBUG       0

using namespace std;

int main()
{
#if DEBUG
    ifstream inFile;
    inFile.open("input.txt");
#endif

    unsigned long long n, h;
#if DEBUG
    inFile >> n >> h;
#else
    cin >> n >> h;
#endif

    vector<unsigned long long> x(n);
    for (size_t i = 0; i < n; i++)
    {
#if DEBUG
        inFile >> x[i];
#else
        cin >> x[i];
#endif
    }

    if (0 == n || 0 == h)
    {
        cout << 0 << endl;
    }
    else
    {
        vector<int> lastFrom(n);
        vector<unsigned long long> cost(n);

        cost[0] = h;
        lastFrom[0] = 0;

        for (size_t i = 1; i < n; i++)
        {
            cost[i] = h + cost[i - 1];
            lastFrom[i] = i;

            if ((x[i] - x[i - 1]) * (x[i] - x[i - 1]) >= h)
            {
                continue;
            }
            else
            {
                for (int j = i - 1; j >= lastFrom[i - 1]; j--)
                {
                    unsigned long long tmp = h + (x[i] - x[j]) * (x[i] - x[j]);
                    if (0 < j)
                    {
                        tmp += cost[j - 1];
                    }

                    if (tmp < cost[i])
                    {
                        cost[i] = tmp;
                        lastFrom[i] = j;
                    }
                }
            }
        }

        cout << cost[n - 1] << endl;
    }

#if DEBUG
    inFile.close();
#endif

    return 0;
}
{'fraction_non_alphanumeric': 0.15352697095435686, 'fraction_numerical': 0.013040901007705987, 'mean_word_length': 1.147582697201018, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2095438', 'n_tokens_mistral': 605, 'n_tokens_neox': 565, 'n_words': 154}