Go: package main

import "fmt"

var count int

func main() {
	var inputNum, inputCount int
	var resultArr [50]int
	for {
		fmt.Scanf("%d", &inputNum)
		resultArr[inputCount] = calcA(inputNum)
		inputCount++
	}
	for _, value := range resultArr {
		fmt.Println(value)
	}
}

func calcA(input int) int {
	for i := 0; i <= 9; i++ {
		calcB(input, i)
	}
	return count
}

func calcB(input, a int) {
	for i := 0; i <= 9; i++ {
		calcC(input, a, i)
	}
}

func calcC(input, a, b int) {
	for i := 0; i <= 9; i++ {
		calcD(input, a, b, i)
	}
}

func calcD(input, a, b, c int) {
	for i := 0; i <= 9; i++ {
		if a+b+c+i == input {
			count++
		}
	}
}

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

int main()
{
 int x,y; 
 while(cin>>x)
 {
   for(int a=0; a<=9; a++)
    {
      for(int b=0; b<=9; b+=)
        {
          for(int c=0; c<=9; c++)
            {
               for(int d=0; d<=9; d++)
                 {
                   if(a+b+c+d=0) y++;
                 }}}}
                cout<<y<<endl;
               }
                return 0;
                  }

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

int n;

int slv(int now, int t);

int main(){
  
  while(scanf(" %d",&n) != EOF){
    printf("%d\n",slv(0,0));
  }
  
  return 0;
}

int slv(int now, int t){
  if(now == 4){
    if(t == n)return 1;
    return 0;
  }
  
  int ans = 0;
  for(int i=0;i<10;i++){
    ans += slv(now + 1, t + i);
  }
  
  return ans;
}

C++: #include <cstdio>

int main(){
    int a,b,n,k[100],res=0;

    
    for(a = 0; a <= 9; a++){
        for(b = 0; b <= 9; b++){
            k[a * 10 + b] = a + b;
        }
    }

    while(scanf("%d",&n) == 1){
        res = 0;
        for(a = 0; a <= 9; a++){
            for(b = 0; b <= 9; b++){
                for(int i = 0; i < 100; i++){
                    if( n == a + b + k[i] ) res++;
                }
            }
        }

        printf("%d\n", res);
    }
    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++;
    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 << cnt << "\n";
        cnt = 0;
    }
    cout.flush();
}

C++: #include <iostream>

int main()
{
    int n;
    int cnt;  // 正解個数
    
    while (std::cin >> n){
        cnt = 0;
        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){
                            cnt++;
                        }
                    }
                }
            }
        }
        std::cout << cnt << std::endl;
    }
    
    return 0;
}

C++:  /*
Write a program which reads an integer n (n &#8804; 50) and identifies the number of combinations of a, b, c, and d (0 &#8804; a, b, c, d &#8804; 9) which meet the following equality:

        a + b + c + d = n
For example, for n = 35, we have 4 different combinations of (a, b, c, d): (8, 9, 9, 9), (9, 8, 9, 9), (9, 9, 8, 9), (9, 9, 9, 8).
 */

#include <iostream>

using namespace std;

int calc(int a, int b, int n) {
	int tmp = n-a-b;
	int count = 0;
	for (int c=0; c<10; c++) {
		for (int d=0; d<10; d++) {
			if (tmp == c+d)
				count++;
		}
	}
	return count;
}

void solve(int n) {
	int count = 0;
	for (int a=0; a<10; a++) {
		for (int b=0; b<10; b++) {
			count += calc(a,b,n);
		}
	}
	cout << count << endl;
}

int main() {
	int n;
	while (cin >> n) {
		solve(n);
	}
	return 0;
}

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

int serch(int cnt,int 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) cnt++;
	return cnt;
}

int main() {
	int n;
	while(cin>>n){
		int cnt=0;
		if(n<36) cnt=serch(cnt,n);
		cout<<cnt<<endl;
	}
}

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

int main()
{
	int n,count=0;
	while(cin>>n){
		for(int i=0;i<=9;i++){
			for(int j=0;j<=9;j++){
				for(int k=0;k<=9;k++){
					for(int l=0;l<=9;l++){
						if(i+j+k+l==n) count++;
					}
				}
			}
		}
		
		cout<<count<<endl;
		count=0;
	}
	return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
#include<iterator>
using namespace std;
typedef  long long int lint;
typedef pair<int, int> IP;
typedef pair<lint, lint> LLP;
typedef pair<char, char>CP;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define llower(v,hoge) *lower_bound(v.begin(), v.end(), hoge)
#define lupper(v,hoge) *upper_bound(v.begin(), v.end(), hoge)

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

C++: 
#include <iostream>

int n;

bool get_input()
{
//	std::cout << "get_input" << std::endl;
	return (std::cin >> n);
}

// no_use: Â©¦éÌÂ
int solve(int sum, int no_use)
{
//	std::cout << "solve " << "sum: " << sum << "no_use: " << no_use << std::endl;
	if (no_use == 1) {
		if (0 <= sum && sum <= 9) {
			return 1;
		} else {
			return 0;
		}
	} else {
		int ans = 0;
		for (int i = 9; i >= 0; i--) {
			if (sum < i) continue;
			ans += solve(sum - i, no_use - 1);
		}
		return ans;
	}
}

void output(int ans)
{
	std::cout << ans << std::endl;
}

int main(void)
{
	while (get_input()) {
		output(solve(n, 4));
	}
	return 0;
}

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

int main() {
    int ans[100] ={};
    for (int a = 0; a <= 9; ++a) {
        for (int b = 0; b <= 9; ++b) {
            for (int c = 0; c <= 9; ++c) {
                for (int d = 0; d <= 9; ++d) {
                    ++ans[a + b + c + d];
                } 
            }
        }
    }

    int n;
    while (cin >> n) {
        cout << ans[n] << endl;
    }
    
    return 0;
}

C++: #include <iostream>
#include <cstring>
using namespace std;
int ans[51];
void rec(int sum, int d){
  if(d == 4){
    ans[sum]++;
    return;
  }
  for(int i = 0 ; i <10; i++){
    rec(sum+i,d+1);
  }
}
void init(){
  memset(ans,0,sizeof(ans));
  rec(0,0);
}
int main(){
  int n;
  init();
  while(cin >> n){
    cout << ans[n] << endl;
  }
  return 0;
}

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

using namespace std;

int main() {
  int n, count;
  while(!feof(stdin)) {
    scanf("%d",&n);
    if(feof(stdin))break;
    count=0;
    if(n == EOF) break;
    for(int i=0;i<10;i++) {
      for(int j=0;j<10;j++) {
	for(int k=0;k<10;k++) {
	  if(i+j+k>=n-9 && i+j+k<=n)count++;
	}
      }
    }
    printf("%d\n", count);
  }
}