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>

using namespace std;

int ans;
int sum;

void dfs(int i,int n,int s);

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

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

C++: #include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <sstream>
#include <fstream>
using namespace std;

int depth = 0;
int sum = 0;

int dfs (int currs, int currd, int j )
{
	int count = 0;
	int i;

	if (currd == depth ){
		if (currs ==  sum ){
			return 1;
		}else{
			return 0;
		} // end if
	} // end if
	
	for (i = min(j, sum ); i >= 0; --i ){
		count += dfs (currs + i, currd + 1, i - 1 );
	} // end for

	return count;
}

int main()
{
	string str = "";

	while (getline (cin, str ) ){
		int n, s;
		int res = 0;
		stringstream ss(str);
		ss >> n >> s;

		if (n == 0 && s == 0 ){
			break;
		} // end if
		
		depth = n;
		sum = s;

		res = dfs (0, 0, 9 );

		cout << res << endl;
	} // end while
	
	return 0;
}

C++: #include<iostream>

int res = 0;
//least_n: 選べる最小のn
void rec(int n, int s, int least_n){
	if(n == 1 && least_n <= s && s < 10){
		res++;
	}
	for(int i=least_n;i<10;i++){
		rec(n-1, s-i, i+1);
	}
}

int main(){
	int n, s;
	while(std::cin >> n >> s, n){
		res = 0;
		rec(n, s, 0);
		std::cout << res << std::endl;
	}
}

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

#define ll long long
#define vvi vector< vector<int> >
#define vi vector<int>
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define pii pair<int,int>
#define mp make_pair
#define pi 3.14159265359
#define shosu(X) fixed << setprecision(X)
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
int ans = 0;
//????????°,n-?????¨???????¨?,?????¨???????????????
void solve(int plus,int nowsum, int kaisu){
	if(kaisu == 0){
		if(nowsum == 0) ans++;
		return;
	}
	if(plus == 10) return;
	//plus???????????¨???
	solve(plus+1, nowsum - plus, kaisu-1);
	//plus?????????????????£?????¨???
	solve(plus+1, nowsum, kaisu);
}
int main(){
	int n,s;
	while(1){
		ans = 0;
		cin >> n >> s;
		if(n == 0 && s == 0) break;
		solve(0,s,n);
		cout << ans << endl;
	}	
}

C++:  
 #include<iostream>
 #include<stdio.h>
 #include<string>
 #include<math.h>
 #include<iomanip>
 #include<algorithm>
 #include<string.h>
 #include<cctype>
 #include<map>
 #include<set>
 #include<vector>
 #include<sstream>
 #include<stack>
 #include<queue>
 
 using namespace std;
 
 int a[10]={0,1,2,3,4,5,6,7,8,9};
 int n,s;
 int count_2;
 
 void dfs(int step,int i,int sum)
 {
   if(step==n&&i==10&&sum==s)
   {
     count_2++;
     return;                          
   }     
   dfs(step,i+1,sum);
   dfs(step+1,i+1,sum+a[i]);
 }
  
 int main()
 {
   while(cin>>n>>s)
   {
     if(n==0&&s==0) break;
     else
     {
       count_2=0;
       dfs(0,0,0);    
     } 
     cout<<count_2<<endl;               
   }
   //while(1);     
   return 0;  
 }

C++: #include <iostream>
#include <cstring>
#include <stack>

using namespace std;

struct set { int next, sum, depth; };

int n, s, cnt;
bool visited[11][101][10];

void dfs(int next, int sum, int depth) {
    memset(visited, false, sizeof(visited));
    stack<set> S;
    set tmp;
    tmp.next = next; tmp.sum = sum; tmp.depth = depth;
    S.push(tmp);
    while (!S.empty()) {
        set u = S.top();

        if (u.depth == n && u.sum == s) {
            cnt++;
        }
        if (u.next < 10 && u.depth < n && u.sum < s && !visited[u.next][u.sum][u.depth]) {
            tmp.next = u.next + 1;
            tmp.sum = u.sum;
            tmp.depth = u.depth;
            S.push(tmp);

            tmp.next = u.next + 1;
            tmp.sum = u.sum + u.next;
            tmp.depth = u.depth + 1;
            S.push(tmp);
        }
        else {
            S.pop();
        }
        visited[u.next][u.sum][u.depth] = true;
    }
}

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 <cstdio>
#include <cstdlib>
#include <cmath>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <cstring>
#include <functional>

using namespace std;

#define rep(i,n) for((i)=0;(i)<(int)(n);(i)++)
#define foreach(itr,c) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
inline int in(){ int x; scanf("%d",&x); return x;}

int res;

void dfs(int n, int s, vector<int> used){
  int x,i;

//  cout << n << " " << s << endl;
//  rep(i,used.size()) cout << used[i] << " "; cout << endl;
  if(n == 0 && s == 0) res++;
  rep(x,10){
    bool f = false;
    rep(i,used.size()) if(x == used[i]) f = true;
    if(f) continue;
    if(0 <= s-x && 0 <= n-1){
      used.push_back(x);
      dfs(n-1,s-x,used);
    }
  }
}

int main(){
  int i,j,k;
  int n,s;

  while(scanf("%d %d",&n,&s)){
    if(n == 0 && s == 0) break;
    vector<int> used;

    res = 0;
    dfs(n,s,used);
    printf("%d\n",res);
  }

  return 0;
}

C++: #include <iostream>

using namespace std;

int ans;
int sum;

void dfs(int i,int n,int s);

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

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

C++: #include <iostream>
using namespace std;
int ans;
int n, s;
//cnt := ??????????????????
void bfs(int cnt, int sum, int times){
    if(cnt == n){
        if(sum == s){
            ans++;
        }
        return;
    }
    if(times == 9){
    	return;
    }
    bfs(cnt+1, sum+times, times+1);
    bfs(cnt, sum, times+1);
}
int main(void){
    while(cin >> n >> s && n+s != 0){
        ans = 0;
        bfs(0,0,0);
        cout << ans << endl;
    }
    return 0;
}

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

int cnt; int N, Ans;

void choose(int k, int l, int digit) {
  if(k == Ans && l == N) { cnt++; return; }
  else if (k == Ans) return;
  else if (l == N) return;
  else if (digit >= 10) return;
  
  choose(k+digit, l+1, digit+1);
  choose(k, l, digit+1);
}

int main () {
  while(cin>>N>>Ans, N||Ans) {
    cnt = 0;
    choose(0, 0, 0);
    cout << cnt << endl;
  }
  return 0;
}

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

int dfs(int n, int s, int num) {
    if (s == 0 && n == 0) return 1;
    if (num >= 10 || s < 0 || n < 0) return 0;

    int ret = 0;
    // numを選ぶ
    ret += dfs(n-1, s-num, num+1);
    // numを選ばない
    ret += dfs(n, s, num+1);
    return ret;
}

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

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

    return 0;
}