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 _combination(left, source, n, yields):
    if(len(left) == n):
        yields.append(left)
    else:
        for i in range(len(source)):
            _combination(left + [source[i]], source[i + 1:], n, yields)
def combination(source, n):
    yields = []
    _combination([], source, n, yields)
    return yields

printedLater = []
while True:
    n, s = [int(i) for i in input().split()]
    if((n, s) == (0, 0)):
        break
    printedLater.append(len([x for x in combination(range(10), n) if sum(x) == s]))
for line in printedLater:
    print(line)

Python: a = [0,1,2,3,4,5,6,7,8,9]

wa_lis = []
num = 0
def wa(n,k,m):
    global num

    if n == 9 and m == 0 and k == 0:
        num += 1
    if n == 10:
        return
    return wa(n + 1,k - a[n],m - 1) or wa(n+1,k,m)

while True:
   
    n,s = map(int,input().split())
    if [n,s] == [0,0]:
        break
    wa(0,s,n)
    print(num)
    num = 0

Python: from collections import deque


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

    def solve(self, num, rem):
        num -= 1
        if rem < 10 and self.used[rem] == False and num == 0:
            self.Q.append(rem)
            # 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 (rem - i) >= 0:
                self.used[i] = True
                self.Q.append(i)
                self.solve(num, rem - 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

        # ????????????
        a = Bt()
        a.solve(n, s)

        # ???????????¨???
        print(len(a.answers))

Python: class Depth_First_Search_stack:
    def __init__(self, n, s):
        self.n = n
        self.s = s
        self.stack=[[i] for i in range(self.s)]
        self.ans = 0

    def search(self):
        while self.stack:
            c = self.stack.pop()
            if sum(c) == self.s and len(c) == self.n:
                self.ans += 1
                print(c)
            for i in range(self.s-max(c) + 1):
                if max(c)<i and sum(c+[i]) <= self.s and len(c+[i]) <= self.n:
                    self.stack.append(c+[i])

if __name__ == '__main__':
    while 1:
        n, s = list(map(int, input().split(' ')))
        if n==0 and s==0:
            break
        DFS = Depth_First_Search_stack(n, s)
        DFS.search()
        print(DFS.ans)

Python: n=0
s=0

while 1:
    n,s=map(int,input().split())
    if not n and not s:
        break
    ans=0
    for t in range(1024):
        tt=t
        su=0
        cnt=0
        for i in range(10):
            if tt%2:
                su+=i
                cnt+=1
            tt//=2
        if cnt==n and su==s:
            ans+=1
    print(ans)

Python: def calc_combination(n, s, max_digit):
    if n == 1:
        if max_digit > s:
            return 0
        else:
            return 1
    if n * (n - 1) / 2 > s:
        return 0
    total = 0
    max_digit = min(s, max_digit)
    for i in range(n-1, max_digit):
        total += calc_combination(n-1, s-i, max_digit-1)
    return total

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

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: a = [0,1,2,3,4,5,6,7,8,9]

wa_lis = []
num = 0
def wa(n,k,m):
    global num

    if n == 10 and m == 0 and k == 0:
        num += 1
    if n == 10:
        return
    return wa(n + 1,k - a[n],m - 1) or wa(n+1,k,m)

while True:
   
    n,s = map(int,input().split())
    if [n,s] == [0,0]:
        break
    wa(0,s,n)
    print(num)
    num = 0

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

Python: class Node():
    def __init__(self, v):
        self.v = v
        self.parent = None
        self.children = []
        self.is_visited = False
    
    def add_child(self, node):
        self.children.append(node)
        node.parent = self


def construct_tree(node):
    start = -1 if node.v is None else node.v
    if node.v == 9:
        return
    for i in range(start + 1, 10):
        new_node = Node(i)
        node.add_child(new_node)
        construct_tree(new_node)

def reset_state(node):
    node.is_visited = False
    for child in node.children:
        reset_state(child)

def find_answer(node, n, s, cnt=0):
    node.is_visited = True
    
    depth, cur_sum = 0, 0
    cur = node
    while cur.parent is not None:
        cur_sum += cur.v
        depth += 1
        cur = cur.parent
    
    if cur_sum == s and depth == n:
        cnt += 1
   
    if depth < n:
        for child in node.children:
            if not child.is_visited:
                cnt = find_answer(child, n, s, cnt)
    
    return cnt

def solve():
    root = Node(None)
    construct_tree(root)
    
    while True:
        n, s = map(int, input().split())
        if n == 0 and s == 0:
            break
        
        count = find_answer(root, n, s)
        print(count)
        reset_state(root)

if __name__ == "__main__":
    solve()

Python: def decSum(n, sm, mn):
    print(n,sm,mn)
    if mn + n > 10 :
        return 0
    elif sum(range(mn, mn + n)) > sm or sum(range(10 - n, 10)) < sm:
        return 0
    elif n == 1:
        return 1
    else:
        a = 0
        for i in range(mn, 10 if sm >= 10 else sm):
            a += decSum(n - 1, sm - i, i + 1)
        return a
while True:
    n, sm = map(int, input().split())
    if n == 0:
        break
    print(decSum(n, sm, 0))