Problem:


Sum of 4 Integers

Write a program which reads an integer n  and identifies the number of combinations of a, b, c and d (0 ≤ a, b, c, d ≤ 9) which meet the following equality:

a + b + c + d = n

For example, for n = 35, we have 4 different combinations of (a, b, c, d): (8, 9, 9, 9), (9, 8, 9, 9), (9, 9, 8, 9), and (9, 9, 9, 8).

Input

The input consists of several datasets. Each dataset consists of n (1 ≤ n ≤ 50) in a line. The number of datasets is less than or equal to 50.

Output

Print the number of combination in a line.

Sample Input

35
1

Output for the Sample Input

4
4



Sample input:
35
1


Sample output:
4
4

Submission status: Wrong Answer

Solution code:
x=[0]*37
for a in range(10):
	for b in range(10):
		for c in range(10):
			for d in range(10):
				x[a+b+c+d]+=1
while True:
	try:
		print(x[int(input())])
	except:
		break

Submission status: Wrong Answer

Solution code:
cnt=0
n=int(input())

s=range(10)

for i in s:
    for j in s:
        for k in s:
            for l in s:
                if i+j+k+l==n:
                    cnt+=1

print(cnt)

Submission status: Wrong Answer

Solution code:
n = int(raw_input())
ans = 0
for a in range(min(n+1,10)):
    for b in range(min(n+1,10)):
        for c in range(min(n+1,10)):
            for d in range(min(n+1,10)):
                if a + b + c + d ==n:
                    ans += 1
print ans

Submission status: Wrong Answer

Solution code:
n = int(raw_input())
ans = 0
for a in range(min(n+1,10)):
    for b in range(min(n+1,10)):
        for c in range(min(n+1,10)):
            for d in range(min(n+1,10)):
                
                if a + b + c + d ==n:
                    ans += 1
                    print a,b,c,d
print ans

Submission status: Wrong Answer

Solution code:
n = int(raw_input())
ans = 0
for a in range(min(n+1,10)):
    for b in range(min(n+1,10)):
        for c in range(min(n+1,10)):
            for d in range(min(n+1,10)):
                
                if a + b + c + d ==n:
                    ans += 1
print int(ans)

Submission status: Wrong Answer

Solution code:
n = int(raw_input())
ans = 0
for a in range(1,10):
    for b in range(1,10):
        for c in range(1,10):
            for d in range(1,10):
                if a + b + c + d ==n:
                    ans += 1
print ans

Submission status: Wrong Answer

Solution code:
n = int(raw_input())

x = [0]*51
for a in xrange(0,10):
    for b in xrange(0,10):
        for c in xrange(0,10):
            for d in xrange(0,10):
                x[a+b+c+d] +=1
print x[n]

Submission status: Wrong Answer

Solution code:
#! /usr/bin/python3

s=int(input())
n=0
for i in range(10):
    for j in range(10):
        for k in range(10):
            for l in range(10):
                if s == i+j+k+l: n+=1
print(n)

Submission status: Wrong Answer

Solution code:
import itertools

N = int(raw_input())

res = 0
l = [1,2,3,4,5,6,7,8,9]
for element in itertools.combinations_with_replacement(l,5):
    if sum(element) == N:
        res += 1
print res

Submission status: Wrong Answer

Solution code:
import itertools

l = [1,2,3,4,5,6,7,8,9]

while True:
    try:
        N = int(raw_input())
        res = 0
        for element in itertools.combinations_with_replacement(l,4):
            if sum(element) == N:
                print element
                res += 4
        print res
    except EOFError:
        break

Submission status: Wrong Answer

Solution code:
import itertools

l = [0,1,2,3,4,5,6,7,8,9]

while True:
    try:
        N = int(raw_input())
        res = 0
        for element in itertools.combinations_with_replacement(l,4):
            if sum(element) == N:
                print element
                res += 4
        print res
    except EOFError:
        break

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

while(True):
    try:
        n = int(raw_input())
        sum = 0
        for a in range(10):
            for b in range(10):
                for c in range(10):
                    for d in range(10):
                        if (a + b + c + d == n):
                            sum += 0
        print sum
    except EOFError:
        break

