Language: C++

#include <iostream>
 
using namespace std;
 
 
 
unsigned long f( int v )
{
    unsigned long r = 1;
 
//    cout << "f() " << v << endl;
    if ( v < 0 ) return 1;
    for ( unsigned long l = v; l > 0; l -- ) {
        r *= l;
    }
//    cout << "f(" << v << ")=" << r << endl;
 
    return r;
}
 
unsigned long ncr( unsigned long n, unsigned long r )
{
    if ( n <= 0 ) return 1;
    if ( r <= 0 ) return 1;
    if ( n < r ) return 1;
    if ( n == r ) return 1;
 
//    cout << n << " C " << r << endl;
 
#if(0) 
    unsigned long ret = f(n) / ( f(r) * f(n-r));
#else
    unsigned long a = 1;
    for ( unsigned long i = 0; i < r; i ++ ) {
        a *= (n-i);
    }
 
//    cout << "ncr() a:" << a << " f(r):" << f(r) << endl;
 
    if ( a == 0 || f(r) == 0 ) return 0;
    unsigned long ret = a / f(r);
#endif
 
    return ret;
}
 
 
 
int main()
{
    int N, K;
 
    cin >> N >> K;
 
    int i;
    for ( i = 1; i <= K; i ++ )  {
//       cout << "i=" << i << endl;
        unsigned long r = ncr( N-K+1, i );
        unsigned long b = ncr( K-1, i-1 );
//        cout << "b:" << b << endl;
//        cout << "r:" << r << endl;
//        cout << b * r << endl;
 
        cout << (b*r) % 1000000007L << endl;
 
    }
 
    return 0;
}
#include <iostream>

using namespace std;



unsigned long f( int v )
{
    unsigned long r = 1;

//    cout << "f() " << v << endl;
    if ( v < 0 ) return 1;
    for ( unsigned long l = v; l > 0; l -- ) {
        r *= l;
    }
//    cout << "f(" << v << ")=" << r << endl;

    return r;
}

unsigned long ncr( unsigned long n, unsigned long r )
{
    if ( n == 0 ) return 1;
    if ( r == 0 ) return 1;
    if ( n < r ) return 1;
    if ( n == r ) return 1;

//    cout << n << " C " << r << endl;

#if(0) 
    unsigned long ret = f(n) / ( f(r) * f(n-r));
#else
    unsigned long a = 1;
    for ( unsigned long i = 0; i < r; i ++ ) {
        a *= (n-i);
    }

//    cout << "ncr() a:" << a << " f(r):" << f(r) << endl;

    if ( a == 0 || f(r) == 0 ) return 0;
    unsigned long ret = a / f(r);
#endif

    return ret;
}



int main()
{
    int N, K;

    cin >> N >> K;

    int i;
    for ( i = 1; i <= K; i ++ )  {
//       cout << "i=" << i << endl;
        unsigned long r = ncr( N-K+1, i );
        unsigned long b = ncr( K-1, i-1 );
//        cout << "b:" << b << endl;
//        cout << "r:" << r << endl;
//        cout << b * r << endl;

        cout << (b*r) % 1000000007L << endl;

    }

    return 0;
}


Compiler output:
a.cc:76:15: error: redefinition of 'long unsigned int f(int)'
   76 | unsigned long f( int v )
      |               ^
a.cc:7:15: note: 'long unsigned int f(int)' previously defined here
    7 | unsigned long f( int v )
      |               ^
a.cc:90:15: error: redefinition of 'long unsigned int ncr(long unsigned int, long unsigned int)'
   90 | unsigned long ncr( unsigned long n, unsigned long r )
      |               ^~~
a.cc:21:15: note: 'long unsigned int ncr(long unsigned int, long unsigned int)' previously defined here
   21 | unsigned long ncr( unsigned long n, unsigned long r )
      |               ^~~
a.cc:118:5: error: redefinition of 'int main()'
  118 | int main()
      |     ^~~~
a.cc:49:5: note: 'int main()' previously defined here
   49 | int main()
      |     ^~~~