from itertools import product
import numpy as np
L = 3 N = 100
combination = np.tile(np.arange(1, N+1), [L, 1])
combine = product(*combination, repeat=1)
number of placements with repetitions : 100^3
but we only need those that are equal to N
r = 0
for comb in combine:
if sum(comb)==L:
r += 1
r will be equal = 4851
but the number of operations will be = 1000000