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 <algorithm>
#include <cmath>
#include <iomanip>
#include <vector>
#include <utility>
#include <numeric>
#include <string>
#include <set>
#include <map>
#include <tuple>
#include <queue>
#include <stack>
#define rep(i, a, n) for(int (i) = (int)(a);(i) < (int)(n);++(i))
#define repe(i, a, n) for(int (i) = (int)(a);(i) <= (int)(n);++(i))
#define repr(i, a, n) for(int (i) = (int)(a);(i) > (int)(n);--(i))
#define reper(i, a, n) for(int (i) = (int)(a);(i) >= (int)(n);--(i))
#define SIZE(x) ((int)(x).size())
#define ALL(x) (x).begin(), (x).end()
#define RNG(x, n) &((x)[0]), &((x)[n])
#define SUBIF(a, b, x) ((x) ? (b) : (a))
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define yes cout << "yes" << endl;
#define no cout << "no" << endl;
#define pb push_back
#define EPS (1e-20)
#define INF 2147483647LL
#define MOD 1000000007LL
using llint = long long;
using VI = std::vector<int>;
using PII = std::pair<int, int>;
using SI = std::set<int>;
using MII = std::map<int, int>;
using TIII = std::tuple<int, int, int>;
using namespace std;


int n, s;


int cntBit(int bit){
	int cnt = 0;
	do {
		cnt += bit&1;
	} while(bit/=2);
	return cnt;
}


VI enumComb(){
	VI comb;
	rep(i, 0, 1<<10)
		if(cntBit(i) == n) comb.pb(i);
	return comb;
}


int solve(){
	int ans = 0;
	VI comb = enumComb();
	for(int x : comb){
		int sum = 0;
		repe(i, 0, 9)
			if((x>>i)&1) sum += i;
		if(sum == s) ans++;
	}
	return ans;
}


int main(){
	while(cin >> n >> s, n && s) cout << solve() << endl;

	return 0;
}

C++: #include <iostream>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <map>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,b) FOR(i,0,b)
#define PB push_back
#define MP make_pair
int n,s,ans;
void rec(int a,int b,int sum){
  if(sum==s&&b==0){
    ans++;
    return;
  }
  if(a>=10||b<=0)return;
  rec(a+1,b,sum);
  rec(a+1,b-1,sum+a);
}
int main(){
  while(cin>>n>>s&&n&&s){
    ans=0;
    rec(0,n,0);
    cout<<ans<<endl;
  }
}

C++: #include<stdio.h>

int main(){
	while(1){
		int n,s;
		scanf("%d %d",&n,&s);
		if(n==0)return 0;
		int ans=0;
		int i,j;
		int sum;
		int time;
		for(i=0;i<1<<10;i++){
			sum=0;
			time=0;
			for(j=0;j<10;j++)if(i>>j&1){sum+=j;time++;}
			if(sum==s&&time==n)ans++;
		}
		printf("%d\n",ans);
	}
}

C++: #include<iostream>
#include<vector>
#include<string>
#include<cstdlib>
#include<sstream>
#include<queue>
#include<deque>
#include<cmath>
#include<algorithm>
#include<stack>
#include<map>
#include<set>
#include<iomanip>
#define INF 2147483647
#define lli long long int
#define MOD 1000000007

using namespace std;
typedef vector<int> vi;
typedef vector< vector<int> > vvi;
typedef pair<int,int> pii;
typedef vector<pair<int,int>> vpii;

void printv(vi v){
	for(int i = 0; i < v.size(); i++){
		cout << v[i] << " ";
		}cout << endl;
		return ;
		}

