"""Compress token type IDs by finding the position of the first occurrence of 1.

This function processes a list of token type IDs, which are expected to be a sequence of zeros followed by a sequence of ones. It returns the index of the first occurrence of 1. If no 1 is found, it returns the length of the list. The function raises a ValueError if the sequence does not conform to the expected pattern (e.g., if a 1 appears before a 0 or if any value greater than 1 is present).

Args:
    token_type_ids (List[int]): A list of integers representing token type IDs. The list should consist of zeros followed by ones.

Returns:
    int: The index of the first occurrence of 1 in the list. If no 1 is found, returns the length of the list.

Raises:
    ValueError: If the sequence of token type IDs does not conform to the expected pattern (zeros followed by ones).

Examples:
    >>> compress_token_type_ids([0, 1])
    1
    >>> compress_token_type_ids([0, 0, 0, 1])
    3
    >>> compress_token_type_ids([0])
    1
    >>> compress_token_type_ids([1])
    0
"""