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>Recurring Decimals</h1>3<!-- end en only -->4 5 6 7<!-- begin en only -->8<p>9A decimal representation of an integer can be transformed to another integer by rearranging the order of digits.10Let us make a sequence using this fact.11</p>12<p>13A non-negative integer <i>a</i><sub>0</sub> and the number of digits <i>L</i> are given first.14Applying the following rules, we obtain <i>a</i><sub><i>i</i>+1</sub> from <i>a</i><sub><i>i</i></sub>.15 16<ol>17 <li> Express the integer <i>a</i><sub><i>i</i></sub> in decimal notation with <i>L</i> digits. Leading zeros are added if necessary. For example, the decimal notation with six digits of the number 2012 is 002012.18 </li>19 <li> Rearranging the digits, find the largest possible integer and the smallest possible integer;20 In the example above, the largest possible integer is 221000 and the smallest is 000122 = 122.21 </li>22 <li> A new integer <i>a</i><sub><i>i</i>+1</sub> is obtained by subtracting the smallest possible integer from the largest.23 In the example above, we obtain 220878 subtracting 122 from 221000.24 </li>25</ol>26</p>27 28<p>29When you repeat this calculation, you will get a sequence of integers 30<i>a</i><sub>0</sub> , 31<i>a</i><sub>1</sub> , 32<i>a</i><sub>2</sub> , ... .33</p>34 35<p>36For example, starting with the integer 83268 and with the number of digits 6,37you will get the following sequence of integers38<i>a</i><sub>0</sub> , 39<i>a</i><sub>1</sub> , 40<i>a</i><sub>2</sub> , ... .41</p>42<!-- end en only -->43 44<blockquote>45<i>a</i><sub>0</sub> = 083268<br>46<i>a</i><sub>1</sub> = 886320 − 023688 = 862632<br>47<i>a</i><sub>2</sub> = 866322 − 223668 = 642654<br>48<i>a</i><sub>3</sub> = 665442 − 244566 = 420876<br>49<i>a</i><sub>4</sub> = 876420 − 024678 = 851742<br>50<i>a</i><sub>5</sub> = 875421 − 124578 = 750843<br>51<i>a</i><sub>6</sub> = 875430 − 034578 = 840852<br>52<i>a</i><sub>7</sub> = 885420 − 024588 = 860832<br>53<i>a</i><sub>8</sub> = 886320 − 023688 = 862632<br>54 …<br>55</blockquote>56 57<!-- begin en only -->58<p>59Because the number of digits to express integers is fixed, 60you will encounter occurrences of the same integer in the sequence61<i>a</i><sub>0</sub> , 62<i>a</i><sub>1</sub> , 63<i>a</i><sub>2</sub> , ...64eventually.65 66Therefore you can always find a pair of <i>i</i> and <i>j</i> 67that satisfies the condition <i>a</i><sub><i>i</i></sub> = <i>a</i><sub><i>j</i></sub> 68(<i>i</i> > <i>j</i> ).69In the example above, the pair (<i>i</i> = 8, <i>j</i> = 1) satisfies the condition because <i>a</i><sub>8</sub> = <i>a</i><sub>1</sub> = 862632.70</p>71 72<p>73Write a program that,74given an initial integer <i>a</i><sub>0</sub> and a number of digits <i>L</i>,75finds the smallest <i>i</i> that satisfies the condition <i>a</i><sub><i>i</i></sub> = <i>a</i><sub><i>j</i></sub> (<i>i</i> > <i>j</i> ).76 77</p>78<!-- end en only -->79 80 81 82<h3>Input</h3>83 84 85<!-- begin en only -->86<p>87The input consists of multiple datasets.88A dataset is a line containing two integers <i>a</i><sub>0</sub> and <i>L</i> 89separated by a space.90<i>a</i><sub>0</sub> and <i>L</i> 91represent the initial integer of the sequence and the number of digits, respectively,92where 931 ≤ <i>L</i> ≤ 694and 950 ≤ <i>a</i><sub>0</sub> < 10<sup><i>L</i></sup> .96</p>97<p>98The end of the input is indicated by a line containing two zeros;99it is not a dataset.100</p>101<!-- end en only -->102 103 104 105<h3>Output</h3>106 107<!-- begin en only -->108<p>109For each dataset, 110find the smallest number <i>i</i> 111that satisfies the condition112<i>a</i><sub><i>i</i></sub> = <i>a</i><sub><i>j</i></sub> (<i>i</i> > <i>j</i> )113and print a line containing three integers,114<i>j</i> , 115<i>a</i><sub><i>i</i></sub> and116<i>i</i> − <i>j</i>.117Numbers should be separated by a space.118Leading zeros should be suppressed.119Output lines should not contain extra characters.120</p>121<p>122You can assume that the above <i>i</i> is not123greater than 20.124</p>125<!-- end en only -->126 127<h3>Sample Input</h3>128 129<pre>1302012 413183268 61321112 41330 113499 21350 0136</pre>137 138 139<h3>Output for the Sample Input</h3>140 141<pre>1423 6174 11431 862632 71445 6174 11450 0 11461 0 1147</pre>148 