criyle/codenet-compile-errors huggingface dataset:
Language: C++

#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
#define ALL(obj) (obj).begin(), (obj).end()
long long INF = (long long)1E17;
#define i_7 (long long)(1E9+7)
//#define i_7 998'244'353
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}

//typedef long long ll;
long long po(long a, long b){
    if(b==0){
        return 1;
    }
    
    long long z = po(a,b/2);
    z = mod(z*z);
    if(b%2!=0){
        z = mod(a*z);
    }
    return z;
}

//配列のSIZEは問題ごとに定義する必要がある。
//const int SIZE=...
long long inv[SIZE+1];//各iの逆元を格納する配列。
long long kai[SIZE+1];//i!のmodを格納する配列。
long long invkai[SIZE+1];//各i!の逆元を格納する配列。
const int MOD=i_7;
void invinit(){//上の配列を初期化する関数。
    inv[1]=1;
    for(int i=2;i<=SIZE;i++){
        inv[i] = MOD - ((MOD/i)*inv[MOD%i])%MOD;
    }
    
    kai[0]=invkai[0]=1;
    for(int i=1;i<=SIZE;i++){
        kai[i]=(kai[i-1]*i)%MOD;
        invkai[i]=(invkai[i-1]*inv[i])%MOD;
    }
}

long long comb(long long a, long long b){
    if(b<0 || a<b){
        return 0;
    }
    return mod(kai[a]*mod(invkai[b]*invkai[a-b]));
}

int main(){
  invinit();
  using namespace std;
  long long n, a, b;
  cin>>n>>a>>b;
  long long ans = mod(po(2, n) - 1);
  ans -= comb(n, a);
  ans = mod(ans);
  ans -= comb(n, b);
  ans = mod(ans);
  cout<<ans<<endl;
  return 0;
}


Compiler output:
a.cc:30:15: error: 'SIZE' was not declared in this scope
   30 | long long inv[SIZE+1];//各iの逆元を格納する配列。
      |               ^~~~
a.cc:31:15: error: 'SIZE' was not declared in this scope
   31 | long long kai[SIZE+1];//i!のmodを格納する配列。
      |               ^~~~
a.cc:32:18: error: 'SIZE' was not declared in this scope
   32 | long long invkai[SIZE+1];//各i!の逆元を格納する配列。
      |                  ^~~~
a.cc: In function 'void invinit()':
a.cc:35:5: error: 'inv' was not declared in this scope; did you mean 'int'?
   35 |     inv[1]=1;
      |     ^~~
      |     int
a.cc:36:20: error: 'SIZE' was not declared in this scope
   36 |     for(int i=2;i<=SIZE;i++){
      |                    ^~~~
a.cc:40:5: error: 'kai' was not declared in this scope
   40 |     kai[0]=invkai[0]=1;
      |     ^~~
a.cc:40:12: error: 'invkai' was not declared in this scope
   40 |     kai[0]=invkai[0]=1;
      |            ^~~~~~
a.cc:41:20: error: 'SIZE' was not declared in this scope
   41 |     for(int i=1;i<=SIZE;i++){
      |                    ^~~~
a.cc: In function 'long long int comb(long long int, long long int)':
a.cc:51:16: error: 'kai' was not declared in this scope
   51 |     return mod(kai[a]*mod(invkai[b]*invkai[a-b]));
      |                ^~~
a.cc:51:27: error: 'invkai' was not declared in this scope
   51 |     return mod(kai[a]*mod(invkai[b]*invkai[a-b]));
      |                           ^~~~~~
Language: C++

#include <bits/stdc++.h>
#include "../lib/math/comb.hpp"

using namespace std;

#define SZ(x) (int)(x.size())

using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const double eps = 1e-10;
const ll MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;

template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}

template<typename T1, typename T2>
ostream& operator<<(ostream &os, const pair<T1, T2> p) {
  os << p.first << ":" << p.second;
  return os;
}

template< typename T >
T mod_pow(T x, T n, const T &p) {
  T ret = 1;
  while(n > 0) {
    if(n & 1) (ret *= x) %= p;
    (x *= x) %= p;
    n >>= 1;
  }
  return ret;
}


int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  ll n, a, b; cin >> n >> a >> b;
  Combination<MOD> comb(200010);

  ll ans = mod_pow<ll>(2, n, MOD);
  ans--;

  ll tmpa = 1;
  for(int i=0;i<a;++i) {
    tmpa *= n-i;
    tmpa %= MOD;
  }
  tmpa *= comb.getfinv(a);
  tmpa %= MOD;
  ll tmpb = 1;
  for(int i=0;i<b;++i) {
    tmpb *= n-i;
    tmpb %= MOD;
  }
  tmpb *= comb.getfinv(b);
  tmpb %= MOD;

  ans += MOD - tmpa;
  ans %= MOD;
  ans += MOD - tmpb;
  ans %= MOD;
  cout << ans << endl;



}


Compiler output:
a.cc:2:10: fatal error: ../lib/math/comb.hpp: No such file or directory
    2 | #include "../lib/math/comb.hpp"
      |          ^~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <functional>

// AtCoder
// Submit via the browser!
#include <atcoder/all>
using namespace atcoder;

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...)
#endif

#define rep_(i, a_, b_, a, b, ...) for (int i = (a), i##_len = (b); i < i##_len; ++i)
#define rep(i, ...) rep_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define reprev_(i, a_, b_, a, b, ...) for (int i = (b-1), i##_min = (a); i >= i##_min; --i)
#define reprev(i, ...) reprev_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define all(x) (x).begin(), (x).end()
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
#define fls(x) (64 - __builtin_clzll(x))
#define pcnt(x) __builtin_popcountll(x)
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> P;
typedef long double ld;

constexpr int MOD = (int)1e9 + 7;
using mint = static_modint<MOD>;
// binomial coefficients
constexpr int FAC_MAX = 3000001;
vector<mint> fac(FAC_MAX), finv(FAC_MAX), inv(FAC_MAX);
void com_init() {
    int MOD = modint::mod();
    fac[0] = fac[1] = finv[0] = finv[1] = inv[1] = 1;
    for (int i = 2; i < FAC_MAX; i++){
        fac[i] = fac[i - 1] * i;
        inv[i] = MOD - inv[MOD % i] * (MOD / i);
        finv[i] = finv[i - 1] * inv[i];
    }
}
mint com_mod(int a, int b) {
    int MOD = modint::mod();
    if (a < b) return 0;
    if (a < 0 || b < 0) return 0;
    return fac[a] * finv[b] * finv[a - b];
}

