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>

int Judge(int n, int remain, int start)
{
	if (n == 1)
	{
		if (remain < 0)
		{
			return 0;
		}
		if (remain < start)
		{
			return 0;
		}
		return 1;
	}
	else
	{
		int ret = 0;
		for (int i = start; i < 9; ++i)
		{
			ret += Judge(n - 1, remain - i, i + 1);
		}
		return ret;
	}
}

int main()
{
	int n, s;

	while (std::cin >> n >> s)
	{
		std::cout << Judge(n, s, 0);
	}

	return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

#define TEMP_T template<typename T>
TEMP_T void sort(T& v){ sort(v.begin(), v.end()); }
TEMP_T void revs(T& v){ reverse(v.begin(), v.end()); }
TEMP_T void uniq(T& v){ sort(v); v.erase(unique(v.begin(), v.end())); }
TEMP_T void show(T& v, char delim=' ', char end='\n'){ for(int i=0; i<v.size()-1; i++) cout << v[i] << delim; cout << v[v.size()-1] << end; }
TEMP_T T    cums(T& v){ T r; r.push_back(v[0]); for(int i=1; i<v.size(); i++) r.push_back(r[i-1] + v[i]); return r; }
TEMP_T void maxe(T& v, T m){ v = max(v, m); }
TEMP_T void mine(T& v, T m){ v = min(v, m); }

static inline int in(){ int x; scanf("%d", &x); return x; }

struct Solver {
  int pattern[64];
  int n;
  Solver(int n) : n(n) {
    memset(pattern, 0, sizeof(pattern));
  }
  void solve(int it=0, int c=0, int s=0){
    if (it == 10){
      if (c == n){
        pattern[s]++;
      }
      return;
    }
    solve(it + 1, c + 1, s + it);
    solve(it + 1, c, s);
  }
};

int main()
{
  int n, s;
  while (n = in(), s = in(), !(n == 0 && s == 0)){
    Solver solver(n);
    solver.solve();
    if (s < 64){
      printf("%d\n", solver.pattern[s]);
    }
    else puts("0");
  }

  return 0;
}

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

int n,s,ans = 0;

//???????????°??????????¨???????????????°????????°
void dfs(int i,int sum,int num){
    
    if(num == n){
        
        if(sum == s){
            ans++;
        }
        return;
    }
    if(i == 10){
        return;
    }
    //i????????°??????,??????????????°????¶?????????????
    dfs(i+1,sum,num);
    //i????????¶
    dfs(i+1,sum + i,num+1);
}

int main(){

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

    return 0;
}

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

int solve(vector<bool> selected, int s, int n,set<vector<bool> > &visited){
  int cnt=0;
  if(visited.find(selected)!=visited.end())return 0;
  visited.insert(selected);
  if(n==0){
  	if(s==0)return 1;
  	else return 0;
 	}
  for(int i=0;i<=9;++i){
    if(!selected[i]){
    	selected[i]=true;
    	cnt+=solve(selected,s-i,n-1,visited);
    	selected[i]=false;
    }
  }
  return cnt;
}

int main(void){
  int n,s;
  while(cin>>n>>s,n||s){
  	set<vector<bool> > visited;
    vector<bool> a(10);
    cout<<solve(a,s,n,visited)<<endl;
  }
}

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

int main()
{
	while ( true )
	{
		int n,s; cin>>n>>s;
		if ( n==0 && s==0 )
			break;
		int c = 0;
		for ( int i=0; i<1<<10; i++ )
		{
			int tn = 0;
			int ts = 0;
			for ( int j=0; j<10; j++ )
			if ( i>>j&1 )
				tn++,
				ts += j;
			if ( tn==n && ts==s )
				c++;
		}
		cout << c << endl;
	}
	return 0;
}

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

int cnt, n, s;
void bt(int deep, int sum, int use);

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

void bt(int deep, int sum, int use){
	if(n <= deep){
		if(sum == s){
			cnt++;
		}
	} else{
		//cout <<"deep = " <<deep <<" " <<"sum = " <<sum <<" " <<"use = " <<use <<endl;
		for(int i = use + 1; i <= 9; i++){
			bt(deep + 1, sum + i, i);
		}
	}
}

C++: #include<bits/stdc++.h>

using namespace std;

int n,s;

int F(int deps,int cnt,int sum){
    if(deps == 10){
        if(cnt == n && sum == s)return 1;
        return 0;
    }
    return F(deps + 1,cnt + 1,sum + deps) + F(deps + 1,cnt,sum);
}

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

}

C++: #include<map>
#include<set>
#include<list>
#include<cmath>
#include<queue>
#include<stack>
#include<cstdio>
#include<vector>
#include<complex>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<numeric>
#include<sstream>
#include<iostream>
#include<algorithm>
#include<functional>

using namespace std;

int i=0,n=0,s=0,cnt=0,ans=0;
int combination(int a,int b,int c);


int combination(int a,int b,int c) 
//0-9テ」ツ?ョテヲツ閉ーテ・ツュツ療」ツつ誕,テ」ツ?敕」ツつ古」ツ?ァティツィツ暗ァツョツ療」ツ?療」ツ?淌ヲツ閉ーテ・ツ?、テ」ツつ鍛,テヲツ。ツ?ヲツ閉ーテ」ツつ団テ」ツ?ィテ」ツ?凖」ツつ?
{
	if(b == s && c == n){	//ティツィツ暗ァツョツ療」ツ?療」ツ?淌ヲツ閉ーテ・ツ?、テ」ツ?凝」ツ?、テ・ツ青暗ィツィツ?テ」ツ?ィテヲツ。ツ?ヲツ閉ーテ」ツ?古・ツ?・テ・ツ環崚」ツ?ィテ、ツクツ?ィツ?エテ」ツ?療」ツ?淌・ツ?エテ・ツ青?
		ans++;				//1テゥツ?堙」ツつ甘ィツヲツ凝」ツ?、テ」ツ?凝」ツ?」テ」ツ?淌」ツ?ョテ」ツ?ァテッツシツ妥ゥツ?堙」ツつ甘」ツδ療」ツδゥテ」ツつケテ」ツ?凖」ツつ?
	}
	if(a == 10 || c == n){	//0-9テ」ツ?ョテヲツ閉ーテ・ツ?、テ」ツつ津ヲツ篠「テ」ツ?療ァツオツづ」ツつ湘」ツ?」テ」ツ?淌」ツ?凝」ツ??ヲツ。ツ?ヲツ閉ーテ」ツ?古・ツ?・テ・ツ環崚」ツ?ィテ、ツクツ?ィツ?エテ」ツ?療」ツ?淌・ツ?エテ・ツ青?
		return 0;
	}
	combination(a+1,b,c);	//テヲツ閉ーテ・ツ?、テ」ツつ?1テ」ツ?療」ツ?ヲテ・ツ?催ィツ?ε」ツ?凖」ツつ?
	combination(a+1,b+a,c+1);	//テヲツ閉ーテ・ツ?、テ」ツつ?1テ」ツ?療」ツ??・ツ青暗ィツィツ暗」ツ?ォテヲツ閉ーテ・ツ?、テ」ツつ津ィツカツウテ」ツ?療」ツ??ヲツ。ツ?ヲツ閉ーテ」ツつ津・ツ「ツ療」ツつ?」ツ?療」ツ?ヲテ・ツ?催ィツ??
}
int main()
{
	while(cin >> n >> s && n && s>=0){
		ans=0;
		combination(0,0,0);
		cout << ans << endl;
	}
}

C++: #include <stdio.h>

int n, s, cnt;

void dfs(int i, int sum, int n){
    if(sum==s&&!n){
        cnt++;
        return;
    }
    if(i==10||!n) return;
    dfs(i+1,sum,n);
    dfs(i+1,sum+i,n-1);
}

int main(){
	while(1){
		scanf("%d%d",&n,&s);
		if(n==0&&s==0){
			break;
		}
		cnt=0;
		dfs(0,0,n);
		printf("%d\n",cnt);
	}

    return 0;
}

C++: #include<map>
#include<set>
#include<list>
#include<cmath>
#include<queue>
#include<stack>
#include<cstdio>
#include<string>
#include<vector>
#include<complex>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<numeric>
#include<sstream>
#include<iostream>
#include<algorithm>
#include<functional>

#define MP make_pair
#define PB push_back
#define ALL(x) (x).begin(),(x).end()
#define REP(i,n) for(int i=0;i<(n);i++)
#define REP1(i,n) for(int i=1;i<(n);i++)
#define REP2(i,d,n) for(int i=(d);i<(n);i++)
#define RREP(i,n) for(int i=(n);i>=0;i--)
#define CLR(a)      memset((a),0,sizeof(a))
#define MCLR(a)     memset((a),-1,sizeof(a))
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI > VVI;
typedef vector<string> VS;
typedef vector<LL> VLL;
typedef pair<int,int> PII;

const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;

const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};
 
int f(int n,int s,int i){
	if(i==10&&s==0&&n==0)
		return 1;
	if(i==10&&(s!=0||n!=0))
		return 0;
	return f(n,s,i+1)+f(n-1,s-i,i+1);
}

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