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++: #define _USE_MATH_DEFINES
 
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>

using namespace std;

int test(int n, int s, int i){//n個でsを作る
	//cout << n <<" "<<s<<" "<<i<<endl;
	if(n==0){
		if(s==0){
			return 1;//作れた
		}else{
			return 0;
		}
	}
	if(s-i<0){
		return 0;
	}

	return test(n, s, i+1) + test(n-1, s-i, i+1);
}

int main(){
	
	int km[11][101]={0};
	
	for(int i=0;i<10;i++){
		km[1][i]=1;
	}
	/*
	for(int i=1;i<9;i++){
		for(int j=i-1;j<101;j++){
			for(int k=j;j+k<101;k++){
				if(i+1==3 && j+k==6) cout << i << " "<< j<<" "<<k<<" "<<km[i][j]<<endl;
				if(j!=k){
				km[i+1][j+k]+=km[i][j];
				}else{
					km[i+1][j+k]+=1;
				}
			}
		}
	}
	*/
	/*
	for(int i=2;i<=10;i++){
		/*
		for(int j=0;j<101;j++){
			if(km[i-1][j]){
				for(int k=j+1;k<=10&&j+k<101;k++){
					if(i==3 && j+k==6) cout << j<<" "<<k<<endl;
					
					km[i][j+k]+=km[i-1][j];
				}
			}
		}
		
		for(int j=0;j<10;j++){
			for(int k=0;k<101;k++){
				if(km[i-1][k]&&k>j){
					if(i==3 && k+j==1) cout << j<<" "<<k<<endl;;
					km[i][k+j]++;
				}
			}
		}
	}
	*/
	/*
	for(int i=2;i<=10;i++){//２個で作る組み合わせから計算
		for(int j=0;j<101;j++){//横に調べて行って
			if(km[i-1][j]){//もしあれば
				for(int k=i-1;k<10;k++){
					if(i==2 && k+j==3) cout << j<<" "<<k<<endl;
					km[i][j+k]++;
				}
			}
		}
	}

	for(int i=0;i<10;i++){
		for(int j=0;j<30;j++){
			cout << km[i][j]<<" ";
		}
		cout << endl;
	}
	cout << km[3][6];
	*/
	/*
	int n, s;
	while(cin >> n >> s){
		if(n==0 && s==0) break;
		cout << km[n][s] << endl;
	}
	*/

	int n,s;
	while(cin >> n >> s){
		if(n==0 && s==0) break;
		cout<<test(n,s,0)<<endl;
	}
	return 0;
}

C++: #include<iostream>
#include<iomanip>
#include<algorithm>
#include<string>
#include<vector>
#include<deque>
#include<queue>
#include<numeric>
#include<stdio.h>

using std::cout;
using std::cout;
using std::cin;
using std::setw;
using std::setfill;
using std::string;
using std::pair;
using std::make_pair;
using std::vector;
using std::queue;
using std::deque;
using std::priority_queue;
using std::next_permutation;
using std::iota;
using std::sort;
using std::greater;
using std::max;
using std::min;

#define INF 999999999;
#define MOD 1000000007

using ulli = unsigned long long int;

#define EVEL 1

#ifndef EVEL
#define dbug(X) std::cout << #X << ":" <<X<<" " ;
#define dbugf(s) std::cout << s << " ";
#define dbugln std::cout<<"\n";
#else
#define dbug(X) {}
#define dbugf(s) {}
#define dbugln {}
#endif

int N, S;
int saiki(int n, int last, int sum){
    int rt=0;
    if(n == 1){
        if(sum == S) rt = 1;
    }else{
        for(int i = last+1; i < 10; i++){
            rt += saiki(n-1, i, sum+i);
        }
    }
    return rt;
}

int main(){
	cin.tie(0);
	std::ios::sync_with_stdio(false);
    
    while(1){
        cin >> N >> S;
        if(N == 0 && S == 0) break;
        cout << saiki(N+1, -1, 0) << "\n";
    }
}

C++: #include <iostream>
#include <stack>

using namespace std;

struct set { int next, sum, depth; };

int n, s, cnt;

