Go: package main

import (
	"fmt"
)

func main() {
	for {
		var a int
		fmt.Scan(&a)
		if a == 0 {
			break
		}
		rs := 0

		for i := 0; i < 10; i++ {
			for j := 0; j < 10; j++ {
				for k := 0; k < 10; k++ {
					for l := 0; l < 10; l++ {
						if i+j+k+l == a {
							rs++
						}
					}
				}
			}
		}
		fmt.Println(rs)
	}
}

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

int Permutation(int a, int b, int c, int d)
{
	if(a==d)
		return 1;
	else if(a==c || b==d)
		return 4;
	else if(a==b || b==c || c==d)
		return 12;
	else
		return 24;
}

int main()
{
	int n;
	while(cin>>n)
	{
		int count=0;
		if(9+9+9+9 < n)
				break;
		for(int i=0; i<10; ++i)
		{
			if(i+9+9+9 < n)
					continue;
			for(int j=i; j<10; ++j)
			{
				if(i+j+9+9 < n)
						continue;
				for(int k=j; k<10; ++k)
				{
					if(i+j+k+9 < n)
							continue;
					for(int l=k; l<10; ++l)
					{
						if(i+j+k+l == n)
						{
							count+=Permutation(i,j,k,l);
							break;
						}
					}
					if(i+j+k > n)
						break;
				}
				if(i+j > n)
					break;
			}
			if(i > n)
				break;
		}
		cout << count << '\n';
	}
}

C++: #include <iostream>

using namespace std;
static int a = 0;


void re(int n, int t) {
    if(t == 0){
        if(n == 0) {
            a++;
            return;
        } else return;
    }

    for(int i = 0; i <= 9; i++) {
        re(n - i, t - 1);
    }

    return;
}

int main() {
    int n;
    while(cin >> n) {
        re(n, 4);
        cout << a << endl;
        a = 0;
    }

    return 0;
}

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

int main(){
	
	int a, b, c, d, n;
	int i;
	int cnt;

	while (cin >> n) {
		cnt = 0;
		for (a = 0; a <= 9; a++) {
			for (b = 0; b <= 9; b++) {
				for (c = 0; c <= 9; c++) {
					for (d = 0; d <= 9; d++) {
						if (a + b + c + d == n) {
							cnt++;
						}
					}
				}
			}
		}
		printf("%d\n", cnt);
	}
	return 0;
}

C++: 


#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

using namespace std;
int main()
{
	int s;
	while (cin >> s) {
		int a = 0;
		for (int i = 0; i < 10; i++) {
			for (int k = 0; k < 10; k++) {
				for (int j = 0; j < 10; j++) {
					for (int l = 0; l < 10; l++) {
						if (i + k + j + l == s) { a++; }
					}
				}
			}
		}cout << a << endl;
	}
	return 0;
}

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

