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++: #define _CRT_SECURE_NO_WARNINGS

#include<iostream>
#include<string>
#include<iomanip>
#include<list>
#include<math.h>
#include<stack>

using namespace std;

int n = 0;
int s = 0;
static int ans;

void check(int atai, int num, int count){
	if (num > 9) {
		if (atai == s && count == n) {
			ans++;
		}
		return;
	}
	check(atai + num, num + 1, count + 1);
	check(atai, num + 1, count);
}


int main(int argc, char **argv)
{
	while (cin >> n >> s) {
		if (n == 0 && s == 0) {
			break;
		}
		check(0, 0, 0);
		cout << ans << endl;
	}
}

C++: #include<stdio.h>
int main()
{
    int n,s;
    int a[11]={0},i[10],j,kk;
    while(scanf("%d",&n)!=EOF)
    {
        int cnt[11]={0};
        scanf("%d",&s);
        if(n==0&&s==0)break;
        if(n==0)
        {
        printf("0\n");
        goto end;
        }
        if(n==1)
        {
        printf("1\n");
        goto end;
        }
        for(j=1;j<=n;j++)
        {
            a[j]=1;
        }
        for(i[1]=0;i[1]<10;i[1]++)
        {
            if(s==i[1])cnt[1]++;
            for(i[2]=0;i[2]<10;i[2]++)
            {
                if(i[1]==i[2])break;
                if(s==i[1]+i[2])cnt[2]++;
                for(i[3]=0;i[3]<10;i[3]++)
                {
                    if(i[2]==i[3])break;
                    if(s==i[1]+i[2]+i[3])cnt[3]++;
                    for(i[4]=0;i[4]<10;i[4]++)
                    {
                        if(i[3]==i[4])break;
                        if(s==i[1]+i[2]+i[3]+i[4])cnt[4]++;
                        for(i[5]=0;i[5]<10;i[5]++)
                        {
                            if(i[4]==i[5])break;
                            if(s==i[1]+i[2]+i[3]+i[4]+i[5])cnt[5]++;
                            for(i[6]=0;i[6]<10;i[6]++)
                            {
                                if(i[5]==i[6])break;
                                if(s==i[1]+i[2]+i[3]+i[4]+i[5]+i[6])cnt[6]++;
                                for(i[7]=0;i[7]<10;i[7]++)
                                {
                                    if(i[6]==i[7])break;
                                    if(s==i[1]+i[2]+i[3]+i[4]+i[5]+i[6]+i[7])cnt[7]++;
                                    for(i[8]=0;i[8]<10;i[8]++)
                                    {
                                        if(i[7]==i[8])break;
                                        if(s==i[1]+i[2]+i[3]+i[4]+i[5]+i[6]+i[7]+i[8])cnt[8]++;
                                        for(i[9]=0;i[9]<10;i[9]++)
                                        {
                                            if(i[8]==i[9])break;
                                            if(s==i[1]+i[2]+i[3]+i[4]+i[5]+i[6]+i[7]+i[8]+i[9])cnt[9]++;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        printf("%d\n",cnt[n]);
        end:
        kk++;
    }
    return 0;
}

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

int main()
{
	int n, s, res;
	while (cin >> n >> s, n || s) {
		res = 0;
		for (int i = 1; i < 0x400; i++) {
			int digit = 0, sum = 0;
			for (int j = 0;j < 10; j++) {
				if ((i >> j) & 1) {
					digit++;
					sum += j;
				}
			}
			if (digit == n && sum == s) {
				res++;
			}
		}
		cout << res << endl;
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

int answer;

void saiki( int number, int sum, int t )
{
	if( number == 0 ){
		if( sum == 0 ){
			answer++;
			return;
		} else {
			return;
		}
	}

	if( sum < 0 ) return;

	if( t >= 9 ) return;


	saiki( number - 1, sum - t, t + 1 );

	saiki( number, sum, t + 1 );

}

int main(void)
{
	int number, sum;

	while( cin >> number >> sum && number != 0 && sum != 0 ){
		answer = 0;
		saiki( number, sum, 0 );
		cout << answer << endl;
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int n,s,o;
void rec(int d,int k,int x){
  if(d>n) return;
  else if(d==n){
    if(x==s) o++;
  }else{
    for(int i=k+1;i<=9;i++){
      rec(d+1,i,x+i);
    }
  }
}
int main(){
  cin >> n >> s;
  while(n!=0){
    o=0;
    rec(0,-1,0);
    cout << o << endl;
    cin >> n >> s;
  }
  return 0;
}

C++: #include<iostream>
using namespace std;
int solve(int n, int s, int k);
int main(){
  int n,s;
  while(cin >>n>>s,n||s){
    int ans = 0;
    for(int i=0; i<10; i++){
      if(s>=i) ans+=solve(n-1,s-i,i);
    }
    cout <<ans<<endl;
  }
  return 0;
}
int solve(int n, int s, int k){
  int ans = 0;
  if(n == 0 && s == 0) return 1;
  else if(n>0){
    for(int i=k+1; i<10; i++){
      if(s>=i) ans+=solve(n-1,s-i,i);
      else break;
    }
  }
  return ans;
}

C++: #include <iostream>

using namespace std;

int solve(int n, int s, int t){
    if (n == 1) {
     if (s >= t && s < 10) return 1;
     else return 0;
    }
    int ret = 0;
    for(int i = t; i < 10 && i < s; i++)
        ret += solve(n - 1, s - i, i + 1);
    return ret;
}

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

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

class Solve{
private:
    int n_     = 0;
    int s_     = 0;
    int result = 0;
    void dfs(int num, int sum, int cnt);
public:
    Solve(int num, int sum);
    int getSolve();
};

Solve::Solve(int num, int sum){
    n_ = num;
    s_ = sum;
    
    Solve::dfs(0,0,0);
}

void Solve::dfs(int num, int sum, int cnt){
    if(sum == s_ && cnt == n_){
        result++;
        return;
    }
    if(num == 10 || cnt == n_){
        return;
    }
    
    Solve::dfs(num+1, sum+num, cnt+1);
    Solve::dfs(num+1, sum, cnt);
}

int Solve::getSolve(){
    return result;
}


int main(){
    int n, s = 0;
    while(cin >> n >> s){
        if(n == 0 && s == 0){
            break;
        }else{
            Solve solve(n, s);
            cout << solve.getSolve() << endl;
        }
    }
    return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
 
int N,S;
int dfs(int n,int t,int sum){
if(n==10)return 0;if(t==N){if(sum==S)return 1;else return 0;}
    return dfs(n+1,t,sum)+dfs(n+1,t+1,sum+n);
}
int main(){
    while(cin>>N>>S,n||s)cout<<dfs(0,0,0)<<endl;
    return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <vector>
#include <functional>
#include <sstream>
#include <cstdio>
#include <stack>
using namespace std;

// Sum of Integers(0030)
int n, s;

int solve(int i, int sum, int c)
{
	if (c == n) {
		if (sum == s)
			return 1;
		return 0;
	}

	if (i > 9)
		return 0;

	return solve(i+1, sum+i, c+1) + solve(i+1, sum, c);
}

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

C++: #include<bits/stdc++.h>
using namespace std;
int dfs(int x,int y,int k){
	if(y==0)
		return x==0?1:0;
	if(x<=0)
		return 0;
	int ans=0;
	for(int i=k+1;i<10;i++)
		ans+=dfs(x-i,y-1,i);
	return ans;
}
signed main(void){
	ios::sync_with_stdio(false);
	int x,y;
	while(cin>>y>>x&&(x||y))
		cout<<dfs(x,y,-1)<<endl;
}