Go: package main

import "fmt"

var count int

func main() {
	var inputNum int
	for {
		fmt.Scanf("%d", &inputNum)
		fmt.Printf("%d\n", calcA(inputNum))
		count = 0
	}
}

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 <bits/stdc++.h>
using namespace std;

int main(){

  int n;

  while(cin>>n){
    int cnt=0;

    for(int i=0;i<=9;++i){
      for(int j=0;j<=9;++j){
        for(int k=0;k<=9;++k){
          if(n-i-j-k<10&&n-i-j-k>=0) ++cnt;
        }
      }
    }

    cout<<cnt<<endl;
  }

  return EXIT_SUCCESS;
}

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

int main(){
  int n,i,S;
  while(1){
    i=0;
    cin>>n;
    for(S=1;S<=9999;S++){
      if((S/1000)+((S-S/1000*1000)/100)+((S-S/100*100)/10)+(S-S/10*10)==n)
	i=i+1;
    }
    cout<<i<<endl;
  }
  return 0;
}

C++: #include <iostream>

int main()
{
	int n;
	while( std::cin >> n )
	{
		int num = 0;
		for( int i1=0; i1<=9; ++i1 )
		{
			for( int i2=0; i2<=9; ++i2 )
			{
				for( int i3=0; i3<=9; ++i3 )
				{
					for( int i4=0; i4<=9; ++i4 )
					{
						num += (i1+i2+i3+i4 == n);
					}
				}
			}
		}

		std::cout << num << '\n';
	}
}

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

#define MIN(a,b) ((b<a)?b:a)
#define MAX(a,b) ((b>a)?b:a)

int main(){
	int n;
	while(scanf("%d", &n)!=EOF){
	int c=0;
	int i,j,k;
	int t=n;
	for(i=MAX(t-27,0);i<=MIN(t,9);i++){
		t-=i;
		for(j=MAX(t-18,0);j<=MIN(t,9);j++){
			t-=j;
			for(k=MAX(t-9,0); k<=MIN(t,9) ;k++){
				c++;
			}
			t+=j;
		}
		t+=i;
	}
	printf("%d\n", c);
}
}

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

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

C++: #include<stdio.h>
int main()
{
	int n;
	while(scanf("%d",&n))
	{
		int count=0;
		for(int i=0;i<=9;i++)
			for(int j=0;j<=9;j++)
				for(int k=0;k<=9;k++)
						if(9>=n-i-j-k && n-i-j-k >=0)
							count++;
		printf("%d\n",count);
	}
	return 0;
}

C++: #include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
using namespace std;
typedef pair<int, int> P;

signed main(){
	int n;
	while(cin >> n){
		int ans = 0;
		rep(i, 0, 10){
			rep(j, 0, 10){
				rep(k, 0, 10){
					rep(l, 0, 10){
						if(i + j + k + l == n) ans++;
					}
				}
			}
		}
		cout << ans << endl;
	}
}

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; j <= 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 <iostream>
#include <cstdio>
#include <cstdlib>

using namespace std;

int main()
{
	int n;

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

	return 0;
}

C++: import java.util.*;class Main{public static void main(String[]a){new Main();}public Main(){f(3,0);for(Scanner s=new Scanner(System.in);s.hasNext();){Object i=m.get(s.nextInt());System.out.println(i==null?0:i);}}Map<Integer,Integer>m=new HashMap<Integer,Integer>();void f(int n,int s){for(int i=0,r;i<10;i++){r=s+i;if(n<1)m.put(r,m.get(r)!=null?m.get(r)+1:1);else f(n-1,r);}}}

C++: #include <iostream>

int combinations_of_sum_of_4_integers(int n);

int main(int argc, char** argv) {
	int n;

	while(std::cin >> n) {
		std::cout << combinations_of_sum_of_4_integers(n) << std::endl;
	}
}

int combinations_of_sum_of_4_integers(int n) {
	int i, j, k, l, result;
	result = 0;
	if(n > 36) {
		return 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) {
						result += 1; 
					}
				}
			}
		}
	}
	return result;
}

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

int main() {
	// your code goes here
	int n;
	while(cin>>n){
	int count=0;
		for(int i=9; i>=0; i--){
			for(int j=9; j>=0; j--){
				for(int k=9; k>=0; k--){
					for(int l=9; l>=0; l--){
						if(i+j+k+l==n)count++;
					}
				}
			}
		
	
	}
	cout<<count<<endl;
	}
	return 0;
}

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

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

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

int main()
{
	int n,nn=0;
	int countdata [100];

	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++;
						}
					}
				}
			}
		}
		countdata[nn] = count;
		nn++;
	}
	for (int a=0;a<nn;a++)
		cout << countdata[a] << endl;
}

C++: #include<iostream>

using namespace std;

int main(){
  int pair[100];
  int input;
  
  for(int i = 0; i < 10; i++)
    for(int j = 0; j < 10; j++)
      pair[i * 10 + j] = i + j;


  while(cin >> input){
    int count = 0;
    if(input > 36){
      continue;
    } else {
      for(int i = 0; i < 100; i++){
	int cd = input - pair[i];
	
	if(cd <= 18){
	  for(int j = 0; j < 100; j++) if(pair[j] == cd)
	      count++;
	}
      }
    }
    
    cout << count << endl;
  }

  return 0;
}

C++: #include <stdio.h>

int main(void){
	int t[100];
	int n = 0;
	int c = 0;

	for(int i=0;i<=9;++i){
		for(int j=0;j<=9;++j){
			t[i*10+j] = i+j;
		}
	}

	while(scanf("%d", &n) != EOF){
		c = 0;
		for(int i=0;i<100;++i){
			for(int j=0;j<100;++j){
				if(t[i]+t[j] == n){
					c++;
				}
			}
		}
		printf("%d\n", c);
	}
	return 0;
}

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

using namespace std;

int solve(const int n) {
	set< vector<int> > s;
	vector<int> v(4);
	for (v[0] = 0; v[0] < 10; v[0]++)
		for (v[1] = 0; v[1] < 10; v[1]++)
			for (v[2] = 0; v[2] < 10; v[2]++)
				for (v[3] = 0; v[3] < 10; v[3]++) {
					int sum = 0;
					for (int i = 0; i < 4; i++) sum += v[i];
					if (sum == n) {
						s.insert(v);
						break;
					}
				}
	return s.size();
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	while (cin) {
		int n;
		cin >> n;
		cout << solve(n) << endl;
	}
	return 0;
}

C++: #include <cmath>
#include <cstdlib>
#include <cstdio>

#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>

int main() {
  long n;
  long last;
  long count;

  while( std::cin >> n ) {
    count = 0;
    for(int i = 0; i <= 9; ++i) {
      for(int j = 0; j <= 9; ++j) {
	for(int k = 0; k <= 9; ++k) {
	  last = n - (i + j + k);
	  if( 0 <= last and last <= 9 ) {
	    ++count;
	  }
	}
      }
    }
    
    std::cout << count << std::endl;
  }

  return 0;
}

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

int main(){
	int n;
	cin>>n;
	for(int i=1;i<=n;i++){
		int a,b,c;
		cin>>a>>b>>c;
		if(a*a+b*b==c*c || a*a==b*b+c*c || a*a+c*c==b*b){
			cout<<"YES"<<endl;
		}
		else cout<<"NO"<<endl;
	}
}