{"kind":"task","effective_mode":"full","benchmark":{"kind":"benchmark","effective_mode":"full","slug":"hlce","formal_name":"Humanity's Last Code Exam","introduction":"Humanity's Last Code Exam evaluates problem solving and code generation using ICPC World Finals and IOI problems. The project describes 235 problems; this import selects its public ICPC dataset of 146 problems.","introduction_ja":"","introduction_en":"","category":"Category not supplied","task_count":null,"acquisition_status":"Acquisition status not supplied","official_url":"https://humanity-s-last-code-exam.github.io/website/","indexing_mode":"noindex","profile":{"resources":[],"task_format":"","scoring":"","metric":"","size":"","answer_access":"","license":"","citation":"","maintainer":"","released":"","why_hard":"","related":[]}},"task_id":"6404bb87-4dba-5b28-a378-6dd6134c2b3e","task_key":"ICPC~2dWorld~2dFinals--examples--2021~5fC","task_revision_id":"2","upstream_id":"2021_C","short_description":"Fair Division","config":"ICPC-World-Finals","split":"examples","body":"{\"platform\":\"atcoder\",\"question_content\":\"## Problem Statement\\n\\nAfter sailing the Seven Seas and raiding many ships, Cap’n Red and his crew of fellow pirates are finally ready to divide their loot. According to ancient traditions, the crew stands in a circle ordered by a strict pirate hierarchy. \\n\\nCap’n Red starts by taking a fraction \\\\( f \\\\) of the loot and passing the remainder on to the next pirate. That pirate takes the same fraction \\\\( f \\\\) of the loot left over by the previous pirate and passes the remainder on to the following pirate. Each pirate behaves in the same way, taking a fraction \\\\( f \\\\) of what is left and passing on the rest. The last pirate in the hierarchy passes the remainder on to Cap’n Red, who starts another round of this “fair” division, and so on, indefinitely.\\n\\nFortunately, pirates in the 21st century can use a computer to avoid this lengthy process and constant nitpicking when the fraction \\\\( f \\\\) does not exactly divide the loot at some step. You have been captured by the pirates and asked to come up with a suitable fraction \\\\( f \\\\). As an incentive, Cap’n Red has promised to leave you alive if you succeed.\\n\\nThe fraction \\\\( f \\\\) needs to be a rational number strictly between 0 and 1. It is not necessary that \\\\( f \\\\) exactly divides the loot remaining at any step of the round-robin process described above. However, the total loot that would be assigned to each pirate by carrying out this process infinitely needs to be an integer.\\n\\n### Input\\n\\nThe input consists of one line with two integers \\\\( n \\\\) and \\\\( m \\\\), where:\\n\\n- \\\\( n \\\\) (6 ≤ \\\\( n \\\\) ≤ \\\\( 10^6 \\\\)) is the number of pirates including Cap’n Red.\\n- \\\\( m \\\\) (1 ≤ \\\\( m \\\\) ≤ \\\\( 10^{18} \\\\)) is the total value of their loot.\\n\\n### Output\\n\\nOutput one line with two positive integers \\\\( p \\\\) and \\\\( q \\\\), where \\\\( f = \\\\frac{p}{q} \\\\) as specified above. If there are multiple suitable fractions, choose one with the smallest \\\\( q \\\\). Among multiple suitable fractions with the same smallest \\\\( q \\\\), choose the one with the smallest \\\\( p \\\\). If there is no suitable fraction, output `impossible` instead and hope for mercy.\\n\\n### Sample Input 1\\n```\\n8 51000\\n```\\n\\n### Sample Output 1\\n```\\n1 2\\n```\\n\\n### Sample Input 2\\n```\\n6 91000\\n```\\n\\n### Sample Output 2\\n```\\n2 3\\n```\\n\\n### Sample Input 3\\n```\\n10 1000000000000000000\\n```\\n\\n### Sample Output 3\\n```\\nimpossible\\n```\",\"question_title\":\"Fair Division\"}","display_format":"text","language":"","answer_status":"published","assets":[],"source_url":"https://humanity-s-last-code-exam.github.io/website/","history":"initial import","indexing_mode":"noindex","subproblems":[],"grids":[]}