TADELIVE : Run Time Error

all subtasks passed except one. I am unable to find the error.
Links to the question and my code are :
Question
My Solution

Please Help.

New ambition: get everyone to use debug compiler flags when debugging :slight_smile:

[simon@simon-laptop][10:28:36]
[~/devel/hackerrank/otherpeoples]>g++ -std=c++14 askswaraj-TADELIVE.cpp -O3 -g3 -Wall -Wextra -DONLINE_JUDGE  -D_GLIBCXX_DEBUG -fsanitize=undefined  -ftrapv
askswaraj-TADELIVE.cpp: In function ‘int main()’:
askswaraj-TADELIVE.cpp:17:9: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’, declared with attribute warn_unused_result [-Wunused-result]
  freopen("input1.txt", "r", stdin);
  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
askswaraj-TADELIVE.cpp:18:9: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’, declared with attribute warn_unused_result [-Wunused-result]
  freopen("output1.txt", "w", stdout);
  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
[simon@simon-laptop][10:29:07]
[~/devel/hackerrank/otherpeoples]>echo "5 3 3                                                                                
1 2 3 4 5
5 4 3 2 1" | ./a.out
/usr/include/c++/7/bits/stl_algo.h:4866:
Error: comparison doesn't meet irreflexive requirements, assert(!(a < a)).

Objects involved in the operation:
    instance "functor" @ 0x0x7ffe63bde738 {
      type = bool (*)(node, node);
    }
    iterator::value_type "ordered type" {
      type = node;
    }
Aborted (core dumped)
3 Likes