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>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
using namespace std;

#define FOR(i,a,b) for(long long int i=(a);i<(b);i++)
#define REP(i,n) for(long long int i=0;i<(n);i++)
#define ALL(s) (s).begin(),(s).end()

#define PI 3.14159265358479

typedef long long int ll;
typedef vector<long long int> vi;

int main(){
	ll n, c = 0;
	while (cin >> n){
		REP(i, 10){
			REP(j, 10){
				REP(k, 10){
					REP(l, 10){
						if (i + j + k + l == n){
							c++;
							cout << i << "+" << j << "+" << k << "+" << l << "+=" << n << "\n";
						}
					}
				}
			}
		}
		cout << c << "\n";
		c = 0;
	}
}

C++: // http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0008&lang=jp

#include <iostream>
using namespace std;

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

C++: #include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,x,n) for(int i=(x);i<(n);i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define fir first
#define sec second
#define ub upper_bound
#define lb lower_bound
#define int long long
using namespace std;
const int MOD=1000000007;
const int INF=1000000009;

signed main(){
  int n;
  while(cin>>n){
    if(n>36)cout<<0<<endl;
    else{
      int sum,ans=0;
      rep(i,10){
        rep(j,10){
          rep(k,10){
            sum=(i+j+k);
            if(n-sum>=0&&n-sum<10)ans++;
          }
        }
      }
      cout<<ans<<endl;
    }
  }
  return 0;
}

C++: #include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;

int main(void) {
    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 << endl;
    }
    return 0;
}

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

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

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

int main() {
      int a,b,c,d,count;
      count = 0;
      int num[100];
      int max;
      int n;
      
      for (int v=0;v<100;v++) {
      	num[v] = 100;
      	cin >> num[v];
      	if (!(0<=num[v]&&num[v]<=50)){
      		max = v-1;
      		break;
      	}
      }
      for (int w=0;w<=max;w++){
      	n=num[w];
      	count = 0;
      	for (int i=0;i<=9;i++) {
            a=i;
            if (n-a<0) {

            	break;
            }
            for (int j=0;j<=n-a&&j<=9;j++) {
            	b=j;
            	if (n-a-b < 0) {
            		break;
            	}
            	for (int k=0;k<=n-a-b&&k<=9;k++) {
            		c=k;
            		if (n-a-b-c < 0) {
            			break;
            		}
            		
            		for (int l=0;l<=n-a-b-c&&l<=9;l++) {
            			d=l;
            			if (n==a+b+c+d) {
            				//cout << a << b << c << d <<(a+b+c+d)<<endl;
            				count++;
            			}
            			if (n-a-b-c-d < 0) {
            			break;
            		}
            		}
            	}
            }
      }
      
      cout << count <<endl;
      }
      return 0;
}

C++: #include <stdio.h>

int main(void) {
	int n;
	while (scanf("%d", &n) == 1) {
		int total = 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)
				total++;
		}}}}
		printf("%d\n", total);
	}
	return 0;
}

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

using namespace std;

// 2つの値の和がaとなる順列の数。
int func2(int a) {
	if (a > 18) {
		return 0;
	}
	int count = 0;
	
	for (int i = 0; i <= min(a, 9); ++i) {
		if (a - i < 10) {
			++count;
		}
	}
	return count;
}

// 3つの値の和がaとなる順列の数
int func3(int a) {
	if (a > 27) {
		return 0;
	}
	int count = 0;

	for (int i = 0; i <= min(a, 9); ++i) {
		count += func2(a - i);
	}
	return count;
}

// 4つの値の和がaとなる順列の数
int func4(int a) {
	if (a > 36) {
		return 0;
	}
	int count = 0;
	for (int i = 0; i <= min(a, 9); ++i) {
		count += func3(a - i);
	}
	return count;
}

int main() {
	int n;

	while (cin >> n) {
		cout << func4(n) << endl;
	}
	return 0;
}

C++: #include<iostream>
#include<cstdio>
using namespace std;
int main()
{
  int n;
  int cnt = 0;

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

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

C++: #include <stdio.h>
int main(){
int n;
int a, b, c, d;
int count;
while(scanf("%d", &n) != EOF){
count = 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){
count++;
break;
}
}
}
}
}
printf("%d\n", count);
}
return 0;
}

C++: #include <iostream>
using namespace std;
int main(void){
    int n, x, cnt;
    while(cin >> n){
        x = 0;
        for(int i = 0; i < 10; i++){
            for(int j = i; j < 10; j++){
                for(int k = j; k < 10; k++){
                    for(int l = k; l < 10; l++){
                        if(n == i + j + k + l){
                            cnt = 0;
                            if(i == j || i == k || i == l)  cnt++;
                            if(j == k || j == l)    cnt++;
                            if(k == l)  cnt++;
                            if(cnt == 3)   x ++;
                            else if(cnt == 2)   x += 4; 
                            else if(cnt == 1){
                                if(i == j && j != k && k != l)  x += 12;
                                else if(j == k && i != j && k != l)  x += 12;
                                else if(k == l && i != j && j != k)  x += 12;
                                else    x += 4;
                            }
                            else    x += 24;
                        }
                    }
                }
            }
        }
        cout << x << endl;
    }
    
    return 0;
}

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

int main() {

    vector<int> result (51);

    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++) {
                    result[a+b+c+d] += 1;
                }
            }
        }
    }

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