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>
using namespace std;
int syu(int *p,int n){
  int s=0;
  for(int i=0;i<n;i++) s += p[i];
  return s;
}
int main(){
  int n,s;
  while(cin>>n>>s){
    if(n==0&&s==0) break;
    int p[n],count=0;
    for(int a=0;a<=9;a++){
      p[0] = a;
      if(n==1&&syu(p,n)==s){
	count++;
	continue;
      }
      for(int b=a+1;b<=9;b++){
	p[1] = b;
	if(n==2&&syu(p,n)==s){
	  count++;
	  continue;
	}
	for(int c=b+1;c<=9;c++){
	  p[2] = c;
	  if(n==3&&syu(p,n)==s){
	    count++;
	    continue;
	    for(int d=c+1;d<=9;d++){
	      p[3] = d;
	      if(n==4&&syu(p,n)==s){
		count++;
		continue;
		for(int e=d+1;e<=9;e++){
		  p[4] = e;
		  if(n==5&&syu(p,n)==s){
		    count++;
		    continue;
		    for(int f=e+1;f<=9;f++){
		      p[5] = f;
		      if(n==6&&syu(p,n)==s){
			count++;
			continue;
			for(int g=f+1;g<=9;g++){
			  p[6] = g;
			  if(n==7&&syu(p,n)==s){
			    count++;
			    continue;
			  }
			  for(int h=g+1;h<=9;h++){
			    p[7] = h;
			    if(n==8&&syu(p,n)==s){
			      count++;
			      continue;
			    }      
			    for(int i=h+1;i<=9;i++){
			      p[8] = i;
			      if(n==2&&syu(p,n)==s){
				count++;
				continue;
			      }
			    }
			  }
			}
		      }
		    }
		  }
		}
	      }
	    }
	  }
	}
      }
    }
    cout << count << endl;
  }
  return 0;
}

C++: #include<stdio.h>

int kumi;

int saiki(int n,int s,int k){
	if(s==0 && n==0){
		++kumi;
		return 0;
	}
	
	int i;
	for(i=k+1;i<10;i++){
		saiki(n-1,s-i,i);
	}
	return 0;
}
		

main(){
	int n,s,i;
	
	while(0<=scanf("%d%d",&n,&s)){
		if(n==0 && s==0)break;
		kumi=0;
		for(i=0;i<10;i++){
			saiki(n-1,s-i,i);
		}
		printf("%d\n",kumi);
	}
	return 0;
}

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

typedef long long ll;

// dp[k][s][prev] := 最後に使った数がprev-1でk個使って和がsになる組合せ
ll dp[10][1010][110] = {0};

int main(){
	for(int i = 0; i <= 100; i++) dp[1][i][i+1] = 1;
	
	for(int k = 1; k < 9; k++){
		for(int i = 0; i <= 1000; i++){
			for(int prev = 0; prev <= 100; prev++){
				if( dp[k][i][prev] ){
					for(int j = prev; j <= 100; j++){
						if( 1000 < i + j ) break;
						dp[k+1][i+j][j+1] += dp[k][i][prev];
					}
				}
			}
		}
	}
	int n, s;
	while( cin >> n >> s, n || s ){
		ll res = 0;
		for(int i = 0; i <= 101; i++){
			res += dp[n][s][i];
		}
		cout << res << endl;
	}
}

C++: #define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include "bits/stdc++.h"
#define REP(i,a,b) for(int i=a;i<b;++i)
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define ALL(a) begin(a),end(a)
#define ifnot(a) if(not (a))
#define dump(x)  cerr << #x << " = " << (x) << endl
using namespace std;

// #define int ll
#ifdef _MSC_VER
const bool test = true;
#else 
const bool test = false;
#endif

int dx[] = { 0,1,0,-1 };
int dy[] = { 1,0,-1,0 };
#define INF (1 << 28)
ull mod = (int)1e9 + 7;
//.....................
const int MAX = (int)2e5 + 5;

int n, s;

ll dfs(int v,int sum,int depth) {
	int res = 0;
	if (depth == n) {
		if (sum == s) return 1;
		else return 0;
	}
	REP(i, v + 1, 10) {
		ll tmp = dfs(i, v+i, depth + 1);
		res += tmp;
		// cout << "dfs(" << i << "," << v + i << "," << depth + 1  
		//	<< ") = " << tmp << endl;
	}
	return res;
}

int main() {
	while (1) {
		cin >> n >> s;
		if (n == 0) break;
		// dump(dfs(2, 6, 3));
		cout << dfs(-1,0,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 main(){
	cin.tie(0);
	ios_base::sync_with_stdio(0);
	
	while(cin>>n>>s && (n||s)){
		int ans=0;
		rep(mask,1<<10)if(__builtin_popcount(mask)==n){
			int sum=0;
			rep(i,10)if(mask>>i&1)sum+=i;
			if(sum==s)ans++;
		}
		cout<<ans<<endl;
	}
}

C++: #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <functional>
#include <sstream>
#include <complex>
#include <climits>
using namespace std;

#define REP(i,a,n) for(int i=(a);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define EPS 1e-8

int memo[16][1000];
int main(){
	int n,s;
	
	for(int i=0; i<(1<<10); i++){
		int sum = 0;
		int bitc = 0;
		for(int j=0; (1<<j)<=i; j++)if( i&(1<<j) ){
			sum += j;
			bitc++;
		}
		memo[bitc][sum]++;
		printf("bitc:%d  , sum:%d\n",bitc,sum);
	}
	
	while(scanf("%d%d",&n,&s),n|s){
		printf("%d\n",memo[n][s]);
	}
	return 0;
}

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

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

		vector <int> numbers;
		for ( int i = 0; i < s; i++ )
			numbers.push_back( i );

		int kotae = 0;
		do
		{
			bool continue_flag = false;
			for ( int i = 0; i < n-1; i++ )
			{
				if ( numbers[i] > numbers[i+1] )
				{
					continue_flag = true;
					break;
				}
			}
			if ( continue_flag )
				continue;
			int sum = 0;
			for ( int i = 0; i < n; i++ )
			{
				sum += numbers[i];
			}
			if ( sum == s )
			{
				kotae++;
			}
		} while ( next_permutation( numbers.begin(), numbers.end() ) );

		kotae /= 6;
		cout << kotae << endl;

	}
	return 0;
}

C++: #include <functional>
#include <algorithm>
#include <iostream>
#include <numeric>
#include <iomanip>
#include <utility>
#include <cstdlib>
#include <sstream>
#include <bitset>
#include <vector>
#include <cstdio>
#include <ctime>
#include <queue>
#include <deque>
#include <cmath>
#include <stack>
#include <list>
#include <map>
#include <set>

using namespace std;

typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;

#define dump(x)  cerr << #x << " = " << (x) << endl
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back

int c;
int n,s;

void dfs(int flor,bool used[10],int sum,int bef){
    if(flor>=n){
        if(sum==s)c++;
    }
    else{
        for(int i=bef+1;i<10;i++){
            if(used[i]==false){
                used[i]=true;
                dfs(flor+1,used,sum+i,i);
                used[i]=false;
            }
        }
    }
}


int main() {
    while(cin>>n>>s){
        if(n==0 && s==0)break;
        
        c=0;
        bool a[10]={};
        dfs(0,a,0,-1);
        cout<<c<<endl;
    }
    
    return 0;
}