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<iostream>
using namespace std;
int n,s,ans;
int solve(int c,int sum,int m){
  if(c==n && sum==s) ans++;
  for(int i=m;i<10;i++){
    solve(c+1,sum+i,i+1);
  }
}
int main(void){
  for(;;){
    cin >> n >> s;
    if(!n && !s) break;
    ans=0;
    solve(0,0,0);
    cout << ans << endl;
  }
}

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

int n, s, ans;
void dfs(int now, int num, int total){
    if(num == n){ans+=(total == s); return;}
    for(int i = now; i < 10; i++){
        dfs(i + 1, num + 1, total + i);
    }
    return;
}

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

    while(cin >> n >> s){
        if(n == 0 and s == 0) break;
        ans = 0;
        dfs(0, 0, 0);
        cout << ans << endl;
    }

    return 0;
}

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

#define INPUT_FROM_FILE (0) 
#if INPUT_FROM_FILE
#include <fstream>
#endif

void dfs(int i, int n, int sum, int s, int pre_number, int &count){
	if(i == n){
		if(sum == s){
			count++;
		}
		return;
	}
	
	for(int j = pre_number + 1; j < 10; j++){
		if(sum + j <= s){
			dfs(i + 1, n, sum + j, s, j, count);
		}
	}
	return;
}

int main(int argc, char **argv){
	int n, s;
	int count = 0;

#if INPUT_FROM_FILE
	std::ifstream ifs("test.txt");
	//FILE *fp = fopen("test.txt", "r");
#endif


#if INPUT_FROM_FILE
	while(ifs >> n >> s){
#else
	while(std::cin >> n >> s){
#endif
		if(n == 0 && s == 0){
			break;
		}
	
		count = 0;
		dfs(0, n, 0, s, -1, count);

		std::cout << count << std::endl;
	}


	return 0;
}

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

int bitnum(int n) {
	n = (n&0x55555555) + ((n>>1)&0x55555555);
	n = (n&0x33333333) + ((n>>2)&0x33333333);
	n = (n&0x0f0f0f0f) + ((n>>4)&0x0f0f0f0f);
	n = (n&0x00ff00ff) + ((n>>8)&0x00ff00ff);
	return (n&0x0000ffff) + ((n>>16)&0x0000ffff);
}

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

C++: #include<bits/stdc++.h>
using namespace std;
int serch(int i,int j,int n)
{
    if(i==10)return 0;
    else if(!n&&!j)return 1;
    else if(!j||!n||j<i)return 0;
    return serch(i+1,j-i,n-1)+serch(i+1,j,n);
}
int main()
{
    int n,s;
    while(cin>>n>>s&&(n!=0&&s!=0))cout<<serch(0,s,n)<<endl;
}

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

int main(void)
{
	int n, s;
	while(cin >> n >> s)
	{
		int res = 0;
		if(n==0 && s==0) break;

		for(int i=0; i<=7; i++)
		{
			for(int j=i+1; j<=8; j++)
			{
				for(int k=j+1; k<=9; k++)
				{
					if(i+j+k == s)
						res++;
				}
			}
		}

		cout << res << endl;
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
int main()
{
    int n, s;
    while (cin >> n >> s, (s | n)) {
        int res = 0;
        for (int i = 0; i < (1 << 10); ++i) {
            int t = 0, c = 0;
            for (int j = 0; j < 10; ++j) if ((i >> j) & 1) {
                t += j;
                c++;
            }
            if (c == n && t == s) res++;
        }
        cout << res << endl;
    }
    return 0;
}

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

int a[11][101][11];

int dp(int n,int s,int t){
    if(a[n][s][t]==-1){
        if(t==10 || (n==1 && t>s)){
            a[n][s][t]=0;
        }else if(n==1 &&t<=s){
            a[n][s][t]=1;
        }else{
            a[n][s][t]=dp(n-1,s-t,t+1)+dp(n,s,t+1);
        }
    }
    return a[n][s][t];
}

int main(){
    int n,s;
    scanf("%d %d",&n,&s);
    while(n!=0 || s!=0){
        for(int i=0;i<=10;i++)for(int j=0;j<=100;j++)for(int k=0;k<=10;k++)a[i][j][k]=-1;
        printf("%d\n",dp(n,s,0));
        scanf("%d %d",&n,&s);
    }
    
    return 0;
}

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

using namespace std;

const int INF = 1e+9;

int cnt;

void dfs(int n, int s, int now)
{
    if(now > 9)
    {
        if(n == 0 && s == 0) cnt++;
        return;
    }
    
    dfs(n - 1, s - now, now +1);
    dfs(n, s, now + 1);
    
    return;
}

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

C++: #include <iostream>
using namespace std;
int n, s, cnt = 0;
void dfs(int n, int s, int now) {
	if (now > 9) {
		if (n == 0 && s == 0) {
			cnt++;
		}
		return;
	}
	dfs(n - 1, s - now, now + 1);
	dfs(n, s, now + 1);
	return;
}

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

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 <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <string>
using namespace std;

#define rep(i,n) for(int i=0;i<int(n);++i)


int n,s;
int ans=0;


int solve(int c,int d,int s){
	if(c==n){
		if(s<=9&&s>=d){
			ans++;
		}
	}
	else{
		for(int i=d;i<10;i++){
			solve(c+1,i+1,s-i);
		}
	}
	return ans;
}
	
	

int main(){
	while(cin>>n>>s,n||s){
		//if(s>45) cout<<"0"<<endl;
		ans = 0;
		cout << solve(1,0,s) <<endl;
	}
	return 0;
}

C++: #include <cstdio>
int dfs(int n, int s, int cnt, int sum, int num) {
	int res = 0;
	if (num==10) return 0;
	if (cnt==n&&sum==s) return 1;
	else if (cnt==n) return 0;
	res += dfs(n, s, cnt+1, sum+num, num+1);
	res += dfs(n, s, cnt, sum, num+1);
	return res;
}
int main() {
	int n, s;
	while (scanf("%d%d",&n,&s)) {
		if (n==0&&s==0) break;
		int res = dfs(n, s, 0, 0, 0);
		printf("%d\n",res);
	}
}

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) {
		if (sum == s) {
			ans++;
		}
		return;
	}
	if (pos == 10)return;
	if (sum > s)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;
	}
}