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 <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;

#define all(c) (c).begin(), (c).end()
#define pb push_back
#define mp make_pair
#define EXIST(v,i) (find(all(v), i) != (v).end())
#define ERASE(v,i) (v).erase(remove(all(v), i), (v).end())
#define INDEX(v,i) (find(all(v), i) - (v).begin())
#define rep(i,n) for(int i = 0; i < (int)n; ++i)
#define debug(x) cerr << #x << " = " << (x) << endl;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

const int INF = 100000000;
const double PI = 3.14159265358979323846;
const double EPS = 1e-10;

int ans;
int n,s;

void solve(int num, int sum, int select) {
	if(select == n) {
		if(sum == s) ans++;
		return;
	}
	if(sum >= s) return;
	for(int i = num; i <= 9; i++) {
		solve(i+1, sum + i, select + 1);
	}
}

int main() {
	for(; cin>>n>>s && n && s;) {
		ans = 0;
		solve(0, 0, 0);

		cout << ans << endl;
	}
	return 0;
}

C++: #include <stdio.h>

int sum[10][46]={0};
int main() {
	for(int i=0; i<1<<10; i++) {
		int sumi = 0, count = 0;
		for(int j=0; j<10; j++) {
			if(i & (1<<j)) {
				sumi += j;
				count++;
			} 
		}
		sum[count][sumi]++;
	}
	
	int n = -1, s = -1;
	
	while(scanf("%d%d", &n, &s) !=EOF) {
		if(n > 10 || s > 45) printf("0\n");
		if(n == 0 && s == 0) break;
		printf("%d\n", sum[n][s]);
	}
	return 0;
}

C++: #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cctype>
#include <climits>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <list>
#include <queue>
#include <deque>
#include <algorithm>
#include <numeric>
#include <utility>
#include <complex>
#include <memory>
#include <functional>
 
using namespace std;
 
#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i <= n; i++)
#define rep(i,n) REP(i,0,n)
#define F(i,j,k) fill(i[0],i[0]+j*j,k)
#define P(p) cout<<(p)<<endl;
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define INF 1<<25
#define pb push_back
 
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<double> vd;
typedef pair<int,int> pii;
typedef pair<long,long> pll;
typedef long long LL;
typedef long long int LLI;

int solve(int cnt ,int sum,int now);
 int n=0,s=0;
int main(void)
{
     for(;;){
         cin >> n >> s;
        
        int ans = solve(0, 0, 0);  
         if(n == 0 && s == 0)break;
        cout << ans << endl;
        }
    return 0;  
}
int solve(int cnt ,int sum,int now)
{
    if(cnt == 10){
        return sum == s && now == n;
    }
    int res1 = solve(cnt+1,sum+cnt,now+1) ;
    int res2 = solve(cnt+1,sum,now);
    return res1+res2;
}

C++: #include<cstdio>
using namespace std;
int saiki(int n,int m,int cnt);
int main(){
    int n,m;
    while(scanf("%d%d",&n,&m),n,m){
        int ans = 0;
        int cnt = 0;
        ans = saiki(n,m,cnt);
        printf("%d\n",ans);
    }
    return 0;
}
int saiki(int n,int m,int cnt){
    if(n == 0&&m == 0)return 1;
    if(cnt >= 10)return 0;
    return saiki(n-1,m-cnt,cnt+1)+saiki(n,m,cnt+1);
}

C++: #ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#ifdef __GXX_EXPERIMENTAL_CXX0X__
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#ifdef __GXX_EXPERIMENTAL_CXX0X__
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

using namespace std;

long long int saiki ( int N , int M , int O )
{
	if( N == 1 )
	{
		return M > O&&M<=9;
	}

	long long int ans = 0;
	for( int i = O + 1; i <= min ( 9 , M ); i++ )
	{
		ans += saiki ( N - 1 , M - i , i );
	}
	return ans;
}

int main ()
{
	int N , M;
	while( cin >> N >> M , N || M )
	{
		cout << saiki ( N , M , -1 ) << endl;
	}
}

C++: #include<iostream>

using namespace std;

void conv(int n, int a[10])
{
	for(int i=0;i<10;i++)
	{
		a[i]=n%2;
		n=n/2;
	}
}

int main(void)
{
	int n,s;
	while(cin>>n>>s)
	{
		if(n==0&&s==0)
		{
			break;
		}
		int x,y,z[10],ans;
		ans=0;
		for(int i=0;i<1024;i++)
		{
			x=y=0;
			conv(i,z);
			for(int j=0;j<10;j++)
			{
				if(z[j]==1)
				{
					x++;
					y+=j;
				}
			}
			if(x==n&&y==s)
			{
				ans++;
			}
		}
		cout<<ans<<endl;
	}
}

C++: #include<iostream>
using namespace std;
bool ptr[10];
int kaunto[50]={0};
int count=0;
void dfs(int g,int cd){//g==now place ptr==pointer.
	if(g==0&&cd==0){
		kaunto[count]++;
		return;
	}
	else if(cd==0){
		return;
	}
	else if(g<0){
		return;
	}
	for(int i=0;i<10;i++){
		if(ptr[i]){
			continue;
		}
		ptr[i]=true;
		dfs(g-i,cd-1);
		ptr[i]=false;
	}
}
int kaijo(int x){
	int y=1;
	for(int i=1;i<=x;i++){
		y*=i;
	}
	return y;
}
int main(){
	int n[50]={0},s=0,answer=0;
	while(1){
		cin>>n[count];
		cin>>s;
		if(n[count]==0&&s==0){
			break;
		}
		for(int h=0;h<10;h++){
			ptr[h]=false;
		}
		dfs(s,n[count]);
		count++;
	}
	for(int k=0;k<count;k++){
		cout<<kaunto[k]/kaijo(n[k])<<endl;
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
int n,s;

int dfs(int pos,int selected,int sum){
	if(selected == n)return (sum == s)?1:0;
	if(pos == 9)return 0;
	return dfs(pos+1,selected,sum)+dfs(pos+1,selected+1,sum+pos);
}

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

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

int n,s;
int cnt;

void solve(int a,int b,int i){
  if(a == n && b == s){
    cnt++;
    return;
  }
  if(a == n) return;
  if(b >= s) return;
  if(i == 10) return;

  solve(a+1,b+i,i+1);
  solve(a,b,i+1);
}

int main(){

  while(true){
    cin >> n >> s;
    if(!n && !s) break;

    cnt = 0;
    solve(0,0,0);

    cout << cnt << endl;
  }

}