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(n, s, i):
    if n == 0:
        if s == 0: return 1
        else: return 0
    if i == 10:
        return 0;

    ans = 0
    ans += dfs(n, s, i + 1)
    ans += dfs(n-1, s - i, i + 1)
    return ans


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

    return 0


if __name__ == '__main__':
    main()

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

Python: 
import itertools
for e in iter(input,'0 0'):
 n,s=map(int,e.split())
 print(sum(s==sum(p)for p in itertools.combinations(range(10),n)))

Python: import itertools

while 1:
    n, s = map(int, input().split())
    if n == s == 0:
        break
    clist = itertools.combinations(range(10), n)
    cnt = 0
    for c in clist:
        if sum(c) == s:
            cnt += 1

    print(cnt)

Python: from itertools import combinations as C

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

    print([sum(c) == s for c in C(range(s+1), n)])

Python: from itertools import combinations
import sys

for n, s in (map(int, l.split()) for l in sys.stdin.readlines()):
    if n == 0: break
    print(sum(1 for a in combinations(range(10), n) if sum(a)==s))

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+1):
        total += calc_combination(n-1, s-i, i-1)
    return total

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

Python: import itertools

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

Python: global num_lim
global tgt_sum

def dfs(cnt, num, sum):
  if cnt == num_lim:
    return sum == tgt_sum
  if num > 9:
    return 0
  return dfs(cnt + 1, num + 1, sum + num) + dfs(cnt, num + 1, sum)
    
while True:
  num_lim, tgt_sum = list(map(int, input().split()))
  if num_lim == 0 and tgt_sum == 0:
    break
  print(dfs(0, 0, 0))

Python: import itertools
r=[]
while 1:
    a=list(map(int,input().split()))
    if not a[0] and not a[1]:break
    r.extend([sum([1 for i in itertools.combinations(range(10),a[0]) if sum(i)==a[1]])])
[print(i) for i in r]

Python: import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)

l = list(range(10))

while True:
    n,s = list(map(int, input().split()))
    if n + s < 1:
        break
    print(len([a for a in itertools.combinations(l, n) if sum(a) == s]))

Python: from itertools import combinations
import sys
readline = sys.stdin.readline
write = sys.stdout.write
def solve():
    N, S = map(int, readline().split())
    if N == 0:
        return False
    ans = 0
    for p in combinations(range(10), N):
        if sum(p) == S:
            ans += 1
    write("%d\n" % ans)
    return True
while solve():
    ...

Python: def search(N, s, start, depth):
    if depth == 0 and s == 0:
        return 1
    if depth == 0 and s != 0:
        return 0

    ans = 0
    for i in range(start, 10):
        if N[i] == 1:
            N[i] = 0
            ans += search(N, s-i, i, depth-1)
            N[i] = 1
    return ans

n,s = [int(i) for i in input().split()]
while n != 0 or s != 0:

    N = [1 for i in range(10)]
    print(search(N, s, 0, n))

    n,s = [int(i) for i in input().split()]

Python: while 1:
    n,s=map(int,input().split())
    if n==s==0:break
    ans=0
    for a0 in range(2):
        for a1 in range(2):
            for a2 in range(2):
                for a3 in range(2):
                    for a4 in range(2):
                        for a5 in range(2):
                            for a6 in range(2):
                                for a7 in range(2):
                                    for a8 in range(2):
                                        for a9 in range(2):
                                            if a0+a1+a2+a3+a4+a5+a6+a7+a8+a9==n and 1*a1+2*a2+3*a3+4*a4+5*a5+6*a6+7*a7+8*a8+9*a9==s:ans+=1
    print(ans)

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


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

Python: def dfs(depth,s,m):
    global maxdepth,target,cnt
    if depth==maxdepth:
        if s==target:
            cnt+=1
        return
    r=min([target-s,9])+1
    for i in range(r):
        if i>m:
            dfs(depth+1,s+i,i)
while 1:
    maxdepth,target=[int(st)for st in input().split(" ")]
    if maxdepth==target==0:break
    cnt=0
    u=[False for i in range(10)]
    dfs(0,0,-1)
    print(cnt)

Python: #rest...使用数の残り
#n...今見る数字
#acc...今までの合計
#to...目的の値

def counter(rest, n, acc, to):
  #残り使用数が0なら...acc == to -> 1,  acc != to -> 0
  if rest == 0:
    return acc == to

  #nが使える数(9)を超えたら終了
  if n == 10:
    return 0
  
  #nを使った場合と使わなかった場合の合計の数を出力
  return counter(rest - 1, n + 1, acc + n , to) + counter(rest, n + 1, acc, to)

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

  if not n:
    break

  print(counter(n, 0, 0, s))

Python: def rec(n, s, v):
    # 9までor目標の値が対象の数値でうわまらない場合
    if v == 10 or v > s:
        return 0
    # 一致ケース
    if n == 1:
        if(s < 10):
            return 1
        else:
            return 0
    sum = 0
    for i in range(v, 10):
	    sum += rec(n - 1,s - i,i + 1)
    return sum

while True:
    n, s = (int(x) for x in input().split())
    if n == 0 and s == 0:
        break
    print(rec(n, s, 0))

Python: x = [[0]*50 for i in range(11)]
for i in range(0, 2**10):
    B = format(i,'b')[::-1]
    s,c,j = 0,0,0
    for e in B:
        if e=="1": s,c = s+j, c+1
        j += 1
    x[c][s]+=1

while 1:
    n, s=map(int, raw_input().split())
    if n==0 and s==0: break
    print [x[n][s],0][s>=50]

Python: import itertools

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

    print(c)

Python: while True:
    n, s = map(int, input().split()) #与えられた値をn,sに代入
    answer = 0 #答えとなる関数
    if [n,s] == [0,0]:
        break
    else:
        for i in range(2**10): #部分集合をビット表示する
            a = [] #部分集合を表示するためのリストを作成
            for j in range(10):
                if (i >> j) & 1 == 1:
                    a += [j] #ビット表示をただのリストになおす
            if len(a) == n:
                if sum(a) == s:
                    answer += 1
        print(answer)