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 <cstdio>
#include <string>
#include <algorithm>
#include <math.h>
#include <map>
#include <vector>

//#define PI 3.141592653589

using namespace std;


int ans;
int n, s;


/*
iはこれまでに足し合わせた数字の数

*/
void dfs(int i, int kazu, int sum)
{
	if (i == n && sum == s)
	{
		ans++;
		return;
	} else if (i == n) {
		return;
	} else if (kazu == 10) {
		return;
	}
	
	dfs(i, kazu+1, sum);
	dfs(i+1, kazu+1, sum+kazu);
}


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

C++: #include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#pragma region defins
#define ll long long
#define loop(i,n) for (int i = 0; i < n; i++)
#define loops(i,f,n) for (int i = (f); i < n; i++)
#define INF 100000000000000
#define sort(a) sort(a.begin(),a.end())
#define rsort(a) sort(a.rbegin(),a.rend())
using namespace std;
#pragma endregion
int n, s, ans;
int a[10] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
void dfs(int num, int sum, int count)
{
	//cout << "num:" << num << " sum:" << sum << " count:" << count << endl;
	if (sum == s&&count == n)
	{
		ans++;
		//cout << "ans: " << ans << endl;
	}
	if (sum > s || num == 10 || count == n)return;
	dfs(num + 1, sum + a[num], count + 1);
	dfs(num + 1, sum, count);
}

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

C++: #include<bits/stdc++.h>
using namespace std;
int dfs(int x,int y,int k){
	if(y==0)
		return x==0?1:0;
	if(x<0)
		return 0;
	int ans=0;
	for(int i=k+1;i<10;i++)
		ans+=dfs(x-i,y-1,i);
	return ans;
}
signed main(void){
	ios::sync_with_stdio(false);
	int x,y;
	while(cin>>y>>x&&(x||y))
		cout<<dfs(x,y,-1);
}

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

int a[10] = {0,1,2,3,4,5,6,7,8,9}, N, S;

int part(int index, int sum, int elem){
	if (sum > S || elem > N) return 0;
	if (sum == S && elem == N) return 1;
	if (index >= 10) return 0;
	return part(index + 1, sum + a[index], elem + 1) + part(index+1, sum, elem);
}

int main(){
	while (cin >> N >> S)
	{
		if (!N && !S) break;
		cout << part(0,0,0) << endl;
	}
	return 0;
}

C++: #include<iostream>

using namespace std;

int ans = 0;
void dfs(int n,int s,int depth){
	//if (s < 0) return;  //
	if (s == 0 and n == 0){ // ?§£??????????????£??????
		ans++;
		return;
	}
	if (n == 0) return;	

	depth++;
	if (depth == 10)return;
	//???????????´???
	dfs(n-1,s-depth,depth);
	//?????°????????£?????´???
	dfs(n,s,depth);
return;
}

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

return 0;
}

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

int N, S;

int rec(int sum, int i, int k){
	if(k == N)return sum == S ? 1 : 0;
	if(sum > S)return 0;
	
	int ans = 0;
	for(int j = i; j < 10; j++)
		ans += rec(sum + j, j + 1, k + 1);
	
	return ans;
	
}