Submission status: Wrong Answer

Solution code:
import sys
r=range(10)
x=[0]*50
for a in r:
	for b in r:
		for c in r:
			for d in r:
				x[a+b+c+d-1]+=1
for l in sys.stdin:
	print x[int(l)-1]

Submission status: Wrong Answer

Solution code:
# coding: utf-8
#Problem Name: Debt Hell
#ID: tabris
#Mail: t123037@kaiyodai.ac.jp

n = float(raw_input())
dept = 100000
for i in range(int(n)):
    dept *= 1.05
    if not (dept/1000).is_integer():
        dept /= 1000
        dept = __import__('math',fromlist=['floor']).floor(dept)*1000+1000
print int(dept)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
#Problem Name: Sum of 4 Integers
#ID: tabris
#Mail: t123037@kaiyodai.ac.jp

while True:
    try:
        n = int(raw_input())
        List = []
        for i in range(10):
            for j in range(10):
                for k in range(10):
                    for l in range(10):
                        if i+j+k+l == n:
                            List.append( (i,j,k,l) )
            print len(set(List))
    except:
        break

Submission status: Wrong Answer

Solution code:
from itertools import product

while True:
    try:
        n = int(input)
    except:
        break
    count = sum(a + b + c + d == n for a, b, c, d in product(range(10), repeat=4))
    print(count)

Submission status: Wrong Answer

Solution code:
#! /usr/bin/env python
 
n = int(raw_input())
 
x = 0
i = range(10)
 
 
for a in i:
    for b in i:
        for c in i:
            for d in i:
                if a + b + c + d == n:
                    x = x + 1
print x

Submission status: Wrong Answer

Solution code:
import itertools
import sys


c = list(itertools.product(range(10), repeat=4))

if __name__ == '__main__':
    for n in sys.stdin.readlines():
        print n

Submission status: Wrong Answer

Solution code:
n = input()
ans = 0
a=b=c=d=0
while True:
    if d==10:
        c+=1
        d=0
    if c==10:
        b+=1
        c=0
    if b==10:
        a+=1
        b=0
    if a == 10:
        break
    #print "%d+%d+%d+%d"%(a,b,c,d)
    s = a+b+c+d
    if s == n:
        ans+=1
    d+=1
print ans

Submission status: Wrong Answer

Solution code:
import math
a=input()
cnt=0
for i in xrange(0,10):
    for j in xrange(0,10):
        for k in xrange(0,10):
            for l in xrange(0,10):
                if i+j+k+l==a:
                    cnt+=1
print cnt

Submission status: Wrong Answer

Solution code:
import math
a=input()
if a<37:
    cnt=0
    for i in xrange(0,10):
        for j in xrange(0,10):
            for k in xrange(0,10):
                for l in xrange(0,10):
                    if i+j+k+l==a:
                        cnt+=1
    print cnt
else:print 0

Submission status: Wrong Answer

Solution code:

while True:
	try:
		n=int(input())
		cnt=0
		for a in range(10):
			if a<=n:
				for b in range(10):
					if b<=n:
						for c in range(10):
							if c<=n:
								d = n-(a+b+c)
								if 0<=d<=9:
									cnt+=1
								else:
									break
					else:
						break
			else:
				break
		print(cnt)
	except EOFError:
		break

Submission status: Wrong Answer

Solution code:
n = input()
flag = 0

for a in range(10):
    for b in range(10):
        for c in range(10):
            for d in range(10):
                if a+b+c+d == n:
                    flag += 1

print flag

Submission status: Wrong Answer

Solution code:
n = int(input())
flag = 0

for a in range(10):
    for b in range(10):
        for c in range(10):
            for d in range(10):
                if a+b+c+d == n:
                    flag += 1

print flag

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
def main(): 
	num = int(input())
	if num >= 19:
		num = 19 - num + 17
	res = 1
	gro1 = 3
	for i in range(8):
		if i == num:
			return res
		if i == 0:
			gro2 = 3
		else:
			gro2 += 1
		res += gro1
		gro1 += gro2
	
	for i in range(8,19):
		if i == num:
			return res
		gro2 -= 3
		res += gro1
		gro1 += gro2
			
		
