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: while True:
    n,s = map(int,input().split())
    if n==0 and s==0 :
        break
    flg = []
    for i in range(2**10):
        if str(bin(i)).count('1') ==n:
            flg.append(i)

    cnt = 0
    for f in flg:
        if sum([i for i in range(10) if f>>i&1==1]) == s:
            cnt += 1
    print(cnt)

Python: while True:
    n = int(input())
    a = sorted(list(map(int, input().split())))
    if n == 0:
        break
    ans = 1000
    for i in range(n - 1):
        j = a[i + 1] - a[i]
        if j <= ans:
            ans = j
    print(ans)

Python: import itertools

def cal(n,s):
    l = list(itertools.combinations(range(10),n))
    count = 0
    for i in l:
        if sum(i) == s:
            count += 1
    return count

while True:
    n,s = map(int,input().split())
    if n == 0 and s==0:
        break
    else:
        print(cal(n,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: while True:
    n,s=map(int,input().split())
    cnt=0
    if n==0:
        break
    for i in range(2**10):
        a=[]
        for j in range(10):
            if i>>j & 1:
                a+=[j]
        if len(a)==n and sum(a)==s:
            cnt+=1
    print(cnt)

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(9), num)))

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

Python: def dfs(s, l, n):
    '''
    l?????????????????°??????n???????????§s????????????????????????????????°
    '''
    if s < 0:
        return 0
    elif n == 0:
        if s == 0:
            return 1
        else:
            return 0
    else:
        return sum([dfs(s-l[i], l[i+1:], n-1) for i in range(len(l))])

nl, sl = [], []
while True:
    n, s = map(int, input().split())
    if s == 0 and n == 0:
        break
    nl.append(n)
    sl.append(s)

for n, s in zip(nl, sl):
    print(dfs(s, list(range(10)), n))

Python: ans = 0
def count(use, sum, n, s):
    global ans
    if(sum > s or n < 0):
        return;
    if(n == 0 and s == sum):
        ans += 1
    else:
        for i in range(use + 1, 10):
            count(i, sum + i, n - 1, s)

while(True):
    n = map(int, raw_input().split())
    ans = 0
    if(n[0] == 0 and n[1] == 0):
        break
    count(-1, 0, n[0], n[1])
    print(ans)

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 f2(cnt, n, ci):
    if 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


n, s = map(int, input().split())
print(f2(n, s, 0))

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

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

Python: from itertools import combinations

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

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

Python: import itertools


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

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

Python: from itertools import combinations


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

        # ????????????
        answer = 0
        combi = combinations(range(0, 10), n)
        for c in combi:
            if sum(c) == s:
                answer += 1

        # ???????????¨???
        print(answer)