
    Given the number of historical banking transactions that need to be analyzed for a loan application, determine the minimum size of the binary processing batch that can accommodate all transactions, where batch sizes must be powers of 2 to optimize the credit risk assessment system's memory allocation. For example, if there are 1000 transactions, the system needs to allocate a batch size of 1024 (2^10) to ensure efficient data processing and analysis.
    

    
def next_power_of_2(n):
    """
    Given the number of historical banking transactions that need to be analyzed for a loan application, determine the minimum size of the binary processing batch that can accommodate all transactions, where batch sizes must be powers of 2 to optimize the credit risk assessment system's memory allocation. For example, if there are 1000 transactions, the system needs to allocate a batch size of 1024 (2^10) to ensure efficient data processing and analysis.
    

    """
def next_power_of_2(n):
    """
    Given the number of historical banking transactions that need to be analyzed for a loan application, determine the minimum size of the binary processing batch that can accommodate all transactions, where batch sizes must be powers of 2 to optimize the credit risk assessment system's memory allocation. For example, if there are 1000 transactions, the system needs to allocate a batch size of 1024 (2^10) to ensure efficient data processing and analysis.
    

    """
    if n and (not n & n - 1):
        return n
    count = 0
    while n != 0:
        n >>= 1
        count += 1
    return 1 << count