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++: // tsukasa_diary's programing contest code template
#include <bits/stdc++.h>
using namespace std;
// define
#define for_(i,a,b) for(int i=a;i<b;++i)
#define for_rev(i,a,b) for(int i=a;i>=b;--i)
#define allof(a) a.begin(),a.end()
#define minit(a,b) memset(a,b,sizeof(a))
#define size_of(a) (int)a.size()
// typedef
typedef long long lint;
typedef double Double;
typedef pair<int, int> pii;
//
typedef vector< int > Array;
typedef vector< Array > Matrix;
typedef vector< Double > DArray;
typedef vector< DArray > DMatrix;
typedef vector< string > SArray;
typedef vector< pii > PArray;
// popcount
inline int POPCNT(int _x) { return __builtin_popcount(_x); }
inline int POPCNT(lint _x) { return __builtin_popcountll(_x); }
// inf
const int iINF = 1L << 30;
const lint lINF = 1LL << 60;
// eps
Double EPS = 1e-9;
// in range
inline bool in_range(int _v, int _mx, int _mi) { return _mi <= _v && _v < _mx; }
inline bool in_range(Double _v, Double _mi, Double _mx) { return -EPS < _v - _mi && _v - _mx < EPS; }
inline bool in_range(int _x, int _y, int _W, int _H) { return 0 <= _x && _x < _W && 0 <= _y && _y < _H; }
// neighbor clockwise
const int DX[4] = {0,1,0,-1}, DY[4] = {-1,0,1,0};
const int DX_[8] = {0,1,1,1,0,-1,-1,-1}, DY_[8] = {-1,-1,0,1,1,1,0,-1};

int n, k, s;

int dp[25][11][200];

void solve() {
	minit(dp, 0);
	
	dp[0][0][0] = 1;
	for_(i,0,n) {
		int add = i + 1;
		
		for_(j,0,k + 1) {
			
			for_(v,0,s+1) {
				dp[i + 1][j][v] += dp[i][j][v];
				dp[i + 1][j + 1][v + add] += dp[i][j][v];
			}
		}
	}
	
	cout << dp[n][k][s] << endl;
}

int main() {
	while (cin >> n >> k >> s, n) {
		solve();
	}
	return 0;
}

C++: #include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"

using namespace std;

const long long int MOD = 1000000007;

long long int N, M, K, H, W, L, R;

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

	cin >> N >> M >> K;
	while (N) {
		vector<vector<vector<int>>>dp(N + 1, vector<vector<int>>(M + 1, vector<int>(K + 1)));
		dp[0][0][0] = 1;
		for (int i = 1; i <= N; i++) {
			for (int j = 1; j <= M; j++) {
				for (int k = i; k <= K; k++) {
					for (int l = 0; l < i; l++) {
						dp[i][j][k] += dp[l][j - 1][k - i];
					}
				}
			}
		}
		int ans = 0;
		for (int i = 1; i <= N; i++) {
			ans += dp[i][M][K];
		}
		cout << ans << endl;
		cin >> N >> M >> K;
	}
	return 0;
}

C++: //By Lin
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <bitset>
#include <cmath>
#include <string>
#include <cstdlib>
#include <vector>
#include <queue>

#define X first
#define Y second
#define mp make_pair
#define sqr(x) ((x) * (x))
#define Rep(i, n) for(int i = 0; i<(n); i++)
#define foreach(it, n) for(__typeof(n.begin()) it = n.begin(); it != n.end(); it++)

using namespace std;
typedef long long LL;
typedef pair<int, int> pii;

#define esp 1e-8
#define N 100010
#define MOD 1000000007

int n, K, lim, ans;

void dfs(int cur, int val, int lim) {
	if (lim < (K - cur) * val) return;
	if (lim > (K - cur) * n) return;
	if (cur == K) {
		if (lim == 0) ans++;
		return;
	}
	for (int i = val; i <= n; i++) 
		dfs(cur + 1, i + 1, lim - i);
}

int main() {
	while (~scanf("%d%d%d", &n, &K, &lim)) {
		if (n == 0) break;
		ans = 0;
		dfs(0, 1, lim);
		printf("%d\n", ans);
	}
	return 0;
}

C++: #include <bits/stdc++.h>

#define ascent(i, a, b) for(int i = a; i < b; i ++)

int ans;
int n, k, s;

using namespace std;

void find(int level, int num, int sum) {
  if(level == k) {
    if(sum == s) {
      ans ++;
    }
    return;
  }

  ascent(i, num+1, n+1) {
    find(level+1, i, sum+i);
  }
}

int main() {
  while(cin >> n >> k >> s, n||k||s) {
    ans = 0;
    find(0, 0, 0);
    cout << ans << endl;
  }

  return 0;
}

C++: #include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <bitset>

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;
typedef long long ll;

int n,k,s;

int main()
{
    while(cin >> n >> k >> s) {
        if(n == 0 || k == 0 || s == 0) break;
        
        int ans = 0;
        rep(i,1<<n) {
            bitset<20> bit(i);
            if(bit.count() == k) {
                int sum = 0;
                rep(i,20) {
                    if(bit[i]) {
                        sum += i+1;
                    } 
                }

                if(sum == s) {
                    ans++;
                }
            }
        }
        cout << ans << endl;
    }

    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
int n, k, s;
int ans;

void func(int cnt, int sum, int pre){
  if(cnt == k){
    if(sum == s) ans++;
    return;
  }
  if(cnt > k) return;
  for(int i = pre-1; i > 0; i--){
    func(cnt+1, sum + i, i);
  }
}

int main(void){
  ios::sync_with_stdio(false);
  cin.tie(0);
  while(cin >> n >> k >> s, n | k | s){
    ans = 0;
    func(0, 0, n+1);
    cout << ans << endl;
  }
  return 0;
}