int main() {
	while(1){
		cin >> N >> S;
		if(N == 0 && S == 0)break;
		
		cout << rec(0, 0, 0) << endl;
	}
	return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdio>
#define INF 1111111
using namespace std;
int dp[10][1001]; // [後何個か][残りの合計]
int solve(int i,int sum,int v);
int main(){
  int n,s;
  while(1){
  cin >> n >> s;
  if(!n && !s)break;
  cout << solve( n , s , INF ) << endl;
  }
}
int solve(int i,int sum,int v){
  int ret = 0;
  if(i == 0 && sum == 0)return 1;
  if(sum<0 || i<0)return 0;
  if(dp[i][sum] != 0)return dp[i][sum];
  for(int j=sum;j>=0;j--){
    if(v>j)ret += solve( i - 1 , sum - j , j );
  }
  return dp[i][sum] = ret;
}

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

int n,s,cnt=0;

void dfs(int num,int sum,int i){
	if(sum == s and num != n-1){
		cnt++;
		return;
	}
	if(num == 0) return;
	if(i == -1) return ;
	if(sum >= s) return ;
	i--;
	dfs(num,sum,i);
	dfs(num-1,sum+i,i);
	return ;
}


int main(){

	cin >> n >> s;

	while(n+s!=0){
		cnt = 0;
		dfs(n,0,10);
		cout << cnt << endl;
		cin >> n >> s;
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

int recursive(int n, int s, int lower)
{
	if(n == 1)
	{
		if(s < lower)
			return 0;

		return 1;
	}

	int count = 0;
	for(int i = lower; i <= 9; i++)
		count += recursive(n - 1, s - i, i + 1);
	return count;
}

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

		cout << recursive(n, s, 0) << endl;
	}

	return 0;
}

C++: #include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <valarray>
#include <vector>

#define EPS 1e-9
#define INF 1070000000LL
#define MOD 1000000007LL
#define fir first
#define foreach(it,X) for(__typeof((X).begin()) it=(X).begin();it!=(X).end();it++)
#define ite iterator
#define mp make_pair
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define pb push_back
#define sec second
#define sz(x) ((int)x.size())

using namespace std;

struct timer{
	time_t start;
	timer(){start=clock();}
	~timer(){cerr<<1.*(clock()-start)/CLOCKS_PER_SEC<<" secs"<<endl;}
};

typedef istringstream iss;
typedef long long ll;
typedef pair<int,int> pi;
typedef stringstream sst;
typedef vector<int> vi;

int n,s;

int f(int cur,int num,int sum){
	if(cur==10)return num==0 && sum==0;
	return f(cur+1,num,sum) + f(cur+1,num-1,sum-cur);
}

int main(){
	cin.tie(0);
	ios_base::sync_with_stdio(0);
	
	while(cin>>n>>s && (n||s)){
		cout<<f(0,n,s)<<endl;
	}
}

C++: #include<iostream>
#include <fstream>
#include <stdio.h>
#include <stdlib.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include<string>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<sstream>
#include<algorithm>
#include<map>
#include<complex>
using namespace std;


#define li			long long int
#define rep(i,to)	for(int i=0;i<((int)(to));i++)
#define repp(i,start,to)	for(int i=(int)(start);i<((int)(to));i++)
#define pb			push_back
#define sz(v)		((li)(v).size())
#define bgn(v)		((v).begin())
#define eend(v)		((v).end())
#define allof(v)	(v).begin(), (v).end()
#define dodp(v,n)		memset(v,(li)n,sizeof(v))
#define bit(n)		(1ll<<(li)(n))
#define mp(a,b)		make_pair(a,b)
#define rin	rep(i,n)
#define EPS 1e-10
#define ETOL 1e-8
#define MOD 1000000007
#define p2(a,b)		cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)		cout<<a<<"\t"<<b<<"\t"<<c<<endl

li table[9][1001][101];

li minsum(li n, li from){
	li res=0;
	repp(i,from,n+from)res+=i;
	return res;
}

li maxsum(li n){
	li res=0;
	for(li i=100; i>100-n; i--)res+=i;
	return res;
}

li solve(li n, li s, li from){
	//p3(n,s,from);
	if(n==1){
		if(s>=from && s<=100)return 1;
		else return 0;
	}
	li res=0;
	repp(i,from,101){
		if(minsum(n-1, i+1)>s-i)res+=0;
		else if(maxsum(n-1)<s-i)res+=0;
		else if(i<100 && table[n-2][s-i][i+1]>0) res+=table[n-2][s-i][i+1];
		else res+=solve(n-1,s-i,i+1);
	}
	table[n-1][s][from]=res;
	return res;
}

int main(){
	li n,s;
	while(1){
		cin>>n>>s;
		if(n==s && n==0)break;
		
		rep(i,n){
			rep(j,s+1){
				rep(k,101)table[i][j][k]=-1;
			}
		}
		
		li res=solve(n,s,0);
		cout<<res<<endl;
	}
	
	return 0;
}