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 total = 0; // test
	
	int n;
	while ( cin >> n ) {
		int count;
		if (n>36) count = 0;
		else if (n<=9) count = ((n+1)*(n+2)*(n+3))/6;
		else if (n<=18) count = ((n+1)*(n+2)*(n+3))/6 - 4*((n-9)*(n-8)*(n-7))/6;
		// 220 - ((n-10+1)*(n-10+2)*(n-10+3))/6 + \sum_{k=10}^n { (k+1)(k+2)/2 - 3*(k-9)(k-8)/2 }
		// 220 - ((n-10+1)*(n-10+2)*(n-10+3))/6 + \sum_{k=10}^n { -k^2 + 27k - 107 }
		// 220 - ((n-10+1)*(n-10+2)*(n-10+3))/6 + \sum_{k=1}^n { -k^2 + 27k - 107 } - \sum_{k=1}^9 { -k^2 + 27k - 107 }
		// 220 - ((n-9)*(n-8)*(n-7))/6        - n(n+1)(2n+1)/6      + 27 * n(n+1)/2   - 107n    - 9*10*11/6 + 27*9*10/2 - 107*9
		// 220 - (n^3 - 24n^2 + 191n - 504)/6 - (2n^3 + 3n^2 + n)/6 + (27n^2 + 27n)/2 - 107n    - 165 + 1215 - 963
		// 307 - (3n^3 - 21n^2 + 192n - 504)/6                      + (81n^2 + 81n)/6 - 642n/6
		// 307 - (3n^3 - 102n^2 + 753n - 504)/6
		// 307 - (n^3  -  34n^2 + 251n - 168)/2
		// (-n^3 + 34n^2 - 251n + 782)/2 
		
		// 220  + \sum_{k=10}^n { (k+1)(k+2)/2 } - 4 * ((n-10+1)*(n-10+2)*(n-10+3))/6
		// \sum_{k=1}^n { (k+1)(k+2)/2 }         - 4 * ((n-10+1)*(n-10+2)*(n-10+3))/6
		else if (n<=27) count = ((37-n)*(38-n)*(39-n))/6 - 4*((27-n)*(28-n)*(29-n))/6;
		else count = ((37-n)*(38-n)*(39-n))/6;
		
		cout << count << endl;
		
		//total += count; // test
	}
	
	//cout << "total = " << total << endl; // test
	
	return 0;
}

C++: #include <iostream>

using namespace std;

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

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

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

C++: #include<bits/stdc++.h>
using namespace std;
int main(void){
	int n;
	int i,j,k,l;
	int cnt;
	while(1){
		cin>>n;
		if(cin.eof())	break;
		cnt=0;
		for(i=0;i<=9;i++){
			for(j=0;j<=9;j++){
				for(k=0;k<=9;k++){
					for(l=0;l<=9;l++){
						if(n==i+j+k+l)	cnt++;
					}
				}
			}
		}
		cout<<cnt<<endl;
	}
	return 0;
}

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

int main() {
	int n;

	while (cin >> n) {
		int sum = n;
		int count = 0;
		for (int a = 9; a >= 0; a--, sum = n) {
			sum -= a;
			for (int b = 9; b >= 0; b--, sum = n-a) {
				sum -= b;
				for (int c = 9; c >= 0; c--, sum = n-a-b) {
					sum -= c;
					for (int d = 9; d >= 0; d--, sum = n-a-b-c) {
						sum -= d;
						if (sum == 0) {
							count++;
						}
					}
				}
			}
		}
		cout << count << endl;
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
#define L long long int
int main(){
int n,ans;
while(cin>>n){
ans=0;
int a,b,c,d;
for(a=9;a>=0;a--)for(b=9;b>=0;b--)for(c=9;c>=0;c--)for(d=9;d>=0;d--){
	if(a+b+c+d==n){ans++;
	}else if(a+b+c+d<n){break;
	}
}
cout<<ans<<endl;
}
return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

int main() {
	int n;
	while (cin >> n) {
		int 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++;
						}
					}
				}
			}
		}
		cout << cnt << endl;
	}
}

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