if __name__ == '__main__':
	print(main())

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
def kai(num): 
	if num >= 19:
		num = 19 - num + 17
	res = 1
	gro1 = 3
	for i in range(8):
		if i == num:
			return res
		if i == 0:
			gro2 = 3
		else:
			gro2 += 1
		res += gro1
		gro1 += gro2
	
	for i in range(8,19):
		if i == num:
			return res
		gro2 -= 3
		res += gro1
		gro1 += gro2
def main():
	while True:
		try:
			num = int(input())
		except:
			return
		else:
			print(kai(num))
		
if __name__ == '__main__':
	main()

Submission status: Wrong Answer

Solution code:
n = input()
flugs = [0]*51
for i in range(10):
    for j in range(10):
        for k in range(10):
            for l in range(10):
                flugs[i+j+k+l] += 1

print flugs[int(n)]

Submission status: Wrong Answer

Solution code:
import sys

sum = [0] * 51
for i in range(10):
    for j in range(10):
        for k in range(min(10,18-i-j)):
            for l in range(min(10,18-i-j-k)):
                sum[i+j+k+l] += 1
                sum[36-i-j-k-l] += 1

for i in sys.stdin:
    print(sum[int(i)])

Submission status: Wrong Answer

Solution code:
n = int(input())
cnt = 0
for i in range(10):
    for j in range(10):
        for k in range(10):
            for l in range(10):
                if i+j+k+l == n:
                    cnt += 1
                    print(i,j,k,l)
print(cnt)

Submission status: Wrong Answer

Solution code:
n = int(input())
cnt = 0
for i in range(10):
    for j in range(10):
        for k in range(10):
            for l in range(10):
                if i+j+k+l == n:
                    cnt += 1
print(cnt)

Submission status: Wrong Answer

Solution code:
n=int(input())
cnt=0
for i in range(10):
    for j in range(10):
        for k in range(10):
            for l in range(10):
                if i+j+k+l==n:
                    cnt=cnt+1
                    print(i,j,k,l)

print(cnt)

Submission status: Wrong Answer

Solution code:
n=int(input())
cnt=0
for i in range(10):
    for j in range(10):
        for k in range(10):
            for l in range(10):
                if i+j+k+l==n:
                    cnt=cnt+1

print(cnt)

Submission status: Wrong Answer

Solution code:
import itertools
def combination(n):
 c=0
 for i in itertools.product(range(10),repeat=4):
  (a,b,c,d)=i
  if a+b+c+d==n:
   c+=1
 return c

while True:
 try:
  n=int(input())
  combination(n)
 except EOFError:
  break

Submission status: Wrong Answer

Solution code:
import itertools
def combination(n):
 m=0
 for i in itertools.product(range(10),repeat=4):
  (a,b,c,d)=i
  if a+b+c+d==n:
   m+=1
 return m

while True:
 try:
  n=int(input())
  combination(n)
 except EOFError:
  break

Submission status: Wrong Answer

Solution code:
INF=-1
memo=[[INF]*51 for i in range(5)]
def rec(i,n):
    if memo[i][n]!=INF:
        return memo[i][n]
    if i==4:
        return 1 if n==0 else 0
    for m in range(10):
        memo[i][n]+=rec(i+1,n-m)
    return memo[i][n]
while True:
    try:
        n=int(input())
        print(rec(0,n))
    except:
        break

Submission status: Wrong Answer

Solution code:

memo=[[-1]*51 for i in range(5)]
def rec(i,n):
    if memo[i][n]!=-1:
        return memo[i][n]
    memo[i][n]=0
    if i==4:
        return 1 if n==0 else 0
    for m in range(10):
        memo[i][n]+=rec(i+1,n-m)
    return memo[i][n]
    
while True:
    try:
        n=int(input())
        print(rec(0,n))
    except:
        break

Submission status: Wrong Answer

Solution code:
import sys

