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++: //0030
//template
//include-------------------------------------
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<stack>

using namespace std;

//typedef--------------------------------------
typedef vector<int> VI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

#define MP make_pair

//repetition-----------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)

//constant-------------------------------------
const double PI = acos(-1.0);

//cout,cin-------------------------------------
#define COUT(x) cout<<(x)<<endl;
#define CIN(x) cin>>(x);

int dfs(int n, int s, int p, int ans){
	if (p>10) return 0;
	if (n == 0) return s == 0 ? 1 : 0;
	for (int i = p; i < 10; i++)
		ans += dfs(n--, s - i, p++, ans);
	return ans;
}

int main(){

	int n, s;
	while (cin >> n >> s){
		if (n == 0 && s == 0) break;
		COUT(dfs(n, s, 0, 0))
	}

	return 0;

}

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

using namespace std;

int ct(int x, int n, int s)
{
	if (x == 10){
		return (s == 0 && n == 0);
	}
	
	return (ct(x + 1, n - 1, s - x) + ct(x + 1, n, s));
}

int main()
{
	int n, s;
	
	while (scanf("%d %d", &n, &s) && n){
		printf("%d\n", ct(0, n, s));
	}
	
	return (0);
}

C++: #include<stdio.h>

int count=0;
int s,n;

void ans(int i,int n,int sum);

void main()
{

	while(scanf("%d %d",&n,&s),n){
		count=0;
		ans(0,0,0);
		printf("%d\n",count);
	}
}

void ans(int i,int sum,int ele)
{
	if(i==n){
		if(sum==s)
			count++;
	}
	else{
		if(ele<=9){
			ans(i+1,sum+ele,ele+1);
			ans(i,sum,ele+1);
		}
	}
}

C++: //#define _USE_MATH_DEFINES
//#include <cmath>
#include <iostream>
//#include <stdio.h>
//#include <stdlib.h>
//#include <iomanip>
#include <vector>
//#include <string>
//#include <algorithm>
//#include <functional>
//#include <time.h>
//#include <sstream>
//#include <queue>
//#include <map>

using namespace std;

int n,s,ans = 0;

bool dfs(int i, int cnt, int sum,vector <int> v){
	//??±???????????¢?´¢
	
	

	if (cnt == n){
		if (sum == s) {
			ans++;
			//for (int j = 0; j < v.size(); j++){
			//	cout << v[j] << " ";
			//}
			//cout << endl;
		}
		return true;
	}

	if (i == 10)return true;


	for (int j = 0; i < v.size(); j++){
		if (v[j] == i)return true;
	}


	//nouse
	dfs(i + 1, cnt, sum, v);

	//use
	v.push_back(i);
	dfs(i + 1, cnt + 1, sum + i,v);

	return false;

}

int main(){

	vector <int> v;

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

		dfs(0, 0, 0, v);

		cout << ans << endl;
	}


	return 0;
}

C++: # include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
constexpr int MOD = 1000000007;
constexpr int INF = 2000000000;
using namespace std;

int n, s;
int ans = 0;

void dfs(int pos, int sum,int count) {
	if (count == n&&sum == s) {
		ans++;
		return;
	}
	if (pos == 10 || count == n) {
		return;
	}

	dfs(pos + 1, sum + pos,count+1);
	dfs(pos + 1, sum,count);
}

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

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

using namespace std;

int n, s, cont, cost;

void dps(int sum, int i, int cost);

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

    return 0;
}

void dps(int sum, int i, int cost)
{
	if(cost == n && sum == s) {
		cont++;
		cout << cont << ":" << i << endl;
	}

	else if(cost < n && i < 9) {
		dps(sum+i, i+1, cost+1);
		dps(sum, i+1, cost);
	}
}

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

using namespace std;

int main()
{
	int n, s;
	while (cin >> n >> s, n || s) {
		int ans = 0;

		for (int i = 0; i < (1<<10); ++i) {
			int cnt = 0, sum = 0;

			for (int j = 0; j < 10; ++j) {
				if (i >> j & 1) {
					sum += j;
					cnt++;
				}
			}

			if (cnt == n && sum == s) ans++; 
		}

		printf("%d\n", ans);
	}
}

C++: #include <iostream>
#include <vector>
using namespace std;
#define rep2(x,from,to) for(int x=(from); x<(to); (x)++)
#define rep(x,to) rep2(x,0,to)
vector<int> v;
int ret = 0;
void check(int s) {
	int total = 0;
	for(int x : v) {
		total += x;
	}
	if(s == total) ret++;
}
void select(int a, int l, int s) {
	if(!l) {
		check(s);
		return;
	}
	rep2(i,a,10) {
		v.push_back(i);
		select(i+1, l-1, s);
		v.pop_back();
	}
}
		
int main() {
	int n, s;
	while(cin >> n >> s && (n || s)) {
		select(0, n, s);
		cout << ret << endl;
		ret= 0;
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
main(){
	int s,n;
	while(cin>>s>>n,s && n){
		int ans=0;
		for(int i=0;i<=9;++i){
			for(int j=i+1;j<=9;++j){
				for(int k=j+1;k<=9;++k){
					if(n==i+j+k)ans++;
				}
			}
		}
		cout<<ans<<endl;
	}
}

C++: #include <iostream>
#include <map>
#include <vector>
#include <cmath>
#include <iomanip>
#include <string>
#include <queue>
#include <algorithm>
#include <cctype>
#define shosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const double pi=acos(-1);

int n,s,ans;

void func(int x,int y,int z){
	if(!x&&!y){
		ans++;
		return;
	}
	if(!x||y<0||z==10) return;
	for(int i=z;i<10;i++) func(x-1,y-i,i+1);
}

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

C++: #include <iostream>
using namespace std;
int n,s,flag[10] = { 0 },c;
void f(int m,int a,int t){
	if(a == n){
		if(t == s) ++c;
		return;
	}
	else {
		if(t > s) return;
		for(int i = m;i < 10;++i){
			if(flag[i] == 0){
				flag[i] = 1;
				f(i + 1,a + 1,t + i);
				if(a != 0) flag[i] = 0;
			}
		}
	}
	return;
}
int main(){
	while(cin >> n >> s && (n != 0 && s != 0)){
		for(int i = 0;i < 10;++i){
			flag[i] = 0;
		}
		c = 0;
		f(0,0,0);
		cout << c << endl;
	}
	return 0;
}

C++: #include <iostream> 

int main(){
	int a,b;	
	while(std::cin>>a>>b&&a!=0&&b!=0){
		int d2=0,d3=0,d4=0,d5=0,d6=0,d7=0,d8=0,d9=0;
		int o=0;
		for(int d=0;d<10;d++){
			if(a>1&&d<=10-a){
				for(d2=d+1;d2<10;d2++){
			if(a>2&&d2<=10-a+1){
				for(d3=d2+1;d3<10;d3++){
			if(a>3&&d3<=10-a+2){
				for(d4=d3+1;d4<10;d4++){
			if(a>4&&d4<=10-a+3){
				for(d5=d4+1;d5<10;d5++){
			if(a>5&&d5<=10-a+4){
			for(d6=d5+1;d6<10;d6++){
			if(a>6&&d6<=10-a+5){
				for(d7=d6+1;d7<10;d7++){
			if(a>7&&d7<=10-a+6){
				for(d8=d7+1;d8<10;d8++){
			if(a>8&&d8<=10-a+7){
				for(d9=d8+1;d9<10;d9++){
		if(a==9&&b==d+d2+d3+d4+d5+d6+d7+d8+d9){
			o++;
		}
			}
		}
		if(a==8&&b==d+d2+d3+d4+d5+d6+d7+d8+d9){
			o++;
		}
			}
		}
		if(a==7&&b==d+d2+d3+d4+d5+d6+d7+d8+d9){
			o++;
		}
			}
		}
		if(a==6&&b==d+d2+d3+d4+d5+d6+d7+d8+d9){
			o++;
		}
			}
		}
		if(a==5&&b==d+d2+d3+d4+d5+d6+d7+d8+d9){
			o++;
		}
			}
		}
		if(a==4&&b==d+d2+d3+d4+d5+d6+d7+d8+d9){
			o++;
		}
			}
		}if(a==3&&b==d+d2+d3+d4+d5+d6+d7+d8+d9){
			o++;
		}
			}
		}if(a==2&&b==d+d2+d3+d4+d5+d6+d7+d8+d9){
			o++;
		}
		}
		if(a==1&&b==d+d2+d3+d4+d5+d6+d7+d8+d9){
			o++;
		}
			}
		}
		std::cout<<o<<std::endl;
	}
	return 0;
}