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 <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>	// require sort next_permutation count __gcd reverse etc.
#include <cstdlib>	// require abs exit atof atoi 
#include <cstdio>		// require scanf printf
#include <functional>
#include <numeric>	// require accumulate
#include <cmath>		// require fabs
#include <climits>
#include <limits>
#include <cfloat>
#include <iomanip>	// require setw
#include <sstream>	// require stringstream 
#include <cstring>	// require memset
#include <cctype>		// require tolower, toupper
#include <fstream>	// require freopen
#include <ctime>		// require srand
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
int n, s;
int ans;

void dfs (int curr, int depth, int sum )
{
	if (sum > s ) return;

	if (depth == n ){
		if (sum == s ) ans++;
		return;
	} // end if

	if (curr >= 10 ) return;

	dfs (curr+1, depth, sum );
	dfs (curr+1, depth+1, sum + curr );
}

int main()
{
//	cut here before submit 
//	freopen ("testcase.sum_of_integers", "r", stdin );
	while (scanf ("%d %d", &n, &s ) ){
		if (n == 0 && s == 0 ) break;
		ans = 0;
		dfs (0, 0, 0 );
		printf ("%d\n", ans );
	} // end loop
		
	return 0;
}

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

int dfs(int n,int s,int i){
  if(n == 0){
    if(s == 0)return 1;
    else return 0;
  }
  if(s -i < 0)return 0;
  if(i > 9 || n <= 0)return 0;

  return dfs(n,s,i + 1) + dfs(n - 1,s - i,i + 1);
}

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

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

int n,k,m;
int ans=0;
vector<int>s(10);

void bfs(int nn,int sum,int min){
    
    if(nn==0&&sum==0){
        ans++;
        return;
    }
    
    for(int i=min;i<10&&n>0;i++){
        if(sum-i>=0){
            bfs(nn-1,sum-i,i+1);
        }
    }
    
}

int main(){
    while(cin>>n>>m){
        if(n==0 && m==0)break;
        bfs(n,m,0);
        cout<<ans<<endl;
        ans=0;
        
    
    }
    return 0;
}

C++: #include <iostream>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <map>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,b) FOR(i,0,b)
#define PB push_back
#define MP make_pair
int n,s,ans;
void rec(int a,int b,int sum){
  if(sum==s&&b==0){
    ans++;
    return;
  }
  if(a>=10||b<=0)return;
  rec(a+1,b,sum);
  rec(a+1,b-1,sum+a);
}
int main(){
  while(cin>>n>>s){
    if(n==0&&s==0)break;
    ans=0;
    rec(0,n,0);
    cout<<ans<<endl;
  }
}

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

using namespace std;

int Judge(vector<int> no, int n);

int main()
{
  int n, s, cnt, sum, i, j, k, judge;
  
  while(cin >> n >> s, n != 0 && s != 0) {
    vector<int> no(9);
    for(i = 0; i < n ; i++) no[i] = i;
    cnt = 0;
    
    while(1) {
      no[n - 1]++;
      for(k = n - 1; k > 0; k--) {
	if(no[k] == 10) {
	  no[k] = 0;
	  no[k - 1]++;
	}
      }
      if(no[0] == 10) break;
      judge = Judge(no , n);
      if(judge == true) {
	for(k = sum = 0; k < n; k++) {
	  sum += no[k];
	}
	if (sum ==  s) cnt++;
      }
    }
    cout << cnt << endl;
  }
}

int Judge(vector<int> no, int n)
{
  int i, j;
  for(i = 0; i + 1 < n; i++) {
    if (no[i] > no[i + 1]) return false;
    for(j = i + 1; j < n; j++)
      if (no[i] == no[j])
      return false;
  }
  return true;
}

C++: #include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<functional>
#include<algorithm>
#include<cstdio>
#include<unordered_map>
using namespace std;
//---------------------------------------------------
//????????????????????????????????????
#define int long long
const int inf = 999999999999999999;
struct P {
	int pos, cost;
};
bool operator<(P a, P b) { return a.cost < b.cost; }
bool operator>(P a, P b) { return a.cost > b.cost; }
struct B {
	int to, cost;
};
typedef long long ll;
typedef long double ld;
//---------------------------------------------------
//+++++++++++++++++++++++++++++++++++++++++++++++++++
//---------------------------------------------------
int n, s;
int solve(int i, int bf,int res) {
	if (i == n&&res==0) return 1;
	int ans = 0;
	for (int j = 0; j < bf; j++) {
		ans += solve(i + 1, j, res - j);
	}
	return ans;
}
signed main() {
	while (cin >> n >> s&&n + s != 0) {
		cout << solve(0, 10, s) << endl;
	}
}

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

int n,s;
int ans;

void dfs(int x,int now,int co);

int main(){
  while(1){
    cin>>n>>s;
    if(!n && !s)break;
    ans=0;
    dfs(-1,0,0);
    cout<<ans<<endl;
  }
}

void dfs(int x,int now,int co){
  if(co==n && now==s){
    ans++;
    return;
  }
  if(now>s)return;
  for(int i=x+1;i<=9;i++){
    dfs(i,now+i,co+1);
  }
  return;
}

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

using namespace std;

typedef struct{
  int sum;
  int max;
  int rev;
}Point;

int sum,n,s;

void bfs(){
  Point fir;
  fir.sum = fir.rev = 0;
  fir.max = -1;
  queue<Point> Q;
  Q.push(fir);
  while(1){
    Point now = Q.front();
    if(now.rev == n){
      while(!Q.empty()){
	now = Q.front();
	Q.pop();
	if(now.sum == s) sum++;
      }
      break;
    }
    Q.pop();
    for(int i = now.max+1; i < 10; i++){
      Point next = now;
      next.sum += i;
      next.max = i;
      next.rev++;
      Q.push(next);
    }
  }
}

int main(){
  while(cin >> n >> s && n+s){
    sum = 0;
    bfs();
    cout << sum << endl;
  }
  return 0;
}

C++: #include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <vector>
#include <set>

using namespace std;
typedef long long LL;
static const double EPS = 1e-9;

#define FOR(i,k,n) for (int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n) 
int SumOfIntegers(int n, int s){
  if(n<0||s<0) return 0;
if(n==1) return ((s<10)?1:0);
  int a[10],count=0,sum;
  REP(i,10) a[i] = i;
  while(next_permutation(a, a+sizeof(a)/sizeof(a[0]))){
    sum = 0;
    REP(i,n) sum+=a[i];
    if(sum == s) count++;
  }
  int d=6;
  for(int i=10-n;i>0;i--) d*=i;
  return (count/d);
}

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

C++:  
 #include<iostream>
 #include<stdio.h>
 #include<string>
 #include<math.h>
 #include<iomanip>
 #include<algorithm>
 #include<string.h>
 #include<cctype>
 #include<map>
 #include<set>
 #include<vector>
 #include<sstream>
 #include<stack>
 #include<queue>
 
 using namespace std;
 
 int a[10]={0,1,2,3,4,5,6,7,8,9};
 int n,s;
 int count_2;
 
 void dfs(int step,int i,int sum)
 {
   if(sum>s||step>n) return;
   if(i==10)
   {
     if(step==n&&i==10&&sum==s)
     {
       count_2++;
       return;                          
     }
   }
   else return;     
   dfs(step,i+1,sum); 
   dfs(step+1,i+1,sum+a[i]);
   return;
 }
  
 int main()
 {
   while(cin>>n>>s)
   {
     if(n==0&&s==0) break;
     else
     {
       count_2=0;
       dfs(0,0,0);    
     } 
     cout<<count_2<<endl;               
   }
   //while(1);     
   return 0;  
 }