Language: C++

//******\\
||udc321||	 
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<queue>
#include<map>
#include<set>
#include<fstream>
#include<cstring>
#define ll long long
#define fr(e,r,v) for(int e=r;e<v;e++)
#define bc(e,r,v) for(int e=r;e>v;e--)
#define all(n) (n.begin(),n.end())
#define ft first
#define sd second
#define pb push_back
#define lb lower_bound
#define mpr make_pair
#define db  double
using namespace std;
ll mod=1000000007;
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());


int main()
{
	ll n,k;
	cin>>n>>k;
	ll h[n];
	fr(j,0,n)
	{
		cin>>h[j];
	}
	vector<ll> dp(n,mod);
	dp[0]=0;dp[1]=abs(h[1]-h[0]);
	fr(j,1,n)
	{
		fr(i,0,min(j-1,k))
		{
			dp[j]=min(dp[j],abs(h[j]-h[j-i-1])+dp[j-i-1]);
		}
	}
	cout<<dp[n-1]<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:41:27: error: no matching function for call to 'min(int, long long int&)'
   41 |                 fr(i,0,min(j-1,k))
      |                        ~~~^~~~~~~
a.cc:14:33: note: in definition of macro 'fr'
   14 | #define fr(e,r,v) for(int e=r;e<v;e++)
      |                                 ^
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:41:27: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   41 |                 fr(i,0,min(j-1,k))
      |                        ~~~^~~~~~~
a.cc:14:33: note: in definition of macro 'fr'
   14 | #define fr(e,r,v) for(int e=r;e<v;e++)
      |                                 ^
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:5:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:41:27: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   41 |                 fr(i,0,min(j-1,k))
      |                        ~~~^~~~~~~
a.cc:14:33: note: in definition of macro 'fr'
   14 | #define fr(e,r,v) for(int e=r;e<v;e++)
      |                                 ^