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 n, s, ans;
void solve(int v, int sum, int num){
    if(sum==s&&num==n){
        ans++;
        return;
    }
    if(v>=10||sum>=s) 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 <iostream>
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <math.h>
#include <map>
#include <queue>
#include <string>
using namespace std;

int n,s,m[10];

int f(int n,int s,int m){
	if(n==1){
		if(s<m)return 1;
		else return 0;
	}
	int t=0;
	for(int i=0;i<=s&&i<m;i++)t+=f(n-1,s-i,i);
	return t;
}

int main() {
	while(cin>>n>>s){
		if(n+s==0)return 0;
		cout<<f(n,s,10)<<endl;
	}
}

C++: #include<iostream>
using namespace std;
int n, s;
int cou;
void dfs(int i, int sum,int num_of_add) {
	if (sum == s&&num_of_add==n) {
		cou++;
		return;
	}
	if (n == num_of_add||i==10)return;
	dfs(i + 1, sum, num_of_add);
	dfs(i + 1, sum + i, num_of_add + 1);
}
int main() {
	while (cin >> n >> s&&n != 0 && s != 0) {
		cou = 0;
		dfs(0, 0, 0);
		cout << cou << endl;
	}
}

C++: #include<iostream>
using namespace std;
int ans(int n, int s, int x);
int main(){
  int n,s;
  while(cin >>n>>s,n||s){
    int a = 0;
    for(int i=0; i<10; i++) if(s>=i) a+=ans(n-1,s-i,i+1);
    cout <<a<<endl;
  }
  return 0;
}
int ans(int n, int s, int x){
  int a = 0;
  if(n == 0 && s == 0) return 1;
  else if(n == 0) return 0;
  for(int i=x; i<10&&i<=s; i++) a+=ans(n-1,s-i,i+1);
  return a;
}

C++: #include <iostream>
#include <cstring>
using namespace std;
int n,s,flag[10] = { 0 },c;
void f(int m,int a,int t){
	if(a == n){
		if(t == s) ++c;
		return;
	}
	else {
		if(t > s) return;
		for(int i = m;i < 10;++i){
			if(flag[i] == 0){
				flag[i] = 1;
				f(i + 1,a + 1,t + i);
				if(a != 0) flag[i] = 0;
			}
		}
	}
	return;
}
int main(){
	while(cin >> n >> s && (n != 0 && s != 0)){
		for(int i = 0;i < 10;++i){
			flag[i] = 0;
		}
		c = 0;
		f(0,0,0);
		cout << c << endl;
	}
	return 0;
}

C++: #include <bits/stdc++.h>
/* Karen {{{
  ___  ____
 |_  ||_  _|
   | |_/ /    ,--.   _ .--.  .---.  _ .--.
   |  __'.   `'_\ : [ `/'`\]/ /__\\[ `.-. |
  _| |  \ \_ // | |, | |    | \__., | | | |
 |____||____|\'-;__/[___]    '.__.'[___||__]
}}} */
/* cpp template {{{*/
using namespace std;

#define endl '\n'

#define REP(i, n) for (int i = 0; i < (n); i++)
#define REPS(i, a, n) for (int i = (a); i < (n); i++)
#define RREP(i, n) for (int i = 1; i <= (n); i++)
#define X real()
#define Y imag()
#define EQ(n,m) (abs((n)-(m)) < EPS)

typedef double D;
typedef long long ll;
typedef long double lb;
typedef complex<D> P;
typedef vector<P> VP;
typedef vector<int> vi;
typedef vector<vector<int> > vii;
typedef pair<int, int> pii;
typedef pair<int, string> pis;
typedef pair<string, int> psi;

inline bool inside(int y,int x,int H,int W){return(y>=0&&x>=0&&y<H&&x<W);}
inline int in() {int x; std::cin >> x; return x;}

template <typename T>
void print(std::vector<T>& v, char c = ' ') {
  REP(i, v.size()) {
    if (i != 0) std::cout << c;
    std::cout << v[i];
  }
  std::cout << endl;
}
template <typename T>
void print(T x) {
  std::cout << x << '\n';
}
/* }}} */
/* ?????° {{{*/
const ll MOD = 1e9 + 7;
const ll INF = 1e9 + 9;
const D EPS  = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1};
const int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
/* }}} */

