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 dp[11][55][11];

int cnt_sum(int n, int s, int x){
  if(dp[n][s][x] != -1){
    return dp[n][s][x];
  }
  if(n == 0 && s == 0){
    return (1);
  }
  if(x>9){
    return (0);
  }
   
  return dp[n][s][x] = (cnt_sum(n-1, s-x, x+1) + cnt_sum(n, s, x+1));
}
int main(){
  int n, s;
  memset(dp,-1,sizeof(dp));
  while(1){
    scanf("%d %d", &n, &s);
    if(n == 0 && s == 0){
      break;
    }
    printf("%d\n", cnt_sum(n, s, 0));
  }
  return 0;
}

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

int s;
int cmb;
void count( int n ,int k,int sa ){
  if( DEBUG )
    cout << "n="<<n<<" k="<< k << " sa="<<sa 
	 << " cmb="<<cmb << endl;


  if( n<1 && sa==s ){ ++cmb; return; }
  --n;
  for( int i=k;i<=9;i++ ){
    if( sa+i > s)
      break;
    if( DEBUG )
      cout << " i="<<i<<endl;
    if( i+1<=9 )
      count( n,i+1, sa+i );
  }
}


int main(){
  int n;
  while( cin>>n>>s && (n||s) ){
    if( DEBUG )
      cout << "\nn="<<n<<" s="<<s << endl;
    cmb = 0;
    count( n,0,0 );
    cout << cmb << endl;
  }

  return 0;
}

C++: #include <stdio.h>
 
int i,n,s;
 
void part(int cal, int index, int sum){
			if(index == 9 && cal == n && sum == s){
			i++;
			return;	
			} 
			
			if(index > 9|| cal > n||sum > s) return;
			
	part(cal, index + 1, sum);
	part(cal + 1, index + 1, sum + index);
}
 
main(){
	while(1){
		scanf("%d %d", &n , &s);
		if (n==0 && s==0) return 0;
		i = 0;
		part(0, 0, 0);
		printf("%d\n",i);
	}
	return 0;
}

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

int visit(int n, int s, int x){
    int sum=0;
    if(n==0 && s==0)    return 1;
    if(n>0){
        for(int i=x; i<10; i++){
            if(s-i>=0)  sum+=visit(n-1, s-i, i++);
        }
    }
    return sum;
}

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

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

using namespace std;

int n, s, *num, pattern;
void search(int th) {
  if (th == n) {
    int sum = 0;
    for (int i = 0; i < n; i++)
      sum += num[i];
    if (s == sum) {
      for (int j = 0; j+1 < n; j++)
        if (num[j] >= num[j+1])
          return;
      /*                                                                                                                                                                                                                                                     
      for (int j = 0; j < n; j++)                                                                                                                                                                                                                            
        cout << num[j];                                                                                                                                                                                                                                      
      cout << endl;                                                                                                                                                                                                                                          
      */
      pattern++;
    }
  } else {
    int start = 0;
    if (th > 0)
      start = num[th-1]+1;
    for (int i = start; i < 10; i++) {
      num[th] = i;
      search(th + 1);
    }
  }
}

int main(int argc, char *argv[]) {
  vector<int> result;
  while (true) {
    cin >> n >> s;
    if (n == 0 && s == 0)
      break;
    num = new int[n];
    memset(num, 0, sizeof(int) * n);

    pattern = 0;
    search(0);
    result.push_back(pattern);
  }

  for (int i = 0; i < result.size(); i++)
    cout << result[i] << endl;
  return 0;
}

C++: #include<cstdio>
#include<algorithm>
using namespace std;
int n,s;
int solve(int i,int c,int sum){
  if(i<=0){
    if(sum==s) return 1;
    else return 0;
  }
  int res=0;
  for(int j=c;j<10;j++){
    res+=solve(i-1,j+1,sum+j);
  }
  return res;
}
int main(void){
  while(1){
    scanf("%d %d",&n,&s);
    if(!n && !s) break;
    printf("%d\n",solve(n,0,0));
  }
}

C++: #include <iostream>
using namespace std;main(){int n=0,s,j,k,i=0,a[11][46];for(;n<506;n++)a[n%11][n/11]=0;for(;i<1024;){for(j=i++,n=s=k=0;j>0;j/=2,k++)n+=j%2,s+=j%2*k;a[n][s]++;}for(cin>>n>>s;n;s<46?cout<<a[n][s]:cout<<0,cout<<endl,cin>>n>>s);}

C++: #include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define REPr(i,n) for(int i=(n)-1;i>=0; --i)
#define FORq(i, m, n) for(int i = (m);i <= (n);++i)
#define SCD(n) scanf("%d",&n)
#define SCD2(m,n) scanf("%d%d",&m,&n)
#define SCD3(m,n,k) scanf("%d%d%d",&m,&n,&k)
#define SCLLD(n) scanf("%lld",&n)
#define SCLLD2(m,n) scanf("%lld%lld",&m,&n)
#define SCLLD3(m,n,k) scanf("%lld%lld%lld",&m,&n,&k)
#define PB push_back
#define MP make_pair
#define ARSCD(A,N) REP(i,N){SCD(A[i]);}
#define ARSCD1(A,N) FORq(i,1,N){SCD(A[i]);}
#define VSCD(v,N) REP(i,N){int x; SCD(x); v.PB(x);}
#define VSCLLD(v,N) REP(i,N){long long x; SCLLD(x); v.PB(x);}
#define PRINTD(n) printf("%d\n",n)
#define PRINTLLD(n) printf("%lld\n",n)
#define DEBUG printf("%s\n","debug")
#define fst first
#define snd second
#define SIN(x,S) (S.count(x) != 0)
using namespace std;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector < VI > VVI;
typedef vector<long long> VL;
typedef long long ll;
typedef long long integer;
////////////////////////////////////////////////////////////////////
int n,s;
int cnt = 0;

void dfs(int i,int sum,int sumnum){
	if ((sum == s) and (sumnum == n)){
		cnt++;
		return;
	}

	if (i == 10) return;
	if (sum > s) return;

	dfs(i+1,sum,sumnum);
	dfs(i+1,sum+i,sumnum+1);
}

int main(){
	while(true){
		SCD2(n,s);
		if ((n==0) and (s==0)) break;
		cnt = 0;
		dfs(0,0,0);
		PRINTD(cnt);

	}
	return 0;
}