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 <bits/stdc++.h>

using namespace std;

#define TEMP_T template<typename T>
TEMP_T void sort(T& v){ sort(v.begin(), v.end()); }
TEMP_T void revs(T& v){ reverse(v.begin(), v.end()); }
TEMP_T void uniq(T& v){ sort(v); v.erase(unique(v.begin(), v.end())); }
TEMP_T void show(T& v, char delim=' ', char end='\n'){ for(int i=0; i<v.size()-1; i++) cout << v[i] << delim; cout << v[v.size()-1] << end; }
TEMP_T T    cums(T& v){ T r; r.push_back(v[0]); for(int i=1; i<v.size(); i++) r.push_back(r[i-1] + v[i]); return r; }
TEMP_T void maxe(T& v, T m){ v = max(v, m); }
TEMP_T void mine(T& v, T m){ v = min(v, m); }

static inline int in(){ int x; scanf("%d", &x); return x; }

struct Solver {
  int pattern[64];
  int n;
  Solver(int n) : n(n) {
    memset(pattern, 0, sizeof(pattern));
  }
  void solve(int it=0, int c=0, int s=0){
    if (it <= 10 && c == n){
      pattern[s]++;
      return;
    }
    solve(it + 1, c + 1, s + it);
    solve(it + 1, c, s);
  }
};

int main()
{
  int n, s;
  while (n = in(), s = in(), n != 0 && s != 0){
    Solver solver(n);
    solver.solve();
    if (s < 64){
      printf("%d\n", solver.pattern[s]);
    }
    else puts("0");
  }

  return 0;
}

C++: #include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <cmath>
#include <stack>
#include <map>
#include <sstream>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
using namespace std;

int n, s;

int dst(int i, int sum, int k){
    if (sum == s && k == n) return 1;
    if (i >= 10 || sum > s || k >= n) return 0;
    return dst(i+1, sum+i, k+1) + dst(i+1, sum, k);
}

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

C++: #include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
int M,S,cou=0;
int func(int n,int m,int s){
    if(n==10){
        if(m==M&&s==S){
            cou++;
        }
        return cou;
    }
        func(n+1,m,s);
        func(n+1,m+1,s+n);
        return cou;
}
int main(){
    for(;;){
    cou=0;
    cin>>M>>S;
    if(M==0&&S==0)break;
    cou=func(0,0,0);
    cout<<cou<<endl;
    }
}

C++: #include<iostream>
using namespace std;
int main()
{
int n,s,R;
while(cin>>n>>s&&n!=0||s!=0)
{
	R=0;
	if(s<=45)
	{
		for(int j=0;j<10;j++)
		{	
			if(n>=2)
			{
				for(int k=j+1;k<10;k++)
				{		
					if(n>=3)
					{
						for(int l=k+1;l<10;l++)
						{
							if(n>=4)
							{
								for(int m=l+1;m<10;m++)
								{	
									if(n>=5)
									{
										for(int o=m+1;o<10;o++)
										{
											if(n>=6)
											{
												for(int p=o+1;p<10;p++)
												{
													if(n>=7)
													{
														for(int q=p+1;q<10;q++)
														{
															if(n>=8)
															{
																for(int r=q+1;r<10;r++)
																{
																	if(n>=9)
																	{
																		for(int t=r+1;t<10;t++)
																		{
																		if(j+k+l+m+o+p+q+r+t==s)
																		{
																		R++;	
																		}	
																		}
																	}
																	else if(j+k+l+m+o+p+q+r==s)
																	{
																	R++;	
																	}
																}
															}
															else if(j+k+l+m+o+p+q==s)
															{
															R++;	
															}
														}
													}
													else if(j+k+l+m+o+p==s)
													{
													R++;	
													}
												}	
											}
											else if(j+k+l+m+o==s)
											{
											R++;	
											}
										}
									}
									else if(j+k+l+m==s)
									{
									R++;	
									}
								}
							}
							else if(j+k+l==s)
							{
							R++;	
							}
						}				
					}
					else if(j+k==s)
					{
					R++;	
					}	
				}	
			}
			else if(j==s)
			{
			R++;	
			}	
		}
	}		
	cout<<R<<endl;
}
return 0;
}

C++: #include <bits/stdc++.h>

#define INF INT_MAX
#define ll long long
#define REP(i,n) for(int i=0;i<n;i++)

using namespace std;

class State{
public:
	int n;
	int sum;
	int lastnum;
	State(int nn,int s,int l):n(nn),sum(s),lastnum(l){};
};

int main(){
	cin.tie(0);
    ios::sync_with_stdio(false);

	int n,s;
	while(scanf("%d %d",&n,&s) != EOF && n != 0){
		vector<State> v;	//first:?????¨?????°,second:????¨????
		v.push_back(State(0,0,0));
		int ans = 0;
		while(v.size() > 0){
			int nn = v.back().n;
			int sum = v.back().sum;
			int lsn = v.back().lastnum;
			v.pop_back();
			if(nn == n){
				if(sum == s){
					ans++;
				}
				continue;
			}
			for(int i = lsn;i <= 9;i++){
				v.push_back(State(nn+1,sum+i,i));
			}
		}
		cout << ans << endl;
	}

	return 0;
}

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

int main(void){
  const int V = 10, W = 100, C = 10;
  // dp[i][j][k]: ??¢?????????i?????§??§???k????????¢?????????????????£????????????????¨????j??????????????????????????????????????°
  vector<vector<vector<int> > > dp(V, vector<vector<int> >(W + 1, vector<int>(C + 1, 0)));
  dp[0][0][1] = 1;
  for(int i = 1; i < V; i++){
    
    for(int j = 0; j < i; j++){
      for(int k = 0; k <= C; k++){
        dp[i][j][k] = dp[i - 1][j][k];
      }
    }
    
    //printf("%d\n", i);

    //printf("     ");
    for(int k = 1; k <= C; k++){
      //printf(" %d ", k);
    }
    //printf("\n");
    
    for(int j = i; j <= W; j++){
      //printf("%3d: ", j);
      for(int k = 1; k <= C; k++){
        dp[i][j][k] = dp[i - 1][j][k] + dp[i - 1][j - i][k - 1];
        if(j == i && k == 1){ ++dp[i][j][k]; }
        //printf("[%d]", dp[i][j][k]);
      }
      //printf("\n");
    }
    //printf("\n\n");
  }

  /*
  printf("%d\n", V - 1);
  for(int j = 0; j <= W; j++){
    printf("%3d: ", j);
    for(int k = 0; k <= C; k++){
      printf("[%d]", dp[V - 1][j][k]);
    }
    printf("\n");
  }
  printf("\n");
  */

  while(true){
    int n, s;
    cin >> n >> s;
    if(n == 0 && s == 0){ break; }
    cout << dp[V - 1][s][n] << endl;
  }
  
  return 0;
}

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

int n, s, ans, dp[1<<8][15];

void rec(int base, int sum, int used) {
    if(sum == s) {
        if(used == n) ans += 1;
    }
    if(sum > s || used > n) return;
    for(int i = base; i < 10; i++) {
        rec(i + 1, sum + i, used + 1);
    }
}

int main(void) {
    while(scanf("%d%d", &n, &s) == 2 && !(n + s == 0)) {
        ans = 0;
        memset(dp, 0, sizeof(dp));
        rec(0, 0, 0);
        printf("%d\n", ans);
    }
    return 0;
}

C++: #include <cmath>
#include <ctime>
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <stack>
#include <bitset>
#include <functional>
#include <numeric>
#include <utility>
#include <iomanip>
#include <cstdio>
#include <cctype>
#include <queue>
#include <complex>
#include <climits>
#include <cstring>

using namespace std;

const int INF = 1 << 29;
typedef long long ll;
typedef pair<int,int> PI;

int n, s, t, res;

void dfs(int n, int t, int sum){
	if(n == 0 && sum == s) {
		res++;
		return ;
	}
	if(sum > s || n <= 0 || t > s-sum) return ;
	for(int i=t+1; i<=10; ++i){
		dfs(n-1, i, sum+i-1);
	}
}

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

	return 0;
}