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<stdio.h>
#include<math.h>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
int main(){
	int i,j,k,l,m,a,b;
	vector< vector<int> > s;
	s.resize(9);
	for (i = 0; i < 9; i++) {
		s[i].resize(101);
	}
	for (i = 0; i < 9; i++) {
		for (j = 0; j < 101; j++) {
			s[i][j] = 0;
		}
	}
	for (i = 0; i < 10; i++) {
		s[0][i] += 1;
		s[8][45 - i] += 1;
	}
	for (i = 0; i < 9; i++) {
		for (j = i + 1; j < 10; j++) {
			s[1][i + j] += 1;
			s[7][45 - i - j] += 1;
		}
	}
	for (i = 0; i < 8; i++) {
		for (j = i + 1; j < 9; j++) {
			for (k = j + 1; k < 10; k++) {
				s[2][i + j + k] += 1;
				s[6][45 - i - j - k] += 1;
			}
		}
	}
	for (i = 0; i < 7; i++) {
		for (j = i + 1; j < 8; j++) {
			for (k = j + 1; k < 9; k++) {
				for (l = k + 1; l < 10; l++) {
					s[3][i + j + k + l] += 1;
					s[5][45 - i - j - k - l] += 1;
				}
			}
		}
	}
	for (i = 0; i < 6; i++) {
		for (j = i + 1; j < 7; j++) {
			for (k = j + 1; k < 8; k++) {
				for (l = k + 1; l < 9; l++) {
					for (m = l + 1; m < 10; m++) {
						s[4][i + j + k + l + m] += 1;
					}
				}
			}
		}
	}
	while (cin >> a >> b) {
		if (a == 0 && b == 0)break;
		cout << s[a - 1][b] << endl;
	}
	return 0;
}

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

#define MP make_pair
#define PB push_back
#define ALL(x) (x).begin(),(x).end()
#define REP(i,n) for(int i=0;i<(n);i++)
#define REP1(i,n) for(int i=1;i<(n);i++)
#define REP2(i,d,n) for(int i=(d);i<(n);i++)
#define RREP(i,n) for(int i=(n);i>=0;i--)
#define CLR(a)      memset((a),0,sizeof(a))
#define MCLR(a)     memset((a),-1,sizeof(a))
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI > VVI;
typedef vector<string> VS;
typedef vector<LL> VLL;
typedef pair<int, int> PII;

const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;

const int DX[] = { 1, 0, -1, 0 }, DY[] = { 0, -1, 0, 1 };

int combination(int a, int n,int s){
	if (a == 10){
		return s == 0 && n == 0;
	}
	else
		return combination(a + 1, n - 1, s - a) + combination(a + 1, n, s);
}

int main(){
	int n, s;

	do{
		cin >> n >> s;
		if (n == 0 || s == 0)
			break;

		cout << combination(0, n, s) << endl;
	} while (1);

	return 0;
}

C++: #include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>

using namespace std;

typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
#define mp make_pair

template<class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << " "; cout << endl; }
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
int in() { int x; scanf("%d", &x); return x; }

int res[11][100];

int pr(int n,int m,int i){
	res[n+1][m+i]++;
	if(i<9){
		pr(n+1,m+i,i+1);
		pr(n,m,i+1);
	}
	return 0;
}

int main() {
	pr(0,0,0);
	int n,s;
	/*for(int i=0;i<10;i++){
		for(int j=0;j<100;j++){
			cout<<res[i][j]<<" ";
		}
		cout<<endl;
	}*/
	for(;n=in(),s=in(),n;){
		if(s<100&&n<11){cout<<res[n][s]<<endl;}
		else {cout<<0<<endl;}
	}
	return 0;
}

C++: def inputcase():
	global n,s
	n,s = map(int,input().split())
	return n!=0 or s!=0

memo = [[[0 for j in range(123)] for i in range(11)] for k in range(11)]
done = [[[False for j in range(123)] for i in range(11)] for k in range(11)]

def dfs(k, l, t):
	if t < 0:
		return 0
	elif k == 0 and t > 0:
		return 0
	elif k == 0:
		return 1
	elif l > 9:
		return 0
	if done[k][l][t]:
		return memo[k][l][t]
	done[k][l][t] = True
	for i in range(l,10):
		memo[k][l][t] += dfs(k-1,i+1,t-i)
	return memo[k][l][t]

while inputcase():
	print(dfs(n,0,s))

C++: 
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#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 <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//conversion
//------------------------------------------
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();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int DX[] = {0, 1, 0, -1};
const int DY[] = {-1, 0, 1, 0};


//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;


int sum(int n, int s, int i) {
	if (i == 10) {
		if (n == 0 && s == 0)
			return 1;
		else if (n != 0 || s != 0)
			return 0;
	} else {
		return sum(n, s, i + 1) + sum(n - 1, s - i, i + 1);
	}
}

int main(int argc, char const *argv[])
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, s;
	while(cin >> n >> s, n || s){
		cout << sum(n, s, 0) << endl;
	}

	return 0;
}

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

int res;
const int d[10]={0,1,2,3,4,5,6,7,8,9};

bool dfs(int now,int idx,int n,int sum,int s){
	if(now==n&&sum==s) {
		res++;
		return true;
	}
	
	if(dfs(now,idx+1,n,sum,s)) return true;
	
	if(dfs(now+1,idx+1,n,sum+d[idx],s)) return true;
	
	if(idx>9) return false;
	
	return false;
}

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