int hoge(int n, int s, int num)
{
  if (n == 0 && s == 0) return 1;
  if (num > 9 || s < 0) return 0;
  return (hoge(n, s, num + 1) + hoge(n - 1, s - num, num + 1));
}
  
int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);

  int n, s;
  while(cin >> n >> s){
    if (n == 0) break;
    cout << hoge(n, s, 0) << endl;
  }
  return (0);
}

C++: # include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <tuple>
# include <unordered_map>
# include <numeric>
# include <complex>
# include <bitset>
# include <random>
# include <chrono>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
constexpr int INF = 2147483647;
constexpr int HINF = INF / 2;
constexpr double DINF = 100000000000000000.0;
constexpr double HDINF = 50000000000000000.0;
constexpr long long LINF = 9223372036854775807;
constexpr long long HLINF = 4500000000000000000;
const double PI = acos(-1);
int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
template <typename T_char>T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char>T_char TU(T_char cX) { return toupper(cX); };
# define ALL(x)      (x).begin(),(x).end()
# define UNIQ(c)     (c).erase(unique(ALL((c))),(c).end())
# define LOWER(s)    transform(ALL((s)),(s).begin(),TL<char>)
# define UPPER(s)    transform(ALL((s)),(s).begin(),TU<char>)
# define mp          make_pair
# define eb          emplace_back
# define FOR(i,a,b)  for(LL i=(a);i<(b);i++)
# define RFOR(i,a,b) for(LL i=(a);i>=(b);i--)
# define REP(i,n)    FOR(i,0,n)
# define INIT        std::ios::sync_with_stdio(false);std::cin.tie(0)


int N, S;
int ans;

void dfs(int s, int i, int cnt) {
	if (cnt == N&& s == S) {
		ans++;
		return;
	}
	else if (cnt == N || s > S||i==10){
		return;
	}
	else {
		dfs(s + i, i + 1, cnt + 1);
		dfs(s, i + 1, cnt);
	}
}

int main() {
	while (cin >> N >> S && (N != 0 || S != 0)) {
		ans = 0;
		dfs(0, 0, 0);
		cout << ans << endl;
	}
}

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

int n, s, value[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, ans;

void dfs(int i, int count, int sum)
{
	if (n == count) {
		if (0 == sum) ans++;
	}else if (i >= 0) {
		dfs(i-1, count, sum);
		dfs(i-1, count+1, sum - value[i]);
	}
}
int main(void)
{
	while (cin >> n >> s) {
		if (n == 0 && s == 0) break;
		ans = 0;
		dfs(9, 0, s);
		cout << ans << endl;
	}
	
	return 0;
}

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

int res;
const int d[10]={0,1,2,3,4,5,6,7,8,9};

void dfs(int now,int idx,int n,int sum,int s){
	if(now==n) {
		if(sum==s){
			res++;
		}
	}
	if(idx<10){
		dfs(now,idx+1,n,sum,s);
		dfs(now+1,idx+1,n,sum+d[idx],s);
	}
}

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

C++: #include <iostream>

using namespace std;

int main()
{
    int const ns[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
    int ss[11][46] = {};
    for( int i=0; i<1024; ++i ) {
        int sum = 0, n = 0;
        for( int j=0; j<10; ++j ) {
            if ( i & 1 << j ) {
                sum += ns[j];
                ++n;
            }
        }
        ++ss[n][sum];
    }

    int n, s;
    while( cin >> n >> s, n||s ) {
        cout << ss[n][s] << endl;
    }
}

C++: #include <iostream>
using namespace std;
int _s,a,b;
int solve(int c,int n,int s){
      if(!n) return s==_s;
      if(c>=10) return 0;
      return solve(c+1,n-1,s+c) + solve(c+1,n,s);
}
int main(){while(cin >> a >> _s,a||_s)cout <<solve(0,a,0)<< endl;}