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 ret;
int s;

void dfs(int begin, int depth, int sum){
  int i;
  //cout << "(" << begin << " , " << depth << " , " << sum << ")" << endl;
  if(depth == 0){
	if(s == sum){
	  //cout << "ret++" << endl;
	  ret++;
	}
	return;
  }
  for(i=begin+1;i<=9;i++){
	dfs(i,depth-1, sum+i);
  }
}


int main(void){
  int n;
  int i;
  while(1){
	cin >> n >> s;
	if(n==0 && s==0) break;
	for(i=0;i<=9;i++){
	  dfs(i, n-1, i);
	}
	cout << ret << endl;
	ret = 0;
  }
  return 0;
}

C++: #include<stdio.h>
int sum(int a,int x,int n,int n2,int s);
int hako[10];
int type;

int main(void){
	int n,s;
	
	while(1){
		scanf("%d %d",&n,
			&s);
		if(n==0&&s==0){break;}
		type=0;
		type=sum(0,0,n,n,s);
		printf("%d\n",type);
	}
	return 0;
}

int sum(int a,int x,int n,int n2,int s)
{
	int i,sum_num=0;
	
	if(n==0){
		sum_num=0;
		for(i=0;i<n2;i++){
			sum_num+=hako[i];
		}
		if(s==sum_num){
			type++;
		}
		return type;
	}
	for(i=a;i<=9;i++){
		hako[x]=i;;
		if(x!=0){
			if(hako[x-1]==hako[x]){
				continue;
			}
		}
		sum(i+1,x+1,n-1,n2,s);
	}
	return type;
}

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

// グローバル変数としてn, s, ansを定義
int n, s, ans;

void dfs(int i, int sum, int N){  // iは深さ、sumは和、Nは使用した項数
	// 最初はi,sum,Nともに0であることに注意
	
	// 使用した項数がちょうどnかつ、和がsであれば、ans++
	if(N==n && sum==s){
		ans++;
		return;
	}
	// 深さが最後まで到達または、使用した項数がnにもかかわらず和がsでなければ終了
	if(i==10 || N==n){
		return;
	}
	// その数を足す
	dfs(i+1, sum+i, N+1);
	// 足さない
	dfs(i+1, sum, N);
}


int main()
{
	while(cin>>n>>s){
		if(n==0 && s==0){
			break;
		}
		
		// ansを初期化
		ans = 0;
		dfs(0, 0, 0);
		cout<<ans<<endl;
		
	}
	return 0;
}

C++: #include<stdio.h>
int n,m;

int f(int depth, int sum, int s)
{
    if(depth == 10)
    {
        if(sum == n && s == m)return 1;
        return 0;
    }
    return f(depth+1,sum+1,s+depth) + f(depth+1,sum,s);
}
int main()
{
    while(scanf("%d%d",&n,&m),n+m)
    {
        printf("%d\n",f(0,0,0));
        return 0;   
    }    
}

C++: #include <cmath>
#include <ctime>
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <stack>
#include <bitset>
#include <functional>
#include <numeric>
#include <utility>
#include <iomanip>
#include <cstdio>
#include <cctype>
#include <queue>
#include <complex>
#include <climits>
#include <cstring>

using namespace std;

const int INF = 1 << 29;
typedef long long ll;
typedef pair<int,int> PI;

int n, s, t, res;

void dfs(int n, int t, int sum){
	if(n == 0 && sum == s) {
		res++;
		return ;
	}
	if(sum > s || n <= 0 || t > s-sum) return ;
	for(int i=t+1; i<=s; ++i){
		dfs(n-1, i, sum+i-1);
	}
}

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

	return 0;
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 10e15+9
#define MOD 1000000007
#define EPS 1e-10
#define MAX_N 100100
#define MAX_M 100100

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;
typedef pair<P, char> PC;

int n, s;
int ans = 0;

void dfs(int i, int sum, int num){
	if (i == n&&sum == s){
		ans++;
		return;
	}

	for (int j = num; j < 10; j++){
		dfs(i + 1, sum + j, j);
	}
	return;
}

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

C++: #include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <queue>
#include <map>
#include <set>
using namespace std;
typedef long long ll;
const int INF = 1<<30; 
const int MOD = 1e9 + 7;
const int dy[] = {1, 0, -1, 0};
const int dx[] = {0, 1, 0, -1};
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, s;
    while(cin >> n >> s, n | s)
    {
        set<vector<int>> st;
        for(int bit = 0; bit < (1<<10); bit++)
        {
            vector<int> v;
            int sum = 0;
            for(int i = 0; i < 10; i++)
            {
                if(bit & (1<<i))
                {
                    v.push_back(i);
                    sum += i;
                }
            }
            if(sum == s && v.size() == n)
            {
                sort(v.begin(), v.end());
                st.insert(v);
            }
        }
        cout << st.size() << endl;
    }
    return 0;
}

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

int search(int i, int left, int count){
	if(i == 10){
		return left == 0 && count == 0;
	}
	return search(i + 1, left, count) + search(i + 1, left - i, count - 1);
}

int main(){
	int n, s;

	while(scanf("%d%d", &n, &s), n + s){
		std::cout << search(0, s, n) << std::endl;
	}

	return 0;
}

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

void search(int last, int s, int n)
{
    if(n==0){
        if(s==0) c++;
        return;
    }
    if(n==1){
        if(last<s&&s<10) c++;
        return;
    }
    --n;
    for(int i=last+1; i<10; i++){
        search(i, s-i, n);
    }
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    while(true){
        int n, s;
        cin>>n>>s;
        if(n==0&&s==0) break;
        c=0;
        for(int i=0; i<10; i++){
            search(i, s-i, n-1);
        }
        cout<<c<<'\n';
    }
    return 0;
}

C++: #include <algorithm>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <cassert>
#include <functional>

using namespace std;

#define LOG(...) printf(__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define CLR(a) memset((a), 0 ,sizeof(a))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int dx[] = { -1, 0, 1, 0 }; const int dy[] = { 0, 1, 0, -1 };
int ans;
int n, s;
void dfs(int sum,int i,int m){
	if (m == 0 && sum == s)
	ans++;
	if (i == 10 | m == 0)
	return ;	
	dfs(sum+i,i+1,m-1);
	dfs(sum, i + 1, m);
}

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