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 <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <cmath>
#include <cstdio>
#include <istream>
#include <sstream>
#include <iomanip>
#include <iterator>
#include <climits>
using namespace std;

typedef ostringstream OSS;
typedef istringstream ISS;

typedef vector<int> VI;
typedef vector< VI > VVI;

typedef long long LL;

typedef pair<int, int> PII;
typedef vector<PII> VPII;

#define X first
#define Y second

int solve(int s, int n, int idx, int sum) {
	if (idx == 10) {
		return sum == s && n == 0;
	}

	return solve(s, n - 1, idx + 1, sum + idx) + solve(s, n, idx + 1, sum);
}

int main(void) {
	int n, s;
	while (cin >> n >> s, n) {
		cout << solve(s, n, 0, 0) << endl;
	}

	return 0;
}

C++: #include <iostream>

using namespace std;

int count(int m, int n, int s) {
    if (n == 1) {
        if (s >= m) return 1;
        return 0;
    }
    int c = 0;
    for (int i = m; i < 9; i++) {
        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 <iostream>

int main(){
	int n,s;
	while(std::cin>>n>>s&&n!=0&&s!=0){
	     int a,b=0,c=1;
	     for(int a=0;a<=9;a++){
	     	if(n>1){
	     		for(int a2=0;a<=9;a2++){
	     	if(n>2){
	     		for(int a3=0;a<=9;a3++){
	     	if(n>3){
	     		for(int a4=0;a<=9;a4++){
	     	if(n>4){
	     		for(int a5=0;a<=9;a5++){
	     	if(n>5){
	     		for(int a6=0;a<=9;a6++){
	     	if(n>6){
	     		for(int a7=0;a<=9;a7++){
	     	if(n>7){
	     		for(int a8=0;a<=9;a8++){
	     	if(n>8){
	     		for(int a9=0;a<=9;a9++){
	     	
			 	if(s==a+a2+a3+a4+a5+a6+a7+a8+a9){
			 		b++;
			 		c=9;
				 }	
			 }
		 
			 }else{
			 	if(s==a+a2+a3+a4+a5+a6+a7+a8){
			 		b++;
				 	c=8;
			 }
		 }
	}
			 }else{
			 	if(s==a+a2+a3+a4+a5+a6+a7){
			 		b++;
			 		c=7;
				 }	
			 }
		 }
			 }else{
			 	if(s==a+a2+a3+a4+a5+a6){
			 		b++;
			 		c=6;
				 }	
			 }
		 }
			 }else{
			 	if(s==a+a2+a3+a4+a5){
			 		b++;
			 		c=5;
				 }	
			 }
		 }
			 }else{
			 	if(s==a+a2+a3+a4){
			 		b++;
			 		c=4;
				 }	
			 }
		 }
			 }else{
			 	if(s==a+a2+a3){
			 		b++;
			 		c=3;
				 }	
			 }
		 }
			 }else{
			 	if(s==a+a2){
			 		b++;
			 		c=2;
				 }	
			 }
		 }
			 }else{
			 	if(s==a){
			 		b++;
				 }	
			 }
		 }
	
	std::cout<<b/c<<std::endl;
}
return 0;
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <cmath>
using namespace std;
typedef vector <int> vi;
typedef vector <vi> vvi;

vvi x(11, vi(101));
int reverse(string &s){
    int n = s.size(), n2 = n/2;
    for (int i=0; i<n2; i++)
        swap(s[i], s[n-1-i]);
    return 0;
}

string dec2bin(int n, bool r=false){
	string s="";
	while (n>0){
		if (n%2==1) s+="1";
		else s+="0";
		n/=2;
	}
	if (s=="") s="0";
	if (!r) reverse(s);
	return s;
}

int main(void){
	int m=pow(2,10);
	for (int i=0; i<10; i++)
		for (int j=0; j<101; j++)
			x[i][j] = 0;

	string s;
	for (int i=1; i<m; i++){
		s = dec2bin(i, true);
		s += string(10-s.size(),'0');

		int n=0, c=0;
		for (int i2=0; i2<s.size(); i2++)
			if (s[i2]=='1'){
				n += i2;
				c++;
			}
		x[c][n]++;		
	}

	while (true){
		int a1,a2;
		cin>>a1>>a2;
		if (a1==0 && a2==0) break;
		cout<<x[a1][a2]<<endl;
	}
	return 0;
}

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

int n,k,count;

void dfs(int i,int sum,int num)
{
	if(num == n)
	{
		if(sum == k)
		{
			count++;
		}
		return;
	}

	if(i == 10)
	{
		return;
	}
	
	dfs(i+1,sum,num);
	dfs(i+1,sum+i,num+1);
}
int main()
{
	while(cin >> n >> k)
	{
		if(n == 0 && k == 0) break;

		count = 0;
		dfs(0,0,0);
		cout << count << endl;

	}
	return 0;
}

C++: #include <iostream>

using namespace std;

int answer;

void saiki( int number, int sum, int t )
{
	if( t > 10 ) return;

	if( number == 0 ){
		if( sum == 0 ){
			answer++;
			return;
		} else {
			return;
		}
	}

	if( sum < 0 ) return;



	saiki( number - 1, sum - t, t + 1 );

	saiki( number, sum, t + 1 );

}

int main(void)
{
	int number, sum;

	while( cin >> number >> sum && number != 0 && sum != 0 ){
		answer = 0;
		saiki( number, sum, 0 );
		cout << answer << endl;
	}
	return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
using namespace std;
int n,s;
int solve(int se,int no,int sum){
  if(no>=n){
    if(sum==s) return 1;
    else return 0;
  } 
  if(se>=10) return 0;
  return solve(se+1,no,sum)+solve(se+1,no+1,sum+se);
}
main(){
  while(1){
    int res;
    scanf("%d %d",&n,&s);
    if(n==0 && s==0) break;
    res=solve(0,0,0);
    printf("%d\n",res);
  }
}

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;
  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;
    cout<<n<<","<<s<<endl;
    a[n][s]++;
  }
  while(true){
    cin>>n>>s;
    if(!n&&!s)
      break;
    cout<<a[n][s]<<endl;
  }
}
  //  for(cin>>n>>s;n||s;cout<<a[n][s]<<endl,cin>>n>>s);

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 && 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 && k <  p && 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 && b < c && c < d && 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]);
		}
	}
    return 0;
}

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

using namespace std;
using ll = long long;
using pii = pair<int, int>;

int dfs(int d, int n, int s) {
  if (n == 0 && s == 0) return 1;
  if (d == 10) return 0;
  return dfs(d + 1, n, s) + dfs(d + 1, n - 1, s - d);
}

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  int n, s;
  while (cin >> n >> s, n) {
    cout << dfs(0, n, s) << endl;
  }

  return 0;
}