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 <string.h>
#include <iostream>

using namespace std;

int main()
{
	int n[50], s[50], c = 0, dp[10][100][100];

	long long SUM = 0;

	memset(dp, 0, sizeof(dp));

	for (int i = 0; i < 100; i++)
	{
		dp[1][i][i] = 1;
	}

	for (int N = 2; N < 10; N++)
	{
		for (int i = 1; i < 100; i++)
		{
			for (int j = 1; j < 100; j++)
			{
				if (j - i >= 0)
				{
					for (int k = 0; k < i; k++)
					{
						dp[N][i][j] += dp[N - 1][k][j - i];
					}
				}
			}
		}
	}

	while (true)
	{
		cin >> n[c] >> s[c];

		if (n[c] == 0 && s[c] == 0) { goto Exit; }

		c++;
	}

Exit:;

	for (int p = 0; p < c; p++)
	{
		SUM = 0;

		for (int i = 0; i < 100; i++)
		{
			SUM += dp[n[p]][i][s[p]];
		}

		cout << SUM << endl;
	}

	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <math.h>
#include <map>
#include <vector>

//#define PI 3.141592653589

using namespace std;


int ans;
int n, s;


/*
iはこれまでに足し合わせた数字の数

*/
void dfs(int i, int kazu, int sum)
{
	if (i == n && sum == s)
	{
		ans++;
		return;
	} else if (i == n) {
		return;
	} else if (kazu == 9) {
		return;
	}
	
	dfs(i, kazu+1, sum);
	dfs(i+1, kazu+1, sum+kazu);
}


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

C++: #include <iostream>
#include <cstdio>
#include <string>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <ctime>
using namespace std;

#define rep(i,a,n) for(int i=a; i<n; i++)
#define repr(i,a,n) for(int i=a; i>=n; i--)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 999999999

#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))

typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long int ll;

typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;

int const MOD = 1000000007;

int a, b, ret;
// x????¶???????????????????????????§???y????¶???????????????????????????§???????¨????sum???
void dfs(int x, int y, int sum) {
    if(x == 10 || sum > b) return;
    if(sum == b && y == a) {
        ret++; return;
    }
    dfs(x+1,y,sum);
    dfs(x+1,y+1,sum+x);
}

int main() {
    while(cin >> a >> b) {
        ret = 0;
        if(a == 0 && b == 0) break;
        dfs(0,0,0);
        cout << ret << endl;
    }
    return 0;
}

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

int avail(int depth, int sum, int minval) {
	if (depth == 0)
		return (sum == 0 ? 1 : 0);

	int ret = 0;
	for (int i = minval; i <= 9 && i <= sum; i++)
		ret += avail(depth-1, sum-i, i+1);
	return ret;
}

int main() {
	int n, s;
	while (cin >> n >> s, n||s) {
		cout << avail(n, s, 0) << endl;
	}
	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int n,s,ans;

void func(int c,int b,int sum){
  int ctr=c+1,a;
  for(a=b+1;a<10;a++){
    if(ctr==n){
      if(sum+a==s){
        ans++;
        break;
      }else if(sum+a>s){
        break;
      }
    }else{
      func(ctr,a,sum+a);
    }
  }
  return;
}
int main(){
  cin >> n >> s;
  int a,b,c;
  while(n||s){
    ans=0;
    func(0,-1,0);
    cout << ans << endl;
    cin >> n >> s;
  }
  return 0;
}

C++: #include <bits/stdc++.h>
#include <numeric>
#define REP(i, s, n) for (int i = s; i < n; ++i)
#define rep(i, n) REP(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define SORT_INV(c) sort((c).begin(), (c).end(), greater<int>())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false
#define LL long long
#define Dev 1000000007

// sort(a.begin(), a.end(), std::greater<int>());
using namespace std;

int main()
{
    int n, s;
    while (true)
    {
        cin >> n >> s;
        if (n == 0 && s == 0)
            break;
        int num = 0;
        rep(i, 1024)
        {
            vector<int> hoge;
            rep(j, 10)
            {
                if ((i & (1 << j)) > 0)
                    hoge.push_back(j);
            }
            int piyo = 0;
            if (hoge.size() == n)
            {
                for (auto item : hoge)
                    piyo += item;
            }
            if (piyo == s)
                num++;
        }
        cout << num << endl;
    }
    return 0;
}

C++: #include <iostream> 

int main(){
	int a,b,x=0;
	int gh[50];	
	while(std::cin>>a>>b&&a!=0&&b!=0){
		int d2=0,d3=0,d4=0,d5=0,d6=0,d7=0,d8=0,d9=0;
		int o=0;
		x++;
		for(int d=0;d<10;d++){
			if(a>1&&d<=10-a){
				for(d2=d+1;d2<10;d2++){
			if(a>2&&d2<=10-a+1){
				for(d3=d2+1;d3<10;d3++){
			if(a>3&&d3<=10-a+2){
				for(d4=d3+1;d4<10;d4++){
			if(a>4&&d4<=10-a+3){
				for(d5=d4+1;d5<10;d5++){
			if(a>5&&d5<=10-a+4){
			for(d6=d5+1;d6<10;d6++){
			if(a>6&&d6<=10-a+5){
			for(d7=d6+1;d7<10;d7++){
			if(a>7&&d7<=10-a+6){
				for(d8=d7+1;d8<10;d8++){
			if(a>8&&d8<=10-a+7){
				for(d9=d8+1;d9<10;d9++){
		if(a==9&&b==d+d2+d3+d4+d5+d6+d7+d8+d9){
			o++;
		}
			}
		}
		if(a==8&&b==d+d2+d3+d4+d5+d6+d7+d8+d9){
			o++;
		}
			}
		}
		if(a==7&&b==d+d2+d3+d4+d5+d6+d7+d8+d9){
			o++;
		}
			}
		}
		if(a==6&&b==d+d2+d3+d4+d5+d6+d7+d8+d9){
			o++;
		}
			}
		}
		if(a==5&&b==d+d2+d3+d4+d5+d6+d7+d8+d9){
			o++;
		}
			}
		}
		if(a==4&&b==d+d2+d3+d4+d5+d6+d7+d8+d9){
			o++;
		}
			}
		}if(a==3&&b==d+d2+d3+d4+d5+d6+d7+d8+d9){
			o++;
		}
			}
		}if(a==2&&b==d+d2+d3+d4+d5+d6+d7+d8+d9){
			o++;
		}
		}
		
			}if(a==1&&b==d){
			o++;
		}
		}
		gh[x]=o;
	}
	for(int gf=1;gf<=x;gf++){
		std::cout<<gh[gf]<<std::endl;
	}
	return 0;
}

C++: //1〜10までの数を使って、n項の和をs+nにするという問題に置き換える。
#include<iostream>
using namespace std;

int dp[10][11][111];	//dp[今作った項][今使った数(昇順に使う)][今の和]

int main()
{
	int i,j,k,l;
	int n,s;
	
	while( cin >> n >> s ){
		if( !n )break;
		
		for( i = 0;i < 10;i++ ){
			for( j = 0;j < 11;j++ ){
				for( k = 0;k < 111;k++ ){
					dp[i][j][k] = 0;
				}
			}
		}
		dp[0][0][0] = 1;
		
		for( i = 0;i < n;i++ ){
			for( j = 0;j < 11;j++ ){
				for( k = 0;k <= s+n;k++ ){
					for( l = j+1;l < 11;l++ ){
						if( k+l > s+n )
							break;
						
						dp[i+1][l][k+l] += dp[i][j][k];
					}
				}
			}
		}
		int ans = 0;
		
		for( i = 0;i < 11;i++ ){
			ans += dp[n][i][s+n];
		}
		cout << ans << endl;
	}
	return 0;
}

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