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 <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>	// require sort next_permutation count __gcd reverse etc.
#include <cstdlib>	// require abs exit atof atoi 
#include <cstdio>		// require scanf printf
#include <functional>
#include <numeric>	// require accumulate
#include <cmath>		// require fabs
#include <climits>
#include <limits>
#include <cfloat>
#include <iomanip>	// require setw
#include <sstream>	// require stringstream 
#include <cstring>	// require memset
#include <cctype>		// require tolower, toupper
#include <fstream>	// require freopen
#include <ctime>		// require srand
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
vector<int> sum[10][50];
 
int main()
{
//	cut here before submit 
//	freopen ("testcase.sum_of_integers", "r", stdin );
	int n, s;
	while (scanf ("%d %d", &n, &s ), n, s ){
		rep (i, 10 )rep (j, 50 ) sum[i][j].clear();

		rep (i, 10 ){
			sum[0][i].push_back (1<<i);
		} // end rep

		for (int i = 1; i < n; i++ ){
			for (int j = 0; j < 50; j++ ){
				if (!sum[i-1][j].empty() ){
					rep (k, sum[i-1][j].size() ){
						rep (num, 10 ){
							if (!(sum[i-1][j][k] & (1<<num) ) && j+num < 50 ){
								sum[i][j+num].push_back (sum[i-1][j][k] | 1<<num );
							} // end if
						} // end rep
					} // end rep
				} // end if
			} // end for
		} // end for

		set<int> ans; ans.clear();
		rep (i, sum[n-1][s].size() ){
			ans.insert (sum[n-1][s][i] );
		} // end rep
		int res = ans.size();
		printf ("%d\n", res );
	} // end loop
		
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
const int max = 51;

int n, s;
int cnt = 0;

void dfs(int i, int sum, int total){
    if(total == n and sum == s){
        cnt++;
        return;
    }
    //足す場合
    if(i < 10 and total != n) dfs(i+1, sum+i, total+1);
    //足さない場足
    if(i < 10 and total != n) dfs(i+1, sum, total);
}

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

    return 0;
}

C++: #include<iostream>
#include<vector>
#include<string>
#include<cstdio>
using namespace std;
int ans;
int n;
int s;

void count_ans(int k,int C,int j){
	if(k==n){
		if(C==s){
			ans++;
		}
	}else{
		for(int i=j+1;i<10;i++){
			count_ans(k+1,C+i,i);
		}
	}
	
}


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

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

int ans, s;

void dfs(int begin, int depth, int sum) {
  if(depth == 0){
    if(s == sum){
      ans++;
    }
    return;
  }
  for(int i = begin+1 ; i <= 9 ; i++){
    dfs(i, depth-1, sum+i);
  }
}

int main(){
  int n;
  while(cin >> n >> s, n && s){
    ans = 0;
    for(int i = 0 ; i <= 9 ; i++){
      dfs(i, n-1, i);
    }
    cout << ans << endl;
  }
  return 0;
}

C++: #include<cstdio>
#include<iostream>
using namespace std;
int n,s,ans=0;
class SumofIntegers{
public:
    void solve(){
        dfs(0,0,0);
        cout<<ans<<endl;
        ans=0;
    }
    void dfs(int d,int sum,int idx){
        if(d==n){
            if(sum==s)ans++;
            return;
        }
        for(int i=idx;i<10;i++)dfs(d+1,sum+i,i+1);
    }
};
int main(){
    SumofIntegers inst;
    while(cin>>n>>s){
        if(n==0&&s==0)break;
        inst.solve();
    }
}

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

int bit_count( const int n )
{
	int cnt = 0;
	for ( int i = 0; i < 10; i++ )
	{
		if ( n & 1 << i ) cnt++;
	}
	return cnt;
}

int main( void )
{
	int n, s;
	while ( cin >> n >> s )
	{
		if ( n == 0 && s == 0 ) break;
		int answer = 0;
		for ( int i = 0; i < 1 << 10; i++ )
		{
			if ( bit_count( i ) == n )
			{
				int sum = 0;
				for ( int j = 0; j < 10; j++ )
				{
					if ( i & 1 << j )
					{
						sum += j;
					}
				}
				if ( sum == s )
				{
					answer++;
				}
			}
		}
		cout << answer << endl;
	}

	return 0;
}

C++: #include <iostream>
   using namespace std; // Your code  #include <iostream>using namespace std;
int dfs(int n, int s, int x){
  int sum=0;
  if(n==0 && s==0)
  return 1;
  if(n>0){
      for(int i=x; i<10; i++){
          if(s-i>=0) sum+=dfs(n-1, s-i, i+1);
      }
  }
  return sum;
}
int main(void){
  int n, s;
  while(cin >> n >> s){
      if(n==0 && s==0)
  break;
      cout << dfs(n, s, 0) << endl;
  }
  return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int dp[11][101];
int serch(int i,int j,int n,int co)
{
    if(dp[i][j]>-1)return dp[i][j];
    else if(i==10)return 0;
    else if(co==n&&j==0)return 1;
    else if(j<0||co==n)return 0;
    return dp[i][j]=serch(i+1,j,n,co)+serch(i+1,j-i,n,co+1);
}
int main()
{
    int n,s,num;
    memset(dp,-1,sizeof(dp));
    while(cin>>n>>s&&n!=0){
        num=serch(0,s,n,0);
        cout<<num<<endl;
    }
}

C++: #include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <complex>
#include <ctime>
#include <cstdlib>

using namespace std;

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

typedef long long ll;

int num, sum;
//now: 現在の数 cnt: 今なん回目？ add:何回足した？
int judge(int now, int cnt, int add)
{
	if(add == num)
	{
		if(now == sum)
			return 1;
		else
			return 0;
	}
	else if(cnt > 10)
	{
		return 0;
	}
	else
	{
		return judge(now + cnt, cnt+1, add+1) + judge(now, cnt+1, add);
	}
}

int main()
{
	while(cin >> num >> sum)
	{
		if(num == 0 && sum == 0)
			break;
		cout << judge(0, 0, 0) << endl;
	}
}

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

int n,k,m;
int ans=0;
vector<int>s(10);

void bfs(int nn,int sum,int min){
    
    if(nn==0&&sum==0){
        ans++;
        return;
    }
    
    for(int i=min;i<10&&n>0;i++){
        if(sum-i>=0){
            bfs(nn-1,sum-i,i+1);
        }
    }
    
}

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

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

int n,s;

int dfs(int num,int total,int de)
{
	int count = 0;

	if(de == n && total == s)
	{
		return 1;
	}
	if(de == n && total != s)
	{
		return 0;
	}

	for(int i=num; i<=9; i++)
	{
		count += dfs(i+1,total+i,de+1);
	}
	return count;
}

int main()
{

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

	return 0;
}

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

int cnt; int N, Ans;

void choose(int k, int l, int digit) {
  if(k == Ans && l == N) { cnt++; return; }
  else if (k >= N) return;
  else if (l == N) return;
  else if (digit >= 10) return;
  
  choose(k+digit, l+1, digit+1);
  choose(k, l, digit+1);
}

int main () {
  while(cin>>N>>Ans, N||Ans) {
    cnt = 0;
    choose(0, 0, 0);
    cout << cnt << endl;
  }
  return 0;
}