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 <algorithm>
#include <iostream>
#include <vector>

namespace {

int combination(int a, int b, int c, int d)
{
  // (a,a,a,a)
  if (a == d) {
    return 1;
  }
  // (a,a,a,d) or (a,b,b,b)
  else if (a == c || b == d) {
    return 4;
  }
  // (a,a,c,c)
  else if (a == b && c == d) {
    return 6;
  }
  // (a,a,c,d) or (a,b,b,d) or (a,b,c,c)
  else if (a == b || b == c || c == d) {
    return 12;
  }
  // (a,b,c,d)
  else {
    return 24;
  }
}

int calc(int n)
{
  int com = 0;
  int a, b, c, d;

  for (a = 0; a <= 9; ++a) {
    if (a > n) break;
    for (b = a; b <= 9; ++b) {
      if (a + b > n) break;
      for (c = b; c <= 9; ++c) {
        if (a + b + c > n) break;
        for (d = c; d <= 9; ++d) {
          const int sum = a + b + c + d;
          if (sum == n) {
            com += combination(a, b, c, d);
          }
          else if (sum > n) {
            break;
          }
        }
      }
    }
  }

  return com;
}

} // unnamed namespace

int main()
{
  int n;
  while (std::cin >> n) {
    std::cout << calc(n) << std::endl;
  }

  return 0;
}

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

int main(){
  int n;
  while(cin >> n){
    int cnt;
    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>
#include <vector>
using namespace std;

int count = 0;
void dfs(int num, int tempsum, int sum) {
	if (sum < tempsum)
		return;
	if (num == 4) {
		if (tempsum == sum) {
			count++;
		}
		return;
	}

	for (int i = 9; i >= 0; i--) {
		dfs(num+1,tempsum + i,sum);
	}
}  

int main()  
{  
	int iSum = 0;
	while (cin >> iSum) {
		count = 0;
		dfs(0,0,iSum);
		cout << count << endl;
	}

	return 0;
}

C++: #include<iostream>

using namespace std;

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

C++: 
#include <iostream>

using namespace std;

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

C++: #include<stdio.h>

int main(){

int num,i,j,a,b,c,d;
int date[51]={0};


for(i=0;i<=9999;i++){
	
	a=i/1000;
	b=i%1000/100;
	c=i%100/10;
	d=i%10;
	date[a+b+c+d]++;

}


while(scanf("%d",&num)!=EOF){



printf("%d\n",date[num]);
}
return 0;
}

C++: #include<iostream>
using namespace std;
int x,ans;
int main(){
while(1){
ans=0;
cin>>x;
if(x<0)return 0;
for(int i=0;i<10;i++){
for(int j=0;i<10;j++){
for(int k=0;k<10;k++){
if(x-(i+j+k)<10){
ans++;
}
}
}
}
cout<<ans;
}
}