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 <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstring>
#include <iterator>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
#include <iomanip>
//#include <utility>
//#include <memory>
//#include <functional>
//#include <deque>
//#include <cctype>
//#include <ctime>
//#include <numeric>
//#include <list>
//#include <iomanip>

//#if __cplusplus >= 201103L
//#include <array>
//#include <tuple>
//#include <initializer_list>
//#include <forward_list>
//
//#define cauto const auto&
//#else

//#endif

using namespace std;


typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
    stringstream ss;
    ss << f;
    ss >> t;
}

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define F first
#define S second
#define mkp make_pair
#define RALL(v) (v).rbegin(),(v).rend()
#define DEBUG
#ifdef DEBUG
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#else
#define dump(x) 
#define debug(x) 
#endif
#define LDcout(x,n) fixed<<setprecision(n)<<x

#define MOD 1000000007LL
#define EPS 1e-8
static const int INF=1<<24;
int dp[15][15][110];
void mainmain(){
    int n,s;
    dp[0][0][0]=1;
    rep(i,15){
        rep(j,15){
            rep(k,110){
                if(dp[i][j][k]){
                    reep(l,j,10){
                        dp[i+1][l+1][k+l]+=dp[i][j][k];
                    }
                }
            }
        }
    }
    while(cin>>n>>s,n){
        int tmp=0;
        rep(i,15){
            tmp+=dp[n][i][s];
        }
        cout<<tmp<<endl;
    }
}


signed main() {
    ios_base::sync_with_stdio(false);
      cout<<fixed<<setprecision(20);
    mainmain();
}

C++: #include <iostream>

using namespace std;

int judge(int number, int sum, int counter) {
	if (sum == 0 && number == 0) {
		return 1;
	} else if ((sum > 0 && number == 0) || (number >= 2 && sum <= 0) || counter < 0){
		return 0;
	} else {
		if (counter > sum) {
			return judge(number, sum, counter-1);
		} else {
			return judge(number-1, sum-counter, counter-1)+judge(number, sum, counter-1);
		}
	}
}

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

C++: #include<iostream>
using namespace std;
int solve(int n,int m){
  if(2*m>90-(n-1)*n)return 0;
  if(2*m<(n-1)*n)return 0;
  if(n==1)return (0<=m&&m<=9?1:0);
  int res=0;
  if(m-n+1>=0)res+=solve(n-1,m-n+1);
  if(m-n>=0)res+=solve(n,m-n);
  if(m-10>=0)res-=solve(n,m-10);
  return res;
}
int main(){
  int n,m;
  while(cin>>n>>m&&n&&m){
    cout<<solve(n,m)<<endl;
  }
  return 0;
}

C++: #include<iostream>
#include<vector>
#include<string>
#include<cstdio>
using namespace std;
int ans;
int n;
int s;

void count_ans(int k,int C,int j){
	if(k==n){
		if(C==s){
			ans++;
		}
	}else{
		for(int i=j+1;i<10;i++){
			count_ans(k+1,C+i,i);
		}
	}
	
}


int main(){
	while(cin>>n>>s,(n!=0)&&(s!=0)){
		ans=0;
		count_ans(0,0,-1);
		cout<<ans<<endl;
	}
}

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

int main()
{
  int n, s;
  int i, j, tmp;
  int sum, count;
  int ans;
  char c;

  while(cin>>n>>c>>s){
    if(n+s==0) break;

    ans=0;
    for(i=0; i<1024; i++){
      tmp=i; sum=0; count=0;
      for(j=0; j<10; j++){
        if(tmp%2==1){
          sum+=j;
          count++;
        }
        tmp=tmp>>1;
      }
      if(count==n && sum==s) ans++;
    }
    printf("%d\n", ans);
  }

  return 0;
}

