stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#include<iostream>

#include<climits>

using namespace std;



int main()

{

    //put here bitch 

    int n,k; cin>>n>>k;

    int h[1000001];

    for(int i=0;i<n;i++) cin>>h[i];

    int dp[1000001];

    dp[0]=0;

    for(int i=1;i<n;i++)

    {

        dp[i]=INT_MAX;

        for(int j=1;j<=k and i-j>=0;j++)

            dp[i]=min(dp[i],abs(h[i]-h[i-j])+dp[i-j]);

    }

    cout<<dp[n-1]<<endl;

}

// Faster C++ solution for the same problem (measured speedup: 1.165979607143867x):
#include <bits/stdc++.h>

using namespace std;

typedef int int__;

#define int long long

#define pb push_back

#define pi pair<int,int>

#define vpi vector<pi>

#define vi vector<int>

#define vvi vector<vi>

#define all(x) x.begin(), x.end()

#define fi first

#define se second

#define forn(i, n) for(int i = 0; i < int__(n); i++) 

#define sz(a) int__(a.size())

template<class A>ostream& operator<<(ostream& out,const vector<A>&v){out<<"[";forn(i,sz(v)){if(i)out<<", ";out<<v[i];}return out<<"]";}

const int MAX = 1e9 + 7;

#define fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)

int Mod(int x){const int mm=998244353;x%=mm;if(x<0)x+=mm;return x;}

int Pow(int x,int n){if(n==0)return 1;int t=Pow(x,n/2);t=Mod(t*t);if(n&1)t=Mod(t*x);return t;}

#define watch(x) cout << #x << " : " << x << endl;

int gcd(int x,int y){return y!=0 ? gcd(y,x%y) : x;}

 

int__ main() {

	fast;

	int n,k; cin >> n >> k;

	vi h(n);

	for(int i=0;i<n;i++) cin >> h[i];

	vi dp(n+k+1,1e12);

	dp[0] = 0;



	for(int i=0;i < n;i++) {

		for(int j=1;j<=k;j++) {

			dp[i+j] = min(dp[i+j], abs(h[i] - h[i+j]) + dp[i]);

		}

	}

	//watch(dp);

	cout << dp[n-1] << endl;

}
// Slower C++ solution:
#include <iostream>

#include<string.h>

using namespace std;

int main() {

    long int K;

    cin >> K;

    string S;

    cin >> S;

    if (K>=S.size()){

        cout << S << endl;

    }

    else{

            for (int i=0; i<K; i++){

                cout << S[i];

            }

        cout << "..." << endl;

    }

}

// Faster C++ solution for the same problem (measured speedup: 5.295827831654501x):
#include<stdio.h>



int main(){

	int k, len = 0;

	char str[100];

	scanf("%d %s", &k, str);

	for(int i = 0; str[i] != '\0'; i++){

		len++;

	}

	if(len <= k){

		printf("%s\n", str);

	}

	else{

		for(int i = k; i <= k + 3; i++){

			if(i < k + 3){

				str[i] = '.';

			}

			else{

				str[i] = '\0';

			}

		}

		printf("%s\n", str);

	}

	return 0;

}
// Slower C++ solution:
#include<iostream>

#include<string>

#include<algorithm>

#include<vector>

#include<cmath>



using namespace std;



// 無限大の値

const long long INF = 1LL << 60;

// DP テーブル

long long dp[100010];



template<class T> inline bool chmin(T& a, T b) {

    if (a > b) {

        a = b;

        return true;

    }

    return false;

}



int main() {

    // DP テーブル全体を初期化

    for (int i = 0; i < 100010; ++i) dp[i] = INF;



    int N, K;

    cin >> N >> K;

    vector<int> h(N);

    for (int i = 0; i < N; ++i) {

        cin >> h[i];

    }

    dp[0] = 0;

    for (int i = 1; i < N; ++i) {

        for (int k = 1; k <= K; ++k) {

            if (i-k < 0) break;

            chmin(dp[i], dp[i-k]+abs(h[i]-h[i-k]));

        }

    }

    cout << dp[N-1] << endl;

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 1.7947025697719083x):
#include <algorithm>

#include <iostream>

#include <vector>



using namespace std;

using ll = long long;



