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 <bits/stdc++.h>
#include <numeric>
#define REP(i, s, n) for (int i = s; i < n; ++i)
#define rep(i, n) REP(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define SORT_INV(c) sort((c).begin(), (c).end(), greater<int>())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false
#define LL long long
#define Dev 1000000007

// sort(a.begin(), a.end(), std::greater<int>());
using namespace std;

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

        int num = 0;
        rep(i, pow(2, 10))
        {
            vector<int> hoge;
            rep(j, 10)
            {
                if ((i & (1 << j)) != 0)
                    hoge.push_back(j);
            }
            int piyo = 0;
            if (hoge.size() == n)
            {
                for (auto item : hoge)
                    piyo += item;
            }
            if (piyo == s)
                num++;
        }
        cout << num << endl;
    }
    return 0;
}

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

int c,g;

int hcount(int n,int sum,int bf){
	if(n==0){
		if(sum==g){
			c++;
		}
	}
	else{
		for(int i=bf+1;i<10;i++){
			hcount(n-1,sum+i,i);
		}
	}
	return 0;
}

int main(){
	int n;
	while( scanf("%d %d",&n,&g)!=EOF){
		c=0;
		hcount(n,0,-1);
		printf("%d\n",c);
	}
			
	return 0;
}

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

using namespace std;

int solve(int num, int sum, int n, int s) {

  int scnt = 0;
  if(n) for(int i = num + 1; i < 10; ++i) scnt += solve(i, sum + i, n - 1, s);
  else return (sum == s) ? 1 : 0;
  return scnt;

}

int main() {

  int n, s;

  while(cin >> n >> s) {
    if(n == 0 && s == 0) break;
    cout << solve(-1, 0, n, s) << endl;
  }

}

C++: #include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <map>
#include <set>
#include <cstdio>
#include <cmath>
#define rep(i,l,n) for(lint i=l;i<n;i++)
#define rer(i,l,n) for(lint i=l;i<=n;i++)
#define alint(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define pb(a) push_back(a)
#define mk(a,b) make_pair(a,b)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef vector<int> vi;
typedef vector<lint> vli;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

int n,s,ans=0;

void solve(int n,int sum,int max){
	if(n){
		rep(i,max+1,9){
			solve(n-1,sum+i,i);
		}
	}else if(sum==s){
		ans++; return;
	}
	return;
}


int main(){
	while(1){
		cin>>n>>s;
		if(n==0 && s==0) break;
		ans=0;
		solve(n,0,-1);
		o(ans);
	}
}

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

int n, s, cnt;

void dfs(int i, int sum, int n){
	if(sum==s&&!n){
		cnt++;
		return;
	}
	if(i==10||!n) return;
	//使用する3つを探索
	//使用しなければカウントされない
	dfs(i+1,sum,n);
	dfs(i+1,sum+i,n-1);
}

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

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

int n, s;
int ans;

void tadoru(int f, int step, int sum)
{
	if(sum>s) return;
	if(sum==s){
		if(step==n){
			ans++;
		} else {
			return;
		}
	}
	for(int i=f+1; i<10; i++){
		tadoru(i, step+1, sum+i);
	}
	return;
}

int main()
{
	while(cin>>n>>s){
		if(!n&&!s) break;
		ans = 0;
		tadoru(-1, 0, 0);
		cout<<ans<<endl;
	}
	return 0;
}

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

using namespace std;

int main()
{
	int n[50], s[50], c = 0, dp[10][10][101];

	long long SUM = 0;

	memset(dp, 0, sizeof(dp));

	for (int i = 0; i <= 10; i++)
	{
		dp[1][i][i] = 1;
	}

	for (int N = 2; N <= 9; N++)
	{
		for (int i = 1; i <= 9; i++)
		{
			for (int j = 1; j <= 100; j++)
			{
				if (j - i >= 0)
				{
					for (int k = 0; k < i; k++)
					{
						dp[N][i][j] += dp[N - 1][k][j - i];
					}
				}
			}
		}
	}

	while (true)
	{
		cin >> n[c] >> s[c];

		if (n[c] == 0 && s[c] == 0) { goto Exit; }

		c++;
	}

Exit:;

	for (int p = 0; p < c; p++)
	{
		SUM = 0;

		for (int i = 0; i < 10; i++)
		{
			SUM += dp[n[p]][i][s[p]];
		}

		cout << SUM << endl;
	}

	return 0;
}

