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<map>
#include<set>
#include<list>
#include<cmath>
#include<queue>
#include<stack>
#include<cstdio>
#include<string>
#include<vector>
#include<complex>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<numeric>
#include<sstream>
#include<iostream>
#include<algorithm>
#include<functional>

#define MP make_pair
#define PB push_back
#define ALL(x) (x).begin(),(x).end()
#define REP(i,n) for(int i=0;i<(n);i++)
#define REP1(i,n) for(int i=1;i<(n);i++)
#define REP2(i,d,n) for(int i=(d);i<(n);i++)
#define RREP(i,n) for(int i=(n);i>=0;i--)
#define CLR(a)      memset((a),0,sizeof(a))
#define MCLR(a)     memset((a),-1,sizeof(a))
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI > VVI;
typedef vector<string> VS;
typedef vector<LL> VLL;
typedef pair<int,int> PII;

const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;

const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};

int w[50],cnt=0,s,n;  
  
void solve(int a, int sum, int n){  
    if(sum==s && !n){  
        w[cnt]++;  
        return;  
    }  
    if(a==10 || !n)
		return;  
    solve(a+1, sum, n); 
    solve(a+1, sum+a, n-1);
}  
  
int main(){
	while(cin>>n>>s, n && s){  
        w[cnt]=0;    
        solve(0, 0, n);
		cnt++;
    }
	REP(i,cnt)
		cout<<w[i]<<"\n";
    return 0;  
}

C++: #include <iostream>

using namespace std;

int pat(int n,int s,int d){
  if(n==0){
    if(s==0) return 1;
    else return 0;
  }
  if(d<0) return 0;

  return pat(n-1,s-d,d-1) + pat(n,s,d-1);
}

int main(){
  int n,s;
  while(cin>>n>>s&&(n>0||s>0)){
    cout << pat(n,s,9) << endl;
  }
}

C++: #include<iostream>
#include<vector>
#include<string.h>

int n, s;
int used[10];
int ans = 0;

void func( int num, int sum )
{
	if( num == n ){
		if( sum == s ){
			ans++;
		}
		return;
	}
	
	for( int i = used[num]; i <= 9 - n; i++ ){
		used[num+1] = i + 1;
		func( num + 1, sum + i );
		used[num+1] = 0;
	}
}

int main()
{
	while( 1 ){
		memset( used, 0, 10 );
		ans = 0;
		
	 	std::cin >> n >> s;
		if( !n && !s ) break;
		
		func( 0, 0 );
		
		std::cout << ans << std::endl;
	}

 	return 0;
}

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

int n, s, ans;

void rec(int base, int sum, int used) {
    if(sum == s) {
        if(used == n) ans += 1;
        return;
    }
    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;
        rec(0, 0, 0);
        printf("%d\n", ans);
    }
    return 0;
}

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



int main()
{
	int n, s;
	while (cin >> n >> s)
	{
		int ans = 0;
		if (n == 0 && s == 0)
		{
			break;
		}
		
		for (int i = 0; i < 1023; i++)
		{
			int p = i;
			int sum = 0, cnt = 0;
			for (int j = 0; j < 10; j++)
			{
				if (p % 2 == 1)
				{
					sum += j;
					cnt++;
				}
				p = p / 2;
			}

			if (cnt == n && sum == s)
			{
				ans++;
			}
		}
		cout << ans << endl;
	}
	return 0;
}

C++: #include<stdio.h>

int main()
{

int n,y,c,sum;
int f1[10],f2[10],f3[10],f4[10],f5[10],f6[10],f7[10],f8[10],f9[10];
for(int i=0;i<=9;i++)
{f1[i]=i;f2[i]=i;f3[i]=i;f4[i]=i;f5[i]=i;f6[i]=i;f7[i]=i;f8[i]=i;f9[i]=i;}

while(1)
{
c=0;sum=0;
scanf("%d %d",&n,&y);
if(n==0&&y==0)break;
for(int i1=0;i1<10;i1++)
{
	 if(n==1){if(f1[i1]==y)c++;}
	else if(n!=1){
				for(int i2=i1+1;i2<10;i2++)
					{
						if(n==2){if(f1[i1]+f2[i2]==y)c++;}
							else if(n>2){
							for(int i3=i2+1;i3<10;i3++)
										{						
										if(n==3){if(f1[i1]+f2[i2]+f3[i3]==y)c++;}
										else if(n>3){
														for(int i4=i3+1;i4<10;i4++)
																	{
if(n==4){if(f1[i1]+f2[i2]+f3[i3]+f4[i4]==y)c++;}
else if(n>4){
for(int i5=i4+1;i5<10;i5++)
{
if(n==5){if(f1[i1]+f2[i2]+f3[i3]+f4[i4]+f5[i5]==y)c++;}
else if(n>5){
for(int i6=i5+1;i6<10;i6++)
{
if(n==6){if(f1[i1]+f2[i2]+f3[i3]+f4[i4]+f5[i5]+f6[i6]==y)c++;}
else if(n>6){
for(int i7=i7+1;i7<10;i7++)
{
if(n==7){if(f1[i1]+f2[i2]+f3[i3]+f4[i4]+f5[i5]+f6[i6]+f7[i7]==y)c++;}
else if(n>7){
for(int i8=i8+1;i8<10;i8++)
{
if(n==8){if(f1[i1]+f2[i2]+f3[i3]+f4[i4]+f5[i5]+f6[i6]+f7[i7]+f8[i8]==y)c++;}
else if(n>8){
for(int i9=i9+1;i9<10;i9++)
{
{if(f1[i1]+f2[i2]+f3[i3]+f4[i4]+f5[i5]+f6[i6]+f7[i7]+f8[i8]+f9[i9]==y)c++;}

}}}}}}}}}}}}}}}}}
printf("%d\n",c);
c=0;
}
return 0;
}

C++: #include<iostream>
using namespace std;
int cnt=0,s;
void kumiawase(int i,int n,int ALL){
    for(;i<10;i++){
        if(n==1){
            if(s==ALL+i){
                cnt++;
            }
            continue;
        }
        kumiawase(i+1,n-1,ALL+i);
    }
}

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

C++: #define _USE_MATH_DEFINES

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <utility>
#include <vector>
#include <numeric>

using namespace std;

int n, s;
int cnt = 0;

void dfs(int i, int sum, int c)
{
	if (i > 9)
	{
		return;
	}

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

	dfs(i + 1, sum, c);

	dfs(i + 1, sum + i, c + 1);

	return;
}

int main()
{
	for (; cin >> n >> s;)
	{
		cnt = 0;
		if (n == 0 && s == 0)
		{
			break;
		}
		dfs(0, 0, 0);

		cout << cnt << endl;
	}
}

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

const int LN = 10, LS = 1000;
int dp[LN+1][LS+1], n, s;

void set(){
    for(int i = 0; i <= LS; i++){
        dp[1][i] = 1;
    }
    for(int i = 1; i < LN; i++){
        for(int j = 0; j <= LS; j++){
            dp[i+1][j] = 0;
            if( j >= i ) dp[i+1][j] += dp[i][j-i];
            if( j > i ) dp[i+1][j] += dp[i+1][j-i-1];
        }
    }
}

int main(){
    set();
    while(true){
        cin >> n >> s;
        if(n == 0 && s == 0) break;
        cout << dp[n][s] << endl;
    }
    return 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 (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;
}