# Problem Description
This is a binary number manipulation problem where:
- Input integers are converted to their binary representations
- A "cutting" operation is performed based on a specified cut length
- Only the rightmost digits (specified by cut_len) are retained
- The resulting binary numbers are converted back to decimal
- The entire process transforms an input array into an output array

# Visual Facts
1. There are two examples with different cut lengths:
   - Example 1: cut_len = 2
   - Example 2: cut_len = 4

2. Example 1 shows transformations:
   - 4 → 100 → 00 → 0
   - 7 → 111 → 11 → 3
   - 11 → 1011 → 11 → 3
   - 5 → 101 → 01 → 1

3. Example 2 shows transformations:
   - 59 → 111011 → 1011 → 11
   - 65 → 1000001 → 0001 → 1
   - 21 → 10101 → 0101 → 5
   - 87 → 1010111 → 0111 → 7
   - 37 → 100101 → 0101 → 5

4. Each number goes through three steps:
   - Decimal to binary conversion
   - Binary truncation
   - Binary to decimal conversion

# Visual Patterns
1. Binary Conversion Pattern:
   - All input numbers are first converted to their binary representation

2. Cutting Pattern:
   - Only the rightmost 'cut_len' digits are retained
   - Any digits before the cut point are discarded
   - If binary number length < cut_len, the entire number is kept

3. Value Preservation Pattern:
   - When the last 'cut_len' digits are identical in different numbers, they produce the same output
   - Example: in Example 1, both 7 (111) and 11 (1011) result in 3 because their last 2 digits are '11'

4. Mathematical Pattern:
   - The final decimal value is always equivalent to the binary-to-decimal conversion of the last 'cut_len' digits
   - The maximum possible output value is 2^cut_len - 1


# Solution
from typing import List

def solution(nums: List[int], cut_len: int) -> List[int]:
    """
    Manipulates a list of integers using a specified cut length.

    Parameters:
        nums (List[int]): The input list of integers to process.
        cut_len (int): The value used for cutting.

    Returns:
        List[int]: The processed list after applying the cut operation.
    """
    new_nums = []
    for  num in nums:

        new_nums.append( num % (2**cut_len))
    return new_nums


# Test Script
def test():
    test_cases = [
        ([4,7,11,5],2, [0,3,3,1]),
        ([59,65,21,87,37],4,[11,1,5,7,5]),
        ([136, 839, 614, 172, 834, 661, 751, 474, 352, 161], 5,[8, 7, 6, 12, 2, 21, 15, 26, 0, 1]),
        ([125, 132, 147, 725, 597, 492, 258], 8, [125, 132, 147, 213, 85, 236, 2]),
        ([103, 706, 283, 830, 358, 528, 67, 587, 940], 1,[1, 0, 1, 0, 0, 0, 1, 1, 0]),
        ([821, 287, 970, 212], 2,[1, 3, 2, 0]),
        ([257, 659, 429, 803], 5,[1, 19, 13, 3]),
        ([349, 965, 252, 53, 394, 816, 712, 546, 771],4, [13, 5, 12, 5, 10, 0, 8, 2, 3]),
        ([659, 804, 592, 307, 336, 952], 10, [659, 804, 592, 307, 336, 952]),
        ([635, 208, 583, 480, 937], 5,[27, 16, 7, 0, 9]),
        
    ]
    def equal_arr(arr1, arr2):
        return arr1 == arr2

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

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

test()