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 main(){
  int n,s,j,k;
  int a[11][46];
  for(int s=0;s<46;s++)
    for(int n=0;n<11;n++)
      a[n][s]=0;
  n=s=0;
  for(int i=0;i<1024;i++){
    for(j=i,n=0;j>0;j/=2)
      n += j%2;
    for(j=i,s=0,k=0;j>0;j/=2,k++)
      s += j%2*k;
    a[n][s]++;
  }
  while(true){
    cin>>n>>s;
    if(!n&&!s)
      break;
    if(s<46)
      cout<<a[n][s]<<endl;
    else
      cout<<0<<endl;
  }
  return 0;
}
//  for(cin>>n>>s;n||s;cout<<a[n][s]<<endl,cin>>n>>s);

C++: #include <iostream>
using namespace std;
int main(){
  int n,s,j,k;
  int a[10][45];
  for(int s=0;s<45;s++)
  for(int n=0;n<10;n++)
    a[n][s]=0;
  for(int i=0;i<1024;i++){
    for(j=i,n=0;j>0;j/=2)n+=j%2;
    for(j=i,s=0,k=0;j>0;j/=2,k++)s+=k;
    a[n][s]++;
  }
  cin>>n>>s;
  for(;n||s;cout<<a[n][s]<<endl,cin>>n>>s);

}

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-1){
          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 <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <tuple>
# include <unordered_map>
# include <numeric>
# include <complex>
# include <bitset>
# include <random>
# include <chrono>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
constexpr int INF = 2147483647;
constexpr int HINF = INF / 2;
constexpr double DINF = 100000000000000000.0;
constexpr double HDINF = 50000000000000000.0;
constexpr long long LINF = 9223372036854775807;
constexpr long long HLINF = 4500000000000000000;
const double PI = acos(-1);
int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
template <typename T_char>T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char>T_char TU(T_char cX) { return toupper(cX); };
# define ALL(x)      (x).begin(),(x).end()
# define UNIQ(c)     (c).erase(unique(ALL((c))),(c).end())
# define LOWER(s)    transform(ALL((s)),(s).begin(),TL<char>)
# define UPPER(s)    transform(ALL((s)),(s).begin(),TU<char>)
# define mp          make_pair
# define eb          emplace_back
# define FOR(i,a,b)  for(LL i=(a);i<(b);i++)
# define RFOR(i,a,b) for(LL i=(a);i>=(b);i--)
# define REP(i,n)    FOR(i,0,n)
# define INIT        std::ios::sync_with_stdio(false);std::cin.tie(0)


int N, S;
int ans = 0;

void dfs(int s, int i, int cnt) {
	if (cnt == N&& s == S) {
		ans++;
		return;
	}
	else if (cnt == N || s >= S||i==10){
		return;
	}
	else {
		dfs(s + i, i + 1, cnt + 1);
		dfs(s, i + 1, cnt);
	}
}

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

C++: #include <iostream>

using namespace std;

/** Application main entry point. */
int main (
  int     argc,
  char  * argv[ ]
  )
{
  int table[ 11 ][ 50 ] = { };

  for ( int i = 0; i < 0x800; ++i )   /* 0x800: (10000000000)_2 (10 zeros) */
  {
    int sum = 0;
    int ctr = 0;
    int cur = -1;

    while ( true )
    {
      int __tmp = i >> ++cur;

      if ( !__tmp ) break;
      if ( __tmp & 1 )
      {
        sum += cur;
        ++ctr;
      }
    }

    table[ ctr ][ sum ]++;
  }

  while ( true )
  {
    int n, s;

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

    cout << table[ n ][ s ] << endl;
  }

  return ( 0 );
}

C++: #include<iostream>

using namespace std;

int ans,n,s;
int nums[10];

void search(int num,int t)
{
	if(num>9)
		return;
	int sum;
	if(t==n)
	{
		for(int i=0;i<num+1;i++)
			sum+=nums[i]*i;
		if(sum==s)
			ans++;
		return;
	}
	nums[num+1]=0;
	search(num+1,t);
	nums[num+1]=1;
	search(num+1,t+1);
	return;
}

int main()
{
	
	for(;;)
	{
		cin >> n >> s;
		if(n==0 && s==0)
			break;
		ans=0;
		search(0,0);
		cout << ans << endl;
	}
}

C++: #define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<math.h>

int main() {
	int a=0, b, ans[1024],num[1024];
	for (int i = 0; i < 1024; i++) {
		ans[i] = 0;
		num[i] = 0;
		for (int j = 0; j < 10; j++) {
			int m = 1;
			for (int k = 0; k < j; k++)m *= 2;
			if (i / m % 2 == 1) {
				ans[i] += j;
				num[i]++;
			}
		}
	}
	while (a==a) {
		scanf("%d %d", &a, &b);
		if (a == 0 && b == 0) {
			int an = 0;
			for (int i = 0; i < 1024; i++) {
				if (ans[i] == b && num[i] == a) {
					an++;
				}
			}
			printf("%d\n", an);
		}
		else {
			break;
		}
	}
}

C++: #include <iostream>
using namespace std;
int cnt;
int n,sum;
void dfs(int n, int i , int s){

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

  if(i > 10 || n == 0 ){
    return; 
  }
  dfs(n,i + 1,s);
  dfs(n-1,i + 1,s + i);
}

int main(){

  while( cin >> n >> sum, n + sum){
    cnt = 0;
    dfs(n,0,0);
    cout << cnt << endl;
  }

  return 0;
}

C++: #include<iostream>
#include<cstring>
#include<algorithm>
#include<string>
#include<vector>
#include<cstdio>
#include<cmath>
#define pb(in,tmp) in.push_back(tmp)
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) loop(i,0,b)
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
using namespace std;
int main(){
int n,s;
while(cin>>n>>s,n||s){
bool in[10]={0};
rep(i,n)in[i]=1;
sort(in,in+10);
int co=0;
do{
int sum=0;
rep(i,10)if(in[i])sum+=i;
if(sum==s)co++;
}while(next_permutation(in,in+10));
cout<<co<<endl;
}
}

