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: # -*- coding:utf-8 -*-

def kai(n):
    s=n
    ans=1
    while s>1:
        ans*=s
        s-=1
    return ans

def main():
    LIST=[]

    while True:
        try:
            LIST=[]
            ans=0
            
            n,s=map(int,input().split())
            if n==0:
                break       #N=0なら終了

            for i in range(n):
                LIST.append(0)

            for j in range(10**n):
                index=0
                up=True
                flag=False
                count=0     #初期化

                for i in LIST:
                    if LIST.count(i)>1:
                        flag=True   #同一の数字が無いか検索

                if flag:
                    pass    #あったら飛ばす
                else:
                    for i in LIST:
                        count+=i
                    if count==s:
                        ans+=1      #無かったら合計値が合うか見る

                while up:
                    LIST[index]+=1
                    if LIST[index]%10==0:
                        LIST[index]=0
                        up=True
                        index+=1
                    else:
                        up=False
                    if index==len(LIST):
                        break


            print(int(ans/kai(n)))

        except EOFError:
            break

    
if __name__ == '__main__':
    main()

Python: import itertools
def ANS(n, s):
    A = list(range(10))
    count = 0
    A_pair = list(itertools.combinations(A,n))
    for i in range(len(A_pair)):
        Sum = sum(A_pair[i])
        if Sum==s:
            count += 1
    return count

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

Python: #!/usr/bin/env python

while True:
	n, s = map(int, raw_input().split())
	if not n:
		break
	ans = 0
	for i in range(2**10):
		cnt = 0
		ss = 0
		for j in range(10):
			if i & (2 ** j):
				cnt += 1
				ss += j
		if cnt == n and ss == s:
			ans += 1
	print(ans)

Python: import itertools
while True:
    n, s = map(int, input().split())
    if n == s == 0:
        break
    print([sum(i) for i in itertools.combinations(range(10), n)].count(s))

Python: s = 0
comb = 0

def main():
    global s, comb

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

        comb = 0
        dfs(0, n, 0)
        print(comb)


def dfs(i, num_count, current_sum):
    global comb
    if num_count == 0 and current_sum == s:
        comb += 1
        return
    if i > 9:
        return

    dfs(i + 1, num_count, current_sum)
    dfs(i + 1, num_count - 1, current_sum + i)


if __name__ == '__main__':
    main()

Python: from sys import stdin
from itertools import product,permutations,combinations

while(True):
    n,s = map(int, stdin.readline().split())
    if not n:
        break
    print(sum([1 for m in combinations(list(range(10)),r=n) if sum(m)==s]))

Python: import itertools

while 1:
    n, s = map(int, input().split())
    if n == 0:
        break
    l = itertools.combinations(range(10), n)
    print(len([l for c in l if sum(c) == s]))

Python: # AOJ 0030 Sum of Integers
# Python3 2018.6.18 bal4u

def rec(n, s, vmin):
	if vmin == 10 or vmin > s: return 0
	if n == 1: return (1 if s < 10 else 0)
	sum = 0;
	for i in range(vmin, 10): sum += rec(n-1, s-i, i+1)
	return sum

while True:
	n, s = list(map(int, input().split()))
	if n < 1: break
	print(rec(n, s, 0))

Python: from itertools import combinations

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

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,raw_input().split())
  if n == s == 0:
    break
  print(f(n,s,10))

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: #!/usr/bin/env python
# -*- coding: utf-8 -*-
import itertools

S = []
N = []
while True:
    n,s = map(int,input().split(" "))
    if s == 0 and n == 0:
        break
    else:
        N.append(n)
        S.append(s)

for i in range(0,len(S)):
    sumMap = list(map(sum,list(itertools.combinations(range(0,S[i]+1),N[i]))))
    print(sum([1 for j in range(0,len(sumMap)) if sumMap[j] == S[i]]))

Python: import itertools

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

Python: import itertools
Num_lis = [0,1,2,3,4,5,6,7,8,9]
while True:
    
    num = 0
   
    n,s = map(int,input().split())
    if [n,s] == [0,0]:
        break
    Con_lis = list(itertools.combinations(Num_lis, n))
    for i in range(len(Con_lis)):
        Sum = 0
        for j in range(n):
            Sum += Con_lis[i][j]
        if Sum == s:
            num += 1
    print(num)

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 = []
            for i in self.Q:
                ans.append(i)
            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 bit(N,S):
    global ans
    for s in range(2**10):
        a=[i for i in range(10) if s>>i & 1]
        if len(a)==N and sum(a)==S:
            ans+=1
while True:
    N,S=map(int,input().split())
    if N==0 and S==0:
        break
    ans=0
    bit(N,S)
    print(ans)

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