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 <stdio.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int dp[16][64];

int main() {
    dp[0][0] = 1;
    rep (k, 10) {
        for (int i = 10; i >= 0; i--) {
            rep (j, 64) if (dp[i][j]) dp[i+1][j+k] += dp[i][j];
        }
    }
    for (;;) {
        int n, s;
        scanf("%d%d", &n, &s);
        if (n == 0 && s == 0) return 0;
        printf("%d\n", dp[n][s]);
    }
}

C++: #include <iostream>
#include <sstream>
#include <stdio.h>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <math.h>
#include <utility>
#include <string>
#include <ctype.h>
#include <cstring>
#include <sstream>
using namespace std;

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

int n, s;
int cnt;
void dfs(int i, int j,int sum)
{
	if (i==n)
	{
		if (sum==s)cnt++;
	}
	else if (i <= n && sum <= s && j <= 9)
	{
		dfs(i + 1, j + 1, sum + j);
		dfs(i, j + 1, sum);
	}
}

int main()
{
	while (cin>>n>>s)
	{
		if (n == 0 && s == 0)return 0;
		cnt = 0;
		dfs(0, 0, 0);
		cout << cnt << 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+d2+d3+d4+d5+d6+d7+d8+d9){
			o++;
		}
			}
		}
		gh[x]=o;
	}
	for(int gf=1;gf<=x;gf++){
		std::cout<<gh[gf]<<std::endl;
	}
	return 0;
}

C++: #include <bits/stdc++.h>
#define rep(i,l,n) for(int i=l;i<n;i++)
using namespace std;

int ans;

void solve(int n,int s,int m){
	rep(i,m+1,10){
		if(n==1&&s==i){
			ans++;
			break;
		}
		solve(n-1,s-i,i);
	}
}

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

C++: #include <iostream>

using namespace std;

int research(int n, int s, int v, int t)
{
	if(n == 0 && v == s){
		return 1;
	}
	if(v > s || n < 0){
		return 0;
	}
	int c = 0;
	for(int i = t+1; i <= 9; i++){
		c += research(n-1, s, i+v, i);
	}
	
	return c;
}

int main()
{
	int n, s, c;
	
	while(1){
		cin >> n >> s;
		if(n == 0 && s == 0){
			break;
		}

		c = 0;
		for(int i = 0; i <= 9; i++){
			c += research(n-1, s, i, i);
		}
		
		cout << c << endl;
	}
	
	return 0;
}

C++: #include <iostream>

using namespace std;

int n , s;

int dfs(int i , int sum , int N){

	if(N == 0 && sum == 0) return 1;//yes
	if(N == 0 || i == 10) return 0;//no

	return dfs(i + 1 , sum , N) + dfs(i + 1 , sum - i , N - 1);
}

int main(){

	while(1){
		cin >> n >> s;
		if(n == 0 && s == 0) break;

		cout << dfs(0 , s , n) << endl;
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
 
int a[10] = { 0,1,2,3,4,5,6,7,8,9 };
int n, s,r;
 
void dfs(int i, int sum,int n) {
    if (n==0&&sum == s) {
        r++;
        return;
    }
    if (i == 10 || !n)return;
    dfs(i + 1, sum + a[i],n-1);
    return;
}
 
int main() {
    while (cin >> n >> s, n, s) {
        r = 0;
        dfs(0, 0,n);
        cout <<r << endl;
    }
    return 0;
 
}

C++: #include<stdio.h>
int main(void){
   int n, a, b, c, d, sum, key;
   while(scanf("%d s", &n, &s) != EOF){
      key = 0;
      fir(i = 0; )
      for(a = 0; a <= 9; a++){
         for(b = 1; b <= 9; b++){
            for(c = 2; c <= 9; c++){
               for(d = 3; d <= 9; d++){
                  for(e = 4; e <= 9; e++){
                     for(f = 5; f <= 9; f++){
                        for(g = 6; g <= 9; g++){
                           for(h = 7; h <= 9; h++){
                              for(i = 9; i <= 9; i++){
                                 j = 9;
                              }
                           }
                        }
                     }
                  }
               }
            }
         }
      }
      printf("%d\n", key);
   }
   return 0;
}

C++: #include<iostream>
using namespace std;
int n, s;
int f(int k, int sum, int max) {
	if (sum > s)return 0;
	if (k == n) {
		if (sum == s)return 1;
		else return 0;
	}
	if (max >= 9)return 0;
	int cnt = 0;
	for (int i = max + 1; i < 10; i++)
		cnt += f(k + 1, sum + i, i);
	return cnt;
}
int main() {
	while (cin >> n >> s, n) 
		cout << f(0, 0, -1) << endl;
}

C++: # include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <tuple>
# include <functional>
# include <utility>
# define INF 1000000000
# define MOD 1000000000+7
using namespace std;

int n, s;
int ans;
int dfs(int sum, int count, int num) {
	if (num > 9) {
		return 0;
	}
	if (count == n) {
		if (s == sum) {
			ans++;
		}
		return 0;
	}
	dfs(sum + num, count + 1, num + 1);
	dfs(sum, count, num + 1);
	return 0;
}

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

C++: #include <iostream>
#define N 9
using namespace std;
int solver(int n, int s, int t){	//t??\????????°n?????§s?????????????????????????????°
	if(n == 0 || s < 0 || t > N) return 0;
	if(n == 1 && s == t) return 1;
	return solver(n-1, s-t, t+1) + solver(n, s, t+1);
}
int main(){
	int n, s;
	while(cin >> n >> s, n){
		cout << solver(n, s, 0) << endl;
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int ans,n,s;
void solve(int,int,int);
int main(){
  while(1){
    ans = 0;
    cin >> n >> s;
    if(n==0&&s==0)break;
    solve(n,s,0);
    cout << ans << endl;
  }
}
void solve(int n,int sum,int min){ //回,計,min値
  if(n==0&&sum==0){
    ans++;
    return;
  }
  for(int i=min;i<10&&n>0;i++){
    if(sum-i>=0) solve(n-1,sum-i,i+1);
  }
}

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

using namespace std;

int main() {
    int a[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
    int n, s, sum, cnt;

    while (cin >> n >> s) {
        if (!n && !s) { break; }
        cnt = 0;
        for (int i = 0; i < (1 << 10); i++) {
            sum = 0;
            for (int j = 0; j < 10; j++) {
                if (i & (1 << j)) {
                    sum += a[j];
                }
            }
            if (sum == s && bitset<10>(i).count() == n) { cnt++; }
        }
        cout << cnt << endl;
    }
    return 0;
}