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
//------------------------------------------
#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 <queue>
#include <iterator>
#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);

//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 gcd(int a, int b){
   int tmp;
   while(a%b==0){
      tmp=a%b;
      a=b;
      b=tmp;
   }
}

int lcm(int a,int b){
   return a*b/gcd(a,b);
}

bool prime_number(int n){
   vector<bool> i;
   if(n < 2){
      return false;
   }
   else if(n == 2){
      return true;
   }
   if(n % 2 == 0){
      return false;
   }
   for(int i=3;i<=n/i;i+=2){
      if(n % i == 0) return false;
      return true;
   }
}

int main(){
   int n, s,ans=0;
   while(1){
      cin >> n >> s;
      ans=0;
      if(n+s==0) break;
      if(n==1) cout << 1 << endl;
      if(n==2) cout << n/2+n%2 << endl;
      if(n==3){
         FOR(i,0,101-n)FOR(j,i+1,102-n)FOR(k,j+1,103-n)if(i+j+k==s){
            ans++; break;
         }
      }
      if(n==4){
         FOR(i,0,101-n)FOR(j,i+1,102-n)FOR(k,j+1,103-n)
         FOR(l,k+1,104-n)if(i+j+k+l==s){
            ans++; break;
         }
      }
      if(n==5){
         FOR(i,0,101-n)FOR(j,i+1,102-n)FOR(k,j+1,103-n)
         FOR(l,k+1,104-n)FOR(m,l+1,105-n)if(i+j+k+l+m==s){
            ans++; break;
         }
      }
      if(n==6){
         FOR(i,0,101-n)FOR(j,i+1,102-n)FOR(k,j+1,103-n)
         FOR(l,k+1,104-n)FOR(m,l+1,105-n)FOR(o,m+1,106-n)
         if(i+j+k+l+m+o==s){
            ans++; break;
         }
      }
      if(n==7){
         FOR(i,0,101-n)FOR(j,i+1,102-n)FOR(k,j+1,103-n)
         FOR(l,k+1,104-n)FOR(m,l+1,105-n)FOR(o,m+1,106-n)
         FOR(p,o+1,107-n)if(i+j+k+l+m+o+p==s){
            ans++; break;
         }
      }
      if(n==8){
         FOR(i,0,101-n)FOR(j,i+1,102-n)FOR(k,j+1,103-n)
         FOR(l,k+1,104-n)FOR(m,l+1,105-n)FOR(o,m+1,106-n)
         FOR(p,o+1,107-n)FOR(q,p+1,108-n)
         if(i+j+k+l+m+o+p+q==s){
            ans++; break;
         }
      }
      if(n==9){
         FOR(i,0,101-n)FOR(j,i+1,102-n)FOR(k,j+1,103-n)
         FOR(l,k+1,104-n)FOR(m,l+1,105-n)FOR(o,m+1,106-n)
         FOR(p,o+1,107-n)FOR(q,p+1,108-n)FOR(r,q+1,109-n)
         if(i+j+k+l+m+o+p+q+r==s){
            ans++; break;
         }
         if(i>s) break;
      }
      
      cout << ans << endl;
   }
}

C++: #include <iostream>
#include <cstring>
#include <stack>

using namespace std;
 
struct set { int next, sum, depth; };
 
int n, s, cnt;

void dfs(int next, int sum, int depth) {
    stack<set> S;
    set tmp;
    tmp.next = next; tmp.sum = sum; tmp.depth = depth;
    S.push(tmp);
    while (!S.empty()) {
        set u = S.top();
        // cout << u.next << " " << u.sum << " " << u.depth  << endl;
        if (u.depth == n && u.sum == s) {
            cnt++;
        }
        if (u.next == 10 && u.depth == 0 && u.sum == 0) break;

        if (u.next < 10 && u.depth < n) {
            tmp.next = u.next + 1;
            tmp.sum = u.sum;
            tmp.depth = u.depth;
            S.push(tmp);
 
            tmp.next = u.next + 1;
            tmp.sum = u.sum + u.next;
            tmp.depth = u.depth + 1;
            S.push(tmp);
        }
        else if (u.next == 10) {
            int tmp = u.depth;
            while (S.top().depth == tmp) {
                S.pop();
            }
        }
        else {
            S.pop();
        }
    }
}
 
int main() {
    while (cin >> n >> s) {
        if (n == 0 && s == 0) break;
        cnt = 0;
        dfs(0, 0, 0);
        cout << cnt << endl;
    }
    return 0;
}

C++: #include <bits/stdc++.h>
#define rep(i, a) for (int i = 0; i < (a); i++)
using namespace std;

int dfs(int i, int sum, int total){
	if(i <= 10 && sum == 0 && total == 0) return 1;
	if(i >= 10 || sum < 0 || total < 0) return 0;

	return dfs(i+1, sum-i, total-1) + dfs(i+1, sum, total);
}

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

C++: #include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <functional>
#include <iterator>
#include <limits>
#include <numeric>
#include <utility>
#include <cmath>

using namespace std; using namespace placeholders;

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

template < typename T > inline void input_n( vector< T > &out ) { copy_n( istream_iterator< T >( cin ), out.size(), out.begin() ); };
template < typename T > inline T fromString( const string &s ) { T res; istringstream iss( s ); iss >> res; return res; };
template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); };

#define REP( i, m, n ) for ( int i = (int)( m ); i < (int)( n ); ++i )
#define FOR( e, c ) for ( auto &e : c )
#define ALL( c ) (c).begin(), (c).end()
#define AALL( a, t ) (t*)a, (t*)a + sizeof( a ) / sizeof( t )
#define DRANGE( c, p ) (c).begin(), (c).begin() + p, (c).end()

#define PB( n ) push_back( n )
#define EM emplace
#define EB emplace_back
#define MP( a, b ) make_pair( ( a ), ( b ) )
#define EXIST( c, e ) ( (c).find( e ) != (c).end() )

#define fst first
#define snd second

#define DUMP( x ) cerr << #x << " = " << ( x ) << endl

int solve( const int C, const int N, const int S )
{
	return C == 10 ? ( !S && !N ) : solve( C + 1, N, S ) + solve( C + 1, N - 1, S - C );
}

int main()
{
	cin.tie( 0 );
	ios::sync_with_stdio( false );

	for ( int n, s; cin >> n >> s, ( n | s ); cout << solve( 0, n, s ) << endl );

	return 0;
}