Language: C++

use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

pub fn read_n<T: FromStr>(n: usize) -> Vec<T> {
    read_n_logic::<T>(n, vec![])
}

pub fn read_n_logic<T: FromStr>(n: usize, mut a: Vec<T>) -> Vec<T> {
    match n {
        0 => a,
        _ => {
            a.push(read::<T>());
            read_n_logic(n - 1, a)
        }
    }
}
use std::cmp::{max, min};
/// for nCr
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,
        }
    }
    /// nCr
    pub fn ncr(&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
        }
    }
}

const MOD: i64 = 1_000_000_007;

fn main() {
    let n: usize = read();
    let k: i64 = read();
    let mut ans: i64 = 0;

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

    for i in 1..n {
        // i is the abount of 0 rooms
        if k < i as i64 {
            break;
        }

        ans += c.ncr(n, i) * c.ncr(n - 1, n - i - 1) % MOD;
        ans = ans % 1_000_000_007;
    }
    println!("{}", ans + 1);
}


Compiler output:
a.cc:54:18: error: too many decimal points in number
   54 |         for i in 2..n {
      |                  ^~~~
a.cc:90:14: error: too many decimal points in number
   90 |     for i in 1..n {
      |              ^~~~
a.cc:1:1: error: 'use' does not name a type
    1 | use std::io::*;
      | ^~~
a.cc:2:1: error: 'use' does not name a type
    2 | use std::str::FromStr;
      | ^~~
a.cc:4:1: error: 'pub' does not name a type
    4 | pub fn read<T: FromStr>() -> T {
      | ^~~
a.cc:16:1: error: 'pub' does not name a type
   16 | pub fn read_n<T: FromStr>(n: usize) -> Vec<T> {
      | ^~~
a.cc:20:1: error: 'pub' does not name a type
   20 | pub fn read_n_logic<T: FromStr>(n: usize, mut a: Vec<T>) -> Vec<T> {
      | ^~~
a.cc:29:1: error: 'use' does not name a type
   29 | use std::cmp::{max, min};
      | ^~~
a.cc:31:1: error: 'pub' does not name a type
   31 | pub struct Comb {
      | ^~~
a.cc:38:1: error: 'impl' does not name a type
   38 | impl Comb {
      | ^~~~
a.cc:81:10: error: found ':' in nested-name-specifier, expected '::'
   81 | const MOD: i64 = 1_000_000_007;
      |          ^
      |          ::
a.cc:81:7: error: 'MOD' does not name a type
   81 | const MOD: i64 = 1_000_000_007;
      |       ^~~
a.cc:83:1: error: 'fn' does not name a type
   83 | fn main() {
      | ^~