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 B: </font>Stylish</H1>3 4<p>5<i>Stylish</i> is a programming language whose syntax comprises <i>names</i>, that are sequences of Latin alphabet letters, three types of <i>grouping symbols</i>, periods ('.'), and newlines. Grouping symbols, namely round brackets ('(' and ')'), curly brackets ('{' and '}'), and square brackets ('[' and ']'), must match and be nested properly. Unlike most other programming languages, Stylish uses periods instead of whitespaces for the purpose of term separation. The following is an example of a Stylish program.6</p>7 8<pre>91 ( Welcome .to102 ......... Stylish )113 { Stylish .is124 .....[.( a. programming . language .fun .to. learn )135 .......]146 ..... Maybe .[157 ....... It. will .be.an. official . ICPC . language168 .......]179 .....}18</pre>19 20 21<p>22As you see in the example, a Stylish program is indented by periods. The <i>amount of indentation</i> of a line is the number of leading periods of it.23</p>24 25<p>26Your mission is to visit Stylish masters, learn their indentation styles, and become the youngest Stylish master. An indentation style for <i>well-indented</i> Stylish programs is defined by a triple of integers, (<i>R</i>, <i>C</i>, <i>S</i>), satisfying 1 ≤ <i>R</i>, <i>C</i>, <i>S</i> ≤ 20. <i>R</i>, <i>C</i> and <i>S</i> are amounts of indentation introduced by an open round bracket, an open curly bracket, and an open square bracket, respectively.27</p>28 29<p>30In a well-indented program, the amount of indentation of a line is given by <i>R</i>(<i>r<sub>o</sub></i> − <i>r<sub>c</sub></i>) + <i>C</i>(<i>c<sub>o</sub></i> − <i>c<sub>c</sub></i>) + <i>S</i>(<i>s<sub>o</sub></i> − <i>s<sub>c</sub></i>), where <i>r<sub>o</sub></i>, <i>c<sub>o</sub></i>, and <i>s<sub>o</sub></i> are the numbers of occurrences of open round, curly, and square brackets in all preceding lines, respectively, and <i>r<sub>c</sub></i>, <i>c<sub>c</sub></i>, and <i>s<sub>c</sub></i> are those of close brackets. The first line has no indentation in any well-indented program.31</p>32 33<p>34The above example is formatted in the indentation style (<i>R</i>, <i>C</i>, <i>S</i>) = (9, 5, 2). The only grouping symbol occurring in the first line of the above program is an open round bracket. Therefore the amount of indentation for the second line is 9 · (1 − 0) + 5 · (0 − 0) + 2 ·(0 − 0) = 9. The first four lines contain two open round brackets, one open curly bracket, one open square bracket, two close round brackets, but no close curly nor square bracket. Therefore the amount of indentation for the fifth line is 9 · (2 − 2) + 5 · (1 − 0) + 2 · (1 − 0) = 7.35</p>36 37<p>38Stylish masters write only well-indented Stylish programs. Every master has his/her own indentation style.39</p>40 41<p>42Write a program that imitates indentation styles of Stylish masters.43</p>44 45<H2>Input</H2>46 47<p>48The input consists of multiple datasets. The first line of a dataset contains two integers <i>p</i> (1 ≤ <i>p</i> ≤ 10) and <i>q</i> (1 ≤ <i>q</i> ≤ 10). The next <i>p</i> lines form a well-indented program <i>P</i> written by a49Stylish master and the following <i>q</i> lines form another program <i>Q</i>. You may assume that every line of both programs has at least one character and at most 80 characters. Also, you may assume that no line of <i>Q</i> starts with a period.50</p>51 52<p>53The last dataset is followed by a line containing two zeros.54</p>55 56 57<H2>Output</H2>58 59<p>60Apply the indentation style of <i>P</i> to <i>Q</i> and output the appropriate amount of indentation for each line of <i>Q</i>. The amounts must be output in a line in the order of corresponding lines of <i>Q</i> and they must be separated by a single space. The last one should not be followed by trailing spaces. If the appropriate amount of indentation of a line of <i>Q</i> cannot be determined uniquely through analysis of <i>P</i>, then output <span>-1</span> for that line.61</p>62 63<H2>Sample Input</H2>64<pre>655 466(Follow.my.style67.........starting.from.round.brackets)68{then.curly.brackets69.....[.and.finally70.......square.brackets.]}71(Thank.you72{for.showing.me73[all74the.secrets]})754 276(This.time.I.will.show.you77.........(how.to.use.round.brackets)78.........[but.not.about.square.brackets]79.........{nor.curly.brackets})80(I.learned81how.to.use.round.brackets)824 283(This.time.I.will.show.you84.........(how.to.use.round.brackets)85.........[but.not.about.square.brackets]86.........{nor.curly.brackets})87[I.have.not.learned88how.to.use.square.brackets]892 290(Be.smart.and.let.fear.of91..(closed.brackets).go)92(A.pair.of.round.brackets.enclosing93[A.line.enclosed.in.square.brackets])941 295Telling.you.nothing.but.you.can.make.it96[One.liner.(is).(never.indented)]97[One.liner.(is).(never.indented)]982 499([{Learn.from.my.KungFu100...}])101((102{{103[[104]]}}))1051 2106Do.not.waste.your.time.trying.to.read.from.emptiness107(108)1092 3110({Quite.interesting.art.of.ambiguity111....})112{113(114)}1152 4116({[117............................................................]})118(119{120[121]})1220 0123</pre>124 125<H2>Output for the Sample Input</H2>126<pre>1270 9 14 161280 91290 -11300 21310 01320 2 4 61330 -11340 -1 41350 20 40 60136</pre>