int main() {
	while(1){
	
	int n,s; cin >> n >> s;
	if (n + s == 0) break;
	int ans = 0;
	vi loop(10,1);
	for (int i = 0; i < 10; i++){
		if (10 - i > n){
			loop[9-i] = 0;
		}
		
	}

	
	
	vi aold_used(10,0);
	vi bold_used(10,0);
	vi cold_used(10,0);
	vi dold_used(10,0);
	vi eold_used(10,0);
	vi fold_used(10,0);
	vi gold_used(10,0);
	vi hold_used(10,0);
	vi iold_used(10,0);
	vi jold_used(10,0);
	for (int a = 0; a <= 9*loop[0]; a++){
		vi used(10,0);
		aold_used = used;
		used[a] = 1;
		for (int b = a*loop[1]; b <= 9*loop[1]; b++){
			bold_used = used;
			if (used[b] == 1 and loop[1] != 0) continue;
			else if(loop[1] != 0) used[b] = 1;
			for (int c = b*loop[2]; c <= 9*loop[2]; c++){
				cold_used = used;
				if (used[c] == 1 and loop[2] != 0) continue;
				else if(loop[2] != 0) used[c] = 1;
				for (int d = c*loop[3]; d <= 9*loop[3]; d++){
					dold_used = used;
					if (used[d] == 1 and loop[3] != 0) continue;
					else if(loop[3] != 0) used[d] = 1;
					for (int e = d*loop[4]; e <= 9*loop[4]; e++){
						eold_used = used;
						if (used[e] == 1 and loop[4] != 0) continue;
						else if(loop[4] != 0) used[e] = 1;
						for (int f = e*loop[5]; f <= 9*loop[5]; f++){
							fold_used = used;
							if (used[f] == 1 and loop[5] != 0) continue;
							else if(loop[5] != 0) used[f] = 1;
							for (int g = f*loop[6]; g <= 9*loop[6]; g++){
								gold_used = used;
								if (used[g] == 1 and loop[6] != 0) continue;
								else if(loop[6] != 0) used[g] = 1;
								for (int h = g*loop[7]; h <= 9*loop[7]; h++){
									hold_used = used;
									if (used[h] == 1 and loop[7] != 0) continue;
									else if(loop[7] != 0) used[h] = 1;
									for (int i = h*loop[8]; i <= 9*loop[8]; i++){
										iold_used = used;
										if (used[i] == 1 and loop[8] != 0) continue;
										else if(loop[8] != 0) used[i] = 1;
										for (int j = i*loop[9]; j <= 9*loop[9]; j++){
											jold_used = used;
											if (used[j] == 1 and loop[9] != 0) continue;
											else if(loop[9] != 0) used[j] = 1;
											if (a + b + c + d + e + f + g + h + i + j == s){
												//cout << a << " " << b << " " << c << " " << d << " " << e << " " << f << " " << g << " " << h << " " << i << " " << j << endl;
												ans++;
											}
											used = jold_used;
										}	
										used = iold_used;
									}
									used = hold_used;
								}
								used = gold_used;
							}
							used = fold_used;
						}
						used = eold_used;
					}
					used = dold_used;
				}
				used = cold_used;
			}
			used = bold_used;
		}
		used = aold_used;
	}

	cout << ans << endl;
	}
}

C++: #define	_USE_MATH_DEFINES
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstdio>
#include <string>
#include <cmath>
#include <cfloat>
#include <map>
#include <queue>
#include <stack>
#include <list>
using namespace std;

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

C++: 
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <stack>
#include <cctype>
#include <complex>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <cassert>

using namespace std;


int dfs(int n, int s, int k){
	if(n==0 && s==0) return 1;
	if(n==0) return 0;
	if(s<=0) return 0;
	if(k>9) return 0;
	int res1 = dfs(n-1, s-k, k+1);
	int res2 = dfs(n, s, k+1);
	return res1 + res2;
}

bool solve(){
	int a[10] = {0,1,2,3,4,5,6,7,8,9};
	int n,s;
	
	while(1){
		cin>> n>> s;
		if(n==0 && s==0) break;
		int res = dfs(n,s,0);
		cout<< res<< endl;
	}

	return true;
}

int main(){
	cout.setf(ios::fixed);
	cout.precision(10);
	solve();

	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int a,b,ans;
void dfs(int n,int s,int bit,int bef);
int main(){

  cin >> a >> b;
  while(a!=0||b!=0){
    
    ans = 0;
    dfs(0,0,0,-1);
    cout << ans << endl;
    cin >> a >> b;
  }

  return (0);
}

void dfs(int n,int s,int bit,int bef){
  
  if(n == a){
    if(s == b) ans++;
  }

  else {
    
    for(int i=0;i<=9;i++){
      if( ((1<<i)&bit)==0 && bef<i){
	dfs(n+1,s+i,bit|(1<<i),i);
      }
    }
  }
  
}