p = [0] * 51
v = 0
for i in range(10):
    p[i] = p[36-i] = (i+3)*(i+2)*(i+1)//6

for i in range(10,19):
    p[i] = p[36-i] = (i+1)*(i+2)*(1-i)//2

for i in sys.stdin:
    print(p[int(i)])

Submission status: Wrong Answer

Solution code:
n=int(input())
cnt=0
for i in range(10):
    for j in range(10):
        for k in range(10):
            for l in range(10):
                if i+k+j+l==n:
                    cnt+=1
print(cnt)

Submission status: Wrong Answer

Solution code:
n = int(input().rstrip())
cnt = 0

for a in range(10):
    for b in range(10):
        for c in range(10):
            for d in range(10):
                if a + b + c + d == n:
                    cnt = cnt + 1

print(str(cnt))

Submission status: Wrong Answer

Solution code:
import sys

a=[]

for num in sys.stdin:
  a.append(num)

for n in a:
  time=0

  if n<=18:
    for i in range(n+1):
      if i<=9:
        if n-i<=9:
          time+=(i+1)*(n-i+1)
        else:
          time+=(i+1)*(19-n+i)
      else:
        time+=(19-i)*(n-i+1)
  elif n>18 and n<=36:
    for i in range(37-n):
      pre=i+n-18
      if pre<=9:
        time+=(pre+1)*(19-n+pre)
      else:
        if n-pre<=9:
          time+=(19-pre)*(n-pre+1)
        else:
          time+=(19-pre)*(19-n+pre)
  print time

Submission status: Wrong Answer

Solution code:
n=input()
c=0
for i in range(10000):
	if n==sum(map(int, list(str(i)))):
		c+=1
print c

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
# -*- conding: utf-8 -*-
import itertools
import sys
import math

for line in sys.stdin.readlines():
    n = int(line.strip())
    if n == 36:
        print(1)
        continue
    if n > 36:
        print(0)
        continue
    cnt = 0
    cmbs = itertools.combinations_with_replacement(range(0,10), 4)
    for cmb in cmbs:
        if sum(cmb) == n:
            if len(set(cmb)) == 1:
                cnt += 1
            elif len(set(cmb)) == 2:
                cnt += math.factorial(2) * 2
            elif len(set(cmb)) == 3:
                cnt += math.factorial(3)
            elif len(set(cmb)) == 4:
                cnt += math.factorial(4)
    print(cnt)

Submission status: Wrong Answer

Solution code:
num=int(input())
sum=0
Range=10
for a in range(Range):
    for b in range(Range):
        for c in range(Range):
            for d in range(Range):
                if num==a+b+c+d:
                    sum+=1
print(sum)

Submission status: Wrong Answer

Solution code:
import sys
import math as mas

n=int(input())
out=0
for i in range(10):
	for j in range(10):
		for k in range(10):
			for l in range(10):
				if(i+j+k+l==n):out+=1
print(out)

#for i in sys.stdin:
#	a,b=map(int,i.split())
#	print(gcd(a,b),lcm(a,b))

Submission status: Wrong Answer

Solution code:
import sys
def count(number) :
    result = 0
    for a in range(10) :
        for b in range(10) :
            for c in range(10) :
                for d in range(10) :
                    if a + b + c + d == 35 : result += 1
    return result

for make in sys.stdin.readlines():
    print(count(make))

Submission status: Wrong Answer

Solution code:
import sys
def count(number) :
    result = 0
    for a in range(10) :
        for b in range(10) :
            for c in range(10) :
                for d in range(10) :
                    if a + b + c + d == 35 : result += 1
    return result

for make in sys.stdin : print(count(make))

Submission status: Wrong Answer

Solution code:
for _ in range(50):
    try:
        n = int(input()) # 1 <= n <= 50
        ans =set()
        for a in range(10):
            if (n - a) >= 1:
                for b in range(10):
                    if(n - a -b) >= 1:
                        for c in range(10):
                            if(n - a - b - c) >= 1:
                                for d in range(10):
                                    if(n - a - b - c - d) == 0:
                                        ans.add("{},{},{},{}".format(a,b,c,d))
        print(len(ans))
    except EOFError:
        break

