Language: C++

#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define SORT(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define EQ(a,b) (abs((a)-(b))<eps)
#define MOD 1000000007ll
ll dp[2050][2050];
int N,X;
ll D;
ll mod_pow(ll a,int x)
{
	ll res =1ll;
	if(x==0)return res;
	while(x>0)
	{
		if(x&1)res = (res*a)%MOD;
		a = (a*a)%MOD;
		x >>= 1;
	}
	return res;
}
int main()
{
	while(1)
	{
		cin >> N >> D >> X;
		if(N==0&&D==0&&X==0)break;
		memset(dp,0,sizeof(dp));
		dp[0][0]=1;
		for(int i=0;i<N;i++)
		{
			for(int j=0;j<N;j++)
			{
				dp[i+1][j+1]=(dp[i][j]+dp[i+1][j])%MOD;
				if(j-X+1>=0)dp[i+1][j+1]+=(dp[i+1][j+1]-dp[i][j-X+1]+MOD)%MOD;
			}
		}
		ll ans = 0ll;
		ll C = D%MOD;
		for(int i=1;i<=min(D,N);i++)
		{
			ans = (ans+C*dp[i][N])%MOD;
			C = (C*(D-i))%MOD;
			C = (C*mod_pow(i+1,MOD-2))%MOD;
		}
		cout << ans << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:67:35: error: no matching function for call to 'min(ll&, int&)'
   67 |                 for(int i=1;i<=min(D,N);i++)
      |                                ~~~^~~~~
In file included from /usr/include/c++/14/bits/specfun.h:43,
                 from /usr/include/c++/14/cmath:3906,
                 from a.cc:4:
/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:67:35: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   67 |                 for(int i=1;i<=min(D,N);i++)
      |                                ~~~^~~~~
/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:8:
/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:67:35: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   67 |                 for(int i=1;i<=min(D,N);i++)
      |                                ~~~^~~~~