int main() {

  int N, K;

  cin >> N >> K;

  vector<int> h(N);

  for (int i = 0; i < N; ++i) {

    cin >> h[i];

  }

  vector<int> dp(N);

  dp[0] = 0;

  dp[1] = abs(h[1] - h[0]);

  for (int i = 2; i < N; ++i) {

    int candi = dp[i - 1] + abs(h[i] - h[i - 1]);

    for (int j = 2; j <= K; ++j) {

      if (i - j < 0) break;

      candi = min(candi, dp[i - j] + abs(h[i] - h[i - j]));

    }

    dp[i] = candi;

  }

  cout << dp[N - 1] << endl;

  return 0;

}
// Slower C++ solution:
#include <iostream>

#include <vector>

using namespace std;

int n;

int k;

vector<int> h(100000);

vector<int> cost(100000);



int ans(int n, int k)

{

    if (cost.at(n) != -1)

        return cost.at(n);

    cost.at(n) = ans(n - 1, k) + abs(h.at(n) - h.at(n - 1));



    for (int i = 2; i <= k; i++)

    {

        cost.at(n) = min(cost.at(n), ans(n - i, k) + abs(h.at(n) - h.at(n - i)));

    }



    return cost.at(n);

}



void init(int k)

{

    cost.at(0) = 0;

    for (int i = 1; i < k; i++)

    {

        cost.at(i) = cost.at(i - 1) + abs(h.at(i) - h.at(i - 1));

        for (int j = 2; j <= i; j++)

        {

            cost.at(i) = min(cost.at(i), cost.at(i - j) + abs(h.at(i) - h.at(i - j)));

        }

    }

}



int main()

{

    cin >> n;

    cin >> k;

    for (int i = 0; i < n; i++)

    {

        cin >> h.at(i);

        cost.at(i) = -1;

    }

    init(k);

    cout << ans(n - 1, k) << endl;

}

// Faster C++ solution for the same problem (measured speedup: 1.7934341918179548x):
#include <bits/stdc++.h>

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)

typedef long long int ll;

int main()

{

    int n, k;

    cin >> n >> k;

    vector<int> h(n);

    vector<ll> dp(n + 200, 1e15);

    rep(i, n)

    {

        cin >> h[i];

    }

    dp[0] = 0;

    rep(i, n)

    {

        for (int j = 1; j <= k; j++)

        {

            dp[i + j] = min(dp[i + j], dp[i] + abs(h[i + j] - h[i]));

        }

    }

    cout << dp[n - 1] << endl;

}
// Slower C++ solution:
#include <iostream>

#include<vector>

using namespace std;

int main() {

  int n, k,soma=0;

  cin>>n>>k;

  int V[n];

  vector<int>custo;

  for(int i=0;i<n;i++){

    cin>>V[i];

  }

custo.push_back(0);

for(int i=1;i<n;i++){

  int min = custo[i-1] + abs(V[i-1]-V[i]);

  //cout<<"Esse e o minimo: "<<min<<endl;

  for(int j=i-1;j>=i-k&&j>=0;j--){

    if(custo[j]+abs(V[j]-V[i])<min){

        min=custo[j]+abs(V[j]-V[i]);

        //cout<<"Esse e o novo minimo: "<<min<<endl;

      }

    }

    custo.push_back(min);

  }

  //for(int i=0;i<custo.size();i++)cout<<custo[i]<<" ";

  //cout<<endl;

  cout<<custo[custo.size()-1]<<endl;

}

// Faster C++ solution for the same problem (measured speedup: 1.697816632753814x):
#include <cstdio>

#include <cstring>

#include <algorithm>

#include <cmath>

using namespace std;

int n,k,a[100005],f[100005];

int main()

