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 solve(int n,int m){
  if(2*m>90-(n-1)*n)return 0;
  if(2*m<(n-1)*n)return 0;
  if(n==1)return (0<=m&&m<=9?1:0);
  int res=0;
  if(m-n+1>=0)res+=solve(n-1,m-n+1);
  if(m-n>=0)res+=solve(n,m-n);
  if(m-10>=0)res-=solve(n,m-10);
  return res;
}
*/
int dp[11][101];

int main(){
  int n,m;
  for(int i=0;i<11;i++)
    for(int j=0;j<101;j++)
      dp[i][j]=0;
  for(int i=0;i<=9;i++)dp[1][i]=1;
  for(int i=2;i<=10;i++){
    for(int j=0;j<100;j++){
      if(j-i>=0)dp[i][j]+=dp[i][j-i];
      if(j-i+1>=0)dp[i][j]+=dp[i-1][j-i+1];
      if(j-10>=0)dp[i][j]+=dp[i-1][j-10];
    }
  }

  while(cin>>n>>m&&n&&m){
    cout<<dp[n][m]<<endl;
  }
  return 0;
}

C++: #include <iostream>

int n, s;
//int num[10]={0,1,2,3,4,5,6,7,8,9};

int func(int de, int k, int sum){
	int res = 0;
	if(de == n){
		if(sum == s)return 1;
		return 0;
	}
	//if(sum > s || > n)return 0;
	for(int i = k; i < 10 && sum+i<=s; ++i){
		
		res += func(de + 1, i + 1, sum + i);
		//res += func(de, i + 1, sum);
	}
	return res;
}

int main(){
	while(std::cin >> n >> s, n + s){
		std::cout << func(0, 0, 0) << std::endl;
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int solve(int n,int m){
  if(n==1)return (0<=m&&m<=9);
  int res=0;
  if(m-n+1>=0)res+=solve(n-1,m-n+1);
  if(m-n>=0)res+=solve(n,m-n);
  if(m-10>=0)res-=solve(n,m-10);
  return res;
}
int main(){
  int n,m;
  while(cin>>n>>m&&n&&m){
    cout<<solve(n,m)<<endl;
  }
  return 0;
}

C++: 
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <vector>
#include <map>
#include <utility>
#include <complex>
#include <stack>
#include <climits>
#include <set>

using namespace std;

double sq(double x){return x*x;}

int main(){
	int n,s;
	while(cin>>n>>s,(n||s)){
		int comb = (1 << n) - 1;
		int ans = 0;
		while(comb < (1 << 10)){
			int x = comb & -comb,y = comb + x;

			int sum = 0;
			for (int i = 0; i < 10; i++)
			{
				if(comb & (1 << i)){
					sum += i;
				}
			}
			if(sum == s) ans++;

			comb = ((comb & ~y) / x >> 1) | y;
		}

		cout << ans << endl;
	}

	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
#define all(vec) vec.begin(),vec.end()
typedef long long int ll;
typedef pair<int,int> P;
const ll MOD=1234567;
const ll INF=1000000010;
const ll LINF=1000000000000000010LL;
const int MAX=10000010;
const double EPS=1e-3;
int dx[4]={0,1,0,1};
int dy[4]={0,0,1,1};
int dp[1010][1010];
int dfs(int i,int u,int s){
	if(i==10){
		if(u==0&&s==0){
			return 1;
		}else{
			return 0;
		}
	}
	int ret=0;
	ret+=dfs(i+1,u-1,s-i);
	ret+=dfs(i+1,u,s);
	return ret;
}
int main(){
	int n,s;
	while(cin>>n>>s,n+s){
		cout<<dfs(0,n,s)<<endl;
	}
}

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

map<pair<pair<int,int>,int>,int> memo; 

int BT( int N, int S, int d, int p, int s )
{
	if ( d==N )
		return s==S ? 1 : 0;
	if ( s+(N-d)*p>S)
		return 0;

	pair<pair<int,int>,int> k = make_pair(make_pair(d,p),s);
	if ( memo.count(k)>0 )
		return memo[k];
	int ans = 0;
	for ( int i=p; i<=S; i++ )
		ans += BT(N,S,d+1,i+1,s+i);
	return memo[k]=ans;
}

int main()
{
	while ( true )
	{
		memo.clear();
		int n, s;
		cin >> n>>s;
		if ( n ==0 && s==0 )
			break;

		cout << BT(n,s,0,0,0) << endl;

	}

	return 0;
}

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

int ans;
int n, m;

void dfs(int countNum, int minNum, int total){
	if(countNum == n){
		if(total == m) ans++;
	}
	else if(countNum < n){
		for(int i=minNum+1; i <= 9; i++){
			dfs(countNum+1, i, total+i);
		}
	}
}

int main(){
	while(cin >> n >> m, n || m){
		ans = 0;
		dfs(0, -1, 0);
		cout << ans << endl;
	}
}

C++: #include <iostream>
#include <string>
#include <math.h>
#include <stdio.h>
#include <ctype.h>

using namespace std;

int Sum(int wa, int now, int count, int zero, int x, int y){
    wa+=now*zero;
    if(zero==1){
        count++;
    }
    
    if(now == 10 || count>x){
        return 0;
    }else if(wa==y&&count==x){
        return 1;
    }else{
        return Sum(wa, now+1, count, 1, x, y)+Sum(wa, now+1, count, 0, x, y);
    }
    
}

int main() {
    
    int x,y;
    while(cin>>x>>y){
        if(x==0&&y==0){
            break;
        }
        int ans = Sum(0, 0, 0, 1, x, y)+Sum(0, 0, 0, 0, x, y);
        cout<<ans<<endl;
    }
    
    return 0;
}

C++: #include <iostream>

using namespace std;

int t;
int func(int n, int s, int v, int p)
{
	int c = 0;
	if(s < v){
		return 0;
	} else if(n == 1 && s-v > v){
		t = s - v;
		return 1;
	} else if(n == 0 && s != v){
		return 0;
	} else if(n == 0 && s == v){
		return 1;
	}

	for(int i = p; i < t; i++){
		c += func(n-1, s, v+i, i+1);
	}
	
	return c;
}

int main(int argc, char **argv)
{
	int n, s;
	
	while(cin >> n >> s){
		if(n == 0 && s == 0){
			break;
		}
		t = s;
		cout << func(n, t, 0, 0) << endl;; 
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
typedef long long int ll;

#define rep(i,n) for(ll i = 0;i < n;++i)
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        while(true){
                ll n,s;
                ll ans = 0;
                cin >> n >> s;
                if(n==0&&s==0)break;
                ll shift = 1 << 10;
                rep(tem,shift){
                        ll sum = 0;
                        ll count = 0;
                        rep(i,10){
                                if(tem>>i & 1){
                                        sum+=i;
                                       count++;
                                }
                        }
                        if(sum == s && count == n)ans++;
                }
                cout << ans << endl;
        }
        return 0;
}

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

#define int				long long
#define FOR( i, m, n )  for( int (i) = (m); (i) < (n); (i)++ )
#define REP( i, n )     FOR( i, 0, n )
#define REPR( i, m )	for( int (i) = (m); (i) >= 0; (i)-- )
#define REPONE( i, n )	FOR( i, 1, n + 1 )
#define ALL( a )        (a).begin(), (a).end()
#define MP				make_pair
#define X				first.first
#define Y				first.second

typedef pair<int, int> P;

template<class T>bool chmax( T& a, const T& b ) { if( a < b ) { a = b; return 1; } return 0; }
template<class T>bool chmin( T& a, const T& b ) { if( a > b ) { a = b; return 1; } return 0; }

const int INF = 1e9;
const int MOD = 1e9 + 7;

int n, s, ans;

bool dfs( int i, int sum, int cnt ) {

	if( i == 10 || cnt == n + 1 ) return false;
	if( sum == s && cnt == n ) return true;

	if( dfs( i + 1, sum + i, cnt + 1 ) ) ans++;
	dfs( i + 1, sum, cnt );
	
}

signed main() {
	while( cin >> n >> s, n ) {
		ans = 0;
		dfs( 0, 0, 0 );
		cout << ans << endl;
	}
}

C++: #include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>

using namespace std;
typedef long long ll;

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

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