{"problem":{"name":"Many Balls","description":{"content":"We have an empty box.   Takahashi can cast the following two spells any number of times in any order. *   Spell $A$: puts one new ball into the box. *   Spell $B$: doubles the number of balls in the ","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"abc216_c"},"statements":[{"statement_type":"Markdown","content":"We have an empty box.  \nTakahashi can cast the following two spells any number of times in any order.\n\n*   Spell $A$: puts one new ball into the box.\n*   Spell $B$: doubles the number of balls in the box.\n\nTell us a way to have exactly $N$ balls in the box with **at most $\\mathbf{120}$ casts** of spells.  \nIt can be proved that there always exists such a way under the Constraints given.\nThere is no way other than spells to alter the number of balls in the box.\n\n## Constraints\n\n*   $1 \\leq N \\leq 10^{18}$\n*   All values in input are integers.\n\n## Input\n\nInput is given from Standard Input in the following format:\n\n$N$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"abc216_c","tags":[],"sample_group":[["5","AABA\n\nThis changes the number of balls as follows: $0 \\xrightarrow{A} 1\\xrightarrow{A} 2 \\xrightarrow{B}4\\xrightarrow{A} 5$.  \nThere are also other acceptable outputs, such as `AAAAA`."],["14","BBABBAAAB\n\nThis changes the number of balls as follows: $0 \\xrightarrow{B} 0 \\xrightarrow{B} 0 \\xrightarrow{A}1 \\xrightarrow{B} 2 \\xrightarrow{B} 4 \\xrightarrow{A}5 \\xrightarrow{A}6 \\xrightarrow{A} 7 \\xrightarrow{B}14$.  \nIt is not required to minimize the length of $S$."]],"created_at":"2026-03-03 11:01:14"}}