Go: package main

import (
	"fmt"
	"strconv"
)

func main() {
	for _, leftValue := range MultiplicationTableNum(9) {
		for _, rightValue := range MultiplicationTableNum(9) {
			strLeftVal, strRightVal, strMulti := strconv.Itoa(leftValue), strconv.Itoa(rightValue), strconv.Itoa(Multiplication(leftValue, rightValue))
			fmt.Println(strLeftVal + "x" + strRightVal + "=" + strMulti)
		}
	}
}

func MultiplicationTableNum(num int) []int {
	multiNum := []int{}
	for i := 1; i <= num; i++ {
		multiNum = append(multiNum, i)
	}
	return multiNum
}

func Multiplication(x, y int) int {
	return x * y
}

C++: #include <cstdio>
#include <cstring>
#include <algorithm>
char m[1024][1025];
int a[1024];
bool check(int n)
{
    if ('1' == m[a[1]][a[0]])
        return false;
    for (int i = 1; i < n; ++ i)
        if ('0' == m[a[i]][a[i + n]])
            std :: swap(a[i], a[i + n]);
    int cnt = 1;
    for (int i = 1; i < n; ++ i)
    {
        if ('1' == m[a[0]][a[i]])
            ++ cnt;
        else
        {
            bool flag = false;
            for (int j = 1; j < n; ++ j)
                if ('1' == m[a[j]][a[i]])
                {
                    flag = true;
                    break;
                }
            if (false == flag)
                return false;
        }
    }
    return cnt * 2 >= n;
}
bool use[1024];
int b[1024];
void arrange(int n)
{
    memset(use, false, 2 * n);
    for (int i = 0; i < n * 2; ++ i)
        b[i] = a[i];
    int size = 1;
    for (int i = 1; i < n * 2; ++ i)
        if (!use[i] && '0' == m[0][b[i]])
            for (int j = 1; j < n * 2; ++ j)
                if (i != j && !use[j] && '1' == m[0][b[j]] && '0' == m[b[i]][b[j]])
                {
                    a[size] = b[j];
                    a[n + size ++] = b[i];
                    use[i] = use[j] = true;
                    break;
                }
    for (int i = 1; i < n * 2; ++ i)
        if (!use[i] && '0' == m[0][b[i]])
            for (int j = 1; j < n * 2; ++ j)
                if (i != j && !use[j] && '0' == m[0][b[j]])
                {
                    a[size] = b[j];
                    a[n + size ++ ] = b[i];
                    use[i] = use[j] = true;
                    break;
                }
    for (int i = 1; i < n * 2; ++ i)
        if (!use[i] && '0' == m[0][b[i]])
            for (int j = 1; j < n * 2; ++ j)
                if (i != j && !use[j] && '1' == m[0][b[j]])
                {
                    a[size] = b[j];
                    a[n + size ++] = b[i];
                    use[i] = use[j] = true;
                    break;
                }
    for (int i = 1; i < n * 2; ++ i)
        if (!use[i] && '1' == m[0][b[i]])
            for (int j = 1; j < n * 2; ++ j)
                if (i != j && !use[j] && '1' == m[0][b[j]])
                {
                    a[size] = b[j];
                    a[n + size ++] = b[i];
                    use[i] = use[j] = true;
                    break;
                }
    for (int i = 1; i < n * 2; ++ i)
        if (!use[i])
        {
            a[0] = 0;
            a[n] = b[i];
            break;
        }
}
void solve(int n)
{
    if (1 == n)
        return ;
    n /= 2;
    check(n);
    arrange(n);
    while (!check(n))
        puts("FUCK");
    for (int i = 0; i < n; ++ i)
        printf("%d %d\n", a[i] + 1, a[i + n] + 1);
    solve(n);
}
int main()
{
    int n;
    while (scanf("%d", &n) != EOF)
    {
        for (int i = 0; i < n; ++ i)
            for (int j = 0; j < n; ++ j)
                scanf(" %c", &m[i][j]);
        for (int i = 0; i < n; ++ i)
            a[i] = i;
        solve(n);
    }
}

C++: #import<cstdio>
int Q(int a,int b){return a>9?0:b<10?printf("%dx%d=%d\n",a,b,a*b),Q(a,b+1):Q(a+1,1);}int main(){Q(1,1);}

C++: //AOJ 0000
#include<cstdio>
#include<cstdlib>
#include<cstring>
using namespace std;
#define MAX_A 104
#define MAX_B 104

int a,  i, dp[MAX_A][MAX_B], max, j, b, ans, k;

int sort(const void *a, const void *b){
  return *(int*)a - *(int*)b;
}

int main(){
  /*while(1){
    scanf("%d %d", &a, &b);
    if(a == 0 && b == 0) break;
    memset(dp, -1, sizeof(dp));
    for(i = 0; i < a + 2; i++){
      dp[i][0] = 0;
      dp[i][1] = 1;
    }
    for(i = 0; i < b + 2; i++){
      dp[0][i] = 0;
      dp[1][i] = 1;
    }
    dp[1][1] = 1;
    for(i = 2; i <= a; i++){
      for(j = 2; j <= b; j++){
	dp[i][j] = dp[i - 1][j] + dp[i][j - 1];
	if(i > 2 && j > 2) dp[i][j] -= 2;
	else if(i > 2 || j > 2) dp[i][j]--;
	}
    }
    printf("%d\n", dp[a][b] % 100000);
  }
  */
  while(1){
    scanf("%d %d", &a, &b);
    if(a == 0 && b == 0) break;
    if(b < 3 || b > 24){
      printf("0\n");
      continue;
    }
    ans = 0;
    for(i = 0; i <= 7; i++){
      if(i >= b / 3) break;
      for(j = i + 1; j <= 8; j++){
	if(j >= b - (i + j)) break;
	if(b - (i + j) <= 9) ans++;
      }
    }
    printf("%d\n", ans);
  }
  return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
#define FOR(i, s, n) for(int i = s; i < (int)n; i++)
#define per(i, n) for(int i = n; i >= 0; i--)
#define ROF(i, s, n) for(int i = s; i >= (int)n; i--)
#define FORIT(i, A) for (auto i : A)
#define PRINT(x) cout << (x) << "\n"
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define MP make_pair
#define EACH(i, n) for (__typeof((n).begin()) i = (n).begin(); i != (n).end(); ++i)
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define NCLR(a) memset((a), -1 ,sizeof(a))
#define dump(x) cout << #x << " = " << (x) << "\n";
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << "\n";
#define sq(n) (n) * (n)
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef priority_queue<int> maxpq;
typedef priority_queue< int, vector<int>, greater<int> > minpq;
typedef complex<double> P;
static const double EPS = 1e-10;
static const double PI = acos( -1.0 );
static const int mod = 1000000007;
static const int INF = 1 << 29;
static const LL LL_INF = 1152921504606846976;
static const int dx[] = { -1, 0, 1, 0, 1, -1, 1, -1 };
static const int dy[] = { 0, -1, 0, 1, 1, 1, -1, -1 };


int main() {
#ifdef _DEBUG
	printf( "debug\n" );
#endif
	for ( int i = 1; i < 10; i++ ) {
		for ( int j = 1; j < 10; j++ ) {
			printf( "%dx%d=%d\n", i, j, i * j );
		}
	}
	return 0;
}