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 <stdio.h>

int makePatterns(int minUsbl, int maxUsbl, int n, int s);

int main(void){
    int n, s;
    
    while(scanf("%d %d",&n, &s), n!=0 || s!=0){
        printf("%d\n", makePatterns(0,9,n,s));
    }
    return 0;
}

int makePatterns(int minUsbl, int maxUsbl, int n, int s){
    int ptns=0;

//    printf("%d - %d:%d,%d\n",minUsbl, maxUsbl, n, s);    
    if (n==0){
        if (s==0){
//            printf("well done\n");
            return 1;
        }else {
//            printf("failed\n");
            return 0;
        }
    }
    if (minUsbl > s) return 0;
    
    for (int i=minUsbl; i<=maxUsbl && i<=s; i++){
        ptns += makePatterns(i+1, maxUsbl, n-1, s-i);
    }
    return ptns;
}

C++: #include<iostream>

using namespace std;

int count(int n, int s, int a) {
  if (n == 1) {
    if (0 <= s && s <= 9 && a <= s) {
      return 1;
    } else {
      return 0;
    }
  }
    else {
      int c = 0;
      for (int b = a; s - b > 0; b++) {
      c += count(n - 1, s - b, b + 1);
  }
  return c;
}
}
int main() {
  int n, s;
  while (cin >> n >> s, n || s) {
    cout << count(n, s, 0) << endl;
  }
  return 0;
}

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

int n,k,m;
int ans=0;
vector<int>s(10);

void bfs(int nn,int sum,int min){
    
    if(nn==0&&sum==0){
        ans++;
        return;
    }
    
    for(int i=min;i<10&&n>0;i++){
        if(sum-i>=0){
            bfs(nn-1,sum-i,i+1);
        }
    }
    
}

int main(){
    while(cin>>n>>m){
        if(n==0 && m==0)break;
        bfs(n,m,0);
        cout<<ans<<endl;
        
    
    }
}

C++: #include<stdio.h>
#include<string>
#include<stdlib.h>
#include<math.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<numeric>
#include<string.h>
#include<map>
#include<queue>

using namespace std;

typedef pair<int,int> pii;

#define rep(i,j) for(int i=0;i<(j);i++)
#define reps(i,j,k) for(int i=j;i<=k;i++)
#define in(i,j,k) ((i)>=(j)&&(i)<=(k))

int main(){
	int n,s,l,a,c;
	while(scanf("%d%d",&n,&s)){
		if(!n)break;
		l=min(10,s);
		vector<int> v(l,0);
		rep(i,n)v[i]=1;
		c=0;
		do{
			a=0;
			rep(i,l)a+=i*v[i];
			c+=s==a;
		}while(prev_permutation(v.begin(),v.end()));
		printf("%d\n",c);
	}
	return 0;
}

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

int n, s;

int Comb(int N, int start, int s)
{
	int ret = 0;

	if (s < 0)
		return 0;

	if (N == n)
		if (start == s)
			return 1;
		else
			return 0;

	for (int i = start + 1; i <= 9; ++i)
		ret += Comb(N + 1, i, s - start);
	return ret;
}

int main(){

	vector<int> RET;
	while (cin >> n >> s && (n != 0 || s != 0))
	{
		int ret = 0;
		for (int i = 0; i <= 9; ++i)
			ret += Comb(1, i, s);
		RET.push_back(ret);
	}
	for (int i = 0; i < RET.size(); i++) {
		cout << RET[i] << endl;
	}
	return 0;
}

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

typedef long long ll;

// dp[k][s][prev] := 最後に使った数がprev-1でk個使って和がsになる組合せ
ll dp[10][1010][110] = {0};

int main(){
	for(int i = 0; i <= 100; i++) dp[1][i][i+1] = 1;
	
	for(int k = 1; k < 9; k++){
		for(int i = 0; i <= 1000; i++){
			for(int prev = 0; prev <= 100; prev++){
				if( dp[k][i][prev] ){
					for(int j = prev; j <= 100; j++){
						if( 1000 < i + j ) break;
						dp[k+1][i+j][j+1] += dp[k][i][prev];
					}
				}
			}
		}
	}
	int n, s;
	while( cin >> n >> s, n || s ){
		ll res = 0;
		for(int i = 0; i <= 100; i++){
			res += dp[n][s][i];
		}
		cout << res << 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 "bits/stdc++.h"

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int A[10]={0,1,2,3,4,5,6,7,8,9};
	while(true){
		int N=in(),S=in();
		if(!N && !S) break;
		int ans = 0;
		REP(i,1024){
			int num=0,sum=0,digit=0;
			int v=i;
			while(v){
				if(v&1){
					num++;
					sum+=A[digit];
				}
				v>>=1;
				digit++;
			}
			if(num==N && sum==S) ans++;
		}
		out(ans);
	}
	return 0;
}

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

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

C++: #include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

int n, s;
int dp[10][100][10];
int solve(int i, int j, int k);

int main(void){
	
	while(cin >> n >> s){
		if(n == 0 && s == 0){break;}
		fill_n(**dp,10*100*10,-1);
		cout << solve(0,0,0)-1 << endl;
	}
}

int solve(int now, int sum, int b1){
	if(now == n){
		if(sum == s){return 1;}
		else return 0;
	}
	if(dp[now][sum][b1] != -1){return dp[now][sum][b1];}
	int t = 0;
	for(int i = 0; i < 10; i++){
		if(b1 != 0 && b1 >= i){continue;}
		t += solve(now+1, sum + i, i);
	}
	return dp[now][sum][b1] = t;
}

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

#define FOR(i, a, b) for (int i = (a); i < int(b); ++i)
#define RFOR(i, a, b) for (int i = (b)-1; i >= int(a); --i)
#define REP(i, n) FOR(i, 0, n)
#define REP1(i, n) FOR(i, 1, int(n) + 1)
#define RREP(i, n) RFOR(i, 0, n)
#define RREP1(i, n) RFOR(i, 1, int(n) + 1)
#define ALL(c) begin(c), end(c)

int _ = (
#ifndef LOCAL
    std::cin.tie(nullptr), std::ios::sync_with_stdio(false),
#endif
    std::cout.precision(10), std::cout.setf(std::ios::fixed));

using ll = long long;
using ld = long double;
template <typename T> using vec = std::vector<T>;
using pii = std::pair<int, int>;
using namespace std;

int n, s;

struct solve {
  solve() {
    dfs(0, 0, -1);
    cout << answer << endl;
  }
  void dfs(int acc, int depth, int from) {
    if (acc > s || depth > n) {
      return;
    }
    if (depth == n && acc == s) {
      answer++;
      return;
    }
    for (int i = from + 1; i < 10; i++) {
        dfs(acc + i, depth + 1, i);
    }
  }
  int answer = 0;
};

int main() {
  for (;;) {
    cin >> n >> s;
    if (n == 0 && s == 0) {
      break;
    }
    solve();
  }
  return 0;
}