C++: #include <cstdio>
int dfs(int n, int s, int cnt, int sum, int num) {
	int res = 0;
	if (cnt==n&&sum==s) return 1;
	else if (cnt==n) return 0;
	if (num==10) return 0;
	res += dfs(n, s, cnt+1, sum+num, num+1);
	res += dfs(n, s, cnt, sum, num+1);
	return res;
}
int main() {
	int n, s;
	while (scanf("%d%d",&n,&s)) {
		if (n==0&&s==0) break;
		int res = dfs(n, s, 0, 0, 0);
		printf("%d\n",res);
	}
}

C++: #include <iostream>
using namespace std;
int main(){
  int n,s,j,k;
  int a[11][46];
  for(int s=0;s<46;s++)
  for(int n=0;n<11;n++)
    a[n][s]=0;
  for(int i=0;i<1024;i++){
    for(j=i,n=0;j>0;j/=2)n+=j%2;
    for(j=i,s=0,k=0;j>0;j/=2,k++)s+=k;
    a[n][s]++;
  }
  cin>>n>>s;
  for(;n||s;cout<<a[n][s]<<endl,cin>>n>>s);
}

C++: #include<iostream>
#include<cstdlib>
using namespace std;
int n, s, cnt;
int array[10];
void Sum(int i, int phase){
	array[phase-1] = i;
	if(phase==n){
		for(;i<s;i++){
			int nsum=0;
			for(int j=0;j<phase;j++){
				nsum+=array[j];
			}
			if(nsum==s)cnt++;
		}
	}else{
		for(i++;i<s;i++){
			Sum(i, phase+1);
		}
	}
	return;
}
int main(){
	while(cin>>n>>s,s!=0 && n!=0){
		memset(array, 0, sizeof(array));
		cnt=0;
		Sum(0, 1);
		cout<<cnt<<endl;
	}
	return 0;
}

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

int dfs(int depth, int cur, int accm, int n, int s)
{
  if (depth > n)
    return 0;

  if (depth == n && accm == s)
    return 1;

  if (accm > s)
    return 0;
  else {
    int count = 0;
    for (int i = cur + 1; i < 10; i++) {
      count += dfs(depth+1, i, accm+i, n, s);
    }
    return count;
  }
}


int main(int argc, char **argv)
{
  int n, s;
  for (;;) {
    cin >> n >> s;
    if (n==0 && s==0)
      break;

    int total = 0;
    for (int i = 0; i < 10; i++) {
      total += dfs(1, i, i, n, s);
    }

    cout << total << endl;
  }
  return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;

int d[15][15][200];
/*
 * d[i][j][k]:
 * i未満の数をj個使って、和をkにする通り数
*/
int main(){
	while(1){
		int n,s;
		cin>>n>>s;
		if(n==0&&s==0)break;
		memset(d,0,sizeof(d));
		d[0][0][0]=1;
		for(int i=0;i<=9;i++){
			for(int j=0;j<=n;j++){
				for(int k=0;k<=s;k++){
					//数iを使わない場合
					d[i+1][j][k]+=d[i][j][k];
					//数iを使う場合
					d[i+1][j+1][k+i]+=d[i][j][k];
				}
			}
		}
		cout<<d[10][n][s]<<endl;
	}
	return 0;
}

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

int ans,n,s;

void dfs(int nowsum,int k,int x)
{
	if (k == n)
	{
		if (nowsum == s)
		{
			ans++;
		}
		return;
	}

	if (x <= 9)
	{
		dfs(nowsum+x,k+1,x+1);
		dfs(nowsum,k,x+1);
	}
	return;
}

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

C++: #include <iostream>
using namespace std;
// b~9ツづ慊づづ個青板篠堋づーnツ古つ使ツづづгツづーツ催ャツづゥツ津環づィツ青板づーツ陛板つキ
int solve(int n,int s,int b)
{
  if(s < 0 || b > 9) return 0;
  if(n == 0) return s==0 ? 1 : 0;
  int ret=0;
  for(int i=b;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;
  }
}