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 <algorithm>
#include <sstream>
#include <iostream>
#include <map>
#include <cstring>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <iostream>
#include <fstream>
using namespace std;

#define rep(i,n) for(int i = 0;i<n;i++)
#define FOR(i,s,e) for (int i = int(s); i != int(e); i++)
#define FORIT(i,c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); i++)
#define ISEQ(c) (c).begin(), (c).end()

int main() {
	while(true){
		int s,n,sum = 0,ans = 0;
		cin >> n >> s;
		if(s + n ==0) break;
		int comb = (1 << n) - 1;
		while(comb < 1 << 10){
			sum = 0;
			for(int p = 0;p<10;p++){
				if(comb & (1 << p)){
					sum+=p;
				}
			}
			if(sum == s){
				ans++;
			}
			int x = comb & -comb, y = comb+x;
			comb = ((comb & ~y) / x >> 1)|y;
		}
		cout << ans << endl;
	}
    return 0;
}

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

int res;
const int d[10]={0,1,2,3,4,5,6,7,8,9};

void dfs(int now,int idx,int n,int sum,int s){
	if(now==n) {
		if(sum==s){
			res++;
		}
	}
	if(idx<10){
		dfs(now,idx+1,n,sum,s);
		dfs(now+1,idx+1,n,sum+d[idx],s);
	}
}

int main(){
	int n,s;
	queue<int> que;
	while(cin>>n>>s,n||s){
		res=0;
		dfs(0,0,n,0,s);
		que.push(res);
	}

	while(que.size()){
		cout<<que.front()<<endl;
		que.pop();
	}

	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std ;
 
#define pb(n) push_back(n)
#define fi first
#define se second
#define X real()
#define Y imag()

#define value(x,y,w,h) (x >= 0 && x < w && y >= 0 && y < h)

#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
 
#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))
 
typedef long long ll ;
typedef deque<int> di ;
typedef deque<ll> dl ;
typedef map<string,int> dict;
typedef complex<double> comd;
typedef pair<int,int> pii;
 
constexpr int imax = ((1<<30)-1)*2+1 ;
constexpr int inf = 100000000;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0};
const int dx[] = {0,-1,0,1};
int res;
int n,s;
void solve(int a,int b,int c){
    if(b > n || a > s) return;
    REP(i,c+1,10){
        if(a+i == s && b+1 == n){
            ++res;
        }
        else if(b < n && a+i < s){
            solve(a+i,b+1,i);
        }
    }
    return ;
}

int main(){
    while(cin>> n){
        if( n == 0) break;
        cin >> s;
        res = 0;
        rep(i,10){
            solve(i,1,i);
        }
        cout << res << endl;
    }

    return 0;
}

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

// n個の重複しない整数 (min~) 用いてsを表す組み合わせの数
int ci(int n, int s, int min) {
  if (s < min) return 0; else if (n < 1) return 0; else if (n == 1) return 1;
  int r = 0;
  for (int i=min; i<s; i++) {
    r += ci(n - 1, s - i, i + 1);
  }
  return r;
}

int main() {
  while (true) {
    int n, s;
    cin >> n >> s;
    if (!n && !s) break;
    cout << ci(n, s, 0) << endl;
  }
  return 0;
}

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

int s;
bool used[10];

int countup( int n, int sum, int pre ){
    if( n == 0 ){
        if( sum == s ){
            return 1;
        }
        return 0;
    }
    int ret = 0;
    for( int i=pre; i<10; i++ ){
        if( !used[i] ){
            used[i] = true;
            ret += countup( n-1, sum+i, i+1 );
            used[i] = false;
        }
    }
    return ret;
}

int main(){
    int n;
    while( cin >> n >> s, n||s ){
        for( int i=0; i<10; i++ )
            used[i] = false;
        cout << countup(n, 0, 0) << endl;
    }
    return 0;
}

C++: #include<iostream>

using namespace std;

int dfs(int x,int n,int s){
  
  if(n==0)
    return (s==0);
  if(x==0)
    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,s){
    cout<<dfs(0,n,s)<<endl;
  }

}

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

int solve(int n, int s, int l) {
	if (n == 0) {
		if (s == 0) return 1;
		else return 0;
	}
	int res = 0, h = min(l, 9);
	for (int i = h + 1; i < 10; i++) {
		res += solve(n - 1, s - i, i);
	}
	return res;
}

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