int main (void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    modint::set_mod(MOD);
    com_init();

    ll n, k; cin >> n >> k;
    eprintf("%d\n", modint::mod());
    if (n < k) cout << com_mod(2 * n - 1, n).val() << "\n";
    else {
        mint ans = 0;
        rep (i, k + 1) ans += com_mod(n, i) * com_mod(n - 1, i);
        cout << ans.val() << "\n";
    }
    return 0;
}

Compiler output:
a.cc:26:10: fatal error: atcoder/all: No such file or directory
   26 | #include <atcoder/all>
      |          ^~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, from, to) for (ll i = from; i < (to); ++i)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define pb push_back
using ll = long long;
using vin=vector<int>;
using vvin=vector<vin>;
using vll=vector<ll>;
using vvll=vector<vll>;
using vst=vector<string>;
using P = pair<ll,ll>;
const int inf=1e9+7;
const ll INF=9e18;
template <typename T> bool chmin(T &a, const T& b){if(a > b){a = b;return true;}return false;}
template <typename T> bool chmax(T &a, const T& b){if(a < b){a = b;return true;}return false;}
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };

ll f[1100000],invf[1100000];

ll inv (ll x){
 ll res=1;
  ll k=inf-2;
  ll y=x;
  while(k){
   if(k&1)res=res*y %inf;
    y=y*y%inf;
    k>>=1;
  }
  return res;
}

void init(){
  f[0]=1;
  rep(i,1,1100000)f[i]=f[i-1]*i%inf;
  rep(i,0,1100000)invf[i]=inv(f[i]);
}

ll comb (ll n,ll k){
  if(k<0||k>n)return 0;
  ll a=f[n],b=invf[k],c=invf[n-k];
  return a*b%inf*c%inf;
}








