<think>
Okay, I need to implement the two functions leg_gain and climb_gain based on the given interface. Let me start by understanding what each function is supposed to do.

First, the leg_gain function. The problem says it returns the height gained on one leg, which is the rise when the ground goes up, and zero when it goes down or stays level. So, given start and end integers, I need to calculate the difference. If end is greater than start, then it's end - start. Otherwise, zero. Wait, but what if the start and end are the same? Then the rise is zero, which is correct.

So the function is straightforward. Take start and end, compute end - start if it's positive, else zero. So the code would be:

def leg_gain(start: int, end: int) -> int:
    return max(0, end - start)

That's simple enough.

Next, the climb_gain function. It adds the gains of every leg of a walk, given the heights in order. A walk of fewer than two heights gains nothing. So, the function takes a list of heights. If the list has less than two elements, return 0. Otherwise, iterate through each consecutive pair and sum the leg_gain for each pair.

Wait, for example, if the heights are [h0, h1, h2, h3], then the legs are (h0, h1), (h1, h2), (h2, h3). So for each pair, compute leg_gain and sum them all.

So the steps for climb_gain are:

- Check if the length of heights is less than 2. If yes, return 0.
- Otherwise, initialize total to 0.
- Loop from i=0 to len(heights)-2:
   - Take start = heights[i], end = heights[i+1]
   - Add leg_gain(start, end) to total.
- Return total.

So the code would be:

def climb_gain(heights: list) -> int:
    if len(heights) < 2:
        return 0
    total = 0
    for i in range(len(heights) - 1):
        total += leg_gain(heights[i], heights[i+1])
    return total

Wait, but the problem says "a walk of fewer than two heights gains nothing". So if there's only one height, then no legs, so sum is zero. That's handled by the first check.

Testing edge cases: empty list, which is length 0 < 2, returns 0. Single element, same thing. For two elements, compute leg_gain once. For more, sum all consecutive pairs.

I think that's correct. Let me check the sample inputs.

For example, if heights is [1, 2, 3], then legs are (1,2) → 1, (2,3) → 1. Total is 2.

If heights is [3, 2, 1], then legs are (3,2) → 0, (2,1) → 0. Total 0.

If heights is [5, 5, 5], then each leg is 0, sum is 0.

Another case: [1, 3, 2]. Legs are 2 (1→3) and 0 (3→2). Total 2.

Yes, that seems right.

So the code should be as written. Now, implement these functions in the solution.py file as per the interface.
</think>

```python
def leg_gain(start: int, end: int) -> int:
    return max(0, end - start)

def climb_gain(heights: