Language: C++

#include<stdio.h>
#include<iostream>
#include<queue>
#include<algorithm>
#include<map>
#include<vector>
#include<cstring>
#include<cmath>
inline long long Input(){
    long long ret=0;bool isN=0;char c=getchar();
    while(c<'0' || c>'9'){
        if(c=='-') isN=1;
        c=getchar();
    }
    while(c>='0' && c<='9'){
        ret=ret*10+c-'0';
        c=getchar();
    }
    return isN?-ret:ret;
}

inline void Output(long long x){
    if(x<0){
        putchar('-');x=-x;
    }
    int len=0,data[20];
    while(x){
        data[len++]=x%10;x/=10;
    }
    if(!len)    data[len++]=0;
    while(len--)
        putchar(data[len]+48);
    putchar('\n');
}
#pragma comment(linker,"/STACK:124000000,124000000")
#include<map>
#include<vector>
#include<queue>
#include<set>
#include<stack>
#include <bitset>
#include<complex>
#define eps 1e-6
#define INF 2147483647
#define maxn   100005
#define maxm 200005
#define mod 1000000007
#define llINF 9023372036854775807LL
#define In freopen("solve_in.txt", "r", stdin);
#define Out freopen("solve_out.txt", "w", stdout);
#define totnum 26
const long double PI=acos(-1.0);
using namespace std;

long long fac[2005],ni[2005],ni2[2005];
long long fast(int ci,long long num)
{
    long long ans=1;
    while(ci)
    {
        if(ci&1) ans=ans*num%mod;
        num=num*num%mod;ci=ci>>1;
    }
    return ans;
}
long long get(int c,int a)
{
    if(a==0||a==c) return 1;
    if(a>c||a<0) return 0;
    return fac[c]*ni[a]%mod*ni[c-a]%mod;
}
long long work(int day,int num,int x)
{
    long long ans=0;
    int i=0;
    long long now=1;
    while(1)
    {
        if(day>num) break;
        long long t=get(num-1,day-1);
        if(i&1) ans=ans-now*t%mod;
        else ans=ans+now*t%mod;
        ans=ans%mod;
        if(ans<0) ans+=mod;
        num-=x;i++;
        now=now*(day-i+1)%mod*ni2[i]%mod;
    }
    return ans;
}
int main()
{
    long long d;
    int n,x;
    fac[0]=1;ni[0]=1;ni2[0]=1;
    for(int i=1;i<2005;i++)
    {
        fac[i]=fac[i-1]*i%mod;
        ni2[i]=fast(mod-2,i);
        ni[i]=ni[i-1]*ni2[i]%mod;
    }
    while(scanf("%d%lld%d",&n,&d,&x)&&n)
    {
        if(x==1) {
            printf("0\n");
            continue;
        }
        long long ans=0,now=1;
        for(int i=1;i<=min(n,d);i++)
        {
            long long tans=work(i,n,x-1);
            now=now*(d-i+1)%mod*ni2[i]%mod;
            ans=ans+tans*now%mod;
            ans%=mod;
            if(ans<0) ans+=mod;
        }
        printf("%lld\n",ans);
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:108:27: error: no matching function for call to 'min(int&, long long int&)'
  108 |         for(int i=1;i<=min(n,d);i++)
      |                        ~~~^~~~~
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:2:
/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:108:27: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
  108 |         for(int i=1;i<=min(n,d);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:4:
/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:108:27: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
  108 |         for(int i=1;i<=min(n,d);i++)
      |                        ~~~^~~~~