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++: #define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<queue>
#include<cmath>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<bitset>
#include<unordered_map>
#include<climits>
#include<fstream>
using namespace std;
///////////////////library zone!!!!!!!!!!!!!!!!!!!!!!!!!!!!
typedef long long ll;
typedef long double ld;
#define all(a) (a).begin(),(a).end()
#define EPS (1e-7)
const ll Mod = 1000000007;
const ll mod = 998244353;
struct H {
	ll x, y;
	bool operator<(const H &b) const {
		if (x != b.x) return x < b.x;
		return y < b.y;
	}
	bool operator>(const H &b) const {
		if (x != b.x) return x > b.x;
		return y > b.y;
	}
	bool operator==(const H &b) const { return x == b.x&&y == b.y; }
	bool operator!=(const H &b) const { return (*this) != b; }
};
struct P {
	ll pos, cost;
	bool operator<(const P &b) const { return cost < b.cost; }
	bool operator>(const P &b) const { return cost > b.cost; }
};
struct B {
	ll to, cost;
};
struct E {
	ll from, to, cost;
	bool operator<(const E &b) const { return cost < b.cost; }
	bool operator>(const E &b) const { return cost > b.cost; }
};
template<typename T, typename U>
void chmin(T &a, U b) {
	if (a > b) a = b;
}
template<typename T, typename U>
void chmax(T &a, U b) {
	if (a < b) a = b;
}
template<typename T>
T max_0(T a) {
	if (a < 0) return 0;
	return a;
}
template<typename T>
T min_0(T a) {
	if (a > 0) return 0;
	return a;
}
ll read() {
	ll u;
	ll k = scanf("%lld", &u);
	return u;
}
ll gcd(ll i, ll j) {
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcd(j%i, i);
}
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % p;
		x = x * x % p;
		n >>= 1;
	}
	return res;
}//x^n%p
vector<string>split(string s, char c = ' ') {
	vector<string>vec;
	string h = "";
	for (int i = 0; i < s.size();) {
		int j = i;
		while (j < s.size() && s[j] != ' ') {
			h += s[j++];
		}
		if (h.size() > 0) vec.push_back(h);
		h = "";
		i = j + 1;
	}
	return vec;
}
const ll Inf = 3023372036854775807;
const int inf = 1500000000;
#define int long long
//----------------------------------------------------
class Vec2 {
public:
	ld x, y;
	Vec2() { x = 0, y = 0; }
	Vec2(ld x, ld y) :x(x), y(y) {}
	ld length() {
		return sqrt(x*x + y * y);
	}
	Vec2 normal() {
		ld len = this->length();
		if (len == 0) return Vec2(x, y);
		x /= len, y /= len;
		return *(this);
	}
	Vec2 operator+(Vec2 vec) {
		return Vec2(x + vec.x, y + vec.y);
	}
	Vec2 operator-(Vec2 vec) {
		return Vec2(x - vec.x, y - vec.y);
	}
	template<typename T>
	Vec2 operator*(T cons) {
		return Vec2(x*cons, y*cons);
	}
	ld operator*(Vec2 vec) {
		return x * vec.x + y * vec.y;
	}
	ld operator%(Vec2 vec) {
		return x * vec.y - y * vec.x;
	}
	bool operator==(Vec2 vec) {
		return abs(x - vec.x) < EPS && abs(y - vec.y) < EPS;
	}
};
ld dot(Vec2 a, Vec2 b) {
	return a.x*b.x + a.y*b.y;
}
ld cross(Vec2 a, Vec2 b) {
	return a.x*b.y - a.y*b.x;
}
ld areaIntegral(Vec2 a, Vec2 b) {
	return abs(a.x*b.y - a.y*b.x) / 2.0;
}
class Vec3 {
public:
	ld x, y, z;
	Vec3() { x = 0, y = 0, z = 0; }
	Vec3(ld x, ld y, ld z) :x(x), y(y), z(z) {}
	ld length() {
		return sqrt(x*x + y * y + z * z);
	}
	void normal() {
		ld len = this->length();
		if (len == 0) return;
		x /= len, y /= len, z /= len;
	}
	Vec3 operator+(Vec3 vec) {
		return Vec3(x + vec.x, y + vec.y, z + vec.z);
	}
	Vec3 operator-(Vec3 vec) {
		return Vec3(x - vec.x, y - vec.y, z - vec.z);
	}
	Vec3 operator*(int cons) {
		return Vec3(x*cons, y*cons, z*cons);
	}
	ld operator*(Vec3 vec) {
		return x * vec.x + y * vec.y + z * vec.z;
	}
};
ld dot(Vec3 a, Vec3 b) {
	return a.x*b.x + a.y*b.y + a.z*b.z;
}
class Line {
public:
	Vec2 from, to;
	Line(Vec2 from, Vec2 to) :from(from), to(to) {}
};
Line getPerpendicularBisector(Line line) {
	int cx = (line.from.x + line.to.x) / 2, cy = (line.from.y + line.to.y) / 2;
	Vec2 p = Vec2(cx + (line.from.y - line.to.y), cy + (line.to.x - line.from.x));
	return Line(Vec2(cx, cy), p);
}
int n, s;
int ans;
int solve(int x, int y, int z) {
	if (x == n) {
		if (z == s) return 1;
		return 0;
	}
	if (z > s) return 0;
	int sum = 0;
	for (int i = y + 1; i < 10; i++) {
		sum += solve(x + 1, i, z + i);
	}
	return sum;
}
signed main() {
	while (cin >> n >> s && n + s) {
		cout << solve(0, -1, 0) << endl;
	}
}

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

C++: #include <iostream>
#include <math.h>
#include <algorithm>
using namespace std;

int n;
int s;
int ans;

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

	dfs(i + 1, sumCount + 1, sum + i);
	dfs(i + 1, sumCount, sum);
	return;
}

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

C++: #include<iostream>

using namespace std;

int dfs(int x,int n,int s){
  
  if(n==0){
    return (s==0);
  }
    
  if(x==10)
    return 0;
  
  int res=0;
  
  for(int i=x;i<=9;i++){
    res+=dfs(i+1,n-1,s-i);
  }
  return res;
}

int main(){
  int n,s;

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

C++: #include <sstream>
#include <fstream>
#include <string>
#include <string.h>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;

bool used[10];
int S;

int dfs( int s, int n ){

	if( n == 0 ){
		if( s == S ){
			return 1;
		}else{
			return 0;
		}
	}

	int res = 0;
	for( int i = 0; i <= 9; i++ ){
		if( used[i] ) continue;
		used[i] = true;
		res += dfs( s + i, n - 1 );
		used[i] = false;
	}

	return res;
}

int main() {
	int n;

	while( true ){

		cin >> n >> S;

		if( n == 0 && S == 0 ) break;

		memset( used, false, sizeof( used ) );
		int res = dfs( 0, n );
		int d = 1;
		for( int i = n; i >= 2; i-- ){
			d *= i;
		}
		cout << (res / d) << endl;

	}
}