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しまくる人間のクズ
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <iostream>


//using namespace stdしないと表記がめんどくさいからね、仕方ないね
using namespace std;

//可読性を上げるためのdefineが仇となる典型的パターン
#define FOR(x) for(int i = 0; i < x; i++)

//ローカル変数とグローバル変数は使い分けよう！
stack<short> x, y;
short a[10], n, j, i, m, ans;

//関数って楽しいよね！（魔王スマイル）
void solve(short c, short sum, short cnt){
	if(cnt == n){
		if(sum == m) ans++;
		return;
	}
	if(cnt < n && c > 9) return;
	if(sum > m) return;
	solve(c + 1, sum + c, cnt + 1);
	solve(c + 1, sum, cnt);
	return;
}

int main(){
	while(true){
		scanf("%d %d", &n, &m);
		if(n == 0 && m == 0) return 0;
		ans = 0;
		solve(0, 0, 0);
		printf("%d\n", ans);
	}
}

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

using namespace std;

int main() {
    // 数字リスト
    const int nums[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};

    while(1) {
        int n, s;

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

        // 0-1のフラグ配列を定義
        // nの数だけフラグを立てておき、next_permutationで順列を順次生成する
        // 全列挙を得るため、逆方向からフラグを立てる
        char flag[10] = {0};
        for(int i = 0; i < n; i++) { flag[9-i] = 1; }
        
        int count = 0;
        // フラグ配列の全列挙から異なる数字組を生成
        do {
            int sum = 0;
            
            // フラグが立っている箇所に相当する数字の総和をとる
            for(int i = 0; i < 10; i++) 
                if(flag[i]) { sum += nums[i]; }
            
            // 総和が入力と一致したものをカウント
            if(sum == s) { count++; }
        } while(next_permutation(flag, flag + 10));

        cout << count << endl;
    }
}

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

void get_input(int& n, int& sum) {
    int a, b;
    std::cin >> a >> b;
    if (a == 0 && b == 0) {
        exit(0);
    } 
    n = a;
    sum = b;
    return;
}

int solve(int n, int sum, int max) {
   if (n == 1) {
        if (sum <= max) {
//            std::cout << "return: " << 1 << std::endl;
            return 1;
        } else {
//            std::cout << "return: " << 0 << std::endl;
            return 0;
        }
    } 

    if (sum <= max) {
        max = sum;
    }
/*    std::cout << "n: " << n << ' '
              << "sum: " << sum << ' ' 
              << "max: " << max << std::endl; */
 
    int result = 0;
    for (int i = 0; i < max; i++) {
        result += solve(n-1, sum - (max - i), max - (i + 1));
    }
//    std::cout << "return: " << result << std::endl;
    return result;
}


int main(void) {
    int n, sum;
    while (true) {
        get_input(n, sum);
        std::cout << solve(n, sum, 9) << std::endl;
    }
    return 0;
}

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

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

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

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

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

int main() {

  int d[11][101] = {0};

  for ( long long int i = 0; i < ( 1 << 9 ); i++ ) {
    long long int k = i;
    long long int cnt = 0;
    long long int sum = 0;
    long long int j = 0;
    while( k > 0 ) {
      if ( k % 2 ) {
	sum += j;
	cnt++;
      }
      j++;
      k /= 2;
    }
    d[cnt][sum]++;
  }

  long long int n, s;

  while( cin >> n >> s, n ) {
    cout << d[n][s] << endl;
  }

  return 0;

}

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

int n,s,ans;

void solve(int i,int j,int t){

  if(j == s && t == n){
    ans++;
    return;
  }

  if(i == 10) return;

  solve(i+1,j,t);
  solve(i+1,j+i,t+1);
}


int main(){

  while(true){
    cin >> n >> s;
    if(!n && !s) break;

    ans = 0;
    solve(0,0,0);

    cout << ans << endl;
  }
}

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

int ret[10][110];
int main(){
  ret[0][0]=1;
  for(int i=9;i>=0;i--){
    for(int j=8;j>=0;j--){
      for(int k=0;k<100;k++){
        if(i+k<=100) ret[j+1][i+k] +=ret[j][k];
      }
    }
  }
  int n,s;
  while(true){
    cin>>n>>s;
    if(n==0) return 0;
    cout<<ret[n][s]<<endl;
  }
}

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

using namespace std;

struct set { int i, sum, k; };

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

void dfs(int i, int sum, int k) {
    stack<set> S;
    S.push(set{i, sum, k});

    while (!S.empty()) {
        set u = S.top();
        if (u.k == n && u.sum == s) { cnt++; }

        if (u.i == 10 && u.k == 0 && u.sum == 0) { break; }

        if (u.i < 10 && u.k < n) {
            S.push(set{u.i + 1, u.sum, u.k});
            S.push(set{u.i + 1, u.sum + a[u.i], u.k + 1});
        }
        else if (u.i == 10) {
            int tmp = u.k;
            while (S.top().k == tmp) { S.pop(); }
        }
        else { S.pop(); }
    }
}

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

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

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

void dfs(int i, int sum,int n) {
	if (n==0&&sum == s) {
		r++;
		return;
	}
	if (i == 10 || !n)return;
	dfs(i + 1, sum,n);
	dfs(i + 1, sum + a[i],n-1);
	return;
}

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

}

C++: #include <iostream>
#include <vector>
#include <algorithm>
#include <stdio.h>

using namespace std;

int N, K, ans;

int main(void) {
    while(scanf("%d%d", &N, &K)) {
        if(N == 0 && K == 0) break;
        ans = 0;
        for(int i = 0; i < (1 << K); i++) {
            int tmp = 0, ct = 0;
            for(int j = 0; j <= K; j++) if(i & (1 << j)) {
                tmp += j;
                ct += 1;
            }
            if(tmp == K && ct == N) {
                ans++;
            }
        }
        cout << ans << endl;
    }
    return 0;
}

C++: #include <iostream>

using namespace std;


int n,s;

int count;

void dfs(int i,int j,int sum) {

  //cout << i << " " << j << " " << sum << endl;

  if(j==0 && sum==0) {

    count++;

    return;

  }

  if(i==10 || j==0 || sum<=0) return;

  dfs(i+1,j-1,sum-i);

  dfs(i+1,j,sum);

  return;

}
  

int main() {

  while(cin >> n >> s,n!=0 || s!=0) {

    count=0;

    dfs(0,n,s);

    cout << count << endl;

  }

  return 0;

}

C++: # include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
constexpr int MOD = 1000000007;
constexpr int INF = 2000000000;
using namespace std;

int n, s;
int ans = 0;

void dfs(int pos, int sum,int count) {
	if (count == n&&sum == s) {
		ans++;
		return;
	}
	if (pos > 9 || count == n)return;
	dfs(pos + 1, sum + pos,count+1);
	dfs(pos + 1, sum,count);
}

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