#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright 2023 AVSystem <avsystem@avsystem.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import sys
import functools
import struct

nodes = int(sys.argv[1]) if len(sys.argv) > 1 else 1

def binsearch_depth(nums, num):
    if not nums:
        raise ValueError('should never happen')

    at = len(nums) // 2
    if nums[at] == num:
        return 1
    elif num < nums[at]:
        return 1 + binsearch_depth(nums[:at], num)
    else:
        return 1 + binsearch_depth(nums[at+1:], num)

values = list(range(1, nodes+1))
ordered_values = sorted(values, key=functools.partial(binsearch_depth, values))
for num in ordered_values:
    sys.stdout.buffer.write(struct.pack('=BI', 0, num))

a96cd94f11e9cfc395879c3510292e87d16f7b4f
<mask token>

<mask token>


def binsearch_depth(nums, num):
    if not nums:
        raise ValueError('should never happen')
    at = len(nums) // 2
    if nums[at] == num:
        return 1
    elif num < nums[at]:
        return 1 + binsearch_depth(nums[:at], num)
    else:
        return 1 + binsearch_depth(nums[at + 1:], num)


<mask token>
for num in ordered_values:
    sys.stdout.buffer.write(struct.pack('=BI', 0, num))

<mask token>
nodes = int(sys.argv[1]) if len(sys.argv) > 1 else 1


def binsearch_depth(nums, num):
    if not nums:
        raise ValueError('should never happen')
    at = len(nums) // 2
    if nums[at] == num:
        return 1
    elif num < nums[at]:
        return 1 + binsearch_depth(nums[:at], num)
    else:
        return 1 + binsearch_depth(nums[at + 1:], num)


values = list(range(1, nodes + 1))
ordered_values = sorted(values, key=functools.partial(binsearch_depth, values))
for num in ordered_values:
    sys.stdout.buffer.write(struct.pack('=BI', 0, num))

import sys
import functools
import struct
nodes = int(sys.argv[1]) if len(sys.argv) > 1 else 1


def binsearch_depth(nums, num):
    if not nums:
        raise ValueError('should never happen')
    at = len(nums) // 2
    if nums[at] == num:
        return 1
    elif num < nums[at]:
        return 1 + binsearch_depth(nums[:at], num)
    else:
        return 1 + binsearch_depth(nums[at + 1:], num)


values = list(range(1, nodes + 1))
ordered_values = sorted(values, key=functools.partial(binsearch_depth, values))
for num in ordered_values:
    sys.stdout.buffer.write(struct.pack('=BI', 0, num))

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright 2023 AVSystem <avsystem@avsystem.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import sys
import functools
import struct

nodes = int(sys.argv[1]) if len(sys.argv) > 1 else 1

def binsearch_depth(nums, num):
    if not nums:
        raise ValueError('should never happen')

    at = len(nums) // 2
    if nums[at] == num:
        return 1
    elif num < nums[at]:
        return 1 + binsearch_depth(nums[:at], num)
    else:
        return 1 + binsearch_depth(nums[at+1:], num)

values = list(range(1, nodes+1))
ordered_values = sorted(values, key=functools.partial(binsearch_depth, values))
for num in ordered_values:
    sys.stdout.buffer.write(struct.pack('=BI', 0, num))
