Algorithms
Easy
2928
3199
Distribute Candies Among Children I
distribute-candies-among-children-i
"""
You are given two positive integers n and limit.

Return the total number of ways to distribute n candies among 3 children such that no child gets more than limit candies.

Example 1:

Input: n = 5, limit = 2
Output: 3
Explanation: There are 3 ways to distribute 5 candies such that no child gets more than 2 candies: (1, 2, 2), (2, 1, 2) and (2, 2, 1).

Example 2:

Input: n = 3, limit = 3
Output: 10
Explanation: There are 10 ways to distribute 3 candies such that no child gets more than 3 candies: (0, 0, 3), (0, 1, 2), (0, 2, 1), (0, 3, 0), (1, 0, 2), (1, 1, 1), (1, 2, 0), (2, 0, 1), (2, 1, 0) and (3, 0, 0).


Constraints:

 * 1 <= n <= 50
 * 1 <= limit <= 50
"""
class Solution:
    def distributeCandies(self, n: int, limit: int) -> int:
        
You are given two positive integers n and limit.

Return the total number of ways to distribute n candies among 3 children such that no child gets more than limit candies.

Example 1:

Input: n = 5, limit = 2
Output: 3
Explanation: There are 3 ways to distribute 5 candies such that no child gets more than 2 candies: (1, 2, 2), (2, 1, 2) and (2, 2, 1).

Example 2:

Input: n = 3, limit = 3
Output: 10
Explanation: There are 10 ways to distribute 3 candies such that no child gets more than 3 candies: (0, 0, 3), (0, 1, 2), (0, 2, 1), (0, 3, 0), (1, 0, 2), (1, 1, 1), (1, 2, 0), (2, 0, 1), (2, 1, 0) and (3, 0, 0).


Constraints:

 * 1 <= n <= 50
 * 1 <= limit <= 50


Please complete the code below to solve above prblem:
```python
class Solution:
    def distributeCandies(self, n: int, limit: int) -> int:
        
```

my_solution = Solution()

test_input = { "n": 5, "limit": 2 }
assert my_solution.distributeCandies(**test_input) == 3

test_input = { "n": 3, "limit": 3 }
assert my_solution.distributeCandies(**test_input) == 10

test_input = { "n": 1, "limit": 1 }
assert my_solution.distributeCandies(**test_input) == 3

test_input = { "n": 1, "limit": 2 }
assert my_solution.distributeCandies(**test_input) == 3

test_input = { "n": 1, "limit": 3 }
assert my_solution.distributeCandies(**test_input) == 3

test_input = { "n": 1, "limit": 4 }
assert my_solution.distributeCandies(**test_input) == 3

test_input = { "n": 1, "limit": 5 }
assert my_solution.distributeCandies(**test_input) == 3

test_input = { "n": 1, "limit": 6 }
assert my_solution.distributeCandies(**test_input) == 3

test_input = { "n": 1, "limit": 7 }
assert my_solution.distributeCandies(**test_input) == 3

test_input = { "n": 1, "limit": 8 }
assert my_solution.distributeCandies(**test_input) == 3

test_input = { "n": 1, "limit": 9 }
assert my_solution.distributeCandies(**test_input) == 3

test_input = { "n": 1, "limit": 10 }
assert my_solution.distributeCandies(**test_input) == 3

test_input = { "n": 1, "limit": 11 }
assert my_solution.distributeCandies(**test_input) == 3

test_input = { "n": 1, "limit": 12 }
assert my_solution.distributeCandies(**test_input) == 3

test_input = { "n": 1, "limit": 13 }
assert my_solution.distributeCandies(**test_input) == 3

test_input = { "n": 1, "limit": 14 }
assert my_solution.distributeCandies(**test_input) == 3

test_input = { "n": 1, "limit": 15 }
assert my_solution.distributeCandies(**test_input) == 3

test_input = { "n": 1, "limit": 16 }
assert my_solution.distributeCandies(**test_input) == 3

test_input = { "n": 1, "limit": 17 }
assert my_solution.distributeCandies(**test_input) == 3

test_input = { "n": 1, "limit": 18 }
assert my_solution.distributeCandies(**test_input) == 3

test_input = { "n": 1, "limit": 19 }
assert my_solution.distributeCandies(**test_input) == 3