int main()
{
    for (int n, count; cin >> n; cout << count << endl) {
        count=0;
        if (n<=36) {
            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) {
                                break;
                            }
                            else if (a+b+c+d==n) {
                                count++;
                            }
                        }
                    }
                }
            }
        }
    }
    return 0;
}

C++: #include <iostream>

using namespace std;


int main()
{

	int n,count;
	int a,b, c,d;
	while(cin >> n){

		//a>=b>=c>=dと仮定
		count = 0;
		for( a = 0; a < 10; a++ ) {
			if ( a > n ) 
				continue;
			for( b = 0; b < a+1; b++ ) {
				if( a + b > n )
					continue;
				for( c = 0; c < b+1; c++ ) {
					if( a + b + c > n ) 
						continue;
					d = n - a - b- c;
					if( d > c )
						continue;
				if( a == d )//全部同じ
					count += 1;
				else if( a == c || b == d)//１つ異なる
					count += 4;
				else if( a == b && c == d )//2つずつ同じ
					count += 6;
				else if( a == b || b == c || c == d )//2つ同じ
					count += 12;
				}
			}
		}
		cout << count << endl;

	}

	return 0;
}

C++: #include<cstdio>

int main(){

    int n;

    while(scanf("%d",&n)!=EOF){
        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++;
    printf("%d\n",ans);
    }

    return 0;
}

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

int main()
{
	int a;
	while(cin>>a)
	{
	cin>>a;
	int b =0;
	for(int c=0;c<10;c++)
		for(int d =0;d<10;d++)
			for(int e =0;e<10;e++)
				for(int f =0;f<10;f++)
				{
					if
						(c+d+e+f==a)
						b=b+1;
				}
				cout<<b<<endl;
}
}

C++: #include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <numeric>
#include <cmath>
#include <climits>
#include <limits>
#include <cfloat>
#include <fstream>
using namespace std;

int main()
{
	string str = "";

	while (getline (cin, str)){
		int n = 0;
		int res = 0;
		stringstream ss(str);
		ss >> n;
		for (int i = 0; i < 10000; ++i){
			int a = i/1000;
			int b = (i/100) % 10;
			int c = (i/10) % 10;
			int d = i % 10;
			
			if (a + b + c + d == n){
				++res;
			} // end if
		} // end for
		cout << res << endl;	
	} // end while

	return 0;
}

C++: #include<iostream>  
using namespace std; 
int main() { int n; while(cin>> n){ int ans=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)ans++; } } } } cout << ans << "\n"; } return 0; }

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

int main() {
	int n;
	while (cin >> n) {
		int count = 0;
		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 == n) ++count;
					}
				}
			}
		}
		cout << count << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <queue>
#include <vector>
#include <math.h>
#include <algorithm>
#include <iomanip>
#include <string>
using namespace std;

int main(){
	int n;
	while (cin >> n) {
		int dp[4][51] = {}; //abcd, n
		for (int i = 0; i <= 9; ++i) {
			dp[0][i] = 1;
		}
		for (int i = 1; i < 4; ++i) {
			for (int j = 0; j < 50; ++j) {
				for (int k = 0; k <= 9; ++k) {
					dp[i][j+k] += dp[i-1][j];
				}
			}
		}
		cout << dp[3][n] << endl;
	}
	return 0;
}

C++: #include <stdio.h>
int main() {
    int a,b,c,d,RideBack[55];for (a=0;a<=50;RideBack[a++]=0);
    for (a=0;a<10;a++) for (b=0;b<10;b++) for (c=0;c<10;c++) for (d=0;d<10;d++) RideBack[a+b+c+d]++;
    while (scanf("%d",&a)!=EOF) printf("%d\n",RideBack[a]);return 0;
}