title: Program terminated with signal SIGABRT, Aborted
body: <pre><code>#include&lt;stdio.h&gt;
  #include&lt;stdlib.h&gt;
  int main(void)
  {
      int **seqList, n, q;
      scanf("%d %d", &amp;n, &amp;q);
      seqList = (int**)malloc(n * sizeof(int*));
      int *l_sub_seq = (int*)calloc(n, sizeof(int));//length of subsequences of all sequences                                              
      int lastAnswer = 0;
  
      while(q--)
      {
          int type, x, y, i;
          scanf("%d %d %d", &amp;type, &amp;x, &amp;y);
          i = (x^lastAnswer) % n;
          switch(type)
          {
              case 1:
              l_sub_seq[i]++;
              seqList[i] = (int*)realloc(seqList[i], sizeof(int)*l_sub_seq[i]);
              seqList[i][l_sub_seq[i] - 1] = y;
              break;
  
              case 2:
              lastAnswer = seqList[i][y%l_sub_seq[i]];
              printf("\n");
              break;
          }
      }
      for(int i = 0; i &lt; n; i++)
          free(seqList[i]);
      free(seqList);
  
      for(int i = 0; i &lt; n; i++)
          free(l_sub_seq);
  
      return 0;
  }
  </code></pre>
  
  <p><strong>Compiler message:</strong><br></p>
  
  <blockquote>
    <p>free(): double free detected in tcache 2<br> Reading symbols from
    Solution...done.<br> [New LWP 335079]<br> [Thread debugging using
    libthread_db enabled]<br> Using host libthread_db library
    "/lib/x86_64-linux-gnu/libthread_db.so.1".<br> Core was generated by
    `./Solution'.<br> Program terminated with signal SIGABRT, Aborted.<br>
    <em>#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50</em><br></p>
  </blockquote>