C++: //まともに使い方を理解していないくせにincludeしまくる人間のクズ
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <iostream>


//using namespace stdしないと表記がめんどくさいからね、仕方ないね
using namespace std;

//可読性を上げるためのdefineが仇となる典型的パターン
#define FOR(x) for(int i = 0; i < x; i++)

//ローカル変数とグローバル変数は使い分けよう！
stack<short> x, y;
short a[10], n, j, i, m, ans;

//関数って楽しいよね！（魔王スマイル）
void solve(short c, short sum, short cnt){
	if(cnt == n){
		if(sum == m) ans++;
		return;
	}
	if(cnt < n && c > 9) return;
	if(sum > m) return;
	solve(c + 1, sum + c, cnt + 1);
	solve(c + 1, sum, cnt);
	return;
}

int main(){
	while(true){
		scanf("%d %d", &n, &m);
		if(n == 0 && m == 0) return 0;
		ans = 0;
		solve(0, 0, 0);
		printf("%d\n", ans);
	}
}

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

int main(void){
  const int V = 10, W = 100, C = 10;
  // dp[j][k]: ??¢?????????i?????§??§???k????????¢?????????????????£????????????????¨????j??????????????????????????????????????°
  // (i????????????)
  vector<vector<int> > dp(W + 1, vector<int>(C + 1, 0));
  dp[0][1] = 1;
  for(int i = 1; i < V; i++){
    for(int j = W; j >= i; j--){
      for(int k = 1; k <= C; k++){
        dp[j][k] += dp[j - i][k - 1];
        if(j == i && k == 1){ ++dp[j][k]; }
      }
    }
  }

  while(true){
    int n, s;
    cin >> n >> s;
    if(n == 0 && s == 0){ break; }
    cout << dp[s][n] << endl;
  }
  
  return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<cstdio>
using namespace std;
int cnt=0;
int N,S;
void func(int m,int n,int s){
    if(m==10){
        if(n==N&&s==S)cnt++;

        return;
    }

    func(m+1,n+1,s+m);
    func(m+1,n,s);

    return;
}
int main(){
    while(cin>>N>>S,N||S){
        cnt=0;
        func(0,0,0);
        cout<<cnt<<endl;
    }
}