test_input = { "n": 1, "limit": 20 }
assert my_solution.distributeCandies(**test_input) == 3

test_input = { "n": 1, "limit": 21 }
assert my_solution.distributeCandies(**test_input) == 3

test_input = { "n": 1, "limit": 22 }
assert my_solution.distributeCandies(**test_input) == 3

test_input = { "n": 1, "limit": 23 }
assert my_solution.distributeCandies(**test_input) == 3

test_input = { "n": 1, "limit": 24 }
assert my_solution.distributeCandies(**test_input) == 3

test_input = { "n": 1, "limit": 25 }
assert my_solution.distributeCandies(**test_input) == 3

test_input = { "n": 2, "limit": 1 }
assert my_solution.distributeCandies(**test_input) == 3

test_input = { "n": 2, "limit": 2 }
assert my_solution.distributeCandies(**test_input) == 6

test_input = { "n": 2, "limit": 3 }
assert my_solution.distributeCandies(**test_input) == 6

test_input = { "n": 2, "limit": 4 }
assert my_solution.distributeCandies(**test_input) == 6

test_input = { "n": 2, "limit": 5 }
assert my_solution.distributeCandies(**test_input) == 6

test_input = { "n": 2, "limit": 6 }
assert my_solution.distributeCandies(**test_input) == 6

test_input = { "n": 2, "limit": 7 }
assert my_solution.distributeCandies(**test_input) == 6

test_input = { "n": 2, "limit": 8 }
assert my_solution.distributeCandies(**test_input) == 6

test_input = { "n": 2, "limit": 9 }
assert my_solution.distributeCandies(**test_input) == 6

test_input = { "n": 2, "limit": 10 }
assert my_solution.distributeCandies(**test_input) == 6

test_input = { "n": 2, "limit": 11 }
assert my_solution.distributeCandies(**test_input) == 6

test_input = { "n": 2, "limit": 12 }
assert my_solution.distributeCandies(**test_input) == 6

test_input = { "n": 2, "limit": 13 }
assert my_solution.distributeCandies(**test_input) == 6

test_input = { "n": 2, "limit": 14 }
assert my_solution.distributeCandies(**test_input) == 6

test_input = { "n": 2, "limit": 15 }
assert my_solution.distributeCandies(**test_input) == 6

test_input = { "n": 2, "limit": 16 }
assert my_solution.distributeCandies(**test_input) == 6

test_input = { "n": 2, "limit": 17 }
assert my_solution.distributeCandies(**test_input) == 6

test_input = { "n": 2, "limit": 18 }
assert my_solution.distributeCandies(**test_input) == 6

test_input = { "n": 2, "limit": 19 }
assert my_solution.distributeCandies(**test_input) == 6

test_input = { "n": 2, "limit": 20 }
assert my_solution.distributeCandies(**test_input) == 6

test_input = { "n": 2, "limit": 21 }
assert my_solution.distributeCandies(**test_input) == 6

test_input = { "n": 2, "limit": 22 }
assert my_solution.distributeCandies(**test_input) == 6

test_input = { "n": 2, "limit": 23 }
assert my_solution.distributeCandies(**test_input) == 6

test_input = { "n": 2, "limit": 24 }
assert my_solution.distributeCandies(**test_input) == 6

test_input = { "n": 2, "limit": 25 }
assert my_solution.distributeCandies(**test_input) == 6

test_input = { "n": 3, "limit": 1 }
assert my_solution.distributeCandies(**test_input) == 1

test_input = { "n": 3, "limit": 2 }
assert my_solution.distributeCandies(**test_input) == 7

test_input = { "n": 3, "limit": 4 }
assert my_solution.distributeCandies(**test_input) == 10

test_input = { "n": 3, "limit": 5 }
assert my_solution.distributeCandies(**test_input) == 10

test_input = { "n": 3, "limit": 6 }
assert my_solution.distributeCandies(**test_input) == 10

test_input = { "n": 3, "limit": 7 }
assert my_solution.distributeCandies(**test_input) == 10

test_input = { "n": 3, "limit": 8 }
assert my_solution.distributeCandies(**test_input) == 10

test_input = { "n": 3, "limit": 9 }
assert my_solution.distributeCandies(**test_input) == 10

test_input = { "n": 3, "limit": 10 }
assert my_solution.distributeCandies(**test_input) == 10

test_input = { "n": 3, "limit": 11 }
assert my_solution.distributeCandies(**test_input) == 10

test_input = { "n": 3, "limit": 12 }
assert my_solution.distributeCandies(**test_input) == 10

test_input = { "n": 3, "limit": 13 }
assert my_solution.distributeCandies(**test_input) == 10

test_input = { "n": 3, "limit": 14 }
assert my_solution.distributeCandies(**test_input) == 10

test_input = { "n": 3, "limit": 15 }
assert my_solution.distributeCandies(**test_input) == 10

test_input = { "n": 3, "limit": 16 }
assert my_solution.distributeCandies(**test_input) == 10

test_input = { "n": 3, "limit": 17 }
assert my_solution.distributeCandies(**test_input) == 10

test_input = { "n": 3, "limit": 18 }
assert my_solution.distributeCandies(**test_input) == 10

test_input = { "n": 3, "limit": 19 }
assert my_solution.distributeCandies(**test_input) == 10

test_input = { "n": 3, "limit": 20 }
assert my_solution.distributeCandies(**test_input) == 10

test_input = { "n": 3, "limit": 21 }
assert my_solution.distributeCandies(**test_input) == 10

test_input = { "n": 3, "limit": 22 }
assert my_solution.distributeCandies(**test_input) == 10

test_input = { "n": 3, "limit": 23 }
assert my_solution.distributeCandies(**test_input) == 10

test_input = { "n": 3, "limit": 24 }
assert my_solution.distributeCandies(**test_input) == 10

test_input = { "n": 3, "limit": 25 }
assert my_solution.distributeCandies(**test_input) == 10

test_input = { "n": 4, "limit": 1 }
assert my_solution.distributeCandies(**test_input) == 0

test_input = { "n": 4, "limit": 2 }
assert my_solution.distributeCandies(**test_input) == 6

test_input = { "n": 4, "limit": 3 }
assert my_solution.distributeCandies(**test_input) == 12

test_input = { "n": 4, "limit": 4 }
assert my_solution.distributeCandies(**test_input) == 15

test_input = { "n": 4, "limit": 5 }
assert my_solution.distributeCandies(**test_input) == 15

test_input = { "n": 4, "limit": 6 }
assert my_solution.distributeCandies(**test_input) == 15

test_input = { "n": 4, "limit": 7 }
assert my_solution.distributeCandies(**test_input) == 15

test_input = { "n": 4, "limit": 8 }
assert my_solution.distributeCandies(**test_input) == 15

test_input = { "n": 4, "limit": 9 }
assert my_solution.distributeCandies(**test_input) == 15

test_input = { "n": 4, "limit": 10 }
assert my_solution.distributeCandies(**test_input) == 15

test_input = { "n": 4, "limit": 11 }
assert my_solution.distributeCandies(**test_input) == 15

test_input = { "n": 4, "limit": 12 }
assert my_solution.distributeCandies(**test_input) == 15

test_input = { "n": 4, "limit": 13 }
assert my_solution.distributeCandies(**test_input) == 15

test_input = { "n": 4, "limit": 14 }
assert my_solution.distributeCandies(**test_input) == 15

test_input = { "n": 4, "limit": 15 }
assert my_solution.distributeCandies(**test_input) == 15

test_input = { "n": 4, "limit": 16 }
assert my_solution.distributeCandies(**test_input) == 15

test_input = { "n": 4, "limit": 17 }
assert my_solution.distributeCandies(**test_input) == 15

test_input = { "n": 4, "limit": 18 }
assert my_solution.distributeCandies(**test_input) == 15

test_input = { "n": 4, "limit": 19 }
assert my_solution.distributeCandies(**test_input) == 15

test_input = { "n": 4, "limit": 20 }
assert my_solution.distributeCandies(**test_input) == 15

test_input = { "n": 4, "limit": 21 }
assert my_solution.distributeCandies(**test_input) == 15

test_input = { "n": 4, "limit": 22 }
assert my_solution.distributeCandies(**test_input) == 15

test_input = { "n": 4, "limit": 23 }
assert my_solution.distributeCandies(**test_input) == 15

test_input = { "n": 4, "limit": 24 }
assert my_solution.distributeCandies(**test_input) == 15