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 dfs(depth,prev,sum):
	if depth == n:
		return sum == s
	ret = 0
	for i in range(prev + 1,10):
		ret += dfs(depth + 1,i,sum + i)
	return ret

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

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(max(c), self.s+1):
                if i not in c 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: from itertools import combinations

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

Python: import sys
from itertools import combinations as c
for line in sys.stdin:
    count = 0
    k, v = map(int, line.split())
    if k and v:
        for i in c(range(10), k):
            if sum(i) == v:
                count += 1
    else:
        break
    print(count)

Python: from collections import deque


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

    def solve(self, num, remain):
        # ????´¢??????????°??????§?????????????????????????????§????????????????????§????????°??????????????????????????????
        try:
            min_choice = max(self.Q) + 1
        except ValueError:
            min_choice = 0

        if min_choice <= remain < 10 and self.used[remain] == False and num == 1:
            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()
            # self.answers.append(1)
            return
        elif num < 0:
            return

        for i in range(min_choice, 10):
            if self.used[i] == False and (remain - i) >= 0:
                self.used[i] = True
                self.Q.append(i)
                self.solve(num - 1, 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: def solve(n,s,lst):
    if n == 0 and s == 0:
        #print("Complete!")
        return(1)
    elif n==0 or len(lst)==0 or s < 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(10))))
            
        if n==0 and s==0:
            break

Python: while True:
  a, b = map(int, input().split())
  if a == 0 & b == 0:
    break
  count = 0
  for s in range(2**10):
    arr = [i for i in range(10) if s >> i & 1]
    if len(arr) == a:
      sum = 0
      for i in range(0, len(arr)):
        sum += arr[i]
      if sum == b:
        count += 1
  print(count)

Python: while True:
    n, s = map(int, input().split())
    if n == 0 and s == 0:
        break
    ans = 0
    for i in range(2**10):
        now = 0
        z = 0
        for k in range(10):
            if i >> k & 1:
                z += 1
                now += k
        if z == n and now == s:
            ans += 1
    print(ans)

Python: from __future__ import (absolute_import, division, print_function,
                        unicode_literals)
from sys import stdin
from itertools import combinations

for line in stdin:
    if line.startswith('0 0'):
        break
    num, ans = (int(s) for s in line.split())
    print(sum(sum(t) == ans for t in combinations(xrange(10), num)))

Python: from itertools import combinations


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

Python: def f2(cnt, n, ci):
    if ci >= 10 or n > 45:
        return 0
    elif n < ci:
        return 0
    elif n == ci and cnt > 1:
        return 0
    elif n == ci and cnt == 1:
        return 1
    else:
        v = f2(cnt - 1, n - ci, ci + 1)
        v += f2(cnt, n, ci + 1)
        return v


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

Python: # coding: utf-8

def main():
    while True:
        a, b = map(int, input().split())
        if a == 0 and b == 0:
            break
        c = 0
        for i in range(b // 2):
            for j in range(i + 1, b):
                for k in range(j + 1, b):
                    if i + j + k == b:
                        c += 1
        print(c)

if __name__ == "__main__":
    main()

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

Python: import itertools

while True:
    a, b = map(int, input(). split())
    if a == 0 and b == 0:
        break

    s = list(itertools.combinations(range(10), a))

    cnt = 0

    for i in s:
        if sum(i) == b:
            cnt += 1

    print(cnt)

Python: n, s = map(int, input().split())
import itertools
while n != 0 or s != s:
    count = 0
    a = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
    for j in itertools.combinations(a, n):
        x = 0
        for i in range(n):
            x += j[i]
        if x == s:
            count += 1
    print(count)
    n, s = map(int, input().split())

Python: import itertools

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

Python: def dfs(i,ls):
    if i == 10:
        return len(ls) == n and sum(ls) == s
    return dfs(i + 1,ls) + dfs(i + 1,ls + [i])

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