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

C++: #include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <string>
using namespace std;

#define rep(i,n) for(int i=0;i<int(n);++i)


int n,s;
int ans=0;
int a[100];
//int dp[12][12][10][120] = {0};

int solve(int n,int c,int d,int s){
	if(c==n){
		if(s<=9&&s>=d){
			//cout<<"s="<<s<<endl;
			/*rep(i,n-1){
				cout<<a[i+1]<<" ";
			}
			cout<<s<<endl;*/
			ans++;
		}
	}
	else{
		//cout <<"d = "<< d <<endl;
		for(int i=d;i<10;i++){
			//cout<<"i = "<<i<<endl;
			a[c] = i;
			solve(n,c+1,i+1,s-i);
		}
	}
	return ans;
}
	
	

int main(){
	while(cin>>n>>s,!(n==0&&s==0)){
		ans = 0;
		rep(i,100) a[i] = 0;
		//cout<<n<<" "<<s<<endl;
		//solve(n,n,s);
		//dp[n][1][1][s] = solve(n,n,1,s);
		cout << solve(n,1,0,s) <<endl;
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

int n, s, cnt;
int a[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};

// ??°???{a} ??? i???????????§?????°?????§????????????.
void dfs(int i, int sum, int depth) {
    if (depth == n && sum == s) { cnt++; }

    if (i == 10 || depth == n || sum > s) return;
    // a[i]???????????´???
    dfs(i + 1, sum + a[i], depth + 1);
    // a[i]?????????????????´???
    dfs(i + 1, sum, depth);
}

int main() {
    while (cin >> n >> s) {
        if (n == 0 && s == 0) { break; }
        cnt = 0;
        dfs(0, 0, 0);
        cout << cnt << endl;
    }
    return 0;
}

C++: #include <iostream>
using namespace std;
int n,s,spn;
void sp(int ne,int ns,bool* flag)
{
	if (ne > n) return;
	if (ne == n && ns == s) spn++;
    for(int i=0;i<10;++i){
        if(!flag[i]){
            flag[i]=true;
            sp(ne+1,ns+i,flag);
			flag[i] = false;
		}
    }
}

int perm(int n)
{
	return (n ? n * perm(n - 1) : 1);
}

int main()
{
    while(1)
    {
        cin>>n>>s;if(!n)return 0;
        spn=0;
        bool flag[10]={false};
        sp(0,0,flag);
        spn /= perm(n);
        cout<<spn<<endl;
    }
    return 0;
}

C++: #include <iostream>
using namespace std;
int ans,n,s;
void solve(int n, int s, int m){
    if(n==0 && s==0){
        ans++;
        return;
    }
    for(int i=m; i<10 && n>0; i++){
        if(s-i>=0) solve(n-1, s-i, i+1);
    }
}


int main(void){
    while(1){
        ans=0;
        cin>>n>>s;
        if(n==0 && s==0) break;
        solve(n,s,0);
        cout<<ans<<endl;
    }
}

C++: #include<iostream>
#include<string>
#include<vector>
using namespace std;
#define rep(i,a,b) for(int i=int(a);i<(b);++i)

int n, s;
int ans = 0;

int main() {
	while (true) {
		ans = 0;
		cin >> n >> s;
		if (n == 0)return 0;

		rep(bit, 0, (1 << 10)) {
			vector<int> a;
			rep(i, 0, 10) {
				if (bit & (1 << i))a.push_back(i);
			}

			if (a.size() == n) {
				int sum = 0;
				rep(i, 0, n) {
					sum += a[i];
				}
				if (sum == s)ans++;
				
			}
			
		}
		cout << ans << endl;
	}
}

C++: #include <bits/stdc++.h>
using namespace std ;
 
#define pb(n) push_back(n)
#define fi first
#define se second
#define X real()
#define Y imag()

#define value(x,y,w,h) (x >= 0 && x < w && y >= 0 && y < h)

#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
 
#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))
 
typedef long long ll ;
typedef deque<int> di ;
typedef deque<ll> dl ;
typedef map<string,int> dict;
typedef complex<double> comd;
typedef pair<int,int> pii;
 
constexpr int imax = ((1<<30)-1)*2+1 ;
constexpr int inf = 100000000;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0};
const int dx[] = {0,-1,0,1};
int res;
int n,s;
void solve(int a,int b,int c){
    if(b > n || a > s) return;
    if(a == s && b == n){
        ++res;
        return;
    }
    REP(i,c+1,10){
        if(b < n && a+i < s){
            solve(a+i,b+1,i);
        }
    }
    return ;
}

int main(){
    while(cin>> n >> s){
        if( n + s == 0) break;
        res = 0;
        if(s <= 55){
            rep(i,10){
                solve(i,1,i);
            }
        }
        cout << res << endl;
    }

    return 0;
}

C++: #include <iostream>
using namespace std;
int cnt;
int n,sum;
void dfs(int n, int i , int s){

  if(s == sum && n == 0){
    cnt++;
    return; 
  }

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

int main(){

  while( cin >> n >> sum, n + sum){
    cnt = 0;
    dfs(n,0,0);
    cout << cnt << endl;
  }

  return 0;
}

C++: 
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<stack>
#include<vector>

#define NIL -1
int a[11][101][11];

int dp(int n,int s,int t){
    if(a[n][s][t]== NIL ){
        if(t==10 || (n==1 && (s<t ||9<s))){
            a[n][s][t]=0;
        }else if(n==1){
            a[n][s][t]=1;
        }else{
            a[n][s][t]=dp(n-1,s-t,t+1)+dp(n,s,t+1);
        }
    }
    return a[n][s][t];
}

int main(){
    int n,s;
    scanf("%d %d",&n,&s);
    while(n!=0 || s!=0){
        for(int i=0;i<=10;i++)for(int j=0;j<=100;j++)for(int k=0;k<=10;k++)a[i][j][k]=NIL;
        printf("%d\n",dp(n,s,0));
        scanf("%d %d",&n,&s);
    }
    
    return 0;
}

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

int n, s;

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

int main(void) {
    while (cin >> n >> s) {
        if (n == 0 && s == 0)
            break;
        cout << dfs(0, 0, n) << endl;
    }
    cout << 0 << endl;
    return 0;
}

C++: #include<iostream>
#include<cstring>
using namespace std;
int main(){
    int dp[10][1001];
    int n,s;
    while(cin>>n>>s,n||s){
        memset(dp,0,sizeof(dp));
        dp[0][0]=1;
        for(int i=0;i<=min(s,100);i++){
            for(int j=n;j>=1;j--){
                for(int k=0;k<=s;k++){
                    if(k-i>=0){
                        dp[j][k]+=dp[j-1][k-i];
                    }
                }
            }
        }
        cout<<dp[n][s]<<endl;
    }

}

C++: #include<cstdio>
#include<iostream>

using namespace std;

int n,s,ans;
int use[10];

void solve(int now,int kei){
	if(now==n){
		if(s==kei){
			ans++;
		}
		return;
	}

	for(int i=0;i<=9;i++){
		if(use[i]==0){
			use[i]=1;
			solve(now+1,kei+i);
			use[i]=0;
		}
	}
}

int kaizyo(int n){
	if(n==0) return 1;
	return n*kaizyo(n-1);
}

int main(void){

	while(1){
		cin>>n>>s;
		ans=0;
		for(int i=0;i<10;i++) use[i]=0;
		if(n==0||s==0) break;
		solve(0,0);
		cout<<ans/(kaizyo(n))<<endl;
	}

	return 0;
}