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 <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cctype>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <sstream>
#include <deque>

#define REP(i, n) for ( int i = 0; i < n; i++ )
#define MP(a, b) make_pair(a, b)

using namespace std;

typedef pair<vector<int>, int> data;

/*
全探索
9! = 362880 余裕

持っている配列、ステップ数
*/

int sum(vector<int> nums) {
    int sum = 0;
    REP(i, nums.size()) {
        sum += nums[i];
    }
    return sum;
}

bool insertable(int num, vector<int> nums) {
    REP(i, nums.size()) {
        if ( num == nums[i] ) return false;
    }
    return true;
}

int dump(vector<int> n) {
    REP(i, n.size()) {
        cout << n[i] << " ";
    }
    cout << endl;
}

int main() {
    int n, s;

    while(cin >> n >> s, n||s) {
        queue<data> open;
        int cnt = 0;

        // 初期値をpush
        REP(i, 10-(n-1)) {
            vector<int> num(n);
            num[0] = i;
            open.push( MP(num, 1) );
        }

        while(!open.empty()) {
            data d = open.front(); open.pop();
            vector<int> nums = d.first;
            int c = d.second;

            // cout << c << " " << n << endl;
            if ( c == n ) {
                if ( s == sum(nums) ) {
                    cnt++;
                    // dump(nums);
                }
                continue;
            }

            for ( int i = nums[c-1]; i <= 9; i++ ) {
                if ( insertable(i, nums) ) {
                    nums[c] = i;
                    open.push( MP(nums, c+1) );
                }
            }
        }
        cout << cnt << endl;
    }
    
    return 0;
}

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

// m以上の大きい数n個でsを作る場合の数
int solve(int n, int s, int m){
  if(n == 1){
    if(0 <= s && s <= 9 && s >= m) return 1;
    else return 0;
  }

  int ans = 0;
  for(int i=m; i<=9; i++) ans += solve(n-1, s-i, i+1);
  return ans;
}

int main(){
  int n, s;

  while(true){
    cin >> n >> s;
    if(n == 0 && s == 0) break;
    cout << solve(n, s, 0) << endl;;
  }
}

C++: // AOJ.cpp : アプリケーションのエントリ ポイントを定義します。
//

//#include "stdafx.h"
#include "stdio.h"
#include <vector>
#include <iostream>

using namespace std;

class Puzzle
{
public:
	vector<int> used;

	void play()
	{
		int n;
		int s;
		int ans = 0;
		used = vector<int>(10, 0);

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

			ans = try_sum(n, s, 0);
			printf("%d\n",ans);
		}
	}

	int try_sum(int n, int s, int min)
	{
		if (n == 0 && s == 0) return 1;
		if (n == 0 || s <= 0) return 0;
		int ans = 0;

		for (int ni = min; ni < 10; ni++) {
			if (used[ni] == 0 ) {
				used[ni] = 1;
				ans += try_sum(n - 1, s - ni, ni + 1);
				used[ni] = 0;
			}
		}

		return ans;
	}

};