void dfs(int next, int sum, int depth) {
    stack<set> S;
    set tmp;
    tmp.next = next; tmp.sum = sum; tmp.depth = depth;
    S.push(tmp);
    while (!S.empty()) {
        set u = S.top();

        if (u.depth == n && u.sum == s) {
            cnt++;
        }
        if (u.next == 10 && u.depth == 0 && u.sum == 0) break;

        if (u.next < 10 && u.depth < n) {
            tmp.next = u.next + 1;
            tmp.sum = u.sum;
            tmp.depth = u.depth;
            S.push(tmp);
 
            tmp.next = u.next + 1;
            tmp.sum = u.sum + u.next;
            tmp.depth = u.depth + 1;
            S.push(tmp);
        }
        else if (u.next == 10) {
            int tmp = u.depth;
            while (S.top().depth == tmp) {
                S.pop();
            }
        }
        else {
            S.pop();
        }
    }
}

int main() {
    while (cin >> n >> s) {
        if (n == 0 && s == 0) break;
        cnt = 0;
        dfs(0, 0, 0);
        cout << cnt << endl;
    }
    return 0;
}

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

using namespace std;

int N, S;

int f(int tar, int n, int m)
{
  if (tar < 0) {
    return 0;
  }
  if (n == 0) {
    if (tar == 0) {
      return 1;
    } else {
      return 0;
    }
  }
  if (tar < m) {
    return 0;
  }

  int s = 0;
  for (int i = m + 1; i <= 9; i++) {
    s += f(tar - i, n - 1, i);
  }
  return s;
}
  
void solve()
{
  printf("%d\n", f(S, N, -1));
}

int main()
{
  for (;;) {
    scanf("%d %d ", &N, &S);
    if (N == 0 && S == 0) {
      break;
    }
    solve();
  }
}

C++: //C++14 (Clang 3.8.0)

#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <string>
#include <climits>
using namespace std;
typedef long long ll;
typedef pair<long long,long long> P;
int ans;
int n;
int s;
void dfs(int now,int now2,int sum){
  if(sum==s and now==n) ans++;
  if(now==n or now2==10 or sum>s) return ;
  dfs(now,now2+1,sum);
  dfs(now+1,now2+1,sum+now2); 
}
int main(){
  for(;;){
    ans=0;
    cin>>n;
    cin>>s;
    if(n==0 and s==0)
      break;
    dfs(0,0,0);
    cout<<ans<<endl;
  }
}

C++: #include<stdio.h>

int solve(int a,int b,int c){
	if(a==1&&b>=c&&b<10){
		return 1;
	}
	if(a==1)return 0;
	int ret=0;
	for(int i=c;i<10&&i<b;i++){
		ret+=solve(a-1,b-i,i+1);
	}
	return ret;
}
int main(){
	int a,b;
	while(1){
		scanf("%d%d",&a,&b);
		if(a==0)return 0;
		printf("%d\n",solve(a,b,0));
	}
}

C++: #define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<math.h>

int main() {
	int a=0, b, ans[1024],num[1024];
	for (int i = 0; i < 1024; i++) {
		ans[i] = 0;
		num[i] = 0;
		for (int j = 0; j < 10; j++) {
			int m = 1;
			for (int k = 0; k < j; k++)m *= 2;
			if (i / m % 2 == 1) {
				ans[i] += j;
				num[i]++;
			}
		}
	}
	while (a==a) {
		scanf("%d %d", &a, &b);
		if (a != 0 && b != 0) {
			int an = 0;
			for (int i = 0; i < 1024; i++) {
				if (ans[i] == b && num[i] == a) {
					an++;
				}
			}
			printf("%d\n", an);
		}
		else {
			break;
		}
	}
}

C++: #include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
void func (int cnt,int nowN,int nowS);
int n,s,ans=0;
int main()
{
    while(1){
        scanf("%d%d",&n,&s);
        if(n==0&&s==0)break;
        func (0,0,0);
        printf("%d\n",ans);
        ans=0;
    }
    return 0;
}
void func (int cnt,int nowN,int nowS)
{
    if(cnt==10){
        if(nowN==n&&nowS==s)ans++;
        return;
    }
    /*
    if(cnt==10)return;
    if(cnt==9&&nowN==n&&nowS==s)ans++;
    */

    func(cnt+1,nowN+1,nowS+cnt);//?????¶
    func(cnt+1,nowN,nowS);//?????°??????
}

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

int res = 0;
int n, s;

void solve(int p, int sum, int q)
{
	if(p == n && sum == s){
		res++;
		return;
	}

	if(sum > s) return;

	for(int i=q; i<10; i++)
		solve(p+1, sum+i, i+1);
}

int main(void)
{
	while(cin >> n >> s)
	{
		if(n==0 && s==0) break;

		solve(0, 0, 0);

		cout << res << endl;
		res = 0;
	}
	return 0;
}