{

	scanf("%d%d",&n,&k);

	for(int i=1;i<=n;++i)

		scanf("%d",a+i);

	memset(f,0x3f,sizeof(f));

	f[1]=0;

	for(int i=2;i<=n;++i)

		for(int j=max(i-k,1);j<i;++j)

			f[i]=min(f[i],f[j]+abs(a[i]-a[j]));

	printf("%d\n",f[n]);

	return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

#define _GLIBCXX_DEBUG

#define rep(i,n) for(long long i = 0; i < (n); ++i)

#define ll long long

#define P pair<ll,ll>

#define all(v) (v).begin(),(v).end()



const ll mod = 1e9+7;

const ll INF = 1e18;

const double pi = acos(-1.0);



int main(void)

{

    ll n, m, cnt=0;

    cin >> n >> m;

    vector<ll> a(200000,0);

    rep(i,m){

        ll l, r;

        cin >> l >> r;

        a[--l]++;

        a[r]--;

    }

    rep(i,200000) a[i+1] += a[i];

    rep(i,200000) if(a[i]>=m) cnt++;

    cout << cnt << endl;

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.4119329180263507x):
#include <bits/stdc++.h>

using namespace std;

#define _GLIBCXX_DEBUG

#define rep(i,n) for(long long i = 0; i < (n); ++i)

#define ll long long

#define P pair<ll,ll>

#define all(v) (v).begin(),(v).end()



const ll mod = 1e9+7;

const ll INF = 1e18;

const double pi = acos(-1.0);



int main(void)

{

    ll n, m, l=0, r=INF;

    cin >> n >> m;

    vector<ll> a(200000,0);

    rep(i,m){

        ll a, b;

        cin >> a >> b;

        l = max(l, a);

        r = min(r, b);

    }

    cout << max(0LL, r-l+1) << endl;

    return 0;

}
// Slower C++ solution:
#include <iostream>

#include <vector>

#include <cmath>

#include <algorithm>

#include <iomanip>

#include <cstring>

#define rep(i, N) for (int i = 0; i < (int)N; i++)

using namespace std;

typedef long long ll;

const ll INF = 9223372036854775807/2;

const int MOD = 1000000007;

const int N_MAX = pow(10,5);



int main() {

  int N, K; cin >> N >> K;

  int h[N]; rep(i, N) cin >> h[i];

  ll dp[N_MAX]; fill_n(dp, N_MAX, INF); dp[0] = 0;

  for (int i=1; i<=N; i++) for(int j=1; j<=K; j++) {

    if (i>=j) dp[i] = min(dp[i], dp[i-j]+abs(h[i]-h[i-j]));

  }

  // rep(i, N) cout << dp[i] << endl;

  cout << dp[N-1] << endl;

  return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.8032597129846861x):
#include <bits/stdc++.h>



using namespace std;

typedef long long ll;

typedef pair<ll, ll> p_ll;



template<class T>

void debug(T itr1, T itr2) { auto now = itr1; while(now<itr2) { cout << *now << " "; now++; } cout << endl; }

#define repr(i,from,to) for (int i=(int)from; i<(int)to; i++)

#define all(vec) vec.begin(), vec.end()

#define rep(i,N) repr(i,0,N)

#define per(i,N) for (int i=(int)N-1; i>=0; i--)



const ll MOD = pow(10,9)+7;

const ll LLINF = pow(2,61)-1;

const int INF = pow(2,30)-1;



vector<ll> fac;

void c_fac(int x=pow(10,6)+10) { fac.resize(x,true); rep(i,x) fac[i] = i ? (fac[i-1]*i)%MOD : 1; }

ll inv(ll a, ll m=MOD) { ll b = m, x = 1, y = 0; while (b!=0) { int d = a/b; a -= b*d; swap(a,b); x -= y*d; swap(x,y); } return (x+m)%m; }

ll nck(ll n, ll k) { return fac[n]*inv(fac[k]*fac[n-k]%MOD)%MOD; }

ll gcd(ll a, ll b) { if (a<b) swap(a,b); return b==0 ? a : gcd(b, a%b); }

ll lcm(ll a, ll b) { return a/gcd(a,b)*b; }





int main() {

  int N, K; cin >> N >> K;

  int h[N]; rep(i,N) cin >> h[i];

  int result[N] = {};

  repr(i,1,N) {

    result[i] = INF;

    repr(j,1,min(i+1,K+1)) result[i] = min(result[i], result[i-j]+abs(h[i]-h[i-j]));

  }

  // debug(result,result+N);

  cout << result[N-1] << endl;

  return 0;

}
// Slower C++ solution:
#include <stdio.h>

#include <math.h>

#include <string.h>

#include <algorithm>

#include <iostream>

#include <string>

#include <time.h>

#include <queue>

#include <string.h>

#define sf scanf

#define pf printf

#define lf double

#define ll long long

#define p123 printf("123\n");

#define pn printf("\n");

#define pk printf(" ");

#define p(n) printf("%d",n);

#define pln(n) printf("%d\n",n);

#define s(n) scanf("%d",&n);

#define ss(n) scanf("%s",n);

#define ps(n) printf("%s",n);

#define sld(n) scanf("%lld",&n);

#define pld(n) printf("%lld",n);

#define slf(n) scanf("%lf",&n);

#define plf(n) printf("%lf",n);

#define sc(n) scanf("%c",&n);

#define pc(n) printf("%c",n);

#define gc getchar();

#define re(n,a) memset(n,a,sizeof(n));

#define len(a) strlen(a)

#define LL long long

#define eps 1e-6

using namespace std;





int main(){

	char a[1000];

	char b[1000];

	ss(a);

	int count0 = 0;

	int lena = len(a);

	for(int i = 0; i < lena; i ++){

		if(a[i] == '1' || a[i] == '0'){

			b[count0++] = a[i];

		}else if(a[i] == 'B'){

			if(count0 != 0){

				count0 --;

			} 

		}

		 

	}

	b[count0] = '\0';

	ps(b) pn

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.230020749989005x):
#include<stdio.h>

#include<string.h>



int main(){

	char str[15];

	scanf("%s",&str);

	char temp[15];

	int index=0,len=strlen(str);

	for(int i=0;str[i] != '\0';i++){

		if(str[i]=='0'){

			temp[index] = '0';

			//printf("index[%d] : %s\n",index,temp);

			index++;

		} 

		else if(str[i]=='1'){	

			temp[index] = '1';

			//printf("index[%d] : %s\n",index,temp);

			index++;

		} 				//01B0 temp =     --0

		else if(str[i]=='B'){

			//printf("index[%d] : %s\n",index,temp);

			if(index != 0) index--;

		}

	}

	//printf("%d\n",index);

	temp[index]='\0';

	printf("%s\n",&temp);

	

	

	

	return 0;

}
// Slower C++ solution:
#define _CRT_SECURE_NO_WARNINGS

#include<bits/stdc++.h>

#define rep(i,a,n) for (int i=a;i<n;i++)

#define per(i,a,n) for (int i=n-1;i>=a;i--)

#define all(s) s.begin(),s.end()

#define sz(s) (int)s.size()

#define clr(v, d) memset(v, d, sizeof(v))

#define fi first

#define se second

#define pp push_back

#define pb pop_back

#define pi 3.141592654

#define MOD 1000000007 

#define cons1 1e12

#define cons2 1e6

using namespace std;

typedef long long ll;

typedef vector<int> vi;

typedef pair<int, int> pa;

typedef unsigned long long int ull;

typedef double long dl;

const int N = 1e5+9,oo=1e9;

int n,k;

int v[N], ans[N];

int sol(int i) {

	if (ans[i] == -1) {

		if (i == n - 1)

			ans[i] = 0;

		else {

			int x =1+ min(k, n - i - 1);

			int mx = oo;

			while (--x)

				mx = min(mx, abs(v[i] - v[i + x])+sol(i + x));

			

			ans[i] = mx;

		}



	}

	return ans[i];



}

void solve() {

	clr(ans, -1);

	cin >> n >> k;

	rep(i, 0, n)

		cin >> v[i];

	cout << sol(0) << endl;

	

}

int main() {

	ios::sync_with_stdio(0);

	cin.tie(NULL);

	cout.tie(NULL);

	int t = 1;

	//cin >> t;

	while (t--)

		solve();



#ifndef ONLINE_JUDGE

	- system("pause");

#endif



}

// Faster C++ solution for the same problem (measured speedup: 1.4041443908594253x):
#include <bits/stdc++.h>

 

using namespace std;

 

#define mp make_pair

#define fi first

#define se second

#define pb push_back

typedef long long ll ;

typedef long double ld ;

typedef pair<ll, ll> pairs;

 

 

ll h[100009] ;

ll v[100009] ;

 

int main()

{

   //        freopen("milkorder.out", "w", stdout) ;

     //   freopen("milkorder.in", "r", stdin) ;

    ios_base::sync_with_stdio(0);

    cin.tie(NULL);

    cout.tie(NULL);

 

    ll n , k ; cin >> n >> k ;

    for ( ll i = 0 ; i < n ; i++ ) cin >> h[i] ;

    for ( ll i = 1 ; i < min( n , k ) ; i++ ) v[i] = abs( h[i] - h[0] ) ;

    for ( ll i = k ; i < n  ; i++ ){ v[i] = 1000000009 ;

        for ( ll j = i - k; j < i ; j++ ){

            v[i] = min( v[i] , ( v[j] + abs( h[i] - h[j] ) ) ) ;

            //cout << x << " " << y << " " << v[x] <<  "\n\n" ;

        }

    }  cout << v[n-1] ;

}
// Slower C++ solution:
# include <bits/stdc++.h>

# define ll long long

# define fi first

# define se second



using namespace std ;



ll n, x, k;

ll ans[200001], vc[200001];



int main() {

    cin >> n >> k;

    for( int i = 0 ; i < n ; i ++ ) {

        cin >> vc[i] ;

    }

    for( int i = 1 ; i < n ; i ++ ) {

        ans[i] = abs(vc[i] - vc[i-1]) + ans[i-1];

        for( int j = 2 ; j <= k ; j ++ ) {

            if( j <= i ) ans[i] = min(ans[i], abs(vc[i]-vc[i-j]) + ans[i-j]) ;

        }

    }

    cout << ans[n-1] << endl;

}


// Faster C++ solution for the same problem (measured speedup: 5.212098127372802x):
#include<stdio.h>

#include<stdlib.h>

#include<math.h>





typedef long long ll;





ll *mem, *inp, dist, min_dist, N;

int k;



int main()

{

    ll i, j;

    scanf("%lld%d", &N, &k);



    mem =(ll*) malloc(N * sizeof(ll));

    inp =(ll*) malloc(N * sizeof(ll));



    for(i = 0; i<N; ++i){

        scanf("%lld", inp+i);

    }



    *(mem+N-2) = llabs(*(inp+N-2) - *(inp+N-1));



    for(i = 3; i<=k+1 && i<=N; ++i)

        *(mem+N-i) = llabs(*(inp+N-i) - *(inp+N-1));



    for(i = N-(k+2); i>=0; --i){



        min_dist = llabs(*(inp+i) - *(inp+i+1)) + *(mem+i+1);

        for(j = 2; j<=k && i+j<N; ++j){

            dist = llabs(*(inp+i) - *(inp+i+j)) + *(mem+i+j);

            if (dist < min_dist) min_dist = dist;

        }



        *(mem+i) = min_dist;

    }



    printf("%lld\n", *mem);



    return 0;

}
// Slower C++ solution:
//#include <bits/stdc++.h>

#include <cstdio>

#include <cmath>

#include <cstring>

#include <iostream>

#include <vector>

#include <map>

#include <set>

#include <queue>

#include <string>

#include <stack>

#include <fstream>

#include <iomanip>

#include <algorithm>

#include <functional>

//#include <unordered_set>

#define INF 2147483647

#define MAXN  1000100

#define PII pair<int, int>

#define mp(a,b) make_pair(a,b)

typedef long long ll;

typedef unsigned long long ull;

using namespace std;

const int maxn = 35;

ll a[MAXN];



int main()

{

	//ios::sync_with_stdio(false);

	cin.tie(0);

#ifdef local_debug

	ifstream inputs("input.txt");

	cin.rdbuf(inputs.rdbuf());

	freopen("input.txt", "r", stdin);

#endif

	int n, k;

	while (cin >> n >> k) {

		ll ans = 0;

		for (int i = k + 1; i <= n; i++) {

			int sz = n / i;

			ans += sz * (i - k);

			int j = n % i;

			if (j - k + 1 > 0)

				ans += j - k + 1;

		}

		if (k == 0)

			ans -= n;

		cout << ans << endl;

	}

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.109115172018862x):
#include<cstdio>

#include<algorithm>

using namespace std;

int N,K;

long long ans=0;

int main() {

	#ifdef LOACL

	freopen("in.txt","r",stdin);

	freopen("out.txt","w",stdout);

	#endif

	scanf("%d %d",&N,&K);

	if(K==0)ans=1ll*N*N;

	else {

		for(int b=K+1;b<=N;b++) {

			int x1=b-K;

			int x2=N/b;

			int k=N-x2*b;

			if(k>=K)ans+=k-K+1;

			ans+=x1*x2;

		}

	}

	printf("%lld\n",ans);

	return 0;

}
// Slower C++ solution:
#include <iostream>

#include <cmath>

#include <cstdio>

#include <cstdlib>

#include <algorithm>

using namespace std;

struct node{

    int x,y;

}no[10005];

struct edge{

    int from,to;

    double dis;

}ed[200000];

bool cmp(const edge &a,const edge &b){

    return a.dis>b.dis;

}

int father[10005];

int find(int who){

    if(who==father[who]) return who;

    else return father[who]=find(father[who]);

}

int main(void){

    int n,m;

    cin>>n>>m;

    for(int i=1;i<=n;i++){

        cin>>no[i].x>>no[i].y;

        father[i]=i;

    }

    double ans=0;

    for(int i=1;i<=m;i++){

        int a,b;

        cin>>a>>b;

        ed[i].from=a;

        ed[i].to=b;

        ed[i].dis= pow(pow(no[a].x-no[b].x,2)+pow(no[a].y-no[b].y,2),0.5);

        ans+=ed[i].dis;

    }

    //cout<<ans<<endl;

    sort(ed+1,ed+1+m,cmp);

    for(int i=1;i<=m;i++){

        int x=find(ed[i].from);

        int y=find(ed[i].to);

        if(x!=y){

            if(x<y)

                father[x]=father[y];

            else

                father[y]=father[x];

            ans-=ed[i].dis;

            //cout<<ed[i].dis<<":  "<<ed[i].from<<"---"<<ed[i].to<<endl;

            //for(int j=1;j<=n;j++)

            //    cout<<father[j]<<" ";

            //cout<<endl;

        }

    }

    printf("%.3lf",ans);

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 4.63438098500584x):
#include <cstdio>

#include <cstring>

#include <cmath>

#include <algorithm>

using namespace std;



struct node

{

    int x,y,id;

};

struct edge

{

    int u,v;

    double cost;

    edge() {}

    edge(int x,int y,double z)

    {

        u=x;

        v=y;

        cost=z;

    }

    bool operator <(const edge& a) const

    {

        return cost>a.cost;

    }

};



edge es[50010];

int par[10010];

node p[10010];

int n,m;

void init()

{

    for(int i=1;i<=n;i++) par[i]=i;

}



int find(int x)

{

    return x==par[x]?x:par[x]=find(par[x]);

}



void unite(int x,int y)

{

    x=find(x);

    y=find(y);

    if(x!=y) par[x]=y;

}



double dis(int a,int b)

{

    return sqrt(1.0*(p[a].x-p[b].x)*(p[a].x-p[b].x)+1.0*(p[a].y-p[b].y)*(p[a].y-p[b].y));

}



double kruskal()

{

    sort(es,es+m);

    //for(int i=0;i<m;i++) printf("%d %d %lf\n",es[i].u,es[i].v,es[i].cost);

    double s=0;

    for(int i=0;i<m;i++)

    {

        edge e=es[i];

        if(find(e.u)!=find(e.v))

        {

            unite(e.u,e.v);

        }

        else

        {

            s+=e.cost;

        }

    }

    return s;

}

int main()

{

    //freopen("a.txt","r",stdin);

    int a,b;

    double c,sum;

    while(~scanf("%d%d",&n,&m))

    {

        init();

        sum=0;

        for(int i=1;i<=n;i++)

        {

            scanf("%d%d",&p[i].x,&p[i].y);

        }

        for(int i=0;i<m;i++)

        {

            scanf("%d%d",&a,&b);

            c=dis(a,b);

            es[i]=edge(a,b,c);

        }

        printf("%.3lf\n",kruskal());

    }

    return 0;

}
// Slower C++ solution:
#pragma GCC optimaze("Ofast")

#include <bits/stdc++.h>

#define all(x) (x).begin(),(x).end()



using namespace std;



const int MSIZE = 16;



int g[MSIZE][MSIZE];

long long Precalc[1 << MSIZE];

vector<int> indexes[1 << MSIZE];

long long dp[1 << MSIZE];



int main() {

    ios_base::sync_with_stdio(false);

    cin.tie(nullptr);

    int n;

    cin >> n;

    for (int i = 0; i < n; i++) {

        for (int j = 0; j < n; j++) {

            cin >> g[i][j];

        }

    }

    for (int mask = 0; mask < (1 << n); mask++) {

        for (int i = 0; i < n; i++) {

            for (int j = i + 1; j < n; j++) {

                if ((mask >> i) & (mask >> j) & 1) {

                    Precalc[mask] += g[i][j];

                }

            }

        }

        for (int i = 0; i < n; i++) {

            if (((mask >> i) & 1) == 0) {

                indexes[mask].push_back(i);

            }

        }

    }



    vector<pair<int,int> > masks(1 << n);

    for (int mask = 0; mask < (1 << n); mask++) {

        masks[mask] = make_pair(__builtin_popcount(mask), mask);

    }

    sort(all(masks));



    for (int i = 0; i < (1 << n); i++) {

        int mask = masks[i].second;

        int sz = indexes[mask].size();

        for (int mask2 = 1; mask2 < (1 << sz); mask2++) {

            int curMask = 0;

            for (int i = 0; i < sz; i++) {

                if ((mask2 >> i) & 1) {

                    curMask |= (1 << indexes[mask][i]);

                }

            }

            dp[mask | curMask] = max(dp[mask] + Precalc[curMask], dp[mask | curMask]);

        }

    }

    cout << dp[(1 << n) - 1] << endl;

}


// Faster C++ solution for the same problem (measured speedup: 2.6585945498026784x):
#include <bits/stdc++.h>

#define all(x) (x).begin(),(x).end()



using namespace std;



const int MSIZE = 16;



int g[MSIZE][MSIZE];

long long Precalc[1 << MSIZE];

long long dp[1 << MSIZE];



int main() {

  ios_base::sync_with_stdio(false);

  cin.tie(nullptr);

  int n;

  cin >> n;

  for (int i = 0; i < n; i++) {

    for (int j = 0; j < n; j++) {

      cin >> g[i][j];

    }

  }

  for (int mask = 0; mask < (1 << n); mask++) {

    for (int i = 0; i < n; i++) {

      for (int j = i + 1; j < n && ((mask >> i) & 1); j++) {

        if ((mask >> j) & 1) {

          Precalc[mask] += g[i][j];

        }

      }

    }

  }

  for (int i = 1; i < (1 << n); i++) {

    int mask = i;

    for (int mask2 = mask; mask2 > 0; mask2 = (mask2 - 1) & mask) {

      dp[mask] = max(dp[mask ^ mask2] + Precalc[mask2], dp[mask]);

    }

  }

  cout << dp[(1 << n) - 1] << endl;

}
// Slower C++ solution:
#include<cstdio>

#include<iostream>

#include<cmath>

using namespace std;

const int MAXN = 100010;

const int INF = 0x3f3f3f3f;

int n, k, a[MAXN], f[MAXN];

int main()

{

	scanf("%d%d",&n,&k);

	for(int i=1;i<=n;i++)

		scanf("%d",&a[i]),f[i]=INF;

	f[1] = 0;

	for(int i=1;i<=n;i++)

	{

		for(int j=max(i-k,1);j<i;j++)

			f[i] = min(f[i], f[j]+abs(a[i]-a[j]));

	}

		

	printf("%d\n",f[n]);

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.190905020387024x):
#include<stdio.h>

#include<stdlib.h>

#include<math.h>





typedef long long ll;





ll *mem, *inp, dist, min_dist, N;

int k;



int main()

{

    ll i, j;

    scanf("%lld%d", &N, &k);



    mem =(ll*) malloc(N * sizeof(ll));

    inp =(ll*) malloc(N * sizeof(ll));



    for(i = 0; i<N; ++i){

        scanf("%lld", inp+i);

    }



    *(mem+N-2) = llabs(*(inp+N-2) - *(inp+N-1));



    for(i = 3; i<=k+1 && i<=N; ++i)

        *(mem+N-i) = llabs(*(inp+N-i) - *(inp+N-1));



    for(i = N-(k+2); i>=0; --i){



        min_dist = llabs(*(inp+i) - *(inp+i+1)) + *(mem+i+1);

        for(j = 2; j<=k && i+j<N; ++j){

            dist = llabs(*(inp+i) - *(inp+i+j)) + *(mem+i+j);

            if (dist < min_dist) min_dist = dist;

        }



        *(mem+i) = min_dist;

    }



    printf("%lld\n", *mem);



    return 0;

}