# Problem Description
The problem involves determining how many particles can pass through a series of energy boundaries. Each particle has a specific energy level, and each boundary has a specific energy threshold. A particle can only pass through a boundary if its energy level is a multiple of the boundary's energy threshold. The goal is to calculate the number of particles that can pass through all given boundaries.

# Visual Facts
1. **Example 1**:
   - Particle energies (PE1): [120, 90, 20]
   - Boundary energy (BE1): 3
   - Particle energies (PE2): [120, 90]
   - Boundary energy (BE2): 60
   - Particle energies (PE3): [120]
   - Remaining particles after all boundaries: 1

2. **Example 2**:
   - Particle energies (PE1): [59, 240, 60, 24, 40]
   - Boundary energy (BE1): 10
   - Particle energies (PE2): [240, 60, 40]
   - Boundary energy (BE2): 3
   - Particle energies (PE3): [240, 60]
   - Boundary energy (BE3): 60
   - Particle energies (PE4): [240, 60]
   - Remaining particles after all boundaries: 2

# Visual Patterns
1. **Passing Condition**:
   - A particle can pass a boundary if and only if the particle's energy is a multiple of the boundary's energy (PE % BE == 0).

2. **Sequential Filtering**:
   - Particles are filtered sequentially through each boundary. Only particles that pass the current boundary are considered for the next boundary.

3. **Remaining Particles**:
   - The final count of particles that pass through all boundaries is the number of particles remaining after the last boundary.

4. **Boundary Sequence**:
   - The boundaries are applied in the order they are given. Each boundary filters out particles that do not meet the passing condition.

# Solution
from typing import List

def solution(particle_energy: List[int], energy_boundary: List[int]) -> int:
    """
    Calculates the number of particles that can pass through all energy boundaries.

    Args:
        particle_energy: A list of energy levels for each particle
        energy_boundary: A list of energy levels for each boundary

    Returns:
        The number of particles that successfully pass through all energy boundaries
    """
    count = 0 
    for i in particle_energy:
        flag = True
        for j in range(len(energy_boundary)):
            if i % energy_boundary[j] != 0:
                flag = False
                break
        if flag : count += 1
        
    return count


# Test Script
def test():
    test_cases = [
        ([120, 90, 20],[3, 60], 1),
        ([59, 240, 60, 24, 40],[10, 3, 60], 2),
        ([120, 90, 20],[3, ], 2),
        ([59, 240, 60, 24, 40],[ 3, 60], 2),
        ([59, 240, 60, 24, 40],[ 2, 10], 3),
        ([59, 240, 60, 24, 40],[ 5, 2], 3),
        ([59, 240, 60, 24, 40],[ 5, 12], 2),
        ([59, 240, 60, 24, 40],[ 5, 6], 2),
        ([59, 240, 60, 24, 40],[ 5, 24], 1),
        ([120, 90, 20],[30, ], 2),
        
    ]

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

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

test()