C++: // dfs
#include <iostream>
#include <algorithm>
#include <map>
#include <vector>
#include <string>
#include <cstdio>

using namespace std;

int ans, n, s;

void dfs(int pos, int t, int sum)
{
    if(t == n) {
        if(sum == s)
            ans++;
        return;
    }
    if(t > 9)
        return;

    dfs(pos+1, t, sum);
    dfs(pos+1, t+1, sum + pos);
}

int main(void)
{
    while(cin >> n >> s && n) {
        ans = 0;
        dfs(0, 0, 0);
        cout << ans << endl;
    }

    return 0;
}

C++: #include<iostream>
#include<cstring>
using namespace std;
int n, s, cnt;
int array[10];
void Sum(int i, int phase){
	array[phase-1] = i;
	if(phase==n){
		for(;i<s;i++){
			int nsum=0;
			for(int j=0;j<phase;j++){
				nsum+=array[j];
			}
			if(nsum==s)cnt++;
		}
	}else{
		for(i++;i<s;i++){
			Sum(i, phase+1);
		}
	}
	return;
}
int main(){
	while(cin>>n>>s,s!=0 && n!=0){
		memset(array, 0, sizeof(array));
		cnt=0;
		Sum(0, 1);
		cout<<cnt<<endl;
	}
	return 0;
}

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

using namespace std;

int n, s;
int dp[10][100][10];
int solve(int i, int j, int k);

int main(void){
	
	while(cin >> n >> s){
		if(n == 0 && s == 0){break;}
		fill_n(**dp,10*100*10,-1);
		cout << solve(0,0,10) << endl;
	}
}

int solve(int now, int sum, int b1){
	if(now == n){
		if(sum == s){return 1;}
		else return 0;
	}
	if(dp[now][sum][b1] != -1){return dp[now][sum][b1];}
	now++;
	int t = 0;
	for(int i = 0; i < 10; i++){
		if(b1 != 10 && b1 >= i){continue;}
		t += solve(now, sum + i, i);
	}
	return dp[now][sum][b1] = t;
}

C++: #include <iostream>

using namespace std;

int n, s, ans;
void sumNumber(int _count, int _sum, int i);

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

		ans = 0;
		sumNumber(0, 0, 0);

		cout << ans << endl;
	}

	return 0;
}

void sumNumber(int _count, int _sum, int i) {
	if (_count == n && _sum == s)
		ans++;
	else if (i == 9)
		ans += 0;
	else {
		sumNumber(_count + 1, _sum + i, i + 1);
		sumNumber(_count, _sum, i + 1);
	}
}

C++: #include <iostream>
using namespace std;
int n,s,c;
void f(int m,int a,int t){
	if(a == n){
		if(t == s) ++c;
		return;
	}
	else {
		for(int i = m;i < 10;++i){
			f(i + 1,a + 1,t + i);
		}
	}
	return;
}
int main(){
	while(cin >> n >> s && (n != 0 && s != 0)){
		c = 0;
		f(0,0,0);
		cout << c << endl;
	}
	return 0;
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, int> P;
typedef pair<ll, pair<ll, ll> > P3;

const ll MOD = ll(1e9 + 7);
const ll LLINF = LLONG_MAX;
const int IINF = INT_MAX;
const int MAX_N = int(1e5) + 5;
const double EPS = 1e-8;
int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
#define SORT(v) sort((v).begin(), (v).end())
#define SORTR(v) sort((v).rbegin(), (v).rend())
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (ll i = m; i < n; i++)

int rec(int i, int j, int k){
    if(i==0){
        if(k==0)return 1;
        else return 0;
    }
    if(k==0)return 0;
    int res = 0;
    for (int x = j+1;x<=k;x++){
        res += rec(i-1,x,k-x);
    }
    return res;
}

int main() {
    while(1){
        int n,s;
        cin >> n >> s;
        if(n==0)break;
        cout << rec(n,-1,s) << endl;
    }
    
    return 0;
}