fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int N;
  6. cin >> N;
  7. int *a = new int [N + 1];
  8. a[0] = 1;
  9. a[1] = 1;
  10. a[2] = 2;
  11. for (int i = 3; i <= N + 1; i++)
  12. a[i] = a[i - 1] + a[i - 2] + a[i - 3];
  13. cout << a[N];
  14. delete [] a;
  15. return 0;
  16. }
Runtime error #stdin #stdout #stderr 0s 3436KB
stdin
2
stdout
2
stderr
*** Error in `./prog': free(): invalid next size (fast): 0x09c59008 ***
prog: malloc.c:2369: sysmalloc: Assertion `(old_top == (((mbinptr) (((char *) &((av)->bins[((1) - 1) * 2])) - __builtin_offsetof (struct malloc_chunk, fd)))) && old_size == 0) || ((unsigned long) (old_size) >= (unsigned long)((((__builtin_offsetof (struct malloc_chunk, fd_nextsize))+((2 * (sizeof(size_t))) - 1)) & ~((2 * (sizeof(size_t))) - 1))) && ((old_top)->size & 0x1) && ((unsigned long)old_end & pagemask) == 0)' failed.