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 <string.h>
#include <iostream>

using namespace std;

int main()
{
	const int MAX_NO  = 9;
	const int MAX_NOS = 9;
	const int MAX_SUM = 100;

	int n[50], s[50], c = 0, dp[MAX_NOS + 1][MAX_NO + 1][MAX_SUM + 1];

	long long SUM = 0;

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

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

	for (int N = 2; N <= MAX_NOS; N++)
	{
		for (int i = 1; i <= MAX_NO; i++)
		{
			for (int j = 1; j <= MAX_SUM; 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 <= MAX_NO; i++)
		{
			SUM += dp[n[p]][i][s[p]];
		}

		cout << SUM << endl;
	}

	return 0;
}

C++: #include "stdio.h"
#include <vector>
#include <iostream>

using namespace std;

class Puzzle
{
public:
	vector<int> used;


	void input()
	{

	}

	void play()
	{
		int n;
		int s;
		int ans = 0;
		used = vector<int>(10, 0);

		while (1) {
			cin >> n >> s;
			if (n == 0) break;

			ans = try_sum(n, s, 0);
			printf("%d\n",ans);
		}
	}

	int try_sum(int n, int s, int min)
	{
		if (n == 0 && s == 0) return 1;
		if (n == 0 || s <= 0) return 0;
		int ans = 0;

		for (int ni = min; ni < 10; ni++) {
			if (used[ni] == 0 ) {
				used[ni] = 1;
				ans += try_sum(n - 1, s - ni, ni + 1);
				used[ni] = 0;
			}
		}

		return ans;
	}

};


int main()
{
　　　　Puzzle puz;

	puz.play();

    return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <cmath>
#include <string>
#include <sstream>
#include <iomanip>
#include <complex>
using namespace std;
 
#define ll long long
#define vvi vector< vector<int> >
#define vi vector<int>
#define All(X) X.begin(),X.end()
#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 pb push_back 
#define pii pair<int,int>
#define mp make_pair
#define pi 3.14159265359
#define shosu(X) fixed << setprecision(X)
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

//????????????
//test?????£???wrong answer????????£??????

int n,s;
int c;

void search(int a,int sum,int before){
  FOR(i,before,10){
	if(sum+i>s) continue;
	if(a<n) search(a+1,sum+i,i+1);
	else if(sum+i==s) {
	  //	  	  cout << i <<" " << sum << " " << before-1 << endl;
	  c++;
	}
  }
}

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

	cout << c << endl;

  }
}

C++: #include <iostream>

using namespace std;

int n, s, cnt;
int a[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};

void dfs(int i, int sum, int k) {

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

    if (i == 10 || k == n || sum > s) { return; }

    dfs(i + 1, sum + a[i], k + 1);

    dfs(i + 1, sum, k);
}

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

C++: #include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;

#define all(c) (c).begin(), (c).end()
#define pb push_back
#define mp make_pair
#define EXIST(v,i) (find(all(v), i) != (v).end())
#define ERASE(v,i) (v).erase(remove(all(v), i), (v).end())
#define INDEX(v,i) (find(all(v), i) - (v).begin())
#define rep(i,n) for(int i = 0; i < (int)n; ++i)
#define debug(x) cerr << #x << " = " << (x) << endl;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

const int INF = 100000000;
const double PI = 3.14159265358979323846;
const double EPS = 1e-10;

int ans;
int n,s;

void solve(int num, int sum, int select) {
	if(num > 9) return;
	if(select == n && sum == s) {
		ans++;
		return;
	}
	if(sum > s) return;
	if(select > n) return;
	solve(num+1, sum, select);
	solve(num+1, sum+num, select+1);
}

int main() {
	for(; cin>>n>>s && n && s;) {
		ans = 0;
		solve(0, 0, 0);

		cout << ans << endl;
	}
	return 0;
}