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 || curr >= 10 ) return;

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

	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 ), n, s ){
		ans = 0;
		dfs (0, 0, 0 );
		printf ("%d\n", ans );
	} // end loop
		
	return 0;
}

C++: #include <bits/stdc++.h>
/* Karen {{{
  ___  ____
 |_  ||_  _|
   | |_/ /    ,--.   _ .--.  .---.  _ .--.
   |  __'.   `'_\ : [ `/'`\]/ /__\\[ `.-. |
  _| |  \ \_ // | |, | |    | \__., | | | |
 |____||____|\'-;__/[___]    '.__.'[___||__]
}}} */
/* cpp template {{{*/
using namespace std;

#define endl '\n'

#define REP(i, n) for (int i = 0; i < (n); i++)
#define REPS(i, a, n) for (int i = (a); i < (n); i++)
#define RREP(i, n) for (int i = 1; i <= (n); i++)
#define X real()
#define Y imag()
#define EQ(n,m) (abs((n)-(m)) < EPS)

typedef double D;
typedef long long ll;
typedef long double lb;
typedef complex<D> P;
typedef vector<P> VP;
typedef vector<int> vi;
typedef vector<vector<int> > vii;
typedef pair<int, int> pii;
typedef pair<int, string> pis;
typedef pair<string, int> psi;

inline bool inside(int y,int x,int H,int W){return(y>=0&&x>=0&&y<H&&x<W);}
inline int in() {int x; std::cin >> x; return x;}

template <typename T>
void print(std::vector<T>& v, char c = ' ') {
  REP(i, v.size()) {
    if (i != 0) std::cout << c;
    std::cout << v[i];
  }
  std::cout << endl;
}
template <typename T>
void print(T x) {
  std::cout << x << '\n';
}
/* }}} */
/* ?????° {{{*/
const ll MOD = 1e9 + 7;
const ll INF = 1e9 + 9;
const D EPS  = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1};
const int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
/* }}} */

int Karen(int n, int s, int num)
{
  if (n + s == 0) return 1;
  if (num > 9 || s < 0) return 0;
  cout << n << s << num;
  return (Karen(n, s, num + 1) + Karen(n - 1, s - num, num + 1));
}
  
int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);

  cout << "wei";
  int n, s;
  while(cin >> n >> s){
    if (n == 0) break;
    cout << Karen(n, s, 0) << endl;
    cout << "w";
  }
  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)continue;
						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;
	}
}

C++: #include <iostream>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <sstream>
#include <list>
#include <functional>
#include <algorithm>

using namespace std;

int cnt_i(int n, int s, bool ns[],int d,int sum,int m){
//    if(n>d+1) return 0;
    if(s<sum) return 0;
    if(n==d+1 && s == sum) return 1;
    if(n==d+1) return 0;
    int tmp(0);
    for(int i(m+1);i<=9;++i){
//	if(!ns[i]){
	    auto cpns=ns;
	    cpns[i]=1;
	    tmp += cnt_i(n,s,cpns,d+1,sum+i,i);
//	}
    }
    return tmp;
}
    
// int cnt_i2(int n, int s, bool ns[],int d,int sum,int m){
//     int tmp=0;
//     for(int i(m+1);i<=9;++i)
// 	tmp += cnt_i(n,s,ns,d+1,sum+i,m);

int cnt(int n, int s){
    bool ns[10] = {0,0,0,0,0,0,0,0,0,0};
    return cnt_i(n,s,ns,-1,0,-1);
}
    

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

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

//dp? 深さ優先探索? よくわからんけど、再帰を使えばよい

int n, s;
int ans;

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

int main(){
	while(cin >> n >> s, n||s){
		ans = 0;
		dfs(0, 0, -1);

		cout << ans << endl;
	}
}

C++: #include <stdio.h>

int max;
int s;

int solve(int n, int m, int l)
{
	if (m == max){
		if (n == 0){
			return (1);
		}
		
		return (0);
	}
	if (l == 10){
		return (0);
	}
	return (solve(n - l, m + 1, l + 1) + solve(n, m, l + 1));
}

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

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

using namespace std;

int func(int n,int s,int mimnum){
    int  cnt=0;
    if(n==1 and s >= mimnum and s <= 9) return 1;
    for(int i=mimnum;i<min(11-n,s);i++){
        cnt += func(n-1,s-i,i+1);
    }
    return cnt;
}
int main(int argc, void *argv[]){
    int n,s;
    while(true){
        cin>>n>>s;
        if(n==0 and s==0) break;
        cout<<func(n,s,0)<<endl;;
    }
}

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

int func(int n, int s, int i){
	if(!n){
    	if(!s)return 1;
    	else return 0;
    }
	if(i >= 10 || s-i < 0)return 0;
	return test(n, s, i+1) + test(n-1, s-i, i+1);
}

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

C++: #include <iostream>

int sumOfIntegers(int min, int num, int sum);

int main()
{
    int num, sum;

    while (true) {
        std::cin >> num >> sum;

        if (num == 0 && sum == 0) {
            break;
        }

        std::cout << sumOfIntegers(0, num, sum) << std::endl;
    }

    return 0;
}

int sumOfIntegers(int min, int num, int sum)
{
    if (min > sum || num == 0) {
        return 0;
    }

    if (min == sum && num == 1) {
        return 1;
    }

    return (sumOfIntegers(min + 1, num, sum) + sumOfIntegers(min + 1, num - 1, sum - min));
}