prithivMLmods/Coder-Stat
Coder-Stat Dataset Overview The Coder-Stat dataset is a collection of programming-related data, including problem IDs, programming languages, original statuses, and source code snippets. This dataset is designed to assist in the analysis of coding patterns, error types, and performance metrics. Dataset Details Modalities Tabular: The dataset is structured in a tabular format. Text: Contains text data, including source code snippets.… See the full description on the dataset page: https://huggingface.co/datasets/prithivMLmods/Coder-Stat.
3139
1 2<H1><font color="#000">Problem A: </font> Ginkgo Numbers</H1>3 4<p>5We will define Ginkgo numbers and multiplication on Ginkgo numbers.6</p>7 8<p>9A <i>Ginkgo number</i> is a pair <<i>m</i>, <i>n</i>> where <i>m</i> and <i>n</i> are integers. For example, <1, 1>, <-2, 1> and <-3,-1> are Ginkgo numbers.10</p>11 12<p>13The multiplication on Ginkgo numbers is defined by <<i>m</i>, <i>n</i>> · <<i>x</i>, <i>y</i>> = <<i>mx</i> − <i>ny</i>, <i>my</i> + <i>nx</i>>. For example, <1, 1> · <-2, 1> = <-3,-1>.14</p>15 16<p>17A Ginkgo number <<i>m</i>, <i>n</i>> is called a divisor of a Ginkgo number <<i>p</i>, <i>q</i>> if there exists a Ginkgo number <<i>x</i>, <i>y</i>> such that <<i>m</i>, <i>n</i>> · <<i>x</i>, <i>y</i>> = <<i>p</i>, <i>q</i>>.18</p>19 20<p>21For any Ginkgo number <<i>m</i>, <i>n</i>>, Ginkgo numbers <1, 0>, <0, 1>, <-1, 0>, <0,-1>, <<i>m</i>, <i>n</i>>, <-<i>n</i>,<i>m</i>>, <-<i>m</i>,-<i>n</i>> and <<i>n</i>,-<i>m</i>> are divisors of <<i>m</i>, <i>n</i>>. If <i>m</i><sup>2</sup>+<i>n</i><sup>2</sup> > 1, these Ginkgo numbers are distinct. In other words, any Ginkgo number such that <i>m</i><sup>2</sup> + <i>n</i><sup>2</sup> > 1 has at least eight divisors.22</p>23 24<p>25A Ginkgo number <<i>m</i>, <i>n</i>> is called a prime if <i>m</i><sup>2</sup>+<i>n</i><sup>2</sup> > 1 and it has exactly eight divisors. Your mission is to check whether a given Ginkgo number is a prime or not.26</p>27 28<p>29The following two facts might be useful to check whether a Ginkgo number is a divisor of another Ginkgo number.30</p>31 32<ul>33<li> Suppose <i>m</i><sup>2</sup> + <i>n</i><sup>2</sup> > 0. Then, <<i>m</i>, <i>n</i>> is a divisor of <<i>p</i>, <i>q</i>> if and only if the integer <i>m</i><sup>2</sup> + <i>n</i><sup>2</sup> is a common divisor of <i>mp</i> + <i>nq</i> and <i>mq</i> − <i>np</i>.</li>34<li> If <<i>m</i>, <i>n</i>> · <<i>x</i>, <i>y</i>> = <<i>p</i>, <i>q</i>>, then (<i>m</i><sup>2</sup> + <i>n</i><sup>2</sup>)(<i>x</i><sup>2</sup> + <i>y</i><sup>2</sup>) = <i>p</i><sup>2</sup> + <i>q</i><sup>2</sup>.</li>35</ul>36 37 38<H2>Input</H2>39 40<p>41The first line of the input contains a single integer, which is the number of datasets.42</p>43 44<p>45The rest of the input is a sequence of datasets. Each dataset is a line containing two integers <i>m</i> and <i>n</i>, separated by a space. They designate the Ginkgo number <<i>m</i>, <i>n</i>>. You can assume 1 < <i>m</i><sup>2</sup> + <i>n</i><sup>2</sup> < 20000.46</p>47 48 49<H2>Output</H2>50 51<p>52For each dataset, output a character '<span>P</span>' in a line if the Ginkgo number is a prime. Output a character '<span>C</span>' in a line otherwise.53</p>54 55<H2>Sample Input</H2>56<pre>5785810 0590 260-3 0614 2620 -1363-4 164-2 -1653 -166</pre>67 68<H2>Output for the Sample Input</H2>69<pre>70C71C72P73C74C75P76P77C78</pre>