





from __future__ import annotations

_A				:							List[str]							= """Alexander Joslin"""


def        __snake_case       (						lowerCAmelCase_  )							->	int:

    if number <= 0:
        SCREAMING_SNAKE_CASE__       							= f'''n must be greater than 0. Got n = {number}'''
        raise ValueError(lowerCAmelCase_  )

    SCREAMING_SNAKE_CASE__       							= [number + 1] * (number + 1)

    # starting position
    SCREAMING_SNAKE_CASE__       							= 0
    for i in range(1   ,       lowerCAmelCase_  ):
        SCREAMING_SNAKE_CASE__       							= min(table[i + 1]   ,       table[i] + 1  )
        # check if out of bounds
        if i * 2 <= number:
            SCREAMING_SNAKE_CASE__       							= min(table[i * 2]   ,       table[i] + 1  )
        # check if out of bounds
        if i * 3 <= number:
            SCREAMING_SNAKE_CASE__       							= min(table[i * 3]   ,       table[i] + 1  )
    return table[number]


if __name__ == "__main__":
  import doctest

  doctest.testmod()







import io
import json
import subprocess


_A				:							str							= [
    ["""en""", """ru"""],
    ["""ru""", """en"""],
    ["""en""", """de"""],
    ["""de""", """en"""],
]

_A				:							int							= 8


def        __snake_case       (						lowerCAmelCase_   ,       lowerCAmelCase_  )							->	Optional[Any]:
    SCREAMING_SNAKE_CASE__       							= {}
    for src, tgt in pairs:
        SCREAMING_SNAKE_CASE__       							= f'''{src}-{tgt}'''
        SCREAMING_SNAKE_CASE__       							= f'''sacrebleu -t wmt19 -l {pair} --echo src'''.split()
        SCREAMING_SNAKE_CASE__       							= subprocess.run(lowerCAmelCase_   ,       stdout=subprocess.PIPE  ).stdout.decode('''utf-8'''  ).splitlines()
        SCREAMING_SNAKE_CASE__       							= f'''sacrebleu -t wmt19 -l {pair} --echo ref'''.split()
        SCREAMING_SNAKE_CASE__       							= subprocess.run(lowerCAmelCase_   ,       stdout=subprocess.PIPE  ).stdout.decode('''utf-8'''  ).splitlines()
        SCREAMING_SNAKE_CASE__       							= {'''src''': src_lines[:n_objs], '''tgt''': tgt_lines[:n_objs]}
    return text


_A				:							Optional[Any]							= get_all_data(pairs, n_objs)
_A				:							Optional[Any]							= """./fsmt_val_data.json"""
with io.open(filename, """w""", encoding="""utf-8""") as f:
  _A				:							int							= json.dump(text, f, indent=2, ensure_ascii=False)