Submission status: Wrong Answer

Solution code:
for _ in range(50):
    try:
        n = int(input()) # 1 <= n <= 50
        ans =set()
        for a in range(10):
            if (n - a) >= 1:
                for b in range(10):
                    if(n - a -b) >= 1:
                        for c in range(10):
                            if(n - a - b - c) >= 1:
                                for d in range(10):
                                    if(n - a - b - c - d) == 0:
                                        ans.add("{},{},{},{}".format(a,b,c,d))
                                        ans.add("{},{},{},{}".format(b,c,d,a))
                                        ans.add("{},{},{},{}".format(c,d,a,b))
                                        ans.add("{},{},{},{}".format(d,a,b,c))
        print(ans)
        print(len(ans))
    except EOFError:
        break

Submission status: Wrong Answer

Solution code:
p = input()
p = int(p)
i = 0
for a in range(0, 10):
    for b in range(0, 10):
        for c in range(0, 10):
            for d in range(0, 10):
                sum = a + b + c + d
                if sum == p:
                    i += 1
print(i)

Submission status: Wrong Answer

Solution code:
n=int(input())
print(len([[a,b,c,d]for a in range(10)for b in range(10)for c in range(10)for d in range(10)if a+b+c+d==n]))

Submission status: Wrong Answer

Solution code:
n = int(input())
count = 0
for i in range(10):
    for j in range(10):
        for k in range(10):
            for l in range(10):
                if i + j + k + l == n:
                    count += 1
print(count)

Submission status: Wrong Answer

Solution code:
user = input()
n = int(user)
num = 0
for a in range(10):
    for b in range(10):
        for c in range(10):
            for d in range(10):
                if(n == a + b + c + d):
                    num += 1

print(num)

Submission status: Wrong Answer

Solution code:
n=int(input())
count=0
for a in range(1,10):
    for b in range(1,10):
        for c in range(1,10):
            if 50-a-b-c>=0 and 50-a-b-c<10:
                count+=1
print(count)

Submission status: Wrong Answer

Solution code:
n=int(input())
count=0
for a in range(0,10):
    for b in range(0,10):
        for c in range(0,10):
            if 50-a-b-c>=0 and 50-a-b-c<10:
                count+=1
print(count)

Submission status: Wrong Answer

Solution code:
import sys
import math

def case(a,b):
	return math.factorial(a+b)/(math.factorial(a)*math.factorial(b))

while True:
	try:
		n = int(input())
		if n >= 37:
			print('0')
		elif n >= 10 and n <= 36:
			print(case(n,4)-case(n-10,3))
		else:
			print(case(n,4))		
	except EOFError:
		break

Submission status: Wrong Answer

Solution code:
import sys
import math

def case(a,b):
	return math.factorial(a+b)/(math.factorial(a)*math.factorial(b))

while True:
	try:
		n = int(input())
		if n >= 37:
			print('0')
		elif n >= 10 and n <= 18:
			print(int(case(n,3)-3*case(n-9,2)))
		elif n >= 19 and n <= 27:
			print(int(case(n,3)-3*case(n-9,2)-3*case(n-18,1)))
		elif n >= 28 and n <= 36:
			print(int(case(36-n,3)))
		else:
			print(int(case(n,3)))	
	except EOFError:
		break

Submission status: Wrong Answer

Solution code:
import sys
import math

def case(a,b):
	return math.factorial(a+b)/(math.factorial(a)*math.factorial(b))

while True:
	try:
		n = int(input())
		if n >= 37:
			print('0')
		elif n >= 10 and n <= 18:
			print(int(case(n,3)-3*case(n-9,3)))
		elif n >= 19 and n <= 27:
			print(int(case(36-n,3)-3*case(36-n-9,3)))
		elif n >= 28 and n <= 36:
			print(int(case(36-n,3)))
		else:
			print(int(case(n,3)))	
	except EOFError:
		break

Submission status: Wrong Answer

Solution code:
n = int(input())

