Go: package main

import "fmt"

func main() {
	var n int

	for {
		result := 0
		_, err := fmt.Scanf("%d", &n)
		if err != nil {
			return
		}

		if n <= 36 {
			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 {
								// fmt.Println(a, b, c, d)
								result++
							}
						}
					}
				}
			}
		}
		fmt.Println(result)
	}
}

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

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

C++: #include "stdio.h"

int main()
{
    int a, b, c, d, n;
    while(scanf("%d", &n) != EOF)
    {
        int count = 0;
        for (int i = 0; i <= 9; i++)
        {
            for (int j = 0; j <= 9; j++)
            {
                for (int m = 0; m <= 9; m++)
                {
                    for (int i = 0; i <= 9; i++)
                    {
                        if (a + b + c + d == n)
                            count++;
                    }
                }
            }
        }
        printf("%d\n", count);
    }
    return 0;
}

C++: #include <cstdio>  
  #include<iostream>
#include<algorithm>
  
int main()  
{  
    int n, cnt, i, j, k, l;  
  
    while(cin >> n) {  
        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(i + j + k + l == n)  
                            cnt++;  
  
      cout << cnt << endl;
    }  
  
    return 0;  
}

C++: #include <iostream>
#include <algorithm>
#include <vector>
#include <functional>
#include <sstream>
#include <stdio.h>
using namespace std;

// Sum of 4 Integers(0008)
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 << endl;
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
	int n,a,b,c,d,m;
	while(cin>>n){
		m=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(n==a+b+c+d){
							m+=1;
						}
					}
				}
			}
		}
		cout<<m<<endl;
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
int main() {
  int n, cnt = 0;
  while(cin >> n) {
	for(int i = 0; i <= 9; ++i) {
	  if(i > n) break;
	  for(int j = 0; j <= 9; ++j) {
		if(i+j > n) break;
		for(int k = 0; k <= 9; ++k) {
		  if(i+j+k > n) break;
		  for(int l = 0; l <= 9; ++l) {
			if(i+j+k+l > n) break;
			else if(i+j+k+l == n) cnt++;
		  }
		}
	  }
	}
	cout << cnt << endl;
  }
  return 0;
}

C++: #include<iostream>
#define REP(i,n) for(int i=1;i<=n;i++)
using namespace std;

#define N 10

int main()
{
    int t;
    while(cin >> t)
    {
        int ans = 0;
        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)==t)ans++;

        cout << ans << endl;
    }

    return 0;
}

C++: #include<iostream>
int main()
{
	int result[50];
	int num;
	for(int i = 0;; i++)
	{
		result[i] = 0;
		int n;
		std::cin >> n;
		if(std::cin.eof())
		{
			num = i;
			break;
		}
		for(int j = 0; j <= 9; j++)
		{
			for(int k = 0; k <= 9; k++)
			{
				for(int l = 0; l <= 9; l++)
				{
					for(int m = 0; m <= 9; m++)
					{
						if(j + k + l + m == n)
						{
							result[i]++;
						}
					}
				}
			}
		}
	}
	for(int i = 0; i < num; i++)
	{
		std::cout << result[i] << std::endl;
	}
	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;
}

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