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++: #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <sstream>
#include <string>
#include <cstdio>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cstring>
#include <tuple>
#include <utility>
#include <list>
#include <cmath>
#include <unordered_map>

using namespace std;

typedef long long LL;
typedef vector<int> Array;
typedef pair<int, int> P;

const int INF = 1 << 29;
const LL MOD = 100000;
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define all(c) (c).begin(), (c).end()

struct edge{ int to, cost; edge(int t, int c) :to(t), cost(c){} };

int main()
{
	//while (cin >> n)
	stringstream ss;
	//ss << "result" << i + 1 << ".txt";
	//FILE* fp_out = freopen(ss.str().c_str(), "w", stdout);

	int n;
	while (cin >> n)
	{
		int s; cin >> s;
		function<int(int, int, int)> dfs = [&](int now, int rem, int sum)
		{
			if (rem == 0 && sum == s)
				return 1;
			if (now == 10 || rem == 0) return 0;
			return dfs(now + 1, rem, sum) + dfs(now + 1, rem - 1, sum + now);
		};

		cout << dfs(0, n, 0) << endl;
	}

	return 0;
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 10e15+9
#define MOD 1000000007
#define EPS 1e-10
#define MAX_N 100100
#define MAX_M 100100

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;
typedef pair<P, char> PC;

int n, s;
int ans = 0;

void dfs(long long i, long long sum, long long num){
	if (i == n&&sum == s){
		ans++;
		return;
	}

	for (int j = num; j <= 9; j++){
		dfs(i + 1, sum + j, j + 1);
	}
	return;
}

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

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

int n,k,count;
int value[10] = {0,1,2,3,4,5,6,7,8,9};

void dfs(int i,int sum,int num)
{
	if(num == n && sum == k) 
	{
		count++;
		return;
	}

	if(i == 10)
	{
		return;
	}
	
	dfs(i+1,sum,num);
	dfs(i+1,sum + value[i],num+1);
}
int main()
{
	while(cin >> n >> k && n && k)
	{
		count = 0;
		dfs(0,0,0);
		cout << count << endl;

	}
	return 0;
}

C++: #include <cstdio>

using namespace std;

int solve(int n, int s) {
  int ret = 0;
  for (int mask = 0; mask < 1<<10; mask++) {
    if (__builtin_popcountll(mask) == n) {
      int sum = 0;
      for (int i = 0; i < 10; i++) {
        if (mask & 1 << i)
          sum += i;
      }
      if (sum == s)
        ++ret;
    }
  }
  return ret;
}

int main(int argc, char *argv[])
{
  int n, s;
  while (~scanf(" %d %d", &n, &s)) {
    if (n == 0 && s == 0)
      break;
    int ret = solve(n, s);
    printf("%d\n", ret);
  }
  
  return 0;
}

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

int res;
const int d[10]={0,1,2,3,4,5,6,7,8,9};

bool dfs(int now,int idx,int n,int sum,int s){
	
	
	if(now==n&&sum==s) {
		res++;
		return true;
	}
	
	if(idx>9) return false;
	
	if(dfs(now,idx+1,n,sum,s)) return true;
	
	if(dfs(now+1,idx+1,n,sum+d[idx],s)) return true;
	
	return false;
}

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

C++: #include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)

int n,s;
int ans;

void dfs(int sum,int flor,int last){
    if(sum>s)return ;
    
    if(flor==n){
        if(sum==s)ans++;
        return ;
    }
    rep(i,10){
        if(i<=last)continue;
        dfs(sum+i,flor+1,i);
    }
}


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

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

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

using namespace std;

int dfs(int x,int n,int s){
  
  if(n==0){
    return (s==0);
  }
    
  if(x==10)
    return 0;
  
  int res=0;
  
  for(int i=x;i<=9;i++){
    res+=dfs(i+1,n-1,s-i);
  }
  return res;
}

int main(){
  int n,s;

  while(cin>>n>>s,n,s){
    cout<<dfs(0,n,s)<<endl;
  }
}

C++: #include<stdio.h>

int main()
{

int n,y,c,sum;
int f1[9],f2[9],f3[9],f4[9],f5[9],f6[9],f7[9],f8[9],f9[9];
for(int i=0;i<9;i++)
{f1[i]=i;f2[i]=i;f3[i]=i;f4[i]=i;f5[i]=i;f6[i]=i;f7[i]=i;f8[i]=i;f9[i]=i;}

while(1)
{
c=0;sum=0;
scanf("%d %d",&n,&y);
if(n==0&&y==0)break;
for(int i1=0;i1<9;i1++)
{
	 if(n==1){if(f1[i1]==y)c++;}
	else if(n!=1){
				for(int i2=i1+1;i2<9;i2++)
					{
						if(n==2){if(f1[i1]+f2[i2]==y)c++;}
							else if(n>2){
							for(int i3=i2+1;i3<9;i3++)
										{						
										if(n==3){if(f1[i1]+f2[i2]+f3[i3]==y)c++;}
										else if(n>3){
														for(int i4=i3+1;i4<9;i4++)
																	{
if(n==4){if(f1[i1]+f2[i2]+f3[i3]+f4[i4]==y)c++;}
else if(n>4){
for(int i5=i4+1;i5<9;i5++)
{
if(n==5){if(f1[i1]+f2[i2]+f3[i3]+f4[i4]+f5[i5]==y)c++;}
else if(n>5){
for(int i6=i5+1;i6<9;i6++)
{
if(n==6){if(f1[i1]+f2[i2]+f3[i3]+f4[i4]+f5[i5]+f6[i6]==y)c++;}
else if(n>6){
for(int i7=i7+1;i7<9;i7++)
{
if(n==7){if(f1[i1]+f2[i2]+f3[i3]+f4[i4]+f5[i5]+f6[i6]+f7[i7]==y)c++;}
else if(n>7){
for(int i8=i8+1;i8<9;i8++)
{
if(n==8){if(f1[i1]+f2[i2]+f3[i3]+f4[i4]+f5[i5]+f6[i6]+f7[i7]+f8[i8]==y)c++;}
else if(n>8){
for(int i9=i9+1;i9<9;i9++)
{
{if(f1[i1]+f2[i2]+f3[i3]+f4[i4]+f5[i5]+f6[i6]+f7[i7]+f8[i8]+f9[i9]==y)c++;}

}}}}}}}}}}}}}}}}}
printf("%d\n",c);
c=0;
}
return 0;
}

C++: #include <iostream>
//#include <fstream>
using namespace std;
int ans,n,s;
 
void dfs(int cnt,int sum,int i){
	if(sum==s&&cnt==n){
        ++ans;
        return;
    } else if(cnt==n||i>=10){
        return;
    }
    dfs(cnt,sum,i+1);
    dfs(cnt+1,sum+i,i+1);
    return;
};
 
int main(){
    while(cin>>n>>s&&n&&s){
        ans=0;
        dfs(0,0,0);
        cout << ans << "\n";
    }
    return 0;
}

C++: #include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<cstdio>
#include<sstream>
#include<iomanip>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef pair<int,pii> pip;
typedef vector<pip>vip;
const double PI=acos(-1);
const double EPS=1e-8;
const int inf=1e8;
int main(){
	int N=9,S=100;
	vvi dp(N+1,vi(S+1));
	dp[0][0]=1;
	loop(x,0,10)for(int i=N-1;i>=0;i--)for(int j=S-x;j>=0;j--){
		dp[i+1][j+x]+=dp[i][j];
	}
	int n,s;
	while(cin>>n>>s,n+s){
		cout<<dp[n][s]<<endl;
	}
}