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 <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef tuple<int, int> duo;
const int dx[] = {0, 0, 1, -1, 1, 1, -1, -1};
const int dy[] = {1, -1, 0, 0, 1, -1, 1, -1};
const int Mod = 1000000000 + 0;
//{{{ templates
#define TT_ template<typename T>inline
#define TTF_ template<typename T,typename F>inline
TT_ T sq(T x){return x*x;}
TT_ T In(){T x;cin>>x;return x;}
TT_ void Out(T&x){cout<<x;}
TT_ void sort(T&v){sort(begin(v),end(v));}
TT_ void revs(T&v){reverse(begin(v),end(v));}
TT_ void uniq(T&v){sort(v);v.erase(unique(begin(v),end(v)),end(v));}
TT_ int ubnd(T&v,typename T::value_type x){return upper_bound(begin(v),end(v),x)-begin(v);}
TT_ int lbnd(T&v,typename T::value_type x){return lower_bound(begin(v),end(v),x)-begin(v);}
TTF_ void inpt(T&v,int n,F f){for(v.reserve(n);n--;v.emplace_back(f()));}
TTF_ void show(T&v,F f,string d=" ",string e="\n"){int i=0;for(auto&x:v)i++&&(cout<<d),f(x);cout<<e;}
TT_ typename T::iterator minel(T&v){return min_element(begin(v),end(v));}
TT_ typename T::iterator maxel(T&v){return max_element(begin(v),end(v));}

inline void fast_io(){ios_base::sync_with_stdio(0);cin.tie(0);}
inline int in(){int x;scanf("%d",&x);return x;}
inline ll pow_mod(ll a,ll k,ll m){ll r=1;for(;k>0;a=a*a%m,k>>=1)if(k&1)r=r*a%m;return r;}
inline ll mod_inv(ll a,ll p){return pow_mod(a,p-2,p);}
//}}} priority_queue queue deque front stringstream max_element min_element insert count make_tuple

int main()
{
  int n, k, s;
  while (n = in(), k = in(), s = in(), n || k || s){
    int dp[16][999] = {};
    dp[0][0] = 1;
    for (int j = 1; j <= n; j++){
      for (int i = k; i > 0; i--){
        for (int x = 0; x < 255; x++){
          dp[i][x + j] += dp[i - 1][x];
        }
      }
    }
    printf("%d\n", dp[k][s]);
  }
  return 0;
}

C++: #include <cstdio>
#include <cstring>

int n,k,s;
int dp[31][15][190];
int main(void){
	while(1){
		scanf("%d %d %d",&n,&k,&s);
		if(n+k+s==0)break;
		memset(dp,0,sizeof(dp));
		dp[0][0][0]=1;
		for(int i=0;i<n;i++){
			for(int l=0;l<=k;l++){
				for(int j=0;j<=s;j++){
					if(dp[i][l][j]>0){
						dp[i+1][l][j]+=dp[i][l][j];
						dp[i+1][l+1][j+i+1]+=dp[i][l][j];
					}
				}
			}
		}
		printf("%d\n",dp[n][k][s]);
	}
	return 0;
}

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

#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i, n) FOR(i, 0, n);

using namespace std;

int dp[21][11][160];
int dfs(int n, int k, int s){
	if(k == 0) return s == 0; 

	int &res = dp[n][k][s];
	if(res >= 0) return res;

	res = 0;
	for(int i = n; i >= k; i--){
		res += dfs(i-1, k-1, s-i);
	}

	return res;
}

int main(){
	int n, k, s;
	memset(dp, -1, sizeof(dp));
	while(cin >> n >> k >> s, n|k|s){
		cout << dfs(n, k, s) << endl;
	}


	return 0;
}

C++: #include<iostream>
#include<cmath>
#include<bitset>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

int cnt(int n){
	int res=0;
	for(int i=0;(1<<i)<=n;i++)if(n&(1<<i))res++;
	return res;
}

int sum(int n){
	int res=0;
	for(int i=0;(1<<i)<=n;i++){
		if((n&(1<<i))>0)res+=(i+1);
	}
	return res;
}

int main(){
	int n,k,s;
	while(cin>>n>>k>>s,n||k||s){
		int ans=0;
		rep(i,pow(2,n)){
			if(cnt(i)==k && sum(i)==s)ans++;
		}
		cout<<ans<<endl;
	}
	return 0;
}

C++: #include<iostream>
#include<cstring>
using namespace std;int x[100][1000][250],a,b,c,i,j,k,l,sum;
int main(){
	while(true){
		sum=0;
		memset(x,0,sizeof(x));
		cin>>a>>b>>c;if(a==0){break;}
		x[0][0][0]=1;
		for(i=1;i<=b;i++){
			for(j=0;j<=c;j++){
				for(l=0;l<a;l++){
					for(k=l+1;k<=a;k++){
						x[i][j+k][k]+=x[i-1][j][l];
					}
				}
			}
		}
		for(i=0;i<=a;i++){sum+=x[b][c][i];}
		cout<<sum<<endl;
	}
}

C++: #include <algorithm>
#include <cstdio>
using namespace std;

int main(){
    int n,k,s,i,c,res;
    while(1){
        scanf("%d",&n);
        scanf("%d",&k);
        scanf("%d",&s);
        if(!n && !k && !s){break;}
        int t[n],cd[n];
        for(i=0;i<n;i++){cd[i]=i+1;t[i]=0;}
        for(i=0;i<k;i++){t[n-i-1]=1;}    
        res=0;
        do{
            c=0;
            for(i=0;i<n;i++){c+=(t[i]*cd[i]);}
            if(c==s){res++;}
        } while(next_permutation(t,t+n));
        printf("%d\n",res);
    }
    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 <= n; m++) {
                            if (j + m > s) {
                                break;
                            }
                            dp[m][j + m] += tmp[i][j];
                        }
                    }
                }
            }
        }
        cout << dp[n][s] << endl;
    }

    return 0;
}