Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var scanner = bufio.NewScanner(os.Stdin)

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func nextInt() (int, error) {
	return strconv.Atoi(nextString())
}

func main() {
	scanner.Split(bufio.ScanWords)

	counts := map[int]int{}
	for i := 0; i < 10; i++ {
		for j := 0; j < 10; j++ {
			for k := 0; k < 10; k++ {
				for l := 0; l < 10; l++ {
					s := i + j + k + l
					if s <= 50 {
						counts[s]++
					}
				}
			}
		}
	}
	// fmt.Println(counts)
	for {
		n, err := nextInt()
		if err != nil {
			break
		}
		cnt, ok := counts[n]
		if ok {
			fmt.Println(cnt)
		} else {
			fmt.Println(0)
		}
	}
}

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

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

C++: #include <stdio.h>
#include <string.h>

int main( void ){
    int nCount = 0;
    int n[50];
    int m = 0;
    char str[3];
    while( true ){
        gets( &n[m] );
        if(( n[m] = atoi(str)) == -1 ) break;
        m++;
    }
    for( int a = 0;i < m;a++ ){
    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[a] ) nCount++;
                }
            }
       }
    }
    printf( "%d\n",nCount );
    }
    return 0;
}

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

int main(){
	while(1){
		int ans=0;
		int n;
		cin>>n;
		if(cin.eof())break;
		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)ans++;
					}
				}
			}
		}
		cout<<ans<<endl;
	}
}

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

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++;
	  }
	}
      }
    }

    cout << ans << endl;
  }
}

C++: int main(){
	
	int e;
	int f=0;
	while(std::cin>>e){
		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==e){
							f++;
						}
		            }
		        }
		    }
		}
		std::cout<<f<<std::endl;
	}
    
    return 0;
    
}

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

C++: #include <stdio.h>
#include <algorithm>

using namespace std;
int main(void)
{
	int i, j, k, h, n;
	int sum = 0;
	while (scanf("%d", &n) != EOF){
		
		sum = 0;
		
		for (i = 0; i < 10; i++){
			for (j = 0; j < 10; j++){
				for (k = 0; k < 10; k++){
					for (h = 0; h < 10; h++){
						if (i + j + k + h == n){
							sum++;
						}
					}
				}
			}
		}
	
	
		printf("%d\n", sum);
	}
	return (0);
}

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;
}