def rec(j,s):
    if s > n:
        return 0
    if s == n:
        return 1
    if j == 0:
        return 0
    v = 0
    for i in range(10):
        v += rec(j-1, s + i)
    return v

print(rec(4,0))

Submission status: Wrong Answer

Solution code:
import itertools

N = int(input())
count = 0

for i in list(itertools.combinations_with_replacement(range(10), 4)):
    if (sum(i) == N):
        count += 1

print(count)

Submission status: Wrong Answer

Solution code:
import sys

inputs = sys.argv[1:]

for i in inputs:
    if i=='\n':
        continue
    ans = 0
    n = int(i)
    #logic
    for i in range(10):
        for j in range(10):
            for k in range(10):
                for l in range(10):
                    if i + j + k + l == n:
                        ans +=1
    print "{}\n".format(ans)

Submission status: Wrong Answer

Solution code:
s = int(input())
results=set()
for a in range(10):
    for b in range(10):
        for c in range(10):
            d = s-a-b-c
            if d<0:break
            if d<=9: results.add((a,b,c,d))
print(len(results))

Submission status: Wrong Answer

Solution code:
n = int(raw_input())
sum = 0
for a in range(10):
    for b in range(10):
        for c in range(10):
            for d in range(10):
                #print a , b, c, d
                #print n
                if (a+b+c+d == n):
                    sum += 1
                
print sum

Submission status: Wrong Answer

Solution code:
import itertools, sys

d = {i: 0 for i in range(51)}
for i in itertools.combinations_with_replacement(range(0,10), 4):
    d[sum(i)] += 1
print(d)
for i in map(int, sys.stdin):
    print(d[i]*4)

Submission status: Wrong Answer

Solution code:
import itertools, sys

d = {i: 0 for i in range(51)}
for i in itertools.combinations_with_replacement(range(0,10), 4):
    if i[0] == i[1] == i[2] == i[3]:
        continue
    d[sum(i)] += 1
for i in map(int, sys.stdin):
    if i / 4 == 0:
        print(d[i]*4+1)
    else:
        print(d[i]*4)

Submission status: Wrong Answer

Solution code:
num = int(input())
count = 0
for a in range(10):
	for b in range(10):
		for c in range(10):
			for d in range(10):
				if a+b+c+d==num:
					count+=1
print(int(count))

Submission status: Wrong Answer

Solution code:
n = int(input())
ans = 0
table = [[a,b,c,d] for a in range(10) for b in range(10) for c in range(10) for d in range(10)]
for abcd in table:
    ans += sum(abcd) == n
print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
a,b,c,d=0,0,0,0
ans=0
for i in range(10):
    c=0
    for j in range(10):
        b=0
        for f in range(10):
            a=0
            for e in range(10):
                if a+b+c+d==n:
                    ans+=1
                a+=1
            b+=1
        c+=1
    d+=1
print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
d=0
ans=0
for i in range(10):
    c=0
    for j in range(10):
        b=0
        for f in range(10):
            a=0
            for e in range(10):
                if a+b+c+d==n:
                    ans+=1
                a+=1
            b+=1
        c+=1
    d+=1
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
a=[0]*51
for i in range(10):
 a[i]=a[36-i]=(i+3)*(i+2)*(i+1)//6
for i in range(10,19):
 a[i]=a[36-i]=(i+3)*(i+2)*(i+1)//6-a[i-10]
for e in sys.stdin:
 print(a[int(e)])

Submission status: Wrong Answer

Solution code:
n=int(input())
count=0
for a in range(10):
	for b in range(10):
		for c in range(10):
			for d in range(10):
				ans = a + b + c + d 
				if(n == ans):
					count += 1 
print(count)

Submission status: Wrong Answer

Solution code:
ans=[0]*51
for a in range(10):
	for b in range(10):
		for c in range(10):
			for d in range(10):
				ans[sum([a,b,c,d])] += 1 
while True:
	try:print(sum[int(imput())])
	except:break

Submission status: Wrong Answer

Solution code:
n=int(input())
ans=0
for i in range(10):
	for j in range(10):
		for k in range(10):
			for l in range(10):
				if i+j+k+l==n:
					ans+=1
