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 solve(int n,int s,int l)
{
  if(s < 0 || l > 9) return 0;
if(n == 0) {
    if(s == 0) return 1;
    return 0;
 }
 int ret=0;
 for(int i=l;i<10;i++){
   ret += solve(n-1,s-i,i+1);
 }
 return ret;
}
int main(void)
{
  int n,s;
  for(;;){
    cin >> n >> s; if(n+s == 0) break;
    cout << solve(n,s,0) << endl;
  }
}

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>

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 PI acos(-1.0)
#define INF 1000000007

typedef long long ll; 
typedef pair<ll, ll> PL;

int n, s;
bool d[10];
vector< vector<int> > C;

void dfs(int i, int sum){
	if (i == n&&sum == s){
		vector<int> vi;
		if (C.empty()){
			REP(j, 10){
				if (d[j] == 1){
					vi.push_back(j);
				}
			}
			C.push_back(vi);
			return;
		}
		bool f = 1;
		REP(j, C.size()){
			int co = 0;
			REP(k, n){
				if (d[C[j][k]] == 1) co++;
			}
			if (co == n){
				f = 0;
				break;
			}
		}
		if (f){
			REP(j, 10){
				if (d[j] == 1){
					vi.push_back(j);
				}
			}
			C.push_back(vi);
		}
	}

	for (int j = 0; j < 10; j++){
		if (d[j] == 0){
			d[j] = 1;
			dfs(i + 1, sum + j);
			d[j] = 0;
		}
	}
	return;
}

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

C++: #include<stdio.h>

int dp[10][10][100];

int main(){
  int i, j, k, n, s;
  dp[0][0][0] = dp[0][1][0] = 1;
  for(i = 1;i < 10;i++){
    for(j = 0;j < 10;j++){
      for(k = 0;k < 100;k++){
	dp[i][j][k] = dp[i - 1][j][k];
	if(k - i >= 0 && j > 0){
	  dp[i][j][k] += dp[i - 1][j - 1][k - i];
	}
      }
    }
  }
  while(scanf("%d%d", &n, &s)){
    if(n == 0 && s == 0)return 0;
    printf("%d\n", dp[9][n][s]);
  }
  return 0;
}

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

int pattern_num[1];

void find_pattern(int now, int sum, int t_n, int n, int s) {
	//printf("%d %d %d %d %d\n",now ,sum, t_n, n, s);
	// Found
	if (t_n == n && sum == s) {
		pattern_num[0]++;
		return;
	}
	// Search
	for (int i = now+1; i < 10; i++) {
		if (sum+i <= s)
			find_pattern(i, sum+i, t_n+1, n, s);
	}
	return;
}

int main(int argc, char *argv[]) {
	int n, s;
	while (true) {
		// init
		pattern_num[0] = 0;
		// load data
		fscanf(stdin, "%d %d", &n, &s);
		// End of Program
		if (n == 0 && s == 0) {
			break;
		}
		// find pattern
		for (int i = 0; i < 10; i++) {
			if (i <= s)
				find_pattern(i, 0, 1, n, s);
		}
		// print
		printf("%d\n", pattern_num[0]);
	}
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std ;
 
#define pb(n) push_back(n)
#define fi first
#define se second
#define X real()
#define Y imag()

#define value(x,y,w,h) (x >= 0 && x < w && y >= 0 && y < h)

#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
 
#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))
 
typedef long long ll ;
typedef deque<int> di ;
typedef deque<ll> dl ;
typedef map<string,int> dict;
typedef complex<double> comd;
typedef pair<int,int> pii;
 
constexpr int imax = ((1<<30)-1)*2+1 ;
constexpr int inf = 100000000;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0};
const int dx[] = {0,-1,0,1};
int res;
int n,s;
void solve(int a,int b,int c){
    if(b > n || a > s) return;
    if(a == s && b == n){
        ++res;
        return;
    }
    REP(i,c+1,10){
            solve(a+i,b+1,i);
    }
    return ;
}

int main(){
    while(cin>> n >> s){
        if( n + s == 0) break;
        res = 0;
        if(s <= 55){
            rep(i,10){
                solve(i,1,i);
            }
        }
        cout << res << endl;
    }

    return 0;
}

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

int Dfs(int n, int s, int p) {
  if (n == 0 && s == 0)
    return 1;
  if (n < 0)
    return 0;
  int res = 0;
  for (int i = p + 1; i <= 9; ++i)
    res += Dfs(n - 1, s - i, i);
  return res;
}

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

C++: #include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#pragma region defins
#define ll long long
#define loop(i,n) for (int i = 0; i < n; i++)
#define loops(i,f,n) for (int i = (f); i < n; i++)
#define INF 100000000000000
#define sort(a) sort(a.begin(),a.end())
#define rsort(a) sort(a.rbegin(),a.rend())
using namespace std;
#pragma endregion
int n, s, ans;
void dfs(int num, int sum, int count)
{
	//cout << "num:" << num << " sum:" << sum << " count:" << count << endl;
	if (sum == s&&count == n)
	{
		ans++;
		//cout << "ans: " << ans << endl;
	}
	if (sum > s || num == 9 || count == n)return;
	dfs(num + 1, sum + num, count + 1);
	dfs(num + 1, sum, count);
}

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

C++: #include <cstdio>
#include <cstring>
bool used[10];
int n,s;
int dfs(int x,int y,int sum) {
	if(x==n) return (sum==s);
	if(sum>=s) return 0;
	int ret=0;
	for(int i=y+1;i<=9;i++) {
		if(!used[i]) {
			used[i]=true;
			ret+=dfs(x+1,i,sum+i);
			used[i]=false;
		}
	}
	return ret;
}
int main() {
	while(scanf("%d %d",&n,&s),n|s) {
		memset(used,0,sizeof(used));
		printf("%d\n",dfs(0,-1,0));
	}
}

C++: #include <iostream>

int n, s;
int num[10]={0,1,2,3,4,5,6,7,8,9};
int ans=0;
int func(int de, int k, int sum){
	int res = 0;
	if(de == n){
		if(sum == s)ans++;
		return 0;
	}
	if(sum > s)return 0;
	for(int i = k; i < 10 && de<n; ++i){
		res += func(de + 1, i + 1, sum + i);
		//res += func(de, i + 1, sum);
	}
	return res;
}

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

C++: #include <iostream>
using namespace std;
 int dfs(int n, int s, int x){
    int sum=0;
    if(n==0 && s==0)
    return 1;
    if(n>0){
        for(int i=x; i<10; i++){
            if(s-i>=0)  sum+=dfs(n-1, s-i, i+1);
        }
    }

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

C++: #include <bits/stdc++.h>
 
using namespace std;
 
int dfs(int x, int n, int s)
{
    if (n == 0) {
        return (s == 0);
    }
    if (x == 10) return 0;
             
    int res = 0;
    for (int i = x; i <= 9; i++) {
        res += dfs(i + 1, n - 1, s - i);
    }
    return res;
}
 
int main()
{
    int n, s;
    while (cin >> n >> s, n) {
        cout << dfs(0, n, s) << endl;
    }
    return 0;
}