int main(){
	int n;
	cin>>n;
	int ans=0;
	for(int i=0;i<10;i++){
		for(int j=0;j<10;j++){
			for(int k=0;k<10;k++){
				for(int l=0;l<10;l++){
					if(i+j+k+l==n)ans++;
				}
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}

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

int main(void) {
  int in;
  int table[51];

  memset(table, 0, sizeof(table));
  for(int a = 0; a < 10; a++) {
    for(int b = 0; b < 10; b++) {
      for(int c = 0; c < 10; c++) {
        for(int d = 0; d < 10; d++) {
          table[a + b + c + d]++;
        }
      }
    }
  }
  while(cin) {
    cin >> in;
    cout << table[in] << endl;
  }
  return 0;
}

C++: #include<iostream>

using namespace std;

#define MAX 256

int miku(int x){
	if(x > 36)return 0;
	if(x < 10)return (x + 3)*(x + 2)*(x + 1) / 6;
	if(x > 18)return miku(36 - x);
	if(x > 9 && x < 19)return (x + 3)*(x + 2)*(x + 1) / 6 - (miku(x - 10) * 4);
}

int main(void){
	int n,i = 0;
	int ans[MAX];
	
	while((n = cin.get()) != istream::traits_type::eof()){
		ans[i] = miku(n);
		i++;
	}
	
	for(int j = 0;j < i;j++){
		cout << ans [j] <<endl;
	}

	return 0;
}

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

bool binary_search(vector<int> a, int x){
	int left = 0, right = a.size() - 1;

	while (left <= right){
		int mid = (left + right) / 2;
		if (a[mid] == x) return true;
		else if (a[mid] < x) left = mid + 1;
		else right = mid - 1;
	}
	return false;
}

int main()
{
	vector<int> vec(19);
	int cnt = 0;
	for (auto& x : vec) x = cnt++;
	for (auto x : vec) cout << x << endl;
	int n;
	cnt = 0;
	while (cin >> n){
		for (int i = 0; i < 10; i++){
			for (int j = 0; j < 10; j++){
				if (binary_search(vec, n - i - j)){
					if (n - i - j == 0 || n - i - j == 18) cnt++;
					else cnt += 2;
					//cout << "i:" << i << " j:" << j << "k + l:" << n - i - j << endl;
				}
			}
		}
		cout << cnt << endl;
		cnt = 0;
	}
}

C++: #include<iostream>
using namespace std;
int main(){
  int n,j=0;
  while(cin>>n){
  for(int a=0;a<10;a++)
    for(int b=0;b<10;b++)
      for(int c=0;c<10;c++)
	for(int d=0;d<10;d++)
	  if(a+b+c+d==n)
	    j++;
  cout<<j<<endl;
  j=0;
  }
  return 0;
}

C++: //  0008.cpp
//  2012/09/03.

#if 1

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <cctype>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <complex>
#include <fstream>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T> T RoundOff(T a){ return int(a+.5-(a<0)); }
template<class T, class C> void chmax(T& a, C b){ if(a < b) a = b; }
template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; }
template<class T, class C> pair<T, C> mp(T a, C b){ return make_pair(a, b); }

int main()
{
    int n;
	while(cin >> n)
	{
		int res = 0;
		rep(a, 10) rep(b, 10) rep(c, 10) rep(d, 10) if(a + b + c + d == n) res++;
		cout << res << endl;
	}
}

#endif

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

int main(){
	int n[36]={};
	int m;
	for(int a=0; a<10; a++){
		for(int b=0; b<10; b++){
			for(int c=0; c<10; c++){
				for(int d=0; d<10; d++){
					n[a+b+c+d-1]+=1;
				}
			}
		}
	}

	while(cin>>m){
		if(m>36){
			cout << "0" << endl;
			continue;
		}
		cout << n[m-1] << endl;
	}

	return 0;
}

C++: #include<iostream>

using namespace std;

#define MAX 256

int kai (int x){
	if(x == 1 || x == 0)return 1;
	return x * kai(x - 1);
}

int miku(int x){
	if(x > 36)return 0;
	if(x < 10)return kai(x + 3) / ( kai(x) * 6);
	if(x > 19)return miku(36 - x);
	if(x > 9 && x < 19)return kai(x + 3) / ( kai(x) * 6) - (miku(x - 10) * 4);
}

int main(void){
	int n,i = 0;
	int ans[MAX];
	
	while((n = cin.get()) != istream::traits_type::eof()){
		ans[i] = miku(n);
		i++;
	}
	
	for(int j = 0;j < i;j++){
		cout << ans [j] <<endl;
	}

	return 0;
}

C++: #include<cstdio>

int solve(int a,int b){
 
 if(b==4){
  if(a==0) return 1;
  else return 0; 
 }
 else{
  int res=0;
  for(int i=0;i<=a&&i<10;i++){
   res+=solve(a-i,b+1);
  }
  return res;
 }
}

int main(){
 int n;
 while(~scanf("%d",&n)){
  printf("%d\n",solve(n,0));
}
return 0;
}

C++: 
#include <iostream>
using namespace std;
#define MAX_N 4000
int num[MAX_N/2+1];

int main(int argc, char const *argv[]){
  for(int i=0;i<=MAX_N/4;i++){
    for(int j=0;j<=MAX_N/4;j++){
      num[i+j]++;
    }
  }
  int n;
  while(cin>>n){
    int ans=0;
    for(int i=0;i<=MAX_N/2;i++){
      int cd = n-i;
      if(cd<0)break;
      if(cd>2000)continue;
      ans += num[i] * num[cd];
    }
    cout<<ans<<endl;
  }
  return 0;
}