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 <iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <vector>
#include <set>

using namespace std;
typedef long long LL;
static const double EPS = 1e-9;

#define FOR(i,k,n) for (int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n) 
int SumOfIntegers(int n, int s){
  if(n<0||s<0) return 0;
  int a[10],count=0,sum;
  REP(i,10) a[i] = i;
  while(next_permutation(a, a+sizeof(a)/sizeof(a[0]))){
    sum = 0;
    REP(i,n) sum+=a[i];
    if(sum == s) count++;
  }
  int d=6;
  for(int i=10-n;i>0;i--) d*=i;
  return (count/d);
}

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

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

int func(int n, int s, int i){
	if(!n){
    	if(!s)return 1;
    	else return 0;
    }
	if(i >= 10 || s-i < 0)return 0;
	return func(n, s, i+1) + func(n-1, s-i, i+1);
}

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

C++: #include<iostream>

using namespace std;

int ans = 0;
void dfs(int n,int s,int d){
	if (s < 0) return;
	if (s == 0 and n == 0){
		ans++;
		return;
	}
	if (n == 0) return;	
	d++;
	if (d == 10)return;
	//???????????´???
	dfs(n-1,s-d,d);
	//?????°????????£?????´???
	dfs(n,s,d);
return;
}

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

return 0;
}

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

int n, s, cnt;

void dfs(int i, int sum, int n){
	if(sum==s&&!n){
		cnt++;
		return;
	}
	if(i==10||!n) return;
	//使用する3つを探索
	//使用しなければカウントされない
	dfs(i+1,sum,n);
	dfs(i+1,sum+i,n-1);
}

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

C++: #include<bits/stdc++.h>
using namespace std;
int cnt,n,s;
void func(int sum,int c,int j){
	int i;
	if(c<n){
		for(i=j;i<10;i++){
			if(sum+i>s)break;
			if(sum+i==s&&c+1==n) cnt++;
			else if(sum+i<s&&c+1<n)	func(sum+i,c+1,i+1);
		}
	}
}
int main(void){
	int i;
	while(1){
		cin>>n>>s;
		if(n==0)break;
		cnt=0;
		func(0,0,0);
		cout<<cnt<<endl;
	}
	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int ans;
void serch(int i,int j,int n)
{
    if(!n&&!j){
        ans++;
        return;
    }
    else if(i==10||!n)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)){
            ans=0;
            serch(0,s,n);
            cout<<ans<<endl;
    }
}

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

#define MAX_S 100
#define MAX_N 10

int N, S;

int dfs(int n, int s, int count);

int main(){
	while(1){
		scanf("%d%d", &N, &S);
		if(N == 0 && S == 0) return 0;
		
		printf("%d\n", dfs(0, 0, 0));
	}
}

int dfs(int n, int s, int count){//今nまで足すか否かを決定し、その和がs
	if(n == 10 || s > S) return 0;
	
	if(count == N) return (s == S)? 1 : 0;
	
	int res = dfs(n + 1, s, count) + dfs(n + 1, s + n, count + 1);
	
	return res;
}

C++: #include <stdio.h>

int sum[10][46]={0};
int main() {
	for(int i=0; i<1<<10; i++) {
		int sumi = 0, count = 0;
		for(int j=0; j<10; j++) {
			if(i & (1<<j)) {
				sumi += j;
				count++;
			} 
		}
		sum[count][sumi]++;
	}
	
	int n = -1, s = -1;
	if(freopen("D:\\test.txt", "r", stdin) == NULL) return -1;
	while(scanf("%d%d", &n, &s) !=EOF) {
		if(n == 0 && s == 0) break;
		printf("%d\n", sum[n][s]);
	}
	return 0;
}

C++: #include <iostream>
#include <vector>
#include <stdio.h>
#include <string.h>

using namespace std;

int N, S, ans, dp[15][60][15];

void rec(int base, int x, int used) {
    if(x > S || used > N) return;
    if(x == S && used == N) {
        if(!dp[base][x][used]) {
            dp[base][x][used] = 1;
            ans += 1;
        }
        return;
    }
    dp[base][x][used] = 1;
    for(int i = base; i <= 9 && x + i <= S; i++) {
        rec(i + 1, x + i, used + 1);
        rec(i + 1, x, used);
    }
}

int main(void) {
    while(1) {
        scanf("%d%d", &N, &S);
        if(N == 0 && S == 0) break;
        ans = 0;
        memset(dp, 0, sizeof(dp));
        for(int i = 0; i <= S; i++) {
            rec(i + 1, i, 1);
        }
        printf("%d\n", ans);
    }
    return 0;
}

C++: #include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <set>
#include <cmath>
#include <algorithm>
using namespace std;

int n;
int cnt=0;

void dfs(int depth , int k , int sum ){
	if(depth==n){
		if(k==0){
			cnt++;
			return;
		}
	}
	if(k<0) return;
	for(int i=sum; i<10 ; i++){
		dfs(depth+1 , k-i , i+1);
	}
}

int main(){
	int s;
	while(cin>> n >> s , (n || s)){
		dfs(0,s,0);
		cout << cnt << endl;
		cnt=0;
	}
	return 0; 
}

C++: #include<iostream>
#include<vector>
using namespace std;
int dfs(int,int);
vector<vector<int> > dp(10,vector<int>(82,-1));
int n,s;
int main(){
	while(1){
		cin>>n>>s;
		if(n==0&&s==0)break;
		dfs(0,0);
	}



	return 0;
}
int dfs(int i,int sum){
	if(i==n-1)return sum;
	for(int j=0;j<=9;++j){
		if(dfs(i+1,sum+j)==s){

		}
	}

}

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

using namespace std;

int Judge(vector<int> no, int n);

int main()
{
  int n, s, cnt, sum, i, j, k, judge;
  
  while(cin >> n >> s, (n != 0 || s != 0)) {
    vector<int> no(9);
    for(i = 0; i < n ; i++) no[i] = i;
    cnt = 0;
    while(1) {
      if(no[0] == 10) break;
      judge = Judge(no , n);
      if(judge == true) {
	for(k = sum = 0; k < n; k++) {
	  sum += no[k];
      }
	if (sum ==  s) cnt++;
      }
      no[n - 1]++;
      for(k = n - 1; k > 0; k--) {
	if(no[k] == 10) {
	  no[k] = 0;
	  no[k - 1]++;
	}
      }
    }
    cout << cnt << endl;
  }
}

int Judge(vector<int> no, int n)
{
  int i, j;
  for(i = 0; i + 1 < n; i++) {
    if (no[i] > no[i + 1]) return false;
    for(j = i + 1; j < n; j++)
      if (no[i] == no[j])
	return false;
  }
  return true;
}

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

C++: #include <iostream>

using namespace std;

int n, s;
int count = 0;

void DFS(int sum, int pre, int depth)
{
	if(depth > n || sum > s)
	{
		return;
	}
	else if(sum == s && depth == n)
	{
		++count;
		return;
	}
	for(int i = pre + 1; i < 10; ++i)
	{
		DFS(sum + i, i, depth + 1);
	}
}

void solve()
{
	while(cin >> n >> s, n || s)
	{
		count = 0;
		for(int i = 0; i < 10; ++i)
		{
			DFS(i, i, 1);
		}
		cout << count << endl;
	}
}

int main()
{
	solve();
	return(0);
}

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

int ans,s,n;

void fanc(int sum,int i,int j){
	if (sum==s&&i==n) {
		ans++;
		return;
	}
	if (sum>s||i>n||j>9) {
		return;
	}
	fanc(sum+j,i+1,j+1);
	fanc(sum,i,j+1);
	
	return;
}


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