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>

using namespace std;

const int INF = 1e+9;

int cnt, n, s;

void dfs(int i, int sum, int num)
{
    if(sum == s && num == n)
    {
        cnt++;
        return;
    }
    
    if(i == 10 || num == n)
        return;

    dfs(i + 1, sum + i, num + 1);
    dfs(i + 1, sum, num);
}


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

    return 0;
}

C++: #include <iostream>
#include <algorithm>

using namespace std;

int ans(int n, int m, int x);

int main()
{
    int n, m;
    while (cin >> n >> m, n!=0) {
        cout << ans(n, m, 0) << endl;
    }
    return 0;
}

int ans(int n, int m, int x)
{
    int a = 0;
    if (n == 0 && m == 0) {
        return 1;
    } 
    for (int i = x; i < 10; i++) {
        if (m-i >= 0) {
            a += ans(n-1, m-i, i+1);
        }
    }
    return a;
}

C++: #include <iostream>
#include <iomanip>
#include <cassert>
#include <algorithm>
#include <functional>
#include <vector>
#include <string>
#include <cstring>
#include <stack>
#include <queue>
#include <map>
#include <bitset>
#include <sstream>
#include <istream>
#include <cmath>
#include <cstdio>

using namespace std;

#define vci vector<int>
#define vcs vector<string>
#define pb push_back
#define sz size()
#define mapii map<int, int>
#define mapci map<char, int>
#define mapsi map<string, int>
#define all(x) x.begin(), x.end()
#define minit(a, i) memset(a, i, sizeof(a));

#define for_(i, a, b) for (int i=(int)a; i<(int)b; i++)
#define for_d(i, a, b) for (int i=(int)a-1; i>=b; i--)
#define for_r(i, a, b, c) for (int i=(int)a; i<(int)b; i += c)
#define for_dr(i, a, b, c) for (int i=(int)a-1; i>=b; i -= c)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

typedef long long ll;

const int iINF = 2147483647;
const ll lINF = 9223372036854775807;

template <class T> inline void dbg(T t) { cout << t << endl; }



int ans[15][100];

void dfs(int nuse, int nsum, int len) {
	ans[len][nsum]++;
	
	for_(i, nuse+1, 10) {
		dfs(i, nsum+i, len+1);
	}
}

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

C++:  
 #include<iostream>
 #include<stdio.h>
 #include<string>
 #include<math.h>
 #include<iomanip>
 #include<algorithm>
 #include<string.h>
 #include<cctype>
 #include<map>
 #include<set>
 #include<vector>
 #include<sstream>
 #include<stack>
 #include<queue>
 
 using namespace std;
 
 int a[10]={0,1,2,3,4,5,6,7,8,9};
 int n,s;
 int count_2;
 
 void dfs(int step,int i,int sum)
 {
   if(sum>s||step>n||i>=10) return;
   if(step==n&&i==10&&sum==s)
   {
     count_2++;
     return;                          
   }     
   dfs(step,i+1,sum); 
   dfs(step+1,i+1,sum+a[i]);
   return;
 }
  
 int main()
 {
   while(cin>>n>>s)
   {
     if(n==0&&s==0) break;
     else
     {
       count_2=0;
       dfs(0,0,0);    
     } 
     cout<<count_2<<endl;               
   }
   //while(1);     
   return 0;  
 }

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

int s;
int cmb;
void count( int n ,int k,int sa ){
  if( n<1 && sa==s ) ++cmb;
  --n;
  for( int i=k;i<=9;i++ )
    count( n,i+1, sa+i );
}


int main(){
  int n;
  while( cin>>n>>s && (n||s) ){
    cmb = 0;
    for( int i=0;i<=9;i++ )
      count( n,i,i );
    cout << cmb << endl;
  }

  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 && 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);
      }
    }
  }
  
}

C++: #include<iostream>

using namespace std;
int n, s, ans;
void solve(int v, int sum, int num){
    if(sum==s&&num==n){
        ans++;
        return;
    }
    if(v>=10||num>=n) return;

    solve(v+1, sum+v, num+1);
    solve(v+1, sum, num);
}


int main(){

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

    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

int N, S, cnt;
void dfs( int i, int sum, int total )
{
    if( total == N && sum == S )
    {
        cnt++;
        return;
    }
    if( i == 10 || total == N ) return;
    
    dfs( i + 1, sum + i, total + 1 );
    dfs( i + 1, sum, total );
}
int main()
{
    while( cin >> N >> S )
    {
        if( N == 0 && S == 0 ) break;
        cnt = 0;
        dfs( 0, 0, 0 );
        cout << cnt << endl;
    }
    return 0;
}

C++: #include <iostream>

using namespace std;

int count(int m, int n, int s) {
    if (n == 0) {
        if (s == 0) return 1;
        return 0;
    }
    int c = 0;
    for (int i = m; i <= 9; i++) {
        c += count(i + 1, n - 1, s - i);
    }
    return c;
}

int main(void) {
    int n, s;
    while (true) {
        cin >> n >> s;
        if (n == 0 && s == 0) break;
        cout << count(0, n, s) << endl;
    }
    return 0;
}

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

int main()
{
	int dp[11][46]={0};
	dp[0][0]=1;
	for(int k=0; k<10; k++)
	{
		for(int i=k; i>=0; i--)
		for(int j=0; j<46-k; j++)
		{
			dp[i+1][j+k] += dp[i][j];
		}
	}

	int N,S;
	while(cin>>N>>S, N||S)
	{
		if(0<=N && N<11 && 0<=S && S<46)
		{
			cout << dp[N][S] << endl;
		}
		else
		{
			cout << 0 << endl;
		}
	}
}

C++: #define _USE_MATH_DEFINES
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<deque>
#include<list>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<map>
#include<queue>
#include<vector>
using namespace std;

/*
0 1 2 3 4 5 6 7 8 9

*/

//int a(int n, int s, int f) {
//	int cnt = 0;
//	if (n > 2)
//		for (int i = f; i <= 9; i++) {
//			if (s - i > i)cnt += a(n - 1, s - i, i + 1);
//			else break;
//		}
//	else if (n == 2)
//		for (int i = f; i <= 9; i++) {
//			if (s - i <= 9 && s - i > i)cnt++;
//			else break;
//		}
//	else
//		cnt = 1;
//
//	return cnt;
//}

int a, S;

void dfs(int i, int s, int n) {
	//cout << i << " " << s << " " << n << endl;
	if (s == S&&n == 0) {
		a++;
		return;
	}
	if (i == 10 || n == 0)
		return;

	dfs(i + 1, s + i, n - 1);
	dfs(i + 1, s, n);
}

int main() {
	for (int n; cin >> n >> S && (n || S);) {
		dfs(0, 0, n);
		cout << a << endl;
	}

	return 0;
}

C++: #include<iostream>
#include<string.h>
#include<vector>
#include<algorithm>
#include<map>
using namespace std;

int n,s;

int solve(int now,int last,int count){
    if(count==n&&now==s){
        return 1;
    }
    if(count==n||now>s){
        return 0;
    }
    int co=0;
    for(int i=last+1;i<10;i++){
        co+=solve(now+i,i,count+1);
    }
    return co;
}
int main()
{
    
    while(cin>>n>>s){
        int count=0;
        for(int i=0;i<n;i++){
            
            count+=solve(i,i,1);
        }
        cout<<count<<endl;
    }
    return 0;
}