{"problem":{"name":"D. Double it","description":{"content":"Alex has two magic machines A and B. Machine A will give you 2x + 1 coins if you insert x coins in it, machine B will give you 2x + 2. Alex has no coins and wants to get exactly n coins in order to bu","description_type":"Markdown"},"platform":"Codeforces","limit":{"time_limit":2000,"memory_limit":65536},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"CF10146D"},"statements":[{"statement_type":"Markdown","content":"Alex has two magic machines A and B. Machine A will give you 2x + 1 coins if you insert x coins in it, machine B will give you 2x + 2. Alex has no coins and wants to get exactly n coins in order to buy a new unicorn, but he can't figure out how to do it. Your task is to find a way to use the machines to get exactly n coins.\n\nThe input consists of a single line containing n (1 ≤ n ≤ 109).\n\nFor each one output a string of A's and B's giving the order in which the machines are used.\n\n## Input\n\nThe input consists of a single line containing n (1 ≤ n ≤ 109).\n\n## Output\n\nFor each one output a string of A's and B's giving the order in which the machines are used.\n\n[samples]","is_translate":false,"language":"English"},{"statement_type":"Markdown","content":"**Definitions**  \nLet $ n \\in \\mathbb{Z} $ with $ 1 \\leq n \\leq 10^9 $.  \nDefine two operations:  \n- Operation $ A $: $ x \\mapsto 2x + 1 $  \n- Operation $ B $: $ x \\mapsto 2x + 2 $  \n\n**Constraints**  \nStart from $ x = 0 $. Apply a sequence of operations $ A $ and $ B $ to reach exactly $ n $.  \n\n**Objective**  \nFind a string $ s \\in \\{A, B\\}^* $ such that applying the operations in order from left to right to initial value $ 0 $ yields $ n $.","is_translate":false,"language":"Formal"}],"meta":{"iden":"CF10146D","tags":[],"sample_group":[],"created_at":"2026-03-03 11:00:39"}}