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

Python: def solve(n,s,lst):
    if n == 0 and s == 0:
        return(1)
    elif s < lst[0] or len(lst)==0:
        return(0)
    else:
        return(solve(n-1,s-lst[0],lst[1:]) + solve(n,s,lst[1:]))

if __name__ == "__main__":
    while True:
        n, s = map(int, input().split())
        if n==0 and s==0:
            break
        print(solve(n,s,list(range(9))))

Python: from itertools import combinations

while True:
    n, s = map(int, input().split())
    if n == s == 0:
        break
    cnt = 0
    for x in combinations(range(10), n):
        cnt += 1 if sum(x) == s else 0
    print(cnt)

Python: while 1:
 n,s=map(int,input().split())
 if n:print(len([1 for i in range(0,8)for j in range(i+1,9)if j<s-i-j<=9]))

Python: import itertools

while True:
    n, s = map(int, input().split())
    if n == 0 and s == 0:
        break
    ans = 0
    for i in itertools.combinations(range(10), n):
        if sum(i) == s:
            ans += 1
    print(ans)

Python: import itertools

while True:
    n, s = [int(x) for x in input().split()]
    if n == 0 and s == 0:
        break
    c = 0
    for t in itertools.combinations(range(10),n):
        if sum(t) == s:
            c += 1
    print(c)

