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 H:</font> Bug Hunt</H1>3 4<p>5In this problem, we consider a simple programming language that has only declarations of one-6dimensional integer arrays and assignment statements. The problem is to find a bug in the given7program.8</p>9<p>10The syntax of this language is given in BNF as follows:11</p>12 13<center>14<img src="https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_bugHunt">15</center>16 17<p>18where <span><</span><i>new line</i><span>></span> denotes a new line character (LF).19</p>20<p>21Characters used in a program are alphabetical letters, decimal digits, <span>=</span>, <span>[</span>, <span>]</span> and new line characters. No other characters appear in a program.22</p>23<p>24A declaration declares an array and specifies its length. Valid indices of an array of length <i>n</i> are integers between 0 and <i>n</i> - 1, inclusive. Note that the array names are case sensitive, i.e.25array <span>a</span> and array <span>A</span> are different arrays. The initial value of each element in the declared array is undefined.26</p>27<p>28For example, array <span>a</span> of length 10 and array <span>b</span> of length 5 are declared respectively as follows.29</p>30 31<pre>32a[10]33b[5]34</pre>35 36<p>37An expression evaluates to a non-negative integer. A <span><</span><i>number</i><span>></span> is interpreted as a decimal38integer. An <span><</span><i>array_name</i><span>></span> <span>[<</span><i>expression</i><span>>]</span> evaluates to the value of the <span><</span><i>expression</i><span>></span> -th element of39the array. An assignment assigns the value denoted by the right hand side to the array element40specified by the left hand side.41</p>42 43<p>44Examples of assignments are as follows.45</p>46 47<pre>48a[0]=349a[1]=050a[2]=a[a[1]]51a[a[0]]=a[1]52</pre>53 54<p>55A program is executed from the first line, line by line. You can assume that an array is declared once and only once before any of its element is assigned or referred to.56</p>57 58<p>59Given a program, you are requested to find the following bugs.60</p>61 62<ul>63 <li> An index of an array is invalid.</li>64 <li> An array element that has not been assigned before is referred to in an assignment as an index of array or as the value to be assigned.</li>65</ul>66 67<p>68You can assume that other bugs, such as syntax errors, do not appear. You can also assume69that integers represented by <span><</span><i>number</i><span>></span>s are between 0 and 2<sup>31</sup> - 1 (= 2147483647), inclusive.70</p>71 72<H2>Input</H2>73 74<p>75The input consists of multiple datasets followed by a line which contains only a single '<span>.</span>' (period).76Each dataset consists of a program also followed by a line which contains only a single '<span>.</span>' (period).77A program does not exceed 1000 lines. Any line does not exceed 80 characters excluding a new78line character.79 80</p>81 82<H2>Output</H2>83 84<p>85For each program in the input, you should answer the line number of the assignment in which86the first bug appears. The line numbers start with 1 for each program. If the program does not87have a bug, you should answer zero. The output should not contain extra characters such as88spaces.89 90</p>91 92<H2>Sample Input</H2>93<pre>94a[3]95a[0]=a[1]96.97x[1]98x[0]=x[0]99.100a[0]101a[0]=1102.103b[2]104b[0]=2105b[1]=b[b[0]]106b[0]=b[1]107.108g[2]109G[10]110g[0]=0111g[1]=G[0]112.113a[2147483647]114a[0]=1115B[2]116B[a[0]]=2117a[B[a[0]]]=3118a[2147483646]=a[2]119.120.121</pre>122 123<H2>Output for the Sample Input</H2>124<pre>125212621272128312941300131</pre>132 133 134 135 136 