print(ans)

Submission status: Wrong Answer

Solution code:
lst=[0 for i in range(50)]
for a in range(10):
    for b in range(10):
        for c in range(10):
            for d in range(10):
                lst[a+b+c+d] += 1
while 1:
    try:
        print(lst[int(input())])
    except:
        break

Submission status: Wrong Answer

Solution code:
a = int(input())
count = 0
for i in range(10):
    for j in range(10):
        for k in range(10):
            for l in range(10):
                if (i + j + k + l) is a:
                    count += 1
print(count)

Submission status: Wrong Answer

Solution code:
import math
n = int(input())
nn = n
arr = []
for i in range (1,5):
    if(nn>10):
        arr.append(9)
        nn = nn-9
    else:
        arr.append(nn)
        nn = nn-nn

#print(arr)

top = math.factorial(4)
bottom = 1
for i in range(0,4):
    exist = False
    for j in range(0,i):
        if(arr[i]==arr[j]):
            exist = True
    count = 0
    if(not(exist)):
        for j in arr:
            if(arr[i]==j):
                count += 1

        bottom = bottom * math.factorial(count)


print(str(int(top/bottom)))

Submission status: Wrong Answer

Solution code:
import math
n = int(input())
nn = n
arr = []
for i in range (1,5):
    if(nn>10):
        arr.append(9)
        nn = nn-9
    else:
        arr.append(nn)
        nn = nn-nn

#print(arr)

top = math.factorial(4)
bottom = 1
for i in range(0,4):
    exist = False
    for j in range(0,i):
        if(arr[i]==arr[j]):
            exist = True
    count = 0
    if(not(exist)):
        for j in arr:
            if(arr[i]==j):
                count += 1

        bottom = bottom * math.factorial(count)


print(str(int(top/bottom)))
print()

Submission status: Wrong Answer

Solution code:
import sys
import math
for n in sys.stdin:
    n = int(n)
    nn = n
    arr = []
    for i in range (1,5):
        if(nn>10):
            arr.append(9)
            nn = nn-9
        else:
            arr.append(nn)
            nn = nn-nn

    #print(arr)

    top = math.factorial(4)
    bottom = 1
    for i in range(0,4):
        exist = False
        for j in range(0,i):
            if(arr[i]==arr[j]):
                exist = True
        count = 0
        if(not(exist)):
            for j in arr:
                if(arr[i]==j):
                    count += 1

            bottom = bottom * math.factorial(count)


    print(str(int(top/bottom)))

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

n = int(raw_input())
case = 0
for a in range(10):
    for b in range(10):
        for c in range(10):
            for d in range(10):
                if a + b + c + d == n:
                    case += 1
print(case)

Submission status: Wrong Answer

Solution code:
import sys
for n in sys.stdin:
    ans = 0
    for (a,m,d) in [(int(n)/i,int(n)%i,i) for i in range(1,10) if int(n)/i <= 4]:
        if (a==4 and m==0): ans += 1
        elif (a%2==1): ans += 4
        elif (a==2): ans += m+1
    print ans

Submission status: Wrong Answer

Solution code:
ans=0
q=input()
for i in range(10):
    for j in range(10):
        for x in range(10):
            for y in range(10):
                if i+j+x+y == q:
                    ans+=1
print ans

Submission status: Wrong Answer

Solution code:
import itertools

n = int(raw_input())
c = 0
for a in itertools.product(range(10), repeat=4):
    if sum(a) == n:
        c += 1
print c

Submission status: Wrong Answer

Solution code:
import math

num = int(raw_input())
count = 0

for a in range(0, 10):
	for b in range(0, 10):
		for c in range(0, 10):
			for d in range(0, 10):
				if a+b+c+d == num:
					count += 1

print count

Submission status: Wrong Answer

Solution code:
while 1:
	try:
		n = input()
		x = 0
		if n < 37:
			for a in range(10):
				for b in range(10):
					for c in range(10):
						for d in range(10):
							if a + b + c + d == n:
								x += 1
			print x
	except EOFError:
			break

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

import sys

def mCn(m, n):
    ret = 1
    for i in xrange(n):
        ret *= m - i
        ret /= i + 1
    return ret

for line in ["35"]:#sys.stdin.readlines():
    List = map(int, line.strip().split())

    n = List[0]

    ans = 0
    for i in xrange(10000):
        a = i / 1000; i %= 1000
        b = i / 100 ; i %= 100
        c = i / 10  ; i %= 10
        d = i
        if(a + b + c + d == n):
            ans += 1

    print ans

Submission status: Wrong Answer

Solution code:
while True:
    try:
        n = int(raw_input())
        count = 0
        for i in range(10):
           for j in range(10):
                for k in range(10):
                    for l in range(10):
                         i+j+k+l == n
                         count += 1
        print count
    except:
        break

Submission status: Wrong Answer

Solution code:
N = int(raw_input())
print len([None for a in range(10) for b in range(10) for c in range(10) for d in range(10) if a+b+c+d == N])

Submission status: Wrong Answer

Solution code:
from itertools import product

while 1:
    try:
        print len([1 for x in product(range(10), repeat=4) if sum(x) == input()])
    except:
        break

Submission status: Accepted

Solution code:
while True:
    try:
        n=int(input())
        ans=0
        for a in range(10):
            for b in range(10):
                for c in range(10):
                    for d in range(10):
                        if a+b+c+d==n:ans+=1
        print(ans)
    except:break

Submission status: Accepted

Solution code:
while True:
    try:
        n = int(raw_input())
        cnt = 0
        for a in range(10):
            for b in range(10):
                for c in range(10):
                    for d in range(10):
                        if n == a+b+c+d:
                            cnt+=1
        print cnt
    except:
        break

Submission status: Accepted

Solution code:
while True:
	try:
		n = int(input())
	except EOFError:
		break
	ret=0
	for a in range(10):
		for b in range(10):
			for c in range(10):
				for d in range(10):
					if a+b+c+d==n:
						ret+=1
	print(ret)

Submission status: Accepted

Solution code:
while True:
    try:
        n=int(input())
        ans=0
        for a in range(0,10):
            for b in range(0,10):
                for c in range(0,10):
                    if 0<=(n-(a+b+c))<=9:
                        ans+=1
        print(ans)
    except:
        break

Submission status: Accepted

Solution code:
try:
    while True:
        n = int(input())
        count = 0
        for a in range(10):
            for b in range(10):
                for c in range(10):
                    for d in range(10):
                        if a+b+c+d == n:
                            count += 1
        print(count)
except:
    pass

Submission status: Accepted

Solution code:
import sys

x = [0]*51
for a in xrange(0,10):
  for b in xrange(0,10):
    for c in xrange(0,10): 
      for d in xrange(0,10):
        x[a+b+c+d]+=1
for i in sys.stdin:
  print x[int(i)]

Submission status: Accepted

Solution code:
# 累積計算

from itertools import product

if __name__ == "__main__":
    while True:
        try:
            col = 0
            n = int(input())
            #print(n)
            if n > 36:
                print(0)
            else:
                for a, b, c, d in product(range(0, 10), repeat=4):
                    if a + b + c + d == n:
                        col += 1
                    else:
                        pass
                print(col)

        except EOFError:
            break  # escape from while loop

pass
#

Submission status: Accepted

Solution code:
while(True):
    try:
        ans = 0
        n = input()
        for i in range(10):
            for j in range(10):
                for k in range(10):
                    for l in range(10):
                        if(i + j + k + l == n):
                            ans += 1
        print(ans)
    except Exception:
        break

Submission status: Accepted

Solution code:
while True:
	ans = 0
	try:
		n = input()
		
	except (EOFError):
		break
	
	for a in range(10):
		atmp = n - a
		if(-1 < atmp and atmp<28):
			for b in range(10):
				btmp = atmp - b
				if(-1 < btmp and btmp<19):
					for c in range(10):
						d = btmp  - c
						if(-1 < d and d<10):
							ans += 1
							#print (a, b, c, d)
	print ans