Go: package main

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

func solve(a, b, c int) int {
	if a == 1 && b >= c && b < 10 {
		return 1
	}
	if a == 1 {
		return 0
	}
	ret := 0
	for i := c; i < 10 && i < b; i++ {
		ret += solve(a-1, b-i, i+1)
	}
	return ret
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	for {
		scanner.Scan()
		a, _ := strconv.Atoi(scanner.Text())
		if a == 0 {
			break
		}
		scanner.Scan()
		b, _ := strconv.Atoi(scanner.Text())
		fmt.Println(solve(a, b, 0))
	}
}

C++: #include <iostream>
#include <cstring>
using namespace std;

int c[11][11][46];

int solve(int n, int index, int s) {
    if (0 <= s && s < 46 && c[n][index][s] >= 0) {
        return c[n][index][s];
    }
    if (n == 0 && s == 0) {
        return 1;
    } else if (n == 0 || s <= 0 || s < index || 9 < index) {
        return 0;
    }
    int res = 0;
    res += solve(n - 1, index + 1, s - index);
    res += solve(n, index + 1, s);
    return c[n][index][s] = res;
}

int main() {
    while (true) {
        int n, s;
        cin >> n >> s;
        if ((n | s) == 0) {
            break;
        }
        memset(c, -1, sizeof(c));
        cout << solve(n, 0, s) << endl;
    }
}

C++: // This is free and unencumbered software released into the public domain.

// Anyone is free to copy, modify, publish, use, compile, sell, or
// distribute this software, either in source code form or as a compiled
// binary, for any purpose, commercial or non-commercial, and by any
// means.

// In jurisdictions that recognize copyright laws, the author or authors
// of this software dedicate any and all copyright interest in the
// software to the public domain. We make this dedication for the benefit
// of the public at large and to the detriment of our heirs and
// successors. We intend this dedication to be an overt act of
// relinquishment in perpetuity of all present and future rights to this
// software under copyright law.

// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
// OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.

// For more information, please refer to <http://unlicense.org>

/****************/
/* template.hpp */
/****************/

#include <algorithm>
#include <cassert>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <numeric>

using std::abs;
using std::cerr;
using std::cout;
using std::endl;
using std::max;
using std::min;
using std::numeric_limits;
using std::swap;

struct BoolName : std::numpunct<char> {
  std::string t, f;
  BoolName (std::string t, std::string f) : t(t), f(f) {}
  std::string do_truename() const {return t;}
  std::string do_falsename() const {return f;}
};

void set_bool_name(std::string t, std::string f) {
  cout.imbue(std::locale(cout.getloc(), new BoolName(t, f)));
}

struct Initializer {
  Initializer() {
    cout << std::fixed << std::setprecision(15) << std::boolalpha;
    set_bool_name("Yes", "No");
  }
} initializer;

struct Input {
  bool eof;

  Input() : eof(false) {}

  operator char() {
    char v;
    this->eof = (std::scanf("%c", &v) != 1);
    return v;
  }

  operator int() {
    int v;
    this->eof = (std::scanf("%d", &v) != 1);
    return v;
  }

  operator long() {
    long v;
    this->eof = (std::scanf("%ld", &v) != 1);
    return v;
  }

  operator long long() {
    long long v;
    this->eof = (std::scanf("%lld", &v) != 1);
    return v;
  }

  operator double() {
    double v;
    this->eof = (std::scanf("%lf", &v) != 1);
    return v;
  }

  operator long double() {
    long double v;
    this->eof = (std::scanf("%Lf", &v) != 1);
    return v;
  }

  void ignore() const {
    getchar();
  }
} in;

template<typename T> bool chmin(T& a, T b) {return a > b ? a = b, true : false;}

template<typename T> bool chmax(T& a, T b) {return a < b ? a = b, true : false;}

template<typename T, typename S> std::function<S(T)> cast() {
  return [](const T& t) { return static_cast<S>(t); };
}

/************/
/* main.cpp */
/************/

int main() {
  int dp[11][101]{};
  dp[0][0] = 1;
  for (int i = 0; i < 10; ++i) {
    for (int j = i; j >= 0; --j) {
      for (int k = 0; k + i <= 100; ++k) {
        dp[j + 1][k + i] += dp[j][k];
      }
    }
  }
  for (int n, s; n = in, s = in, n != 0 || s != 0;) {
    cout << dp[n][s] << endl;
  }
}

C++: #include <iostream>

using namespace std;

int main() {

	while(true) {
		int n,s;
		cin >> n >> s;
		if (!n && !s) break;

		int ans = 0;

		for (unsigned i = 0; i < 1<<10; ++i) {
			int sum = 0, cnt = 0;
			for(unsigned j = 0; j < 10; ++j) {
				if ((i>>j)&1) {
					sum += j;
					cnt++;
				}
			}

			if (sum == s && cnt == n) ans++;
		}

		cout << ans << endl;
	}

	return 0;
}

C++: #include <cstdio>

using namespace std;

int count(int n, int s, int begin) {
  if (n == 1) { return begin <= s && s <= 9 ? 1 : 0; }
  int acc = 0;
  for (int i = begin; i < s - i; ++i) {
    acc += count(n - 1, s - i, i + 1);
  }
  return acc;
}

int main() {
  while (true) {
    int n, s;
    scanf("%d %d", &n, &s);
    if (n == 0 && s == 0) { break; }
    printf("%d\n", count(n, s, 0));
  }

  return 0;
}

C++: #include <iostream>
using namespace std;

int counter(int n, int s,int a){
	if(n == 1)
		if(0 <= s && s <= a){
			cout << "OK" << endl;
			return 1;
		} else {
			return 0;
		};
	if(n == 0) return 0;
	int max = a;
	int count = 0;
	for(int j = 1; j <= a; j++){
		if(s - j >= 0)
			count += counter(n - 1, s - j, j - 1);
	}
	return count;
}
int main(){
	int n,s;
	while(cin >> n >> s){
		if(n == 0 && s == 0) break;
		cout << counter(n, s, 9) << endl;
	}
	return 0;
}

C++: #define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl;
typedef long long ll;
typedef unsigned long long ull;

int n, s;
int a[10];

int combi(int i, int s, int t)
{
    if (s == 0 && t == n)
        return 1;
    if (i == 10 || t == n)
        return 0;

    return combi(i + 1, s, t) + combi(i + 1, s - a[i], t + 1);
}
int main()
{
    rep(i, 10) a[i] = i;

    while (cin >> n >> s, n)
    {

        OP(combi(0, s, 0));
    }

    return 0;
}

C++: // 2014/09/10 Tazoe

#include <iostream>
using namespace std;

int cnt;

void DFS(int n, int s, int m)
{
	if(n==0 && s==0){
		cnt++;
		return;
	}

	if(!(n>0 && s>=0 && m<9))
		return;

	DFS(n-1, s-m, m+1);
	DFS(n, s, m+1);
}

int main()
{
	while(true){
		int n, s;
		cin >> n >> s;

		if(n==0 && s==0)
			break;

		if(s>45){
			cout << 0 << endl;
			continue;
		}

		cnt = 0;

		DFS(n, s, 0);

		cout << cnt << endl;
	}

	return 0;
}

C++: #include <iostream>
#include <stdlib.h>

using namespace std;

int count;

void func(int n, int s, int tmp, int num)
{
	if(tmp == s && n == 0){
		count++;
		return ;
	}

	for(int i = num; (i+tmp) <= s; i++){
		if(i == tmp){
			break;
		}
		func(n-1, s, i+tmp, num+1);
	}
	
	return ;
}

int main(int argc, char **argv){
	int n, s;
	
	while(1){
		cin >> n >> s;
		
		if(n == 0 && s == 0){
			break;
		}
		count = 0;
		
		for(int i = 0; i <= (s-n); i++){
			func(n-1, s, i, 1);
		}
		
		cout << count << endl;
	}
	
	return 0;
}