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>
using namespace std;
int ans(int n, int m, int x);
int main(){
  int n,m;
  while(cin >>n>>m,n||m){
    cout <<ans(n,m,0)<<endl;
  }
  return 0;
}
int ans(int n, int m, int x){
  int a=0;
  if(n == 1 && m>=x) return 1;
  for(int i=x; i<10; i++) if(m-i>0) a+=ans(n-1,m-i,i+1);
  return a;
}

C++: #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using VI = vector<int>;
using VL = vector<ll>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);(i)++)
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);(i)--)
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);(i)--)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; }return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; }return 0; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }

int main() {
    init();

    int n, s;
    while (1) {
        cin >> n >> s;
        if (!(n || s))break;
        map<int, int> map;
        eFOR(i, 0, 1 << 10) {
            int cnt = 0, sum = 0;
            eFOR(j, 0, 10)if (i & (1 << j)) {
                cnt++;
                sum += j;
            }
            if (cnt == n)map[sum]++;
        }
        cout << map[s] << "\n";
    }
}

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

using namespace std;

int n,s;

int f(int deps,int cnt,int sum)
{
    if(deps == 10){
        if(cnt == n && sum == s)return 1;
        return 0;
    }
    return f(deps + 1,cnt + 1,sum + deps)+f(deps + 1,cnt,sum);
}

int main()
{
    while(1){
    cin >> n >> s;
    if(n == 0 && s == 0)break;
    printf("%d\n",f(0,0,0));
    }
    return 0;
}