Python: while 1:
 n,x=map(int,input().split())
 if n+x==0:break
 print(sum([max(0,(x-a-1)//2-max(a,x-a-1-n))for a in range(1,x//3)]))

Python: from itertools import combinations

while True:
    n, s = map(int, input().split())
    if n == s == 0: break

    print(sum(1 for x in combinations(range(10), n) if sum(x) == s))

Python: from itertools import combinations

while True:
    n, s = map(int, input().split())
    if n==s==0: break
    m = s if s < 10 else 10
    print([sum(c) for c in combinations(range(m), n)].count(s))

Python: import heapq
from collections import deque
from enum import Enum
import sys
import math
from _heapq import heappush, heappop
import copy

BIG_NUM = 2000000000
HUGE_NUM = 99999999999999999
MOD = 1000000007
EPS = 0.000000001
sys.setrecursionlimit(100000)


dp = [[0]*101 for _ in range(10)]

dp[0][0] = 1
for i in range(0,10):
    for num in range(9,0,-1):
        for tmp_sum in range(i,101):
            dp[num][tmp_sum] += dp[num-1][tmp_sum-i]

while True:
    N,S = map(int,input().split())
    if N == 0 and S == 0:
        break
    print("%d"%(dp[N][S]))

Python: # coding: utf-8
while True:
    n, s = map(int, input().split()) # nとsの入力
    ans = 0 #解答の初期化
    if [n, s] == [0, 0]: # 終了処理
        break
    else:
        for t in range(2 ** 10): # ビット表現で[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]の部分集合を列挙
            a = [] # 列挙のためのlistを用意し、初期化
            for i in range(10):
                if t >> i & 1:
                    a += [i]
            if len(a) == n: # 要素数がnのもののみ考察する
                if sum(a) == s:
                    ans += 1
        print(ans) #解答の出力

Python: def inputcase():
	global n,s
	n,s = map(int,input().split())
	return n!=0 or s!=0

memo = [[[0 for j in range(123)] for i in range(11)] for k in range(11)]
done = [[[False for j in range(123)] for i in range(11)] for k in range(11)]

def dfs(k, l, t):
	if t < 0:
		return 0
	elif k == 0 and t > 0:
		return 0
	elif k == 0:
		return 1
	elif l > 9:
		return 0
	if done[k][l][t]:
		return memo[k][l][t]
	done[k][l][t] = True
	for i in range(l,10):
		memo[k][l][t] += dfs(k-1,i+1,t-i)
	return memo[k][l][t]

while inputcase():
	print(dfs(n,0,s))

Python: from collections import deque


class Bt(object):
    def __init__(self):
        self.used = [False] * 10  # ?????°???????????¨?????????????????????????????°
        self.answers = []  # ?????¶???????????????????????????
        self.Q = deque()  # ????????§???????????¢??????????????°???????¨???¶??¨

    def solve(self, num, remain):
        num -= 1
        if remain < 10 and self.used[remain] == False and num == 0:
            self.Q.append(remain)
            # print('{0}'.format(self.Q))
            ans = [*self.Q]
            ans.sort()
            if not ans in self.answers:
                self.answers.append(ans)
            self.Q.pop()
            return

        try:
            min_num = self.used.index(True)
        except ValueError:
            min_num = 0

        for i in range(min_num, 10):
            if self.used[i] == False and (remain - i) >= 0:
                self.used[i] = True
                self.Q.append(i)
                self.solve(num, remain - i)
                self.used[i] = False
                self.Q.pop()


if __name__ == '__main__':
    while True:
        # ??????????????\???
        n, s = [int(x) for x in input().split(' ')]
        if n == 0 and s == 0:
            break

        if 0 <= s <= 45:
            # ????????????
            a = Bt()
            a.solve(n, s)

            # ???????????¨???
            print(len(a.answers))
        else:
            print(0)

Python: from itertools import combinations
while 1:
 n,s=map(int,input().split())
 if n:print(sum([1 for p in combinations(range(10),n)if sum(p)==s]))

Python: while True:
    n, s = map(int, input().split())
    if n == 0 and s == 0:
        break

    ans = 0
    for b in range(2 ** 10):
        comb = set()
        for i in range(10):
            if b >> i & 1:
                comb.add(i)
        if len(comb) == n:
            if sum(comb) == s:
                ans += 1
    print(ans)

Python: def f(n,s,x):
  if n == s == 0:
    return 1
  elif n == 0 or x == 0:
    return 0
  else:
    a = 0
    for i in range(x):
      a += f(n-1,s-i,i)
    return a
while True:
  n,s = map(int,input().split())
  if n == s == 0:
    break
  print(f(n,s,10))

Python: import itertools
while True:
    n,s = map(int, input().split())
    if not(n or s):
        break
    t = 0
    for i in itertools.combinations(range(0,10), n):
        if sum(i) == s:
            t += 1
    print(t)

Python: def rec_sum(n, s, piv):
  if piv == 10 or piv > s:
    return 0
  if n == 1 and s < 10:
    return 1
  else:
    counter = 0
    for i in range(piv, 10):
      counter += rec_sum(n-1, s-i, i+1)
    return counter

while True:
  n, s = map(int, input().split())
  if n == 0 and s == 0:
    break
  print(rec_sum(n, s, 0))

Python: searched = set()
def search(nums, cur_comb, n, s):
    #print(searched)
    #print(cur_comb)
    if cur_comb in searched:
        return 0
    else:
        searched.add(cur_comb)
    if sum(cur_comb) > s:
        return 0
    if len(cur_comb) == n:
        if sum(cur_comb) == s:
            return 1
        else:
            return 0
    return sum([search(nums[:i]+nums[i+1:], tuple(sorted(cur_comb + (nums[i],))), n , s) for i in range(len(nums))])
    
while True:
    n, s = map(int,  input().split())
    if n == s == 0:
        break
    searched.clear()
    cnt = search(list(range(10)), (), n, s)
    print(cnt)

Python: 
def dfs(p,n,s):#p以下の数からn個用いてsを作る場合の数
    if not p:
        if n == 1 and s == 0:
            return 1
        else:
            return 0
    elif n == 1:
        if 0 <= s <= p:
            return 1
        else:
            return 0
    elif s < 0:
        return 0
    else:
        return dfs(p-1,n-1,s-p)+dfs(p-1,n,s)

while True:
    try:
        n,s = map(int, input().split())
        if (not n and not s):
            break;
        print(dfs(9,n,s))
    except:
        break;