title: Runtime error on hackerrank problems for no reason?
body: <p>This is the question:
  <a href="https://www.hackerrank.com/challenges/lisa-workbook/problem" rel="nofollow noreferrer">https://www.hackerrank.com/challenges/lisa-workbook/problem</a>.</p>
  <p>My code passes all the test cases except one. The message I get is just <em>Run Time Error</em>. Even if I return 0 at the beginning of the function that I am supposed to implement, I still get this error, while in all other test cases I get <em>Wrong Answer</em>.</p>
  <p>This is not the only question on hacker rank where this happened. In the last couple of days I encountered 3 or 4 more questions with that one odd case that was always giving a runtime error. In the end, I had to implement a Python 3 solution (with the same logic), which passed all the test cases, to solve these problems.</p>
  <p>I wonder if this is a bug on the website or if I am understanding something wrongly. Here is my function implementation for this problem:</p>
  <pre class="lang-c prettyprint-override"><code>int workbook(int n, int k, int arr_count, int* arr)
  {
      int tmp = 1, specprob = 0;
      int *chstart = malloc(n * sizeof(int));
      int *chend = malloc(n * sizeof(int));
      for (int i = 0; i &lt; n; i++) {
          chstart[i] = tmp;
          tmp += arr[i] / k - 1;
          if (arr[i] % k != 0) {
              tmp++;
          }
          chend[i] = tmp;
          tmp++;
          if (!(arr[i] &lt; chstart[i])) {
              int qno = 0, chpage = 1, iqno = 0;
              for (int j = chstart[i]; j &lt; chend[i] + 1; j++) {
                  if (chpage * k &lt;= arr[i]) {
                      qno += k;
                  } else {
                      qno += (k - (chpage * k - arr[i]));
                  }
                  if (j &gt; iqno &amp;&amp; j &lt; qno + 1) {
                      specprob++;
                  }
                  iqno = qno;
                  chpage++;
              }
          }
      }
      return specprob;
  }
  </code></pre>