
    Write a function that analyzes an hourly emergency room patient arrival code to determine if the predicted patient load is manageable, where each digit represents the expected number of new patients per time block. The patient load is considered manageable only if the frequency of each digit in the code does not exceed the value of that digit itself (for example, the digit 2 should not appear more than 2 times in the code). The function should return true if the patient load is manageable, and false otherwise.
    

    
def validate(n):
    """
    Write a function that analyzes an hourly emergency room patient arrival code to determine if the predicted patient load is manageable, where each digit represents the expected number of new patients per time block. The patient load is considered manageable only if the frequency of each digit in the code does not exceed the value of that digit itself (for example, the digit 2 should not appear more than 2 times in the code). The function should return true if the patient load is manageable, and false otherwise.
    

    """
def validate(n):
    """
    Write a function that analyzes an hourly emergency room patient arrival code to determine if the predicted patient load is manageable, where each digit represents the expected number of new patients per time block. The patient load is considered manageable only if the frequency of each digit in the code does not exceed the value of that digit itself (for example, the digit 2 should not appear more than 2 times in the code). The function should return true if the patient load is manageable, and false otherwise.
    

    """
    for i in range(10):
        temp = n
        count = 0
        while temp:
            if temp % 10 == i:
                count += 1
            if count > i:
                return False
            temp //= 10
    return True