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 <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define INF (ll)2e9
#define MOD ((ll)1e9+7)
#define ALL(v) v.begin(), v.end()
#define SZ(x) ((int)(x).size())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define bit(n) (1LL<<(n))
#define cauto const auto&
#define println(v) cout << v << "\n";

inline vector<vector<vector<ll>>> makeVector(ll i, ll j, ll k) {
    vector<vector<vector<ll>>> v(i, vector<vector<ll>>(j, vector<ll>(k, 0)));
    return v;
}
inline vector<vector<ll>> makeVector(ll i, ll j) {
    vector<vector<ll>> v(i, vector<ll>(j, 0));
    return v;
}

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template <class InputIterator>
InputIterator adv(InputIterator x, typename std::iterator_traits<InputIterator>::difference_type n) {
    advance(x, n);
    return x;
}

class mod {
    static ll fact[];
public:

    template<class... A>
    static ll mul(A... args) {
        ll res = 1;
        for (ll i : std::initializer_list<ll>{args...}) {
            res = (res * i) % MOD;
        }
        return res;
    }

    static ll power(ll base, ll exp) {
        if (exp == 0) return 1;
        if (exp & 1) {
            return mul(base, power(base, exp - 1));
        } else {
            ll p = power(base, exp / 2);
            return mul(p, p);
        }
    }

    static ll factorial(int n) {
        if (fact[n] != 0) return fact[n];
        if (n == 0) return 1;
        return fact[n] = mul(n, factorial(n - 1));
    }

    static ll inverse(int n) {
        return power(n, MOD - 2);
    }

    static ll comb(int n, int r) {
        if (r < 0 || r > n) return 0;
        return mul(factorial(n), inverse(factorial(n - r)), inverse(factorial(r)));
    }

    template<class... A>
    static ll div(ll dividend, A... args) {
        ll res = dividend;
        for (ll i : std::initializer_list<ll>{args...}) {
            res = mul(res, inverse(i));
        }
        return res;
    }

    template<class... A>
    static ll add(A... args) {
        ll res = 0;
        for (ll i : std::initializer_list<ll>{args...}) {
            res = (res + i) % MOD;
        }
        return res;
    }

    template<class... A>
    static ll sub(ll l, A... args) {
        ll res = l;
        for (ll i : std::initializer_list<ll>{args...}) {
            res = (res - i + MOD) % MOD;
        }
        return res;
    }
};
ll mod::fact[(int) 1e6 + 1];

int ni() {
    int i;
    cin >> i;
    return i;
}
ll nll() {
    ll l;
    cin >> l;
    return l;
}

int main()
{

    while (true) {
        int n = ni();
        int s = ni();
        if (n == 0 && s == 0) break;

        int ans = 0;
        REP(i, 1<<10) {
            int sum = 0;
            int popcount = 0;
            REP(j, 10) {
                if ((i>>j)&1) {
                    sum += j;
                    popcount++;
                }
            }
            if (popcount == n && sum == s) {
                ans++;
            }
        }
        cout << ans << endl;
    }

    return 0;
}

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

using namespace std;

int n,s;
int cnt;

void dfs(int v,int c,int ns){
	if(c==n && s==ns)cnt++;
	if(c<n){
		for(int i=v+1;i<=9;i++)dfs(i,c+1,ns+i);
	}
}

int main(void){
	while(1){
		scanf("%d%d",&n,&s);
		cnt=0;
		if(n==0)break;
		dfs(-1,0,0);
		printf("%d\n",cnt);
	}
	return 0;
}

C++: #include<stdio.h>
int n,m;

int f(int depth, int sum, int s)
{
    if(depth == 10)
    {
        if(sum == n && s == m)return 1;
        return 0;
    }
    return f(depth+1,sum+1,s+depth) + f(depth+1,sum,s);
}
int main()
{
    while(scanf("%d%d",&n,&m),n+m)
    {
        printf("%d\n",f(0,0,0));
    }
    return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <sstream>
#include <fstream>

using namespace std;

int dfs (const int depth, const int sum, int currs, int currd, int j)
{
	int count = 0;
	int i;

	if (currd == depth ){
		if (sum == currs ){
			return 1;
		}else{
			return 0;
		} // end if
	} // end if
	
	for (i = min(j, sum ); i >= 0; --i){
		currs += i;
		count += dfs (depth, sum, currs, currd + 1, i - 1 );
		currs -= i;
	} // end for

	return count;
}

int main()
{
//	cut here before submit 
//	freopen("testcase.si", "r", stdin);
	string str = "";

	while (getline (cin, str ) ){
		int n, sum;
		int res = 0;
		stringstream ss(str);
		ss >> n >> sum;

		if (n == 0 && sum == 0){
			break;
		} // end if
		
		res = dfs (n, sum, 0, 0, 9 );

		cout << res << endl;
	} // end while
	
	return 0;
}

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

C++: #include <cmath>
#include <ctime>
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <stack>
#include <bitset>
#include <functional>
#include <numeric>
#include <utility>
#include <iomanip>
#include <cstdio>
#include <cctype>
#include <queue>
#include <complex>
#include <climits>
#include <cstring>

using namespace std;

const int INF = 1 << 29;
typedef long long ll;
typedef pair<int,int> PI;

int n, s, t, res;

void dfs(int n, int t, int sum){
	if(n == 0 && sum == s) {
		res++;
		return ;
	}
	if(sum > s) return ;
	for(int i=t+1; i<=s; ++i){
		dfs(n-1, i, sum+i-1);
	}
}

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

	return 0;
}

C++: #include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<cstdio>
#include<sstream>
#include<iomanip>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef pair<int,pii> pip;
typedef vector<pip>vip;
const double PI=acos(-1);
const double EPS=1e-8;
const int inf=1e8;
int main(){
	int N=9,S=100;
	vvi dp(N+1,vi(S+1));
	dp[0][0]=1;
	loop(x,0,10)for(int i=N-1;i>=0;i--)for(int j=S;j>=0;j--)if(j+x<=100){
		dp[i+1][j+x]+=dp[i][j];
	}
	int n,s;
	while(cin>>n>>s,n+s){
		cout<<dp[n][s]<<endl;
	}
}