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>
using namespace std;

int main()
{
	int n, s, count = 0,count2 = 0;
	int ans[100], data[100];
	while (1) {
		cin >> n >> s;
		if (n == 0 && s == 0)
			break;
		for (int a = 0; a <= 9; a++) {
			if (n == 1) {
				if (a == s)
					count2++;
			}
			for (int b = a+1; b <= 9; b++) {
				if (n == 2) {
					if (a + b == s)
						count2++;
				}
				for (int c = b+1; c <= 9; c++) {
					if (n == 3) {
						if (a + b + c == s)
							count2++;
					}
					for (int d = c+1; d <= 9; d++) {
						if (n == 4) {
							if (a + b + c + d == s)
								count2++;
						}
						for (int e = d+1; e <= 9; e++) {
							if (n == 5) {
								if (a + b + c + d + e == s)
									count2++;
							}
							for (int f = e+1; f <= 9; f++) {
								if (n == 6) {
									if (a + b + c + d + e + f == s)
										count2++;
								}
								for (int g = f+1; g <= 9; g++) {
									if (n == 7) {
										if (a + b + c + d + e + f + g == s)
											count2++;
									}
									for (int h = g+1; h <= 9; h++) {
										if (n == 8) {
											if (a + b + c + d + e + f + g + h == s)
												count2++;
										}
										for (int i = h+1; i <= 9; i++) {
											if (n == 9) {
												if (a + b + c + d + e + f + g + h + i == s)
													count2++;
											}
										}
									}
								}
							}
						}
					}
				}
			}
		}
		ans[count] = count2;
		count2 = 0;
		count++;
	}
	for (int i = 0; i < count; i++)
		cout << ans[i] << endl;
}

C++: #include <iostream>

using namespace std;

int dfs(int o, int n, int s) {
    if (n == 0 && s == 0) return 1;

    int ret = 0;
    for (int i = o; i <= 9; i++) {
        ret += dfs(i + 1, n - 1, s - i);
    }
    return ret;
}

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

    return 0;
}

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;
	}
	else {
		for(int i = m + 1;i < 10;++i){
			f(i,a + 1,t + i);
		}
	}
	return;
}
int main(){
	while(cin >> n >> s && (n != 0 && s != 0)){
		c = 0;
		for(int i = 0;i < 10;++i) f(i,1,i);
		cout << c << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <vector>
#include <map>
#include <stack>
#include <list>
#include <queue>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <math.h>

using namespace std;

int combi(int n, int s, int usedNum = 0){
	int combiCount = 0;
	int tmp;
	n--;
	for(int i = usedNum; i <= 9; i++){
		tmp = s - i;		
		if(n != 0){
			combiCount += combi(n, tmp, i + 1);
		}
		else if(n == 0 && tmp == 0){
			return 1;
		}
	}
	return combiCount;
}


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

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

// n個の重複しない整数(min ~ max)用いてsを表す組み合わせの数
int ci(int n, int s, int min, int max) {
  if (s < min || n < 1) return 0;
  if (n == 1) return (s > max)? 0: 1;
  int r = 0;
  for (int i=min; i<s && i<=max; i++) {
    r += ci(n - 1, s - i, i + 1, max);
  }
  return r;
}

int main() {
  while (true) {
    int n, s;
    cin >> n >> s;
    if (!n && !s) break;
    cout << ci(n, s, 0, 9) << endl;
  }
  return 0;
}

C++: //まともに使い方を理解していないくせにincludeしまくる人間のクズ
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <iostream>


//using namespace stdしないと表記がめんどくさいからね、仕方ないね
using namespace std;

//可読性を上げるためのdefineがあだとなる典型的パターン
#define FOR(x) for(int i = 0; i < x; i++)

//ローカル変数とグローバル変数は使い分けよう！
stack<short> x, y;
short a[10], n, j, i, m, ans;

//関数って楽しいよね！（魔王スマイル）
void solve(short c, short sum, short cnt){
    if(cnt == n){
        if(sum == m) ans++;
        return;
    }
    if(cnt < n && c > 9) return;
    if(sum > m) return;
    solve(c + 1, sum + c, cnt + 1);
    solve(c + 1, sum, cnt);
    return;
}

int main(){
    while(true){
        scanf("%d %d", &n, &m);
        if(n == 0 && m == 0) return 0;
        ans = 0;
        solve(0, 0, 0);
        printf("%d\n", ans);
    }
}

C++: #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <functional>
#include <sstream>
#include <complex>
#include <climits>
using namespace std;

#define REP(i,a,n) for(int i=(a);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define EPS 1e-8

int memo[11][50];
int main(){
	int n,s;
	
	for(int i=0; i<(1<<10); i++){
		int sum = 0;
		int bitc = 0;
		for(int j=0; (1<<j)<=i; j++)if( i&(1<<j) ){
			sum += j;
			bitc++;
		}
		memo[bitc][sum]++;
		//printf("bitc:%d  , sum:%d\n",bitc,sum);
	}
	
	while(scanf("%d%d",&n,&s),n|s){
		printf("%d\n",s<50 ? memo[n][s] : 0);
	}
	return 0;
}

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;

lint n,s,ans=0;

void solve(lint n,lint sum,lint 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>
#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,9){
	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 res;

void dfs(int n, int index, int s) {
    if (n == 0 && s == 0) {
        res++;
        return;
    } else if (n == 0 || s < 0 || s < index || 9 < index) {
        return;
    }
    dfs(n - 1, index + 1, s - index);
    dfs(n, index + 1, s);
    return;
}

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