int main()
{
	Puzzle puz;

	puz.play();

    return 0;
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
 
#define rep(i, n) for(int i = 0; i < n; i ++)
#define ALL(T) T.begin(), T.end()
#define mp make_pair
#define pb push_back
#define MEMSET(v, h) memset((v), h, sizeof(v))
 
using namespace std; 

typedef pair<int, int> pii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<string> vs;

const int INF = 1 << 24;
const int N = 100;

int dp[10][N + 1] = {0};

int main(void){
    dp[0][0] = dp[1][0] = 1;
    for(int i = 1; i <= 9; i ++)
        for(int j = N; 0 <= j; j --)
            rep(k, 10) if(dp[k][j] && j + i <= N) dp[k + 1][j + i] += dp[k][j];

    for(int n, s; cin >> n >> s, n; cout << dp[n][s] << endl);
 
    return 0;
}

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

int t;
int num[10];

void sousa(int a, int b){
	for(num[a-1] = num[a]-1; num[a-1] >= 0; num[a-1]--){
		if(a-1 < 0 || b < 0){
			break;
		}
		else if(a-1 == 0 && b-num[a-1] == 0){
			t++;
			break;
		}
		else{
			sousa(a-1, b-num[a-1]);
		}
	}
}
int main(){
	vector<int> array;
	int n, m;
	while(cin >> n >> m){
		if(n == 0 && m == 0){
			break;
		}
		if(m > 45){
			array.push_back(0);
			continue;
		}
		t = 0;
		num[n] = 10;
		sousa(n, m);
		array.push_back(t);
	}
	for(int i = 0; i < array.size(); i++){
		cout << array[i] << endl;
	}
}

C++: #include<iostream>
using namespace std;
long long a[10][10][60], x[10][60]; int n, m;
int main() {
	a[0][0][0] = 1; a[1][0][0] = 1;
	for (int i = 1; i < 10; i++) {
		for (int j = 0; j < 10; j++) {
			for (int k = 0; k < 60; k++) {
				for (int l = j + 1; l < 10; l++) {
					a[i][l][k + l] += a[i - 1][j][k];
				}
			}
		}
	}
	for (int i = 1; i < 10; i++) {
		for (int j = 0; j < 60; j++) {
			for (int k = 0; k < 10; k++) {
				x[i][j] += a[i][k][j];
			}
		}
	}
	while (true) {
		cin >> n >> m;
		if (!n) { break; }
		cout << x[n][m] << endl;
	}
}

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

int solver(int cnt, int s, int d){
    if(d == 0) return (s==0)?1:0;
    int sum = 0;
    for(int i=cnt+1; i<=9; ++i){
        sum += solver(i, s-i, d-1);
    }
    return sum;
}

int main(){
    int n, s;
    while(cin >> n >> s, n != 0 || s != 0){
        cout << solver(-1,s,n) << endl;
    }
    return 0;
}

C++: #include <iostream>
//#include <fstream>
using namespace std;
int ans,n,s;
 
void dfs(int cnt,int sum,int i){
	if(sum==s&&cnt==n){
        ++ans;
        return;
    }
    if(cnt==n||i>=10){
        return;
    }
    dfs(cnt,sum,i+1);
    dfs(cnt+1,sum+i,i+1);
    return;
};
 
int main(){
    while(cin>>n>>s&&n&&s){
        ans=0;
        dfs(0,0,0);
        cout << ans << "\n";
    }
    return 0;
}

C++: #include <iostream>

using namespace std;

int n,s;

int cou (int i,int cn, int cs){
	if(cs > s|| cn > n)
		return 0;
	if((cn == n||cn==n-1) && cs == s)
		return 1;
	int ans=0;
	i++;
	for(;i<10;i++)
		ans+=cou(i,cn+1,cs+i);
	return ans;
}


int main(void){
	while( cin >> n >> s, n|s){
		cout << cou(0,0,0) << endl;
	}
	return 0;
}

C++: #define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, m, n) for(int i=(m); i<(n); ++i)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define Cout(x) cout << (x) << endl
#define dump(x) cerr << #x << " = " << (x) << endl;
typedef long long LL;
typedef vector<int> VI;
typedef vector<long long> VL;
typedef vector<string> VS;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
const int inf = (int)1e9;
const long long mod = 998244353LL;
const double pi = acos(-1.0);

int main() {
	int n, s;
	while (cin >> n >> s && (n || s)) {
		int ans = 0;
		for (int bit = 0; bit < (1 << 10); bit++) {
			bitset<10> b = bit;
			if (b.count() == n) {
				int sum = 0;
				rep(i, 10)sum += i * b.test(i);
				ans += sum == s;
			}
		}
		Cout(ans);
	}
}

C++: #include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
using namespace std;
int n,s;
int solve(int se,int no,int sum){
  if(se>=10) return 0;
  //  if(sum+se > s) return 0;
  if(no>=n){
    if(sum==s) return 1;
    else return 0;
  } 
  return solve(se+1,no,sum)+solve(se+1,no+1,sum+se);
}
main(){
  while(1){
    int res;
    scanf("%d %d",&n,&s);
    if(n==0 && s==0) break;
    res=solve(0,0,0);
    printf("%d\n",res);
  }
}