Language: C++

#include <cstdio>
#include <cmath>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>

#ifdef _DEBUG
#define DMP(x) cerr << #x << ": " << x << "\n"
#else
#define DMP(x) ((void)0)
#endif

const int MOD = 1000000007, INF = 1111111111; 
using namespace std;
using lint = long long;

template<int Modulo = MOD> struct Mint {
	lint val;
	constexpr Mint(lint v = 0) noexcept : val(v % Modulo) {
		if (val < 0) v += Modulo;
	}
	constexpr int getmod() { return Modulo; }
	constexpr Mint operator - () const noexcept { return val ? Modulo - val : 0; }
	constexpr Mint& operator += (const Mint& r) noexcept {
		val += r.val;
		if (val >= Modulo) val -= Modulo;
		return *this;
	}
	constexpr Mint& operator -= (const Mint& r) noexcept {
		val -= r.val;
		if (val < 0) val += Modulo;
		return *this;
	}
	constexpr Mint& operator *= (const Mint& r) noexcept {
		val = val * r.val % Modulo;
		return *this;
	}
	constexpr Mint& operator /= (const Mint& r) noexcept {
		lint a = r.val, b = Modulo, u = 1, v = 0;
		while (b) {
			lint t = a / b;
			a -= t * b; swap(a, b);
			u -= t * v; swap(u, v);
		}
		val = val * u % Modulo;
		if (val < 0) val += Modulo;
		return *this;
	}
	constexpr Mint operator + (const Mint& r) const noexcept { return *this += r; }
	constexpr Mint operator - (const Mint& r) const noexcept { return *this -= r; }
	constexpr Mint operator * (const Mint& r) const noexcept { return *this *= r; }
	constexpr Mint operator / (const Mint& r) const noexcept { return *this /= r; }
	constexpr bool operator == (const Mint& r) const noexcept {
		return this->val == r.val;
	}
	constexpr bool operator != (const Mint& r) const noexcept {
		return this->val != r.val;
	}
	friend ostream &operator << (ostream &os, const Mint<Modulo>& x) noexcept {
		return os << x.val;
	}
	friend istream& operator >> (istream &is, Mint<Modulo>& x) noexcept {
		lint tmp; is >> tmp;
		x = Mint<Modulo>(tmp);
		return is;
	}
	friend constexpr Mint<Modulo> modpow(const Mint<Modulo> &a, lint n) noexcept {
		Mint res(1), tmp = a;
		while (n > 0) {
			if (n & 1) res *= tmp;
			tmp *= tmp;
			n >>= 1;
		}
		return res;
	}
};

using mint = Mint<>;

class Combi {
private:
	vector<mint> fac, inv, finv;

	void init(int N) {
		fac[0] = fac[1] = 1; inv[1] = 1; finv[0] = finv[1] = 1;

		for (int i = 2; i < N; i++) {
			fac[i] = fac[i - 1] * i;
			inv[i] = - inv[MOD%i] * (MOD / i);
			finv[i] = finv[i - 1] * inv[i];
		}
	}

public:
	Combi(int N = 10000) : fac(N + 1), inv(N + 1), finv(N + 1) { init(N + 1); }

	mint Cmod(int n, int k) {
		if (n < k) return 0;
		if (n < 0 || k < 0) return 0;
		return fac[n] * (finv[k] * finv[n - k]);
	}

	mint Pmod(int n, int k) {
		if (n < k) return 0;
		if (n < 0 || k < 0) return 0;
		return fac[n] * finv[n - k];
	}
};

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int N, K;
	cin >> N >> K;

	Combi C;

	for (int i = 1; i <= K; i++) cout << C.Cmod(N - K + 1, i) * C.Cmod(K - 1, i - 1) % MOD << "\n";

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:124:90: error: no match for 'operator%' (operand types are 'Mint<>' and 'const int')
  124 |         for (int i = 1; i <= K; i++) cout << C.Cmod(N - K + 1, i) * C.Cmod(K - 1, i - 1) % MOD << "\n";
      |                                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~
      |                                                                   |                        |
      |                                                                   Mint<>                   const int
a.cc: In instantiation of 'constexpr Mint<Modulo> Mint<Modulo>::operator*(const Mint<Modulo>&) const [with int Modulo = 1000000007]':
a.cc:92:26:   required from here
   92 |                         fac[i] = fac[i - 1] * i;
      |                                               ^
a.cc:55:81: error: passing 'const Mint<>' as 'this' argument discards qualifiers [-fpermissive]
   55 |         constexpr Mint operator * (const Mint& r) const noexcept { return *this *= r; }
      |                                                                           ~~~~~~^~~~
a.cc:38:25: note:   in call to 'constexpr Mint<Modulo>& Mint<Modulo>::operator*=(const Mint<Modulo>&) [with int Modulo = 1000000007]'
   38 |         constexpr Mint& operator *= (const Mint& r) noexcept {
      |                         ^~~~~~~~