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<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;
  }
}

C++: #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cctype>
#include <climits>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <list>
#include <queue>
#include <deque>
#include <algorithm>
#include <numeric>
#include <utility>
#include <complex>
#include <memory>
#include <functional>
 
using namespace std;
 
#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i <= n; i++)
#define rep(i,n) REP(i,0,n)
#define F(i,j,k) fill(i[0],i[0]+j*j,k)
#define P(p) cout<<(p)<<endl;
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define INF 1<<25
#define pb push_back
 
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<double> vd;
typedef pair<int,int> pii;
typedef pair<long,long> pll;
typedef long long LL;
typedef long long int LLI;

int solve(int cnt ,int sum,int now);
 int n=0,s=0;
int main(void)
{
     for(;;){
         cin >> n >> s;
        int ans = solve(0, 0, 0);  
        cout << ans << endl;
        }
    return 0;  
}
int solve(int cnt ,int sum,int now)
{
    if(cnt == 10){
        return sum == s && now == n;
    }
    int res1 = solve(cnt+1,sum+cnt,now+1) ;
    int res2 = solve(cnt+1,sum,now);
    return res1+res2;
}

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)? 1: 0;
  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 <iostream>
#include <vector>
#include <string>
#include <numeric>

int func( const std::vector<int>& v, int n, int s ){
    int sum = 0;
    if ( n == v.size() ){
        if ( std::accumulate(v.begin(),v.end(),0) == s ){ return 1; }
        return 0;
    } else {
        for( int i=*(v.end()-1)+1; i<10; ++i ){
            std::vector<int> vx{v};
            vx.push_back(i);
            sum += func(vx, n, s);
        }
    }
    return sum;
}

int main(){
    for(;;){
        int n,s; int sum = 0;
        std::cin >> n >> s;
        if ( (n==0) && (s==0) ){return 0;}
        for( int i=0; i<10; ++i ){
            std::vector<int> v = {i};
             sum += func( v, n, s );
        }
        std::cout << sum << std::endl;
    }
}

C++: #include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <ostream>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define INF 1000000000
#define rep(i,a,b) for (int i=(a);i<(b);i++)
#define rev(i,a,b) for (int i=(a)-1;i>=b;i--)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef queue<int> qi;
typedef vector<int> vi;
typedef vector<string> vs;
int dx[4] = { 0, 1, 0, -1 };
int dy[4] = { 1, 0, -1, 0 };

int main() {

  while(1) {
    int n, s;
    cin >> n >> s;
    if (!n && !s) break;

    int d[10];
    rep(i,0,10) d[i] = i;

    int ans = 0;

    rep(i,0,10)
      rep(j,i+1,10)
        rep(k,j+1,10)
          if (i + j + k == s) ans++;

    cout << ans << endl;
  }

	return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define MP make_pair
#define PB push_back
#define MOD 1000000007
#define INF (1LL<<30)
#define LLINF (1LL<<60)
#define PI 3.14159265359
#define EPS 1e-12
#define int ll

int dp[105][10][10], s, n;
int f(int a, int b, int c) {
  if(dp[a][b][c] != -1) return dp[a][b][c];
  if(a == s && c == n && b <= 10) return 1;
  if(a > s || c > n || b == 10) return 0;
  int res = 0;
  res += f(a+b, b+1, c+1);
  res += f(a, b+1, c);
  return dp[a][b][c] = res;
}

signed main(void)
{
  while(1) {
    cin >> n >> s;
    REP(i, 105) REP(j, 10) REP(k, 10) dp[i][j][k] = -1;
    cout << f(0, 0, 0) << endl;
  }
  return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int dfs(int x,int y,int k){
	if(y==0)
		return x==0?1:0;
	if(x<0)
		return 0;
	int ans=0;
	for(int i=k+1;i<10;i++)
		ans+=dfs(x-i,y-1,i);
	return ans;
}
signed main(void){
	ios::sync_with_stdio(false);
	int x,y;
	while(cin>>y>>x&&(x||y))
		cout<<dfs(x,y,-1)<<endl;
}

C++: #define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<math.h>

int main() {
	int a, b, ans[1024],num[1024];
	for (int i = 0; i < 1024; i++) {
		ans[i] = 0;
		num[i] = 0;
		for (int j = 0; j < 10; j++) {
			int m = 1;
			for (int k = 0; k < j; k++)m *= 2;
			if (i / m % 2 == 1) {
				ans[i] += j;
				num[i]++;
			}
		}
	}
	while (true) {
		scanf("%d %d", &a, &b);
		if (a == 0 && b == 0) {
			int an = 0;
			for (int i = 0; i < 1024; i++) {
				if (ans[i] == b && num[i] == a) {
					an++;
				}
			}
			printf("%d\n", an);
		}
		else {
			break;
		}
	}
}

C++: #include <iostream>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <vector>
#include <utility>
#include <numeric>
#include <string>
#include <set>
#include <map>
#include <tuple>
#include <queue>
#include <stack>
#define rep(i, a, n) for(int (i) = (int)(a);(i) < (int)(n);++(i))
#define repe(i, a, n) for(int (i) = (int)(a);(i) <= (int)(n);++(i))
#define repr(i, a, n) for(int (i) = (int)(a);(i) > (int)(n);--(i))
#define reper(i, a, n) for(int (i) = (int)(a);(i) >= (int)(n);--(i))
#define SIZE(x) ((int)(x).size())
#define ALL(x) (x).begin(), (x).end()
#define RNG(x, n) &((x)[0]), &((x)[n])
#define SUBIF(a, b, x) ((x) ? (b) : (a))
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define yes cout << "yes" << endl;
#define no cout << "no" << endl;
#define pb push_back
#define EPS (1e-20)
#define INF 2147483647LL
#define MOD 1000000007LL
using llint = long long;
using VI = std::vector<int>;
using PII = std::pair<int, int>;
using SI = std::set<int>;
using MII = std::map<int, int>;
using TIII = std::tuple<int, int, int>;
using namespace std;


int n, s;


int cntBit(int bit){
	int cnt = 0;
	do {
		cnt += bit&1;
	} while(bit/=2);
	return cnt;
}


VI enumComb(){
	VI comb;
	rep(i, 0, 1<<10)
		if(cntBit(i) == n) comb.pb(i);
	return comb;
}


int solve(){
	int ans = 0;
	VI comb = enumComb();
	for(int x : comb){
		int sum = 0;
		repe(i, 0, 9)
			if((x>>i)&1) sum += i;
		if(sum == s) ans++;
	}
	return ans;
}


int main(){
	while(cin >> n >> s, n || s) cout << solve() << endl;

	return 0;
}