AtCoder problem 015

C++ solution:
#include <iostream>
#include <vector>
using ll = long long;
#define mod 1000000007
using namespace std;

//34[ms]
struct mint{
  ll x;
  mint(ll x = 0) : x((x + mod) % mod){}
  mint operator-() const{ return mint(-x); }
  mint operator+=(const mint &a){
    if((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint &operator++(){
    if(++x == mod) x = 0;
    return *this;
  }
  mint operator++(int){
    mint temp = *this;
    if(++x == mod) x = 0;
    return temp;
  }
  mint &operator-=(const mint &a){
    if((x -= a.x) < 0) x += mod;
    return *this;
  }
  mint &operator--(){
    if(--x < 0) x += mod;
    return *this;
  }
  mint operator--(int){
    mint temp = *this;
    if(--x < 0) x += mod;
    return temp;
  }
  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;
  }
  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; }
  friend istream &operator>>(istream &is, mint &a){ return is >> a.x; }
  friend ostream &operator<<(ostream &os, const mint &a){ return os << a.x; }
};
const int len = 100010;
vector<mint> fact(len), invfact(len);
mint choose(int n, int r){
  return fact[n] * invfact[n - r] * invfact[r];
}

int main(){
  fact[0] = fact[1] = 1;
  for(int i = 2; i < len; i++) fact[i] = fact[i - 1] * i;
  invfact[len - 1] = fact[len - 1].inv();
  for(int i = len - 2; i >= 0; i--) invfact[i] = invfact[i + 1] * (i + 1);

  int n;
  cin >> n;
  for(int k = 1; k <= n; k++){
    mint ans = 0;
    for(int j = 1; (j-1)*k+1 <= n; j++){
      int num = n - ((j-1)*k + 1);
      //j+1 H num
      ans += choose(j + num, j);
    }
    cout << ans << "\n";
  }
}


Python solution: # でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..)
N = int(input())

MOD = 10**9 + 7
class Mint:
    __slots__ = ('value')

    def __init__(self, value=0):
        self.value = int(value) % MOD
        if self.value < 0: self.value += MOD

    def inverse(self):
        a, b = self.value, MOD
        u, v = 1, 0
        while b:
            t = a // b
            b, a = a - t * b, b
            v, u = u - t * v, v
        if u < 0: u += MOD
        return u

    def __repr__(self): return str(self.value)
    def __int__(self): return self.value
    def __eq__(self, other): return self.value == other.value
    def __neg__(self): return Mint(-self.value)
    def __hash__(self): return hash(self.value)
    def __bool__(self): return self.value != 0

    def __iadd__(self, other):
        self.value = (self.value + int(other)) % MOD
        return self

    def __add__(self, other):
        new_obj = Mint(self.value)
        new_obj += other
        return new_obj
    __radd__ = __add__

    def __isub__(self, other):
        self.value = (self.value - int(other)) % MOD
        if self.value < 0: self.value += MOD
        return self

    def __sub__(self, other):
        new_obj = Mint(self.value)
        new_obj -= other
        return new_obj

    def __rsub__(self, other):
        new_obj = Mint(int(other))
        new_obj -= self
        return new_obj

    def __imul__(self, other):
        self.value = self.value * int(other) % MOD
        return self

    def __mul__(self, other):
        new_obj = Mint(self.value)
        new_obj *= other
        return new_obj
    __rmul__ = __mul__

    def __ifloordiv__(self, other):
        other = other if isinstance(other, Mint) else Mint(other)
        self *= other.inverse()
        return self

    def __floordiv__(self, other):
        new_obj = Mint(self.value)
        new_obj //= other
        return new_obj

    def __rfloordiv__(self, other):
        new_obj = Mint(int(other))
        new_obj //= self
        return new_obj

class FactorialUtils:
    __slots__ = ('fac', 'ifac')

    def __init__(self, n):
        self.fac = [1] * (n + 1)
        self.ifac = [1] * (n + 1)
        for i in range(2, n + 1): self.fac[i] = self.fac[i - 1] * i % MOD
        self.ifac[n] = pow(self.fac[n], MOD - 2, MOD)
        for i in range(n, 1, -1): self.ifac[i - 1] = self.ifac[i] * i % MOD

    def choose(self, n, r):
        if r < 0 or r > n: return 0
        return (self.fac[n] * self.ifac[n - r] % MOD) * self.ifac[r] % MOD

    def multichoose(self, u, k):
        return (self.fac[u + k - 1] * self.ifac[u - 1] % MOD) * self.ifac[k] % MOD

    def permutation(self, n, r):
        if r < 0 or r > n: return 0
        return self.fac[n] * self.ifac[n - r] % MOD

fu = FactorialUtils(N)
for k in range(1, N + 1):
    ans = Mint()
    for i in range(N // k + 1):
        ans += fu.choose(N - (k - 1) * i, i + 1)
    print(ans)