Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	io := NewIo()
	defer io.Flush()
	for {
		N, K, S := io.NextInt(), io.NextInt(), io.NextInt()
		if N == 0 {
			break
		}
		dp := [21][11][156]int{}
		for i := 0; i <= N; i++ {
			dp[i][0][0] = 1
		}
		for i := 1; i <= N; i++ {
			for j := 1; j <= K; j++ {
				for k := 1; k <= S; k++ {
					if k-i >= 0 {
						dp[i][j][k] += dp[i-1][j-1][k-i]
					}
					dp[i][j][k] += dp[i-1][j][k]
				}
			}
		}
		io.Println(dp[N][K][S])
	}
}

// I/O template
type Io struct {
	reader    *bufio.Reader
	writer    *bufio.Writer
	tokens    []string
	nextToken int
}

func NewIo() *Io {
	return &Io{
		reader: bufio.NewReader(os.Stdin),
		writer: bufio.NewWriter(os.Stdout),
	}
}

func (io *Io) Flush() {
	err := io.writer.Flush()
	if err != nil {
		panic(err)
	}
}

func (io *Io) NextLine() string {
	var buff []byte
	for {
		line, isPrefix, err := io.reader.ReadLine()
		if err != nil {
			panic(err)
		}
		buff = append(buff, line...)
		if !isPrefix {
			break
		}
	}
	return string(buff)
}

func (io *Io) Next() string {
	for io.nextToken >= len(io.tokens) {
		line := io.NextLine()
		io.tokens = strings.Fields(line)
		io.nextToken = 0
	}
	s := io.tokens[io.nextToken]
	io.nextToken++
	return s
}

func (io *Io) NextInt() int {
	i, err := strconv.Atoi(io.Next())
	if err != nil {
		panic(err)
	}
	return i
}

func (io *Io) NextFloat() float64 {
	i, err := strconv.ParseFloat(io.Next(), 64)
	if err != nil {
		panic(err)
	}
	return i
}

func (io *Io) Println(a ...interface{}) {
	fmt.Fprintln(io.writer, a...)
}

func (io *Io) Printf(format string, a ...interface{}) {
	fmt.Fprintf(io.writer, format, a...)
}

func (io *Io) PrintIntSlice(a []int) {
	b := make([]interface{}, 0, len(a))
	for _, x := range a {
		b = append(b, x)
	}
	io.Println(b...)
}

func (io *Io) PrintStringSlice(a []string) {
	b := make([]interface{}, 0, len(a))
	for _, x := range a {
		b = append(b, x)
	}
	io.Println(b...)
}

func Log(name string, value interface{}) {
	fmt.Fprintf(os.Stderr, "%s=%+v\n", name, value)
}

func ExampleIo() {
	io := NewIo()
	defer io.Flush()
	a := make([]int, 0, 3)
	a[0], a[1], a[2] = io.NextInt(), io.NextInt(), io.NextInt()
	io.Println(a)
	io.PrintIntSlice(a)
	Log("io", a)
}

C++: #include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>

#if __cplusplus >= 201103L
#include <array>
#include <tuple>
#include <initializer_list>
#include <unordered_set>
#include <unordered_map>
#include <forward_list>

#define cauto const auto&
#else

#endif

using namespace std;


namespace{
typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
    stringstream ss;
    ss << f;
    ss >> t;
}


#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define F first
#define S second
#define mkp make_pair
#define RALL(v) (v).rbegin(),(v).rend()


#define MOD 1000000007LL
#define EPS 1e-8
static const int INF=1<<24;
int dp[22][12][160];
void mainmain(){
	reep(i,1,22){
		reep(k,1,160){
			if(k<=i){
				dp[i][1][k]=1;
			}
			else break;
		}
	}
	reep(i,1,22){
		reep(j,2,12){
			if(i<j) break;
			reep(k,1,160){
				rep(l,i){
					if(k-l<0) break;
					dp[i][j][k]+=dp[l][j-1][k-l-1];
				}
			}
		}
	}
	int a,b,c;
	while(cin>>a>>b>>c,a||b||c){
		cout<<dp[a][b][c]<<endl;
	}
}



}
main() try{
    mainmain();
}
catch(...){
}