int main(){cout<<fixed<<setprecision(20);
		   ll n,k;
           cin>>n>>k;
           //から部屋で場合わけO(n)
           init();
           ll ans=0;
           if(k>=n-1){
             ans=comb(2*n-1,n);
           }
           else{
             rep(i,0,k+1){//空き部屋がi個
               //nci * n-iHi
               ans+=comb(n,i)*comb(n-1,i);
               ans%=inf;
             }
           }
           cout<<ans&inf<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:74:25: error: invalid operands of types 'const int' and '<unresolved overloaded function type>' to binary 'operator<<'
   74 |            cout<<ans&inf<<endl;
      |                      ~~~^~~~~~
Language: C++

#include <iostream>
#include <functional>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <queue>
#include <map>
#include <iomanip>
#include <complex>
#include <random>
#include <bitset>
#include <list>
// #include <prettyprint.hpp>
using namespace std;
#define repi(i,n) for(int i=0;i<n;++i)
#define rep(i,n) for(ll i=0;i<n;++i)
#define repinvi(i,n) for(int i=n-1;i>=0;--i)
#define sll(n) scanf("%lld", &n);
#define sii(n) scanf("%d", &n);
#define slf(n) scanf("%lf", &n);
#define pll pair<ll,ll>
#define pii pair<int,int>
#define psi pair<si,si>
typedef long long ll;
typedef double lf;
typedef short int si;
typedef long long ll;
const int mod = 1000000007;
struct mint {
    ll x; // typedef long long ll;
    mint(ll x=0):x((x%mod+mod)%mod){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
    mint operator+(const mint a) const { return mint(*this) += a;}
    mint operator-(const mint a) const { return mint(*this) -= a;}
    mint operator*(const mint a) const { return mint(*this) *= a;}
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    // for prime mod
    mint inv() const { return pow(mod-2);}
    mint& operator/=(const mint a) { return *this *= a.inv();}
    mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}


struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};

static const ll max_n = 200010;
combination comb(max_n);


void Main(){
    ll n, k;
    cin >> n >> k;
    ll K = min(n, k+1);
    mint ans = 0;
    // 移動した人数がm人なので、各部屋1人ずつ確保した後、互いに取り合うのは移動したm人になる。
    // だから n-m H m になる
    rep(i, K){
        ans += comb(n, i) * comb(n-1, n-1-i);
    }

    cout << ans << endl;

}

int main(){
    Main();
    // string S = "ksdfjl";
    // char v = S[3];
    // S[3] = 'a';
    // cout << S <<endl;
}

Compiler output:
a.cc: In constructor 'combination::combination(int)':
a.cc:67:5: error: 'assert' was not declared in this scope
   67 |     assert(n < mod);
      |     ^~~~~~
a.cc:16:1: note: 'assert' is defined in header '<cassert>'; this is probably fixable by adding '#include <cassert>'
   15 | #include <list>
  +++ |+#include <cassert>
   16 | // #include <prettyprint.hpp>
Language: C++

//ヘッダー
#include<bits/stdc++.h>
using namespace std;

//型定義
typedef long long ll;

//定数

const ll MOD=1e+9+7; //10^9+7

//REPマクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define REP2(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define REPD2(i,a,b) for(ll i=a;i>=(ll)(b);i--)

//グローバル変数


//ライブラリ挿入
// xのn乗%modを計算
vector<ll> fac(300001); //n!(mod M)
vector<ll> ifac(300001); //k!^{M-2} (mod M)
//a,bの範囲的にこれだけ配列を用意していけば十分

ll mpow(ll x, ll n){ //x^n(mod M) ←普通にpow(x,n)では溢れてしまうため，随時mod計算
    ll ans = 1;
    while(n != 0){
        if(n&1) ans = ans*x % M;
        x = x*x % M;
        n = n >> 1;
    }
    return ans;
}

ll comb(ll a, ll b){ //aCbをmod計算
    if(a == 0 && b == 0)return 1;
    if(a < b || a < 0)return 0;
    ll tmp = ifac[a-b]* ifac[b] % M;
    return tmp * fac[a] % M;
}


int main(){
    ll N,k;
    cin >> N >> k;
    ll ans=0;
    ll n;

    fac[0] = 1;
    ifac[0] = 1;
    for(ll i = 0; i<300000; i++){
        fac[i+1] = fac[i]*(i+1) % M; // n!(mod M)
        ifac[i+1] = ifac[i]*mpow(i+1, M-2) % M; // k!^{M-2} (mod M) ←累乗にmpowを採用
    }

    REP(i,min(n+1,k+1)){
        ans+=((comb(n-1,i)*comb(n,i))%MOD);
        ans%=MOD;
    }
    
    cout << ans << endl;

}

Compiler output:
a.cc: In function 'll mpow(ll, ll)':
a.cc:30:31: error: 'M' was not declared in this scope
   30 |         if(n&1) ans = ans*x % M;
      |                               ^
a.cc:31:19: error: 'M' was not declared in this scope
   31 |         x = x*x % M;
      |                   ^
a.cc: In function 'll comb(ll, ll)':
a.cc:40:35: error: 'M' was not declared in this scope
   40 |     ll tmp = ifac[a-b]* ifac[b] % M;
      |                                   ^
a.cc: In function 'int main()':
a.cc:54:35: error: 'M' was not declared in this scope
   54 |         fac[i+1] = fac[i]*(i+1) % M; // n!(mod M)
      |                                   ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
static const int64_t mod=1000000007;
int64_t f(int64_t x,int64_t y){
if(y==0) return 1;
  else{
  if(y%2==0)
  return (f(x,y/2)*f(x,y/2))%mod;
   else
  return (((x*f(x,y/2))%mod)*f(x,y/2))%mod;
 
  }
 
}
int main(){
int64_t n,k;
  cin>>n>>k;
  if(k<=n-1){
  vector<int64_t>A(k+1);
    A.at(0)=1;
    for(int i=1;i<=k;i++)
    A.at(i)=(((((A.at(i-1)*(n-i))%mod)*((n-i+1)*f(i,mod-2))%mod)%mod*f(i,mod-2))%mod;
      int64_t ans=0;
      for(int i=0;i<=k;i++)
        ans=(ans+A.at(i))%mod;
      cout<<ans<<endl;
    
  
  }else{
  vector<int64_t>A(n);
    A.at(0)=1;
    for(int i=1;i<n;i++)
    A.at(i)=((((((A.at(i-1)*(n-i))%mod)*((n-i+1)*f(i,mod-2))%mod)%mod)*f(i,mod-2))%mod;
      int64_t ans=0;
      for(int i=0;i<n;i++)
        ans=(ans+A.at(i))%mod;
      cout<<ans<<endl;
  }
   return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:85: error: expected ')' before ';' token
   22 |     A.at(i)=(((((A.at(i-1)*(n-i))%mod)*((n-i+1)*f(i,mod-2))%mod)%mod*f(i,mod-2))%mod;
      |             ~                                                                       ^
      |                                                                                     )
a.cc:33:87: error: expected ')' before ';' token
   33 |     A.at(i)=((((((A.at(i-1)*(n-i))%mod)*((n-i+1)*f(i,mod-2))%mod)%mod)*f(i,mod-2))%mod;
      |             ~                                                                         ^
      |                                                                                       )
Language: C++

#include<bits/stdc++.h>
using namespace std;
static const int mod=1000000007;
int64_t f(int64_t x,int64_t y){
if(y==0) return 1;
  else{
  if(y%2==0)
  return (f(x,y/2)*f(x,y/2))%mod;
   else
  return (((x*f(x,y/2))%mod)*f(x,y/2))%mod;
 
  }

}
int main(){
int64_t n,k;
  cin>>n>>k;
  if(k<=n-1){
  vector<int64_t>A(k+1);
    A.at(0)=1;
    for(int i=1;i<=k;i++){
    A.at(i)=(A.at(i-1)*((n-i)*(n-i+1)*f(pow(i,2),mod-2))%mod)%mod;
      int64_t ans=0;
      for(int i=0;i<=k;i++)
        ans=(ans+A.at(i))%mod;
      cout<<ans<<endl;
    }
  
  }else{
  vector<int64_t>A(n);
    A.at(0)=1;
    for(int i=1;i<n;i++){
    A.at(i)=(A.at(i-1)*((n-i)*(n-i+1)*f(pow(i,2),mod-2))%mod)%mod;
      int64_t ans=0;
      for(int i=0;i<n;i++)
        ans=(ans+A.at(i))%mod;
      cout<<ans<<endl;
  }
   return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:40:2: error: expected '}' at end of input
   40 | }
      |  ^
a.cc:15:11: note: to match this '{'
   15 | int main(){
      |           ^
Language: C++

// ============how it works=================
// input:
  //ll n
  //ll k
    //nCk
  //ll MAX
    //max(n, k)
  //ll MOD
// output:
  //nCk
// ========================================

const ll MAX = 510010;
const ll MOD = 1000000007;
vector<ll> fac(MAX), finv(MAX), inv(MAX);
bool init_called = false;
//=============modinv============================
void COMinit() {
  init_called = true;
  fac.at(0) = 1;
  fac.at(1) = 1;
  finv.at(0) = 1;
  finv.at(1) = 1;
  inv.at(1) = 1;
  for (ll i = 2; i < MAX; i++){
    fac.at(i) = fac.at(i - 1) * i % MOD;
    inv.at(i) = MOD - inv.at(MOD % i) * (MOD / i) % MOD;
    finv.at(i) = finv.at(i - 1) * inv.at(i) % MOD;
  }
}

ll COM(ll n, ll k){
  if (!init_called) {
    COMinit();
  }
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac.at(n) * (finv.at(k) * finv.at(n - k) % MOD) % MOD;
}
//=================================================


Compiler output:
a.cc:13:7: error: 'll' does not name a type
   13 | const ll MAX = 510010;
      |       ^~
a.cc:14:7: error: 'll' does not name a type
   14 | const ll MOD = 1000000007;
      |       ^~
a.cc:15:1: error: 'vector' does not name a type
   15 | vector<ll> fac(MAX), finv(MAX), inv(MAX);
      | ^~~~~~
a.cc: In function 'void COMinit()':
a.cc:20:3: error: 'fac' was not declared in this scope
   20 |   fac.at(0) = 1;
      |   ^~~
a.cc:22:3: error: 'finv' was not declared in this scope
   22 |   finv.at(0) = 1;
      |   ^~~~
a.cc:24:3: error: 'inv' was not declared in this scope; did you mean 'int'?
   24 |   inv.at(1) = 1;
      |   ^~~
      |   int
a.cc:25:8: error: 'll' was not declared in this scope
   25 |   for (ll i = 2; i < MAX; i++){
      |        ^~
a.cc:25:18: error: 'i' was not declared in this scope
   25 |   for (ll i = 2; i < MAX; i++){
      |                  ^
a.cc:25:22: error: 'MAX' was not declared in this scope
   25 |   for (ll i = 2; i < MAX; i++){
      |                      ^~~
a.cc:26:37: error: 'MOD' was not declared in this scope
   26 |     fac.at(i) = fac.at(i - 1) * i % MOD;
      |                                     ^~~
a.cc: At global scope:
a.cc:32:1: error: 'll' does not name a type
   32 | ll COM(ll n, ll k){
      | ^~
Language: C++

#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; ++i)
#define rrep(i, n) for(int i = n-1; i >= 0; --i)
#define fi first
#define se second
using namespace std;
using lint = long long;
using uint = unsigned int;
using ulint = unsigned long long;
using ldouble = long double;
using pii = pair<int, int>;
using pli = pair<lint, lint>;
using pdd = pair<double, double>;
using pld = pair<ldouble, ldouble>;
using v1i = vector<int>;
using v1li = vector<lint>;
using v2i = vector<vector<int>>;
using v2li = vector<vector<lint>>;
using v3i = vector<vector<vector<int>>>;
using v3li = vector<vector<vector<lint>>>;
using v1b = vector<bool>;
using v2b = vector<vector<bool>>;
using v3b = vector<vector<vector<bool>>>;
using v1c = vector<char>;
using v2c = vector<vector<char>>;
using v3c = vector<vector<vector<char>>>;
constexpr lint mod1 = 1e9+7;
constexpr lint mod2 = 998244353;

lint gyaku(lint a, lint mod){
  lint s = 1, tmp = a, t = mod - 2;
  while(t > 0){
    if(t % 2 == 1){
      s *= tmp;
      s %= mod;
    }
    t /= 2;
    tmp *= tmp;
    tmp %= mod;
  }
  return s;
}

int main(){
  int n, k; scanf("%ld %ld", &n, &k); lint s = 0;
  v1i v(n+1, 1), u(n+1, 1);
  rep(i, n){
    v[i+1] = v[i]*(i+1); v[i+1] %= mod1;
    u[i+1] = u[i]*gyaku(i+1, mod1); u[i+1] %= mod1;
  }
  rep(i, min(k+1, n)){
    lint t = v[n];
    t *= u[i]; t %= mod1;
    t *= u[n-i]; t %= mod1;
    t *= v[n-1]; t %= mod1;
    t *= u[n-i-1]; t %= mod1;
    t *= u[i]; t %= mod1;
    s += t;
    s %= mod1
  }
  printf("%lld\n", s);
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:59:14: error: expected ';' before '}' token
   59 |     s %= mod1
      |              ^
      |              ;
   60 |   }
      |   ~
Language: C++

#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; ++i)
#define rrep(i, n) for(int i = n-1; i >= 0; --i)
#define fi first
#define se second
using namespace std;
using lint = long long;
using uint = unsigned int;
using ulint = unsigned long long;
using ldouble = long double;
using pii = pair<int, int>;
using pli = pair<lint, lint>;
using pdd = pair<double, double>;
using pld = pair<ldouble, ldouble>;
using v1i = vector<int>;
using v1li = vector<lint>;
using v2i = vector<vector<int>>;
using v2li = vector<vector<lint>>;
using v3i = vector<vector<vector<int>>>;
using v3li = vector<vector<vector<lint>>>;
using v1b = vector<bool>;
using v2b = vector<vector<bool>>;
using v3b = vector<vector<vector<bool>>>;
using v1c = vector<char>;
using v2c = vector<vector<char>>;
using v3c = vector<vector<vector<char>>>;
constexpr lint mod1 = 1e9+7;
constexpr lint mod2 = 998244353;

lint gyaku(lint a, lint mod){
  lint s = 1, tmp = a, t = mod - 2;
  while(t > 0){
    if(t % 2 == 1){
      s *= tmp;
      s %= mod;
    }
    t /= 2;
    tmp *= tmp;
    tmp %= mod;
  }
  return s;
}

int main(){
  int n, k; scanf("%d %d", &n, &k); lint s = 0;
  v1i v(n+1, 1), u(n+1, 1);
  rep(i, n){
    v[i+1] = v[i]*(i+1); v[i+1] %= mod1;
    u[i+1] = u[i]*gyaku(i+1, mod1); u[i+1] %= mod1;
  }
  rep(i, min(k+1, n)){
    lint t = v[n];
    t *= u[i]; t %= mod1;
    t *= u[n-i]; t %= mod1;
    t *= v[n-1]; t %= mod1;
    t *= u[n-i-1]; t %= mod1;
    t *= u[i]; t %= mod1;
    s += t;
    s %= mod1
  }
  printf("%ld\n", s);
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:59:14: error: expected ';' before '}' token
   59 |     s %= mod1
      |              ^
      |              ;
   60 |   }
      |   ~
Language: C++

#include <bits/stdc++.h>

using namespace std;

#include "../Algo/NumberTheory/modulo.h"

ModuloOps MOD(1e9+7);

int naive(int n, int k) {
    vector<int> cur(n, 1);
    set<vector<int>> all;
    function<void(int)> enter;
    enter = [&] (int c) {
        if (c == k) {
            all.insert(cur);
            return;
        }
        for (int i = 0; i < n; i++) {
            if (cur[i] == 0) {
                continue;
            }
            for (int j = 0; j < n; j++) {
                if (i != j) {
                    cur[j]++;
                    cur[i]--;
                    enter(c+1);
                    cur[j]--;
                    cur[i]++;
                }
            }
        }

    };
    enter(0);
    return all.size();
}


int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    int n, k;
    cin >> n >> k;
    k = min(k, n-1);
    vector<long long> fact(n+1);
    fact[0] = 1;
    for (int i = 1; i < fact.size(); i++) {
        fact[i] = MOD.mul(fact[i-1], i);
    }
    auto C = [&] (int n, int k) {
        return MOD.mul(fact[n], MOD.mul(MOD.inv(fact[k]), MOD.inv(fact[n-k])));
    };
    long long ans = 0;
    for (int i = 0; i <= k; i++) {
        ans = MOD.add(ans, MOD.mul(C(n, i), C(n-1, i)));
    }
    //cout << naive(n, k) << endl;
    cout << ans << endl;
}




Compiler output:
a.cc:5:10: fatal error: ../Algo/NumberTheory/modulo.h: No such file or directory
    5 | #include "../Algo/NumberTheory/modulo.h"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

use std::cmp::min;

const MOD: i64 = 1000000007;


fn main() {
    let (n, k) = read_tuple();

    let c = Comb::new(2 * n + 1, MOD);

    let mut ans = 0;
    for m in 0..(min(n, k + 1)) {
        ans += (c.nck(n, m) * c.nck(n - 1, m)) % MOD;
        ans %= MOD;
    }
    
    println!("{:?}", ans);
}


/// for nCk
pub struct Comb {
    max: usize,
    m: i64,
    fac: Vec<i64>,
    finv: Vec<i64>,
}

impl Comb {
    /// initialize table 
    /// max: maximum that n as nCk takes
    /// m: MOD, a prime number
    /// O(n)
    pub fn new(max: usize, m: i64) -> Comb {
        let n = max;
        let mut fac = Vec::with_capacity(n);
        fac.push(1);
        fac.push(1);
        let mut finv = Vec::with_capacity(n);
        finv.push(1);
        finv.push(1);
        let mut inv = Vec::with_capacity(n);
        inv.push(1);
        inv.push(1);

        for i in 2..n {
            let i = i as i64;
            let tmp = fac.last().unwrap() * i % m;
            fac.push(tmp);
            let tmp = m - inv[(m % i) as usize] * (m / i) % m;
            inv.push(tmp);
            let tmp = finv.last().unwrap() * inv.last().unwrap() % m;
            finv.push(tmp);
        }

        Comb {
            max: max,
            m: m,
            fac: fac,
            finv: finv
        }
    }

    /// nCk
    pub fn nck(&self, n: usize, k: usize) -> i64 {
        // since n, k are usize, do not need to check `n < 0 || k < 0`
        if n < k || n > self.max {
            panic!("Invalid query (n, k) = ({}, {})", n, k);
        } else {
            self.fac[n] * (self.finv[k] * self.finv[n - k] % self.m) % self.m
        }
    }
}


fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}
fn read_tuple<T: std::str::FromStr + Copy>() -> (T, T) {
    let temp = read_vec();
    (temp[0], temp[1])
}



Compiler output:
a.cc:12:14: error: too many decimal points in number
   12 |     for m in 0..(min(n, k + 1)) {
      |              ^~~
a.cc:46:18: error: too many decimal points in number
   46 |         for i in 2..n {
      |                  ^~~~
a.cc:1:1: error: 'use' does not name a type
    1 | use std::cmp::min;
      | ^~~
a.cc:3:10: error: found ':' in nested-name-specifier, expected '::'
    3 | const MOD: i64 = 1000000007;
      |          ^
      |          ::
a.cc:3:7: error: 'MOD' does not name a type
    3 | const MOD: i64 = 1000000007;
      |       ^~~
a.cc:6:1: error: 'fn' does not name a type
    6 | fn main() {
      | ^~
a.cc:22:1: error: 'pub' does not name a type
   22 | pub struct Comb {
      | ^~~
a.cc:29:1: error: 'impl' does not name a type
   29 | impl Comb {
      | ^~~~
a.cc:76:1: error: 'fn' does not name a type
   76 | fn read_vec<T: std::str::FromStr>() -> Vec<T> {
      | ^~
a.cc:82:1: error: 'fn' does not name a type
   82 | fn read_tuple<T: std::str::FromStr + Copy>() -> (T, T) {
      | ^~
Language: C++

#include <bits/stdc++.h>
using namespace std;
const int MAX = 1000000000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
int main() {
long long n,k;
cin >> n >> k;
COMinit();
long long all=COM(2*n-1,n);
long long empty=0;
for(int i=k+1;i<n;i++){
    empty+=(COM(n,i)*COM(n-1,i))%MOD;
}
all = (all - empty + MOD)%MOD;
cout << all << endl;
}


Compiler output:
/tmp/ccPt2PCa.o: in function `COMinit()':
a.cc:(.text+0x20): relocation truncated to fit: R_X86_64_PC32 against symbol `finv' defined in .bss section in /tmp/ccPt2PCa.o
a.cc:(.text+0x2b): relocation truncated to fit: R_X86_64_PC32 against symbol `finv' defined in .bss section in /tmp/ccPt2PCa.o
a.cc:(.text+0x32): relocation truncated to fit: R_X86_64_PC32 against symbol `finv' defined in .bss section in /tmp/ccPt2PCa.o
a.cc:(.text+0x39): relocation truncated to fit: R_X86_64_PC32 against symbol `inv' defined in .bss section in /tmp/ccPt2PCa.o
a.cc:(.text+0xd4): relocation truncated to fit: R_X86_64_PC32 against symbol `inv' defined in .bss section in /tmp/ccPt2PCa.o
a.cc:(.text+0x135): relocation truncated to fit: R_X86_64_PC32 against symbol `inv' defined in .bss section in /tmp/ccPt2PCa.o
a.cc:(.text+0x150): relocation truncated to fit: R_X86_64_PC32 against symbol `finv' defined in .bss section in /tmp/ccPt2PCa.o
a.cc:(.text+0x168): relocation truncated to fit: R_X86_64_PC32 against symbol `inv' defined in .bss section in /tmp/ccPt2PCa.o
a.cc:(.text+0x1b7): relocation truncated to fit: R_X86_64_PC32 against symbol `finv' defined in .bss section in /tmp/ccPt2PCa.o
/tmp/ccPt2PCa.o: in function `COM(int, int)':
a.cc:(.text+0x22e): relocation truncated to fit: R_X86_64_PC32 against symbol `finv' defined in .bss section in /tmp/ccPt2PCa.o
a.cc:(.text+0x249): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

#include <bits/stdc++.h>
using namespace std;
const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
int main() {
long long n,k;
cin >> n >> k;
COMinit();
long long all=COM(2*n+1,n);
long long empty=0;
for(int i=k+1;i<n;i++){
    empty+=(COM(n,i)*COM(n-1,i))%MOD;
}
long long all = (all - empty + MOD)%MOD;
cout << all << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:35:11: error: redeclaration of 'long long int all'
   35 | long long all = (all - empty + MOD)%MOD;
      |           ^~~
a.cc:30:11: note: 'long long int all' previously declared here
   30 | long long all=COM(2*n+1,n);
      |           ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
typedef long long ll;

ll M = 1000000007;
vector<ll> fac(200010);
vector<ll> ifac(200010);

//べき乗高速化
ll mpow(ll x, ll n){
	ll res= 1;
	while(n != 0){
		if (n&1) ans = ans * x % M;
		x = x*x % M;
		n  = n >> 1;
	}
	return res;
}

//aCbを計算
ll comb(ll a, ll b){
	if (a == 0 && b == 0) return 1;
	if (a < b || a < 0){
		return 0;
	}
	ll temp = ifac[a-b] * ifac[b] % M;
	return temp * fac[a] % M;
}

int main(){
	ll n,k;
	cin >> n >> k;
	fac[0] = 1;
	ifac[0] = 1;
	for(ll i = 0; i<= 200005; i++){
		fac[i+1] = fac[i]*(i+1) % M; // n!(mod M)
		ifac[i+1] = ifac[i]*mpow(i+1, M-2) % M; // k!^{M-2} (mod M) ←累乗にmpowを採用
	}
	ll ans = 0;
	rep(i,min(k,n)+1){
		ans += comb(n,i)*comb(n-1,n-i-1);
		ans %= M;
	}
	cout << ans << endl;
    return 0;
}



Compiler output:
a.cc: In function 'll mpow(ll, ll)':
a.cc:15:26: error: 'ans' was not declared in this scope; did you mean 'abs'?
   15 |                 if (n&1) ans = ans * x % M;
      |                          ^~~
      |                          abs
Language: C++

#include<iostream>
#include <algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<queue>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep1(i, n) for (int i = 1; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1001001001;

const int mod = 1000000007;
struct mint {
  ll x;

  mint(ll x=0):x((x%mod+mod)%mod){}

  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
 
  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};

int main() {
  int n, k;
  cin >> n >> k;

  int m = min(n-1, k);
  combination com(n);
  mint all = 0;
  rep(i,m+1) all += com(n,i) * com((n-i-1)+i,i);
  cout << all.x << endl;
  return 0;
}


Compiler output:
a.cc: In constructor 'combination::combination(int)':
a.cc:69:5: error: 'assert' was not declared in this scope
   69 |     assert(n < mod);
      |     ^~~~~~
a.cc:7:1: note: 'assert' is defined in header '<cassert>'; this is probably fixable by adding '#include <cassert>'
    6 | #include<queue>
  +++ |+#include <cassert>
    7 | #define rep(i, n) for (int i = 0; i < (n); ++i)
Language: C++

#include<iostream>
#include<vector>
using namespace std;

constexpr long long MOD = 1'000'000'007;

class binomial_coefficients {
	long long MAX_VAL;
	vector<long long> fac, mmi;

public:

	binomial_coefficients(){
	}
	
	binomial_coefficients(long long num){
		init(num);
	}
	
	~binomial_coefficients(){
		
	}
	
	void init(long long num){
		MAX_VAL = num+1; 
		fac.resize(MAX_VAL);
		mmi.resize(MAX_VAL);
		
		factorial_mod();
		modular_multiplicatibe_inverse();
	}
	
	void factorial_mod(){
		 fac[0] = 1;
		for(long long i = 1; i < MAX_VAL; fac[i] %= MOD, i++)
			fac[i] = fac[i - 1] * (i % MOD);
	}
	
	long long power(long long x, long long n){
		long long ans = 1;
		for(;n;n >>= 1, x *= x, ans %= MOD, x %= MOD)
			if(n&1)ans*=x;
		return ans % MOD;
	}
	
	void exgcd(long long a, long long b, long long &x, long long &y){
		if(b == 0){
			x = 1;
			y = 0;
			return ;
		}
		exgcd(b, a % b, y, x);
		y -= a / b * x;
	}
	
	void modular_multiplicatibe_inverse(){
		long long x, y;  
		exgcd(fac[MAX_VAL - 1], MOD, x, y);
		mmi[MAX_VAL-1] = x;
		// mmi[MAX_VAL-1] = power(fac[MAX_VAL-1], MOD-2);
		for(long long i = MAX_VAL - 2; i >= 0; mmi[i]%=MOD, i--)
			mmi[i] = mmi[i + 1] * ((i + 1) % MOD);
	}
	
	long long combination(long long n, long long r){
		return n < r ? 0 :fac[n] * (mmi[r] * mmi[n-r] % MOD) % MOD;
	}
};

int main(){
	l n, k, ans = 0;
	
	cin>>n>>k;
	
	
	binomial_coefficients BC(n);
	
	for(int i = 0; i < n && i <= k; i++){
		ans += BC.combination(n, i) * BC.combination(n-1, i);
		ans %= MOD;
	}
	
	cout<<ans<<endl;
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:71:9: error: 'l' was not declared in this scope
   71 |         l n, k, ans = 0;
      |         ^
a.cc:73:14: error: 'n' was not declared in this scope
   73 |         cin>>n>>k;
      |              ^
a.cc:73:17: error: 'k' was not declared in this scope
   73 |         cin>>n>>k;
      |                 ^
a.cc:79:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   79 |                 ans += BC.combination(n, i) * BC.combination(n-1, i);
      |                 ^~~
      |                 abs
a.cc:83:15: error: 'ans' was not declared in this scope; did you mean 'abs'?
   83 |         cout<<ans<<endl;
      |               ^~~
      |               abs
Language: C++

#include<iostream>
#include<vector>
using namespace std;

constexpr long long MOD = 1'000'000'007;

class binomial_coefficients {
	int MAX_VAL;
	vector<int> fac, mmi;

public:

	binomial_coefficients(int num){
		init(num);
	}
	
	binomial_coefficients(){
	}
	
	init(int num){
		MAX_VAL = num+1; 
		
		factorial_mod();
		modular_multiplicatibe_inverse();
	}
	void factorial_mod(){
		 fac[0] = fac[1] = 1;
		for(long long i = 2; i < MAX_VAL; fac[i] %= MOD, i++)
			fac[i] = fac[i - 1] * (i % MOD);
	}
	
	long long power(long long x, long long n){
		long long ans = 1;
		for(;n;n >>= 1, x *= x, ans %= MOD, x %= MOD)
			if(n&1)ans*=x;
		return ans%MOD;
	}
	
	void exgcd(int a, int b, int &x, int &y){
		if(b == 0){
			x = 1;
			y = 0;
			return ;
		}
		exgcd(b, a % b, y, x);
		y -= a / b * x;
	}
	
	void modular_multiplicatibe_inverse(){
		int x, y;  
		exgcd(fac[MAX_VAL - 1], MOD, x, y);
		mmi[MAX_VAL-1] = x;
		// mmi[MAX_VAL-1] = power(fac[MAX_VAL-1], MOD-2);
		for(long long i = MAX_VAL - 2; i >= 0; mmi[i]%=MOD, i--)
			mmi[i] = mmi[i + 1] * ((i + 1) % MOD);
	}
	
	long long combination(long long n, long long r){
		return n < r ? 0 :fac[n] * (mmi[r] * mmi[n-r] % MOD) % MOD;
	}
};

int main(){
	binomial_coefficients BC;
	int n, k, ans = 0;
	
	cin>>n>>k;
	
	BC.init(n);
	
	for(int i = 0; i < n && i <= k; i++){
		ans += BC.combination(n, i) * BC.combination(n-1, i);
		ans %= MOD;
	}
	
	cout<<ans<<endl;
	
	return 0;
}

Compiler output:
a.cc:20:9: error: ISO C++ forbids declaration of 'init' with no type [-fpermissive]
   20 |         init(int num){
      |         ^~~~
a.cc: In member function 'int binomial_coefficients::init(int)':
a.cc:25:9: warning: no return statement in function returning non-void [-Wreturn-type]
   25 |         }
      |         ^
Language: C++

#include <cstdio>
#include <algorithm>
using ll = long long;
using namespace std;

template<int N, typename T, T M>
struct kaijyo
{
	T mod[N + 1];
	T inv_mod[N + 1];

	constexpr kaijyo() : mod(), inv_mod()
	{
		mod[0] = 1;
		for (int i = 0; i < N; ++i)
		{
			mod[i + 1] = (mod[i] * (i + 1)) % M;
		}
		inv_mod[N] = power(mod[N], M - 2);
		for (int i = N - 1; i >= 0; --i)
		{
			inv_mod[i] = (inv_mod[i + 1] * (i + 1)) % M;
		}
	}

	constexpr T power(T a, T b) const
	{
		T r = 1;
		for (; b; b >>= 1, a = 1ll * a * a % M)
			if (b & 1) r = 1ll * r * a % M;
		return r;
	}

	constexpr T comb(T n, T r) const
	{
		if (r < 0 || r > n || n < 0) return 0;
		return (((mod[n] * inv_mod[r]) % M) * inv_mod[n - r]) % M;
	}
};

constexpr ll MOD = 1e9 + 7;
constexpr kaijyo<500000, ll, MOD> kaijyo1;

int main()
{
	ll n, k;
	cin >> n >> k;
	ll zeromax = min(n, k);
	ll ans = 0;
	//注意：空き室の数は１から、0の場合はまだ計算してない
	for (ll i = 1; i <= zeromax; ++i)
	{
		ll room = n - i;
		ans = (ans + kaijyo1.comb(n, room) * kaijyo1.comb(n - 1, room)) % MOD;
	}
	if (k >= 2)
	{
		ans = (ans + 1) % MOD;
	}
	cout << ans;
	return 0;
}

Compiler output:
a.cc:42:35:   in 'constexpr' expansion of 'kaijyo<500000, long long int, 1000000007>()'
a.cc:15:17: error: 'constexpr' loop iteration count exceeds limit of 262144 (use '-fconstexpr-loop-limit=' to increase the limit)
   15 |                 for (int i = 0; i < N; ++i)
      |                 ^~~
a.cc: In function 'int main()':
a.cc:47:9: error: 'cin' was not declared in this scope
   47 |         cin >> n >> k;
      |         ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    2 | #include <algorithm>
  +++ |+#include <iostream>
    3 | using ll = long long;
a.cc:60:9: error: 'cout' was not declared in this scope
   60 |         cout << ans;
      |         ^~~~
a.cc:60:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: C++

#include <bits/stdc++.h>
 
template<int N, typename T, T M>
struct factorial_mod
{
	T mod[N + 1];
	T inv_mod[N + 1];
 
	constexpr factorial_mod() : mod(), inv_mod()
	{
		mod[0] = 1;
		for (int i = 0; i < N; ++i)
		{
			mod[i + 1] = (mod[i] * (i + 1)) % M;
		}
		inv_mod[N] = power(mod[N], M - 2);
		for (int i = N - 1; i >= 0; --i)
		{
			inv_mod[i] = (inv_mod[i + 1] * (i + 1)) % M;
		}
	}
 
	constexpr T power(T a, T b) const
	{
		T r = 1;
		while (b > 0)
		{
			if ((b & 1) != 0) r = (r * a) % M;
			a = (a * a) % M;
			b >>= 1;
		}
		return r;
	}
 
	constexpr T comb(T n, T r) const
	{
		if (r < 0 || r > n || n < 0) return 0;
		return (((mod[n] * inv_mod[r]) % M) * inv_mod[n - r]) % M;
	}
 
	constexpr T H(T n, T r) const
	{
		return comb(n + r - 1, r);
	}
};
 
constexpr long long MOD = 1000000007;
constexpr factorial_mod<500000, long long, MOD> fmod;
 
int main()
{
	long long n, k;
	scanf("%lld%lld", &n, &k);
	long long zeromax = std::min(n, k);
	long long ans = 0;
	for (long long i = 1; i <= zeromax; ++i)
	{
		long long room = n - i;
		long long nn = n - room;
		ans = (ans + fmod.comb(n, room) * fmod.H(room, nn)) % MOD;
	}
	if (k >= 2)
	{
		ans = (ans + 1) % MOD;
	}
	printf("%lld\n", ans);
	return 0;
}

Compiler output:
a.cc:48:49: error: 'constexpr const factorial_mod<500000, long long int, 1000000007> fmod' redeclared as different kind of entity
   48 | constexpr factorial_mod<500000, long long, MOD> fmod;
      |                                                 ^~~~
In file included from /usr/include/features.h:523,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/os_defines.h:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/c++config.h:683,
                 from /usr/include/c++/14/cassert:43,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:33,
                 from a.cc:1:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:201:1: note: previous declaration 'double fmod(double, double)'
  201 | __MATHCALL (fmod,, (_Mdouble_ __x, _Mdouble_ __y));
      | ^~~~~~~~~~
a.cc: In function 'int main()':
a.cc:60:35: error: request for member 'comb' in 'fmod', which is of non-class type 'double(double, double) noexcept'
   60 |                 ans = (ans + fmod.comb(n, room) * fmod.H(room, nn)) % MOD;
      |                                   ^~~~
a.cc:60:56: error: request for member 'H' in 'fmod', which is of non-class type 'double(double, double) noexcept'
   60 |                 ans = (ans + fmod.comb(n, room) * fmod.H(room, nn)) % MOD;
      |                                                        ^
Language: C++

#include <bits/stdc++.h>
 
template<int N, typename T, T M>
struct factorial_mod
{
	T mod[N + 1];
	T inv_mod[N + 1];
 
	constexpr factorial_mod() : mod(), inv_mod()
	{
		mod[0] = 1;
		for (int i = 0; i < N; ++i)
		{
			mod[i + 1] = (mod[i] * (i + 1)) % M;
		}
		inv_mod[N] = power(mod[N], M - 2);
		for (int i = N - 1; i >= 0; --i)
		{
			inv_mod[i] = (inv_mod[i + 1] * (i + 1)) % M;
		}
	}
 
	constexpr T power(T a, T b) const
	{
		T r = 1;
        for (; b; b >>= 1, a = 1ll * a * a % M)
          if (b & 1) r = 1ll * r * a % M;
        return r;
	}
 
	constexpr T comb(T n, T r) const
	{
		if (r < 0 || r > n || n < 0) return 0;
		return (((mod[n] * inv_mod[r]) % M) * inv_mod[n - r]) % M;
	}
 
	constexpr T H(T n, T r) const
	{
		return comb(n + r - 1, r);
	}
};
 
constexpr long long MOD = 1000000007;
constexpr factorial_mod<500000, long long, MOD> fmod;
 
int main()
{
	long long n, k;
	scanf("%lld%lld", &n, &k);
	long long zeromax = std::min(n, k);
	long long ans = 0;
	for (long long i = 1; i <= zeromax; ++i)
	{
		long long room = n - i;
		long long nn = n - room;
		ans = (ans + fmod.comb(n, room) * fmod.H(room, nn)) % MOD;
	}
	if (k >= 2)
	{
		ans = (ans + 1) % MOD;
	}
	printf("%lld\n", ans);
	return 0;
}

Compiler output:
a.cc:44:49: error: 'constexpr const factorial_mod<500000, long long int, 1000000007> fmod' redeclared as different kind of entity
   44 | constexpr factorial_mod<500000, long long, MOD> fmod;
      |                                                 ^~~~
In file included from /usr/include/features.h:523,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/os_defines.h:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/c++config.h:683,
                 from /usr/include/c++/14/cassert:43,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:33,
                 from a.cc:1:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:201:1: note: previous declaration 'double fmod(double, double)'
  201 | __MATHCALL (fmod,, (_Mdouble_ __x, _Mdouble_ __y));
      | ^~~~~~~~~~
a.cc: In function 'int main()':
a.cc:56:35: error: request for member 'comb' in 'fmod', which is of non-class type 'double(double, double) noexcept'
   56 |                 ans = (ans + fmod.comb(n, room) * fmod.H(room, nn)) % MOD;
      |                                   ^~~~
a.cc:56:56: error: request for member 'H' in 'fmod', which is of non-class type 'double(double, double) noexcept'
   56 |                 ans = (ans + fmod.comb(n, room) * fmod.H(room, nn)) % MOD;
      |                                                        ^
Language: C++

#include "bits/stdc++.h"
using ll = long long;
using namespace std;

template<int N, typename T, T M>
struct kaijyo
{
	T mod[N + 1];
	T inv_mod[N + 1];

	constexpr kaijyo() : mod(), inv_mod()
	{
		mod[0] = 1;
		for (int i = 0; i < N; ++i)
		{
			mod[i + 1] = (mod[i] * (i + 1)) % M;
		}
		inv_mod[N] = power(mod[N], M - 2);
		for (int i = N - 1; i >= 0; --i)
		{
			inv_mod[i] = (inv_mod[i + 1] * (i + 1)) % M;
		}
	}

	constexpr T power(T a, T b) const
	{
		T r = 1;
		for (; b; b >>= 1, a = 1ll * a * a % P)
			if (b & 1) r = 1ll * r * a % P;
		return r;
	}

	constexpr T comb(T n, T r) const
	{
		return (((mod[n] * inv_mod[r]) % M) * inv_mod[n - r]) % M;
	}
};

constexpr ll MOD = 1e9+7;
constexpr kaijyo<500000, ll, MOD> kaijyo1;

int main()
{
	ll n, k;
	cin >> n >> k;
	ll zeromax = min(n, k);
	ll ans = 0;
	//注意：空き室の数は１から、0の場合はまだ計算してない
	for (ll i = 1; i <= zeromax; ++i)
	{
		ll room = n - i;
		ans = (ans + kaijyo1.comb(n, room) * kaijyo1.comb(n-1, room)) % MOD;
	}
	if (k >= 2)
	{
		ans = (ans + 1) % MOD;
	}
	cout << ans;
	return 0;
}

Compiler output:
a.cc: In member function 'constexpr T kaijyo<N, T, M>::power(T, T) const':
a.cc:28:54: error: 'P' was not declared in this scope
   28 |                 for (; b; b >>= 1, a = 1ll * a * a % P)
      |                                                      ^
a.cc: At global scope:
a.cc:40:35:   in 'constexpr' expansion of 'kaijyo<500000, long long int, 1000000007>()'
a.cc:14:17: error: 'constexpr' loop iteration count exceeds limit of 262144 (use '-fconstexpr-loop-limit=' to increase the limit)
   14 |                 for (int i = 0; i < N; ++i)
      |                 ^~~
Language: C++

#include <bits/stdc++.h>
#define r1(i, n) for (int i=0;i<n;i++)
#define r2(i, n) for (int i=1;i<n;i++)
#define intc(n) int n; cin >> n;
#define ll long long
#define llc(n) ll n; cin >> n;
using namespace std;
// テーブルを作る前処理
ll MAX = 1000000;
ll fac[MAX], finv[MAX], inv[MAX],mod=1000000007;
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % mod;
        inv[i] = mod - inv[mod%i] * (mod / i) % mod;
        finv[i] = finv[i - 1] * inv[i] % mod;
    }
}
// 二項係数計算
ll COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}

int main() {
    ll n,k,ans=0;
    cin >> n >> k;
    COMinit();
    r1(i, k+1) {
      ll a=(COM(n,i)%mod);
      a=a*(COM(n-1,i)%mod)%mod;
      ans=(ans+a)%mod;
    }
    cout << ans << endl;
}

Compiler output:
a.cc:10:8: error: size of array 'fac' is not an integral constant-expression
   10 | ll fac[MAX], finv[MAX], inv[MAX],mod=1000000007;
      |        ^~~
a.cc:10:19: error: size of array 'finv' is not an integral constant-expression
   10 | ll fac[MAX], finv[MAX], inv[MAX],mod=1000000007;
      |                   ^~~
a.cc:10:29: error: size of array 'inv' is not an integral constant-expression
   10 | ll fac[MAX], finv[MAX], inv[MAX],mod=1000000007;
      |                             ^~~