This is a rather simple problem to describe. You will be given three numbers $S, P$ and $k$. Your task is to find if there are integers $n_1, n_2,...,n_k$ such that $n_1 + n_2 +...+ n_k = S$, $n_1 \cdot n_2 \cdot ... \cdot n_k = P$. If such integers exist, print them out. If no such sequence of integers exist, then print "NO".
For example if $S=11, P=48$ and $k=3$ then $3, 4$ and $4$ is a solution. On the other hand, if $S=11, P=100$ and $k=3$, there is no solution and you should print "NO".

-----Input:-----
A single line with three integers $S, P$ and $k$.

-----Output:-----
A single word "NO" or a seqence of $k$ integers $n_1, n_2,..., n_k$ on a single line. (The $n_i$'s must add up to $S$ and their product must be $P$).

-----Constraints:-----
- $1 \leq k \leq 4$.
- $1 \leq S \leq 1000$.
- $1 \leq P \leq 1000$.

-----Sample input 1:-----
11 48 3

-----Sample output 1:-----
3 4 4 

-----Sample input 2:-----
11 100 3

-----Sample output 2:-----
NO

Difficulty: UNKNOWN_DIFFICULTY

Solutions:
import sys

def IOE():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def main():
	(s, p, k) = map(int, sys.stdin.readline().split())
	if k == 1:
		if s == p:
			print(s)
		else:
			print('NO')
	if k == 2:
		for i in range(s // 2 + 1):
			if i * (s - i) == p:
				print(i, s - i)
				break
		else:
			print('NO')
	if k == 3:
		ans = []
		for i in range(s // 3 + 1):
			for j in range(s // 3 + 2):
				if i * j * (s - i - j) == p:
					ans.append([i, j, s - i - j])
		if len(ans):
			print(*ans[0])
		else:
			print('NO')
	if k == 4:
		ans = []
		for i in range(s // 4 + 1):
			for j in range(s // 4 + 2):
				for k in range(s // 4 + 3):
					if i * j * k * (s - i - j - k) == p:
						ans.append([i, j, k, s - i - j - k])
		if len(ans):
			print(*ans[0])
		else:
			print('NO')

def __starting_point():
	main()
__starting_point()