C++: #include <iostream>
#include <vector>
#include <cstring>
#include <string>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <cassert>
using namespace std;
typedef long long ll;
ll dp[11][50][170];

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	int n, k, s;
	while(cin >> n >> k >> s, n + k + s) {
		memset(dp, 0, sizeof dp);

		dp[0][0][0] = 1;
		for(int i = 0; i < k; i++) {
			for(int j = 0; j <= n; j++) {
				for(int l = 0; l < s; l++) {
					if(dp[i][j][l] == 0) continue;
					for(int m = j + 1; m <= n; m++) {
						if(j + m <= s) {
							dp[i + 1][m][l + m] += dp[i][j][l];
						}
					}
				}
			}
		}

		ll sum = 0;
		for(int i = 0; i <= n; i++) {
			sum += dp[k][i][s];
		}
		cout << sum << endl;
	}
}

C++: #include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <queue>
#include <numeric>
#include <string>
#include <string.h>
#include <map>
#include <set>
#include <functional>
#include <complex>
#include <stack>
#include <tuple>

#define ll long long int

using namespace std;

const int INF = (1<<30) - 1;

const int MAX_N = 20;
const int MAX_K = 10;
const int MAX_S = 155;

int dp[MAX_N+1][MAX_K+1][MAX_S+1];

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    dp[0][0][0] = 1;
    for(int n=0; n<=MAX_N; n++){
        for(int k=0; k<=MAX_K; k++){
            for(int s=0; s<=MAX_S; s++){
                if(n-1>=0 && s-k>=0){
                    if(k-1>=0)
                        dp[n][k][s] += dp[n-1][k-1][s-k];
                    dp[n][k][s] += dp[n-1][k][s-k];
                }
            }
        }
    }
    int N, K, S;
    while(cin>>N>>K>>S, N|K|S){
        cout << dp[N][K][S] << endl;
    }
    
    return 0;
}

C++: #include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
#include <algorithm>
#include <numeric>

using namespace std;
using ll = long long;

int main()
{
    while (true) {
        int n, k, s;
        cin >> n >> k >> s;
        if (n == 0 and k == 0 and s == 0) {
            break;
        }
        if (s < n) {
            cout << 0 << endl;
            continue;
        }
        vector<vector<int>> dp(n + 1, vector<int>(s + 1, 0));  // ?????????i??§??????j
        for (int i = 1; i <= n; i++) {
            dp[i][i] = 1;
        }
        for (int l = 1; l < k; l++) {
            auto tmp = dp;
            fill(dp.begin(), dp.end(), vector<int>(s + 1, 0));
            for (int i = 0; i <= n; i++) {
                for (int j = 0; j <= s; j++) {
                    if (tmp[i][j] > 0) {
                        for (int m = i + 1; m <= min(n, s - j); m++) {
                            dp[m][j + m] += tmp[i][j];
                        }
                    }
                }
            }
        }
        int sum = 0;
        for (int i = 0; i <= n; i++) {
            sum += dp[i][s];
        }
        cout << sum << endl;
    }

    return 0;
}

C++: #include <bits/stdc++.h>
#define range(i, a, n) for(int (i) = (a); (i) < (n); (i)++)
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
using namespace std;
int n, k, s;
int dfs(int d, int pnum, int cs){
    if(cs + pnum >= s) return 0;
    if(d == k - 1){
        int cnum = s - cs;
        if(pnum < cnum and cnum <= n){
            return 1;
        }
    }

    int ret = 0;
    range(i, pnum + 1, n + 1){
        ret += dfs(d + 1, i, cs + i);
    }
    return ret;
}
int main(void){
    for(; cin >> n >> k >> s, n;){
        cout << dfs(0, 0, 0) << endl;
    }

    return 0;
}