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>
#include <algorithm>
using namespace std;

int rec(int n, int p, int s) {
  if(s < 0) return 0;
  if(n == 0) return s == 0;
  int res = 0;
  for(; p <= 9; ++p) {
    res += rec(n-1, p+1, s-p);
  }
  return res;
}

int main() {
  int n, s;
  while(cin >> n >> s && (n|s)) {
    cout << rec(n,0,s) << endl;
  }
  return 0;
}

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

#define ll long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define rep(i, n, m) for (int (i) = (n); (i) < (m); ++(i))
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define debugB(x, y) cerr<<#x<<": "<<bitset<y>(x) << endl;
#define line() cerr << "---------------" << endl;

const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, -1, 1};

int f(int m) {
   int cnt = 0;
   while (m > 0) {
      if (m&1) cnt++;
      m/=2;
   }
   return cnt;
}

int main() {
   int n, s;
   vec<int> num;
   for (int i = 0; i <= 9; i++) num.push_back(i);

   while (cin >> n >> s, n) {
      int cnt = 0;
      for (int mask = 0; mask < (1<<10); mask++) {
         int sum = 0;
         if (f(mask) != n) continue;
         for (int i = 0; i < 10; i++) {
            if ((mask>>i)&1) {
               sum += num[i];
            }
         }
         if (sum == s) cnt++;
      }
      cout << cnt << endl;
   }

   return 0;
}

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

using namespace std;

int n, s;
int dp[10][100][10];
int solve(int i, int j, int k);

int main(void){
	
	while(cin >> n >> s){
		if(n == 0 && s == 0){break;}
		fill_n(**dp,10*100*10,-1);
		cout << solve(0,0,10) << endl;
	}
}

int solve(int now, int sum, int b1){
	if(now == n){
		if(sum == s){return 1;}
		else return 0;
	}
	if(dp[now][sum][b1] != -1){return dp[now][sum][b1];}
	now++;
	int t = 0;
	for(int i = 0; i < 10; i++){
		if(b1 != 10 && b1 >= i){continue;}
		t += solve(now, sum + i, i);
	}
	return dp[now][sum][b1] = t;
}

C++: #include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <cmath>
#include <string>
#include <sstream>
#include <iomanip>
#include <complex>
using namespace std;
 
#define ll long long
#define vvi vector< vector<int> >
#define vi vector<int>
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back 
#define pii pair<int,int>
#define mp make_pair
#define pi 3.14159265359
#define shosu(X) fixed << setprecision(X)
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

//????????????
//test?????£???wrong answer????????£??????

int n,s;
int c;

void search(int a,int sum,int before){
  FOR(i,before,s){
	if(sum+i>s) continue;
	if(a<n) search(a+1,sum+i,i+1);
	else if(sum+i==s) {
	  //	  cout << i <<" "<< a <<" " << sum << " " << before-1 << endl;
	  c++;
	}
  }
}

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

	cout << c << endl;

  }
}

C++: //26
#include<iostream>

using namespace std;

int dfs(int n,int s,int u,int b){
  if(n==0){
    return s==0;
  }else{
    int r=0;
    for(int i=b+1;i<=9;i++){
      if((u&1<<i)==0){
	r+=dfs(n-1,s-i,u|1<<i,i);
      }
    }
    return r;
  }
}

int main(){
  for(int n,s;cin>>n>>s,n|s;){
    cout<<dfs(n,s,0,-1)<<endl;
  }
  return 0;
}

C++: #include<iostream>
using namespace std;
int func(int count,int bused,int q,int sum){
	if(count==0){
		return sum==q?1:0;
	}
	int res = 0;
	for(int i=bused+1;i<=9;++i){
		res += func(count-1,i,q,sum+i);
	}
	return res;
}
bool func2(){
	int a,b;
	cin>>a>>b;
	if(a==0&&b==0){
		return false;
	}
	cout<<func(a,-1,b,0)<<endl;
	return true;
}
int main(){
	while(func2());
	return 0;
}

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

int n;
int s;
int cc;
vector<int> re;


void test(int xs,int c,int lvl){
	if(lvl==n&&xs==s){
		cc++;
	}else{
		for(int i=c+1;i<s;i++){
			test(xs+i,i,lvl+1);
		}
	}
}

int main(){
	while(cin>>n>>s,!(n==0&&s==0)){
		cc=0;
		for(int i=0;i<n-1;i++){
			test(0,i,1);
		}
		re.push_back(cc);
	}
	for(int i=0;i<re.size();i++){
		cout<<re[i]<<endl;
	}
}

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

int loop(int,int[],int,int);

int main(){
   int n,s;
   int ans;
   int flag[10];
   int kaijyo;
   
   for(;;){
      cin>>n>>s;
      if(n==0&&s==0) break;
      
      memset(flag,0,sizeof(flag));
      ans=0;
      kaijyo=1;
      for(int i=n;i>0;i--) kaijyo*=i;
      
      ans = loop(ans,flag,n,s);
      
      cout<<ans/kaijyo<<endl;
   }
   return 0;
}

int loop(int ans,int flag[],int n, int s){

   if(n==0){
      if(s==0) ans++;
      return ans;
   }
   
   int i;
   for(i=0;i<10;i++){
      if(s-i>=0&&flag[i]!=1){
         flag[i]=1;
         ans = loop(ans,flag,n-1,s-i);
         flag[i]=0;
      }
   }
   return ans;
}

C++: #include <cstdio>

using namespace std;

int n,s,ans = 0;

void dfs(int nau,int sum,int last){
	if(nau == n){
		if(sum == s) ans++;
		return;
	}
	
	for(int i = last+1;i <= 9;i++){
		if(sum + i <= s){
			dfs(nau+1,sum+i,i);
		}
	}
	
	return;
}	
		

int main(){
	

	while(1){
	
		scanf("%d%d",&n,&s);
		if(n == 0 && s == 0) break;
		ans = 0;
		dfs(0,0,-1);
		printf("%d\n",ans);
		
	}
	
	return 0;
	
}

C++: #include <stdio.h>
#include<math.h>
using namespace std;



int main(){
	int n,s,check[10][46];

	for(int i=0; i < 10; i++){
		for(int k=0; k < 46; k++){
			check[i][k] = 0;
		}
	}

	//1?????¨9???
	for(int i=0;i<=9;i++){
		check[1][i]++;
		check[9][45-i]++;
	}

	//2?????¨8???
	for(int i=0;i<=9;i++){
		for(int k=0;k<=9;k++){
			if(i != k){
				check[2][i+k]++;
				check[8][45-(i+k)]++;
			}
		}
	}

	//3?????¨7???
	for(int i=0;i<=9;i++){
		for(int k=0;k<=9;k++){
			for(int p=0;p<=9;p++){
				if(i != k && i != p && k != p){
					check[3][i+k+p]++;
					check[7][45-(i+k+p)]++;
				}
			}
		}
	}

	//4?????¨6???
	for(int i=0;i<=9;i++){
		for(int k=0;k<=9;k++){
			for(int p=0;p<=9;p++){
				for(int n=0;n<=9;n++){
					if(i != k && i != p && i != n && k != p && k != n && p != n){
						check[4][i+k+p+n]++;
						check[6][45-(i+k+p+n)]++;
					}
				}
			}
		}
	}

	//5???
	for(int a=0;a<=9;a++){
		for(int b=0;b <= 9; b++){
			for(int c=0;c<=9;c++){
				for(int d=0;d<=9;d++){
					for(int e=0;e<=9;e++){
						if(a != b && a != c && a != d && a != e && b != c && b != d && b != e &&
								c != d && c != e && d != e){
							check[5][a+b+c+d+e]++;
						}
					}
				}
			}
		}
	}


	while(true){
		scanf("%d %d",&n,&s);
		if(n == 0 && s == 0)break;
		if(s >= 46)printf("0\n");
		else{
			printf("%d\n",check[n][s]/6);
		}
	}
    return 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) {
		ans = 0;
		if (n == 0 && s == 0) {
			break;
		}
		check(0, 0, 0);
		cout << ans << endl;
	}
}