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"
#define rep(i,n) for(int i = 0;i < n;i++)
#define P(p) cout<<(p)<<endl;
using namespace std;
typedef long long ll;
int dx[] = { 0, 1, 0, -1 };
int dy[] = { -1, 0, 1, 0 };

unsigned long long sttoi(std::string str) {
	unsigned long long ret;
	std::stringstream ss; ss << str;
	ss >> ret;
	return ret;
}

ll gcd(ll a, ll b){
	if (b > a)swap(a, b); if (b == 0)return a; else{ return gcd(b, a%b); }
}


void solve() {
	while (true){
		int n, s;
		cin >> n >> s;
		int count = 0;
		if (n == 0 && s == 0){
			break;
		}
		for (int i = 0; i <= 1 << 10; i++){
			int bitcnt = 0;
			int sum = 0;
			for (int j = 0; j < 10; j++){
				if (1 << j & i){
					bitcnt++;
					sum += j;
				}
			}
			if (bitcnt == n && sum == s){
				count++;
			}
		}
		P(count);
	}

}

int main() {
	solve();
	return 0;
}

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

std::uint32_t some_of_integer(std::uint32_t n, std::uint32_t s, std::uint32_t sum = 0, std::uint32_t i = 0)
{
	std::uint32_t num_cmb = 0;
	if (n == 0) {
		if (sum + i <= s && s <= sum + 9) {
			++num_cmb;
		}
	}
	else {
		for (; i < 9; ++i) {
			num_cmb += some_of_integer(n - 1, s, sum + i, i + 1);
		}
	}
	return num_cmb;
}

int main()
{
	std::uint32_t n, s;
	for (std::cin >> n >> s; !(n == 0 && s == 0); std::cin >> n >> s) {
		std::cout << some_of_integer(n - 1, s) << std::endl;
	}

	return 0;
}

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

int main()
{
	int n,s;
	while(cin>>n>>s,n)
	{
		int ans=0,comb=(1<<n)-1;
		while(comb<1<<10)
		{
			int tmp=0;
			for (int i = 0; i < 10; ++i)
			{
				if(comb>>i&1) tmp+=i;
			}
			if(tmp==s) ans++;
			int x=comb&-comb,y=comb+x;
			comb=((comb&~y)/x>>1)|y;
		}
		cout<<ans<<endl;
	}
	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<=9; ++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;
}

C++: #include <bits/stdc++.h>
#include <math.h>
using namespace std;
int main() {
  bool end = false;
  while (end == false) {
    int n, s;
    cin >> n >> s;
    if (n == 0 && s == 0) {
      end = true;
      break;
    }
    int ans = 0; // 合致するiの数
    vector<int> number(10);
    for (int i = 0; i < 1024; i++) {
      int a = i;
      for (int j = 0; j < 10; j++) {
        number.at(j) = a % 2;
        a = a / 2;
      } 
      int b = 0; //何回１が現れるかをカウント
      for (int j = 0; j < 10; j++) {
        if (number.at(j) == 1) {
          b++;
        }
      }
      int sum = 0; //１の立った数字の合計
      if (b == n) {
        for (int j = 0; j < 10; j++) {
          sum = sum + j * number.at(j);
        }
        if (sum == s) {
          ans++;
        }
      }
    }
    cout << ans << endl;
  }
}

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=-1, int c=0, int s=0){
    if (c == n){
      pattern[s]++;
      return;
    }
    for (int i = it + 1; i <= 9; i++){
      solve(i, c + 1, s + i);
    }
  }
};

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<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=i6+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=i7+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=i8+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<bits/stdc++.h>

using namespace std;

int n,s;
int mem[100][100][100];
int f(int deps,int cnt,int sum)
{
    if(mem[deps][cnt][sum])return mem[deps][cnt][sum];
    if(cnt == n && sum == s)return 1;
    if(deps == 10) return 0;
    return mem[deps][cnt][sum]=f(deps + 1,cnt + 1,sum + deps)+f(deps + 1,cnt,sum);
}

int main()
{
    while(1){
    memset(mem,0,sizeof(mem));
    cin >> n >> s;
    if(n == 0 && s == 0)break;
    printf("%d\n",f(0,0,0));
    }
    return 0;
}

C++: #define _USE_MATH_DEFINES
#include "bits/stdc++.h"
using namespace std;

//#define int long long
#define DBG 1
#define dump(o) if(DBG){cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define each(it,c) for(auto it=(c).begin();it!=(c).end();it++)
#define all(c) c.begin(),c.end()
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);
int dfs(int n, int max, int s) {
	if (n == 1) {
		if (max <= s&&s <= 9)return 1;
		else return 0;
	}
	int sum(0);
	for (int i = max; i <= 9; i++) {
		sum += dfs(n - 1, i + 1, s - i);
	}
	return sum;
}
signed main() {
	int n, s;
	while (cin >> n >> s, n || s) {
		cout << dfs(n, 0, s) << endl;
	}

	return 0;
}