Given a positive integer N, count the number of possible ways to represent N as the sum of four positive integers.
 
Example 1:
Input:
N = 5
Output:
1
Explanation:
We can represent 5 as
a sum of 4 positive integers,
only in 1 way as 1+1+1+2 = 5
Example 2:
Input:
N = 41
Output:
511
Explanation:
We can represent 41 as
sum of 4 positive integers
in 511 ways
Your Task:
You don't need to read input or print anything. Your task is to complete the function countWays() which takes an integer N as input parameter and returns an integer, the total count of the number of ways N can be represented as sum of 4 positive numbers.
 
Expected Time Complexity: O(N^{4})
Expected Space Complexity: O(1)
 
Constraints:
0 <= N <= 100

Source: geeksforgeeks | Difficulty: EASY
Tags: Mathematics

Starter code: #User function Template for python3

class Solution:
    def countWays (self, N):
        # code here

Solutions:
class Solution:

	def countWays(self, N):
		c = 0
		for i in range(1, N + 1):
			for j in range(i, N + 1):
				for k in range(j, N + 1):
					for l in range(k, N + 1):
						if i + j + k + l == N:
							c += 1
		return c


class Solution:

	def countWays(self, N):
		count = 0
		arr = set()
		for i in range(1, N):
			for k in range(1, N // 2 + 1):
				for j in range(1, N // 3 + 1):
					for l in range(1, N // 4 + 1):
						if i + j + k + l == N:
							a = sorted([i, j, k, l])
							arr.add(tuple(a))
		return len(arr)


class Solution:

	def countWays(self, N):
		c = 0
		z = 0
		for i in range(1, N):
			for j in range(i, N):
				for k in range(j, N):
					for l in range(k, N):
						if i + j + k + l == N:
							c += 1
		return c
if __name__ == '__main__':
	t = int(input())
	for _ in range(t):
		N = int(input())
		ob = Solution()
		print(ob.countWays(N))


class Solution:

	def countWays(self, n):
		c = 0
		for i in range(1, n):
			for j in range(i, n):
				for k in range(j, n):
					for p in range(k, n):
						if i + j + k + p == n:
							c += 1
		return c


class Solution:

	def countWays(self, n):
		count = 0
		for i in range(1, n):
			for j in range(i, n):
				for k in range(j, n):
					for l in range(k, n):
						if i + j + k + l == n:
							count += 1
		return count


class Solution:

	def countWays(self, N):
		count = 0
		for a in range(1, N):
			for b in range(a, N):
				for c in range(b, N):
					for d in range(c, N):
						if a + b + c + d == N:
							count += 1
		return count


class Solution:

	def countWays(self, N):
		x = 0
		for i in range(1, N):
			for j in range(i, N):
				for k in range(j, N):
					for m in range(k, N):
						if i + j + k + m == N:
							x = x + 1
		return x


class Solution:

	def countWays(self, N):
		count = 0
		for i in range(1, int(N / 4) + 1):
			for j in range(i, N):
				for k in range(j, N):
					for m in range(k, N):
						if i + j + k + m == N:
							count += 1
						if i + j + k + m > N:
							m = N
		return count