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 <bits/stdc++.h>
#include <numeric>
#define REP(i, s, n) for (int i = s; i < n; ++i)
#define rep(i, n) REP(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define SORT_INV(c) sort((c).begin(), (c).end(), greater<int>())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false
#define LL long long
#define Dev 1000000007

// sort(a.begin(), a.end(), std::greater<int>());
using namespace std;

int main()
{
    int n, s;
    while (true)
    {
        cin >> n >> s;
        if (n == 0 && s == 0)
            break;
        int num = 0;
        rep(i, 1024)
        {
            vector<int> hoge;
            rep(j, 10)
            {
                if ((i & (1 << j)) != 0)
                    hoge.push_back(j);
            }
            int piyo = 0;
            if (hoge.size() == n)
            {
                for (auto item : hoge)
                    piyo += item;
            }
            if (piyo == s)
                num++;
        }
        cout << num << endl;
    }
    return 0;
}

C++: #include <iostream>
#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);
    int f = 0;
    while (!S.empty()) {
        if (f++ == 200) break;
        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 < n && u.sum < s) {
            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 && u.depth != 0) {
            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>
using namespace std;
int serch(int i,int j,int n)
{
    if(!n&&!j)return 1;
    else if(i==10||!n)return 0;
    return serch(i+1,j-i,n-1)+serch(i+1,j,n);
}
int main()
{
    int n,s;
    while(cin>>n>>s&&(n!=0||s!=0))cout<<serch(0,s,n)<<endl;
}

C++: #include<iostream>
#include<iomanip>
#include<cstdio>
#include<string>
#include<cstring>
#include<climits>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<deque>
#include<tuple>
#include<list>
#include<unordered_map>
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define lb lower_bound
#define pb push_back
#define mp make_pair
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
// #define int ll
using namespace std;
const int INF (1 << 30);
const ll LLINF (1LL << 55LL);
const int MOD = 1000000007;
const int MAX = 510000;



int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    while(true){
        ll n,s;
        cin>>n>>s;
        if(n==0&&s==0) break;
        ll ans=0;
        for(ll bit=0;bit<(1<<10);bit++){
            ll sum=0,cnt=0;
            rep(i,10){
                if(bit&(1<<i)){
                    sum+=i;
                    cnt++;
                }
            }
            if(cnt!=n) continue;
            if(sum==s) ans++;
        }
        cout<<ans<<endl;
    }
    return 0;
}

C++: #include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>	// require sort next_permutation count __gcd reverse etc.
#include <cstdlib>	// require abs exit atof atoi 
#include <cstdio>		// require scanf printf
#include <functional>
#include <numeric>	// require accumulate
#include <cmath>		// require fabs
#include <climits>
#include <limits>
#include <cfloat>
#include <iomanip>	// require setw
#include <sstream>	// require stringstream 
#include <cstring>	// require memset
#include <cctype>		// require tolower, toupper
#include <fstream>	// require freopen
#include <ctime>		// require srand
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
int n, s;
int ans;
bool used[10];

void dfs (int curr, int curr_s, int pre )
{
	if (curr >= n ){
		if (curr_s == s ) ans++;
		return;
	} // end if

	for (int i = pre+1; i < 10; i++ ){
		if (!used[i] ){
			used[i] = true;
			dfs (curr+1, curr_s + i, i );
			used[i] = false;
		} // end if
	} // end rep
}

int main()
{
//	cut here before submit 
//	freopen ("testcase.Sum_of_Integers", "r", stdin );
	while (scanf ("%d %d", &n, &s ) ){
		if (n == 0 && s == 0 ) break;
		memset (used, false, sizeof (false ) );
		ans = 0;
		dfs (0, 0, -1 );
		printf ("%d\n", ans );
	} // end loop
		
	return 0;
}

C++: #include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

template <unsigned T>
bool nextBitset(bitset<T> &bs, int digit)
{
    bitset<T> x, y, z;
    x = bs.to_ulong() & (~(bs.to_ulong()) + 1ULL);
    y = bs.to_ulong() + x.to_ulong() + 0ULL;
    z = bs & ~y;
    if(bs[digit-1] && bs == z)
        return false;
    bs = ((z.to_ulong() / x.to_ulong()) >> 1) + 0ULL;
    bs |= y;
    return true;
}

int main()
{
    for(;;){
        int n, s;
        cin >> n >> s;
        if(n == 0)
            return 0;

        bitset<10> bs((1<<n)-1);
        int ret = 0;
        do{
            int tmp = 0;
            for(int i=0; i<10; ++i){
                if(bs[i])
                    tmp += i;
            }
            if(tmp == s)
                ++ ret;
        }while(nextBitset(bs, 10));
        cout << ret << endl;
    }
}

C++: # include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
constexpr int MOD = 1000000007;
constexpr int INF = 2000000000;
using namespace std;

int n, s;
int ans = 0;

void dfs(int pos, int sum,int count) {
	if (count == n) {
		if (sum == s) {
			ans++;
		}
		return;
	}
	if (pos == 10)return;
	if (sum > s)return;
	dfs(pos + 1, sum + pos,count+1);
	dfs(pos + 1, sum,count);
}

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