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 <vector>
#include <stdio.h>
#include <string.h>

using namespace std;

int N, S, ans, dp[100][100][100];

void rec(int base, int x, int used) {
    if(x > S || used > N) return;
    if(x == S && used == N) {
        if(!dp[base][x][used]) {
            dp[base][x][used] = 1;
            ans += 1;
        }
        return;
    }
    dp[base][x][used] = 1;
    for(int i = base; i <= 9; i++) {
        rec(i + 1, x + i, used + 1);
    }
}

int main(void) {
    while(1) {
        scanf("%d%d", &N, &S);
        if(N == 0 && S == 0) break;
        ans = 0;
        memset(dp, 0, sizeof(dp));
        for(int i = 0; i <= S; i++) {
            rec(i + 1, i, 1);
        }
        printf("%d\n", ans);
    }
    return 0;
}

C++: #include <iostream>

using namespace std;

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

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

C++: #include <bits/stdc++.h>

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

using namespace std;

class State{
public:
	int n;
	int sum;
	int lastnum;
	State(int nn,int s,int l):n(nn),sum(s),lastnum(l){};
};

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

	int n,s;
	while(scanf("%d %d",&n,&s) != EOF && n != 0){
		vector<State> v;	//first:?????¨?????°,second:????¨????
		v.push_back(State(0,0,1));
		int ans = 0;
		while(v.size() > 0){
			int nn = v.back().n;
			int sum = v.back().sum;
			int lsn = v.back().lastnum;
			v.pop_back();
			if(nn == n){
				if(sum == s){
					ans++;
				}
				continue;
			}
			for(int i = lsn;i <= 9;i++){
				v.push_back(State(nn+1,sum+i,i));
			}
		}
		cout << ans << endl;
	}

	return 0;
}

C++: #include <iostream> 

int main(){
	int a,b;	
	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;
		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++;
		}
			}
		}
		std::cout<<o<<std::endl;
	}
	return 0;
}

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

int dfs(int n, int s, int i, int acc){
    if(n == 0) return s == acc ? 1 : 0;
    else if(i == 9) return 0;

    int res = 0;
    for(int j=i+1;j<=9;++j) res += dfs(n-1, s, j, acc + j);
    return res;
}

int main(){
    int n, s;
    while(cin >> n >> s, n != 0){
        int ans = 0;
        for(int i=0;i<=9;++i) ans += dfs(n-1, s, i, i);
        cout << ans << endl;
    }

    return 0;
}

C++: #include <iostream>

using namespace std;

int DFS(int num, int total, int minNum)
{
    if (num == 0 && total == 0)
    {
        return 1;
    }
    
    if (num == 0) //judge the invalid input
    {
        return 0;
    }
    
    if (total < 0)
    {
        return 0;
    }
    
    if (minNum > 9 || minNum > total)
    {
        return 0;
    }
    
    int count1 = DFS (num - 1, total - minNum, minNum + 1);
    int count2 = DFS (num, total, minNum + 1);
    
    return count1 + count2;
    
}


void Solution()
{
    int n, sum;
    
   // int usedNum = 0;
    
    while (cin>>n>>sum)
    {
        if (n == 0 && sum == 0 )
        {
            break;
        }
        
        int count = DFS (n, sum, 0);
   
        cout<<count<<endl;
    }
}

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

//dfs //depth first search
//cnt // count

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

int main()
{
  int n, s;
  int i, ,j, tmp;
  int sum, count;
  int ans;
  char c;

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

    ans=0;
    for(i=0; i<1024; i++){
      tmp=i; sum=0; count=0;
      for(j=0; j<10; j++){
        if(tmp%2==1){
          sum+=i;
          count++;
        }
        tmp=tmp>>1;
      }
      if(count==n && sum==s) ans++;
    }
    printf("%d\n", ans);
  }

  reutrn 0;
}

C++: #include<iostream>
#include <fstream>
#include <stdio.h>
#include <stdlib.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include<string>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<sstream>
#include<algorithm>
#include<map>
#include<complex>
using namespace std;


#define li			long long int
#define rep(i,to)	for(int i=0;i<((int)(to));i++)
#define repp(i,start,to)	for(int i=(int)(start);i<((int)(to));i++)
#define pb			push_back
#define sz(v)		((li)(v).size())
#define bgn(v)		((v).begin())
#define eend(v)		((v).end())
#define allof(v)	(v).begin(), (v).end()
#define dodp(v,n)		memset(v,(li)n,sizeof(v))
#define bit(n)		(1ll<<(li)(n))
#define mp(a,b)		make_pair(a,b)
#define rin	rep(i,n)
#define EPS 1e-10
#define ETOL 1e-8
#define MOD 1000000007
#define p2(a,b)		cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)		cout<<a<<"\t"<<b<<"\t"<<c<<endl

li table[9][1001][101];

li minsum(li n, li from){
	li res=0;
	repp(i,from,n+from)res+=i;
	return res;
}

li maxsum(li n){
	li res=0;
	for(li i=9; i>9-n; i--)res+=i;
	return res;
}

li solve(li n, li s, li from){
	//p3(n,s,from);
	if(n==1){
		if(s>=from && s<=9)return 1;
		else return 0;
	}
	li res=0;
	repp(i,from,10){
		if(minsum(n-1, i+1)>s-i)res+=0;
		else if(maxsum(n-1)<s-i)res+=0;
		else if(i<10 && table[n-2][s-i][i+1]>0) res+=table[n-2][s-i][i+1];
		else res+=solve(n-1,s-i,i+1);
	}
	table[n-1][s][from]=res;
	return res;
}

int main(){
	li n,s;
	while(1){
		cin>>n>>s;
		if(n==s && n==0)break;
		
		rep(i,n){
			rep(j,s+1){
				rep(k,10)table[i][j][k]=-1;
			}
		}
		
		li res=solve(n,s,0);
		cout<<res<<endl;
	}
	
	return 0;
}

C++: #include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)



int main(){
	int n,s;
	while(cin>>n>>s&&(n||s)){
		int dp[11][11][101]={};
		dp[0][0][0] = 1;
		
		for(int i=1;i<=n;i++){
			for(int j=1;j<=10;j++){
				rep(k,s+1){
					for(int l=1;l<=j;l++){
						if(k-(j-1)>=0) dp[i][j][k]+=dp[i-1][j-l][k-(j-1)];
					}
				}
			}
		}
		int ans = 0;
		rep(i,11) ans += dp[n][i][s];
		cout<<ans<<endl;
	}
}