from bs4 import BeautifulSoup

def extract_available_nrcs(html_content: str) -> set:
    """
    Parses SIIAU's raw table payload and extracts all NRC values present.
    Since 'dispp=D' is set, any NRC returned in this payload is verified 
    to have open available seats.
    """
    # Initialize BeautifulSoup. The default html.parser acts like a modern browser,
    # automatically creating closing tags and handling nested layout irregularities safely.
    soup = BeautifulSoup(html_content, 'html.parser')
    
    # We collect values inside a set for O(1) membership lookups later
    available_nrcs = set()
    
    # Find all table cells containing class metadata attributes 'tddatos'
    cells = soup.find_all('td', class_='tddatos')
    
    for cell in cells:
        text_val = cell.get_text(strip=True)
        
        # An NRC is always purely numeric and exactly 5 or 6 characters long
        if text_val.isdigit() and len(text_val) in (5, 6):
            available_nrcs.add(text_val)
            
    return available_nrcs
