# Problem Description
This is a geometric progression problem where we need to calculate the number of green triangles at a given iteration level (t). The problem involves a triangular pattern that grows according to specific rules, starting with a single green triangle and progressively adding more subdivisions, some of which are colored green.

# Visual Facts
1. T=1: Single green triangle
2. T=2: Contains 4 triangles total, with 3 green triangle
3. T=3: Multiple layers of triangles, containing 10 green triangles
4. T=4: Even more layers, with significantly more green triangles
5. Each iteration adds more layers to the triangle
6. White triangles are always inverted (pointing downward)
7. Green triangles are always pointing upward

# Visual Patterns
1. Number of Layers Pattern:
   - T=1: 1 layer
   - T=2: 2 layers
   - T=3: 4 layers
   - T=4: 8 layers
   - T=t: 2^(t-1) layers

2. Green Triangles Count Pattern:
   - T=1: 1 green triangles = 1
   - T=2: 3 green triangle = 1 + 2
   - T=3: 10 green triangles = 1 + 2 + 3 + 4
   - T=4: 36 green triangles = 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8
   - T=t: Sum of first 2^(t-1) natural numbers


# Solution
def solution(t: int) -> int:
    """
    Calculates the number of green triangles at a given iteration level.

    Parameters:
        t (int): The iteration level to calculate.

    Returns:
        int: The number of green triangles at iteration level t.
    """
    inverted = 0
    regular = 1

    for _ in range(2, t + 1):
        new_inverted = regular + 3 * inverted
        new_regular = inverted + 3 * regular
        inverted, regular = new_inverted, new_regular

    return regular


# Test Script
def test():
    test_cases = [
        (1, 1),
        (2, 3),
        (3, 10),
        (4, 36),
        (5, 136),
        (6, 528),
        (7, 2080),
        (8, 8256),
        (9, 32896),
        (10, 131328)
    ]

    for t, expected_output in test_cases:
        try:
            output = solution(t)
        except Exception as e:
            error_message = (
                f"An exception occurred while running the test case:\n"
                f"`t`: {t}\n\n"
                f"Exception: '{str(e)}'"
            )
            assert False, error_message

        if output != expected_output:
            error_message = (
                f"The following Test Case failed:\n"
                f"`t`: {t}\n\n"
                f"Actual Output: {output}\n"
                f"Expected Output: {expected_output}"
            )
            assert False, error_message

test()