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 choice(pos, num):
    global  ans
    if pos == n:
        if len(set(l)) != n:
            return
        check = sum(l)
        if check == s:
            if set(l) not in save:
                save.append(set(l))
                ans += 1
        return
    if num == 10:
        return
    l[pos] = num
    choice(pos + 1, num+1)
    choice(pos, num+1)


number = [0,1,2,3,4,5,6,7,8,9]
n, s = map(int, input().split())
while n != 0:
    l = [0] * n
    save = []
    ans = 0
    choice(0, 0)
    print(ans)
    n, s = map(int, input().split())

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

C++: #include<iostream>
#include<cstdio>
using namespace std;
#define int long long
int func(int n, int a, int b){
	if(n==0 && a==0) return 1;
	else if (n==0 || a<0) return 0;
	int ans=0;
	for(int i=b;i<10;i++) ans += func(n-1, a-i, i+1);
	return ans;
}
signed main(){
	int a,b;
	while( scanf("%lld %lld", &a, &b) != EOF ){
		if(a==0&&b==0) break;
		cout << func(a,b,0) <<endl;
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
  int n,s,j,k,a[11][46];
  for(int s=0;s<46;s++)for(int n=0;n<11;n++)a[n][s]=0;
  for(int i=0;i<1024;i++){
    for(j=i,n=0;j>0;j/=2)
      n += j%2;
    for(j=i,s=0,k=0;j>0;j/=2,k++)
      s += j%2*k;
    a[n][s]++;
  }
  for(cin>>n>>s;n||s;s<45?cout<<a[n][s]<<endl:0,cin>>n>>s);
}

C++: #include <iostream>
#include <vector>
using namespace std;

void func(int start,int num,int current);
int s,res;

int main(void){
  int n;
  cin >> n; cin >> s;
  while(n!=0 && s!=0){
    res = 0;
    func(0,n,0);
    cout << res << endl;
    cin >> n; cin >> s;
  }
}
  
void func(int start,int num,int current){
  int temp=0;
  for(int i=start; i<10; i++){
    if(current+i<=s) temp = current+i;
    else break;
    if(num!=1) func(i+1,num-1,temp);
    else if(temp==s) {
      res++;
    }
    temp=0;
  }
}

C++: #include <bits/stdc++.h>
using namespace std;

int x,y,z[51]={};

int mySet(int d,int e){
	int a=0;
	for(int i=1;i<d;i++){
		if(z[i]>=z[i+1]){
			return 0;
		}
	}
	if(d==x){
		if(e==y){
			return 1;
		}else{
			return 0;
		}
	}
	for(int j=0;j<=9;j++){
		z[d+1]=j;
		a+=mySet(d+1,e+j);
	}
	return a;
}

int main(void){
	while(1){
		cin>>x>>y;
		if(x==0&&y==0){
			break;
		}else{
			cout<<mySet(0,0)<<endl;
		}
	}
	return 0;
}

C++: #include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>

using namespace std;
#define LENGTH 100

int cnt=0;

void dfs(int sum, int s, int n, int i){
  if(sum==s && n==0){
    cnt++;
  }

  if(n<=0 || sum>s || i>9){
    return;
  }
  
  
  dfs(sum+i, s, n-1, i+1);
  dfs(sum, s, n, i+1);
}

int main(){
  int n;
  int s;
  while(cin >> n >> s){
    if(n==0 && s==0){
      break;
    }

    dfs(0, s, n, 0);
    cout << cnt << endl;
    cnt = 0;
  }
}

C++: #include <iostream>
using namespace std;
int main(){
  int n,s,j,k;
  int a[11][46];
  for(int s=0;s<46;s++)
    for(int n=0;n<11;n++)
      a[n][s]=0;
  n=s=0;
  for(int i=0;i<1024;i++){
    for(j=i,n=0;j>0;j/=2)
      n += j%2;
    for(j=i,s=0,k=0;j>0;j/=2,k++)
      s += j%2*k;
    a[n][s]++;
  }
  while(true){
    cin>>n>>s;
    if(!n&&!s)
      break;
    cout<<a[n][s]<<endl;
  }
  return 0;
}
//  for(cin>>n>>s;n||s;cout<<a[n][s]<<endl,cin>>n>>s);

C++: #include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
int dp[10][101];
int x[101],w=0;
int n,s;
int Sum_of_Integers(int i,int sum,int v);
int main(){
  while(1){
    cin >> n >> s;
    if(!n && !s)break;
    memset( dp , -1 , sizeof(dp) ); // -1で初期化
    int k = Sum_of_Integers( 0 , 0 , -1 );
    if(k == 0){
      cout << k << endl;
    }else {
      cout << k << endl;
    }
  }
}
int Sum_of_Integers(int i,int sum,int v){
  int ret = 0;
  if(i > n || sum > s)return 0; // あふれたとき
  if(i == n && sum == s)return 1;
  for(int j=v+1;j<=s;j++){
    ret += Sum_of_Integers( i + 1, sum + j , j );
  }
  return ret;
}

C++: #include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)



int main(){
	int n,s;
	while(cin>>n>>s&&(n||s)){
		int dp[11][11][101]={};
		dp[0][0][0] = 1;
		
		for(int i=1;i<=n;i++){
			for(int j=1;j<=10;j++){
				rep(k,s+1){
					if(k-(j-1)>=0) dp[i][j][k] = dp[i][j-1][k-1] + dp[i-1][j-1][k-(j-1)];
				}
			}
		}
		int ans = 0;
		rep(i,11) ans += dp[n][i][s];
		cout<<ans<<endl;
	}
}

C++: #include <iostream>
using namespace std;
int n,s,c;
void f(int m,int a,int t){
	if(a == n){
		if(t == s) ++c;
		return;
	}
	for(int i = m;i < 10;++i){
		f(i + 1,a + 1,t + i);
	}
}
int main(){
	while(cin >> n >> s && (n != 0 && s != 0)){
		c = 0;
		for(int i = 0;i < 10;++i)f(i + 1,0,i);
		cout << c << endl;
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

int ans;
int sum;

void dfs(int i,int n,int s){
    if(n==0){
        if(sum==s){
            ans++;
        }
        return;
    }
    if(i==10)return;
    dfs(i+1,n,s);
    dfs(i+1,n-1,s+i);
}

int main(void){
    int n;
    while(cin>>n>>sum,n!=0&&sum!=0){
        ans=0;
        dfs(0,n,0);
        cout<<ans<<endl;
    }
    return(0);
}