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 count(int n, int s, int i, int sum){
	if(n == 0 && sum == s){
		return 1;
	}else if(i > 9){
		return 0;
	}
	return count(n-1, s, i+1, sum+i) + count(n, s, i+1, sum);
}

int main(void){
	int n, s;
	bool use[10];
	while(true){
		scanf("%d %d", &n, &s);
		if(n==0 && s==0){ break; }
		printf("%d\n", count(n, s, 0, 0));
	}
	return 0;
}

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

int s;

int rec(int n,int sum ,int a){
  if(sum==s && n==0) return 1;
  if(sum>s || n==0 || a>=9) return 0;
  
  int cnt=0;
  for(int i=a+1;i<10;i++){
    cnt += rec(n-1,sum+i,i);
  }
  
  return cnt;
}

int main(){

  while(1){
    int n;
    scanf("%d %d",&n,&s);
    if(n==0 && s==0) break;

    printf("%d\n",rec(n,0,-1));
  }

  return 0;

}

C++: #include<bits/stdc++.h>
using namespace std;
 
#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 IINF INT_MAX
#define LLINF LLONG_MAX
 
typedef long long ll;
typedef pair<int, int> ii;

#define EPS 1e-8

int main(){
	
	int n, s;
	
	while(cin >> n >> s, n, s){
		int ans = 0;
		rep(i, 1<<10){
			int tmp = i;
			int j = 0;
			int cnt = 0;
			int sum = 0;
			while(tmp != 0){
				int f = tmp % 2;
				cnt += f;
				if(f != 0) sum += j;
				tmp = tmp >> 1;
				j++;
			}
			if(cnt != n) continue;
			if(sum == s) ans++;
		}
		cout << ans << endl;
	}

	
	return 0;
}

C++: #include<iostream>
#include<sstream>
#include<fstream>
#include<cstdio>
#include<vector>
#include<list>
#include<stack>
#include<deque>
#include<queue>
#include<map>
#include<set>
#include<algorithm>
#include<string>
#include<cmath>
#include<cstdlib>
using namespace std;
int u = 0;

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

int main(){
	int n,s;
	while(scanf("%d %d",&n,&s)==2,n||s){
		u = 0;
		solve(0,0,n,s);
		cout<<u<<endl;
	}
	return 0;
}

C++: #include <iostream>

int solve(int element_count, int sum, int range_max)
{
	if (element_count <= 1) {
		return (element_count == 1 && range_max >= sum) ? 1 : 0;
	}
	int result = 0;
	for (int max_element = element_count - 1; max_element <= range_max; ++max_element) {
		if (sum - max_element >= 0) {
			result += solve(element_count - 1, sum - max_element, max_element - 1);
		}
	}
	return result;
}

int main()
{
	int element_count, sum;
	while (std::cin >> element_count >> sum) {
		if (element_count == 0 && sum == 0) {
			break;
		}
		std::cout << solve(element_count, sum, 9) << std::endl;
	}

	return 0;
}

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

using namespace std;

int cnt;
int n,s;

void dfs(int left,int sum,int idx){
	if(left==0){
		if(sum==s)
			cnt++;
		return;
	}
	else if(sum > s)
		return;

	for(int i = idx+1; i <= 9; i++){
		dfs(left-1,sum+i,i);
	}
}

int main(){

	while(cin>>n>>s&&!(n==0&&s==0)){
		cnt=0;
		dfs(n,0,-1);
		cout<<cnt<<endl;
	}

	return 0;
}

C++: #include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<queue>
#include<utility>

using namespace std;

int n, s;

int cal(int a, int b, int c)
{
	int hoge = 0;

	if (a == 1 && b >= c && b < 10)
	{
		return 1;
	}
	if (a == 1)
	{
		return 0;
	}

	for (int i = c; i < 10 && i < b; i++)
	{
		hoge += cal(a - 1, b - i, i + 1);
	}

	return hoge;


}

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

	return 0;
}

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

int n,s;

int dfs(int i,int c,int sum){
	int res=0;
	if(n<c || c+10-i<n || s<sum)return 0;
	if(c==n&&sum==s)return 1;
	res += dfs(i+1,c,sum);
	res += dfs(i+1,c+1,sum+i);
	return res;
}
int main(){
	while(cin>>n>>s,n||s)cout<<dfs(0,0,0)<<endl;
	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
 
int N,S;
int dfs(int n,int t,int sum){
    if(n==10)return 0;
    if(t==N){
          if(sum==S)return 1;
          else return 0;
    }
    return dfs(n+1,t,sum)+dfs(n+1,t+1,sum+n);
}
int main(){
    while(cin>>N>>S,n||s)cout<<dfs(0,0,0)<<endl;
    return 0;
}

C++: #include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <complex>
#include <ctime>
#include <cstdlib>

using namespace std;

inline int to_int(string s) {int v; istringstream sin(s); sin >> v; return v;}
template<class T> inline string to_str(T x) {ostringstream sout; sout << x; return sout.str();}

typedef long long ll;

int num, sum;
//now: 現在の数 cnt: 今なん回目？ add:何回足した？
int judge(int now, int cnt, int add)
{
	if(add == num)
	{
		if(now == sum)
			return 1;
		else
			return 0;
	}
	else if(cnt > 10)
	{
		return 0;
	}
	else
	{
		return judge(now + cnt, cnt+1, add+1) + judge(now, cnt+1, add);
	}
}

int main()
{
	cin >> num >> sum;

	cout << judge(0, 0, 0) << endl;
}

C++: #include <iostream>

int n, sum, ans;

void solve(int n, int sum, int less);

int main(){
	while(true){
		ans = 0;
		std::cin >> n >> sum;
		if(n == 0 && sum == 0)
			break;
		solve(n, sum, 0);
		std::cout << ans << std::endl;
	}
	return 0;
}

void solve(int n, int sum, int less){
	if(n == 0){
		if(sum == 0){
			++ans;
			return;
		}
	}

	for(int i = less; i < 10; ++i){
		if(sum - i >= 0)
			solve(n - 1, sum - i, i + 1);
	}

	return;
}

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

int n, s;

int dfs(int a, int m, int c){
    if(a == s && c == n) return 1;
    if(a >= s || c >= n) return 0;
    if(m > 9) return 0;
    int t = 0;
    for(int i = m; a+i <= s && i < 10; i++){
        t += dfs(a+i, i+1, c+1);
    }
    return t;
}

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

C++: #include <iostream>
#include <vector>
#include <map>
#include <stack>
#include <list>
#include <queue>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <math.h>

using namespace std;

int combi(int n, int s, vector<int> usedNum){
	int combiCount = 0;
	int tmp;
	bool usedFlag;

	n--;
	for(int i = 0; i <= 9; i++){
		usedFlag = false;
		
		for(int j = 0; j < usedNum.size(); j++){
			if(usedNum[j] == i) usedFlag = true; 
		}
		
		if(usedFlag){
			continue;
		}
		tmp = s;
		tmp -= i;
		if(n != 0){
			usedNum.push_back(i);
			combiCount += combi(n, tmp, usedNum);
		}
		else if(n == 0 && tmp == 0){
			usedNum.pop_back();
			return ++combiCount;
		}
	}

	usedNum.pop_back();
	return combiCount;
}


int main(){
	int n, s;
	int combiCount = 0;
	vector<int> usedNum;
	while(cin >> n >> s && n != 0 && s != 0){
		combiCount = combi(n, s, usedNum);
		cout << combiCount << endl;
	}
	return 0;
}