Unusual runtime error

Today while solving problem D of Codeforces round I have encountered a runtime error and I am not able to figure out the reason for it,it will be very helpful if someone can spot the line where the runtime error is happening exactly, below is the submission, note that problem can be accessed from the same link
Link

Looks like a stackoverflow error with sample test input:

[simon@simon-laptop][20:50:56]
[~/devel/hackerrank/otherpeoples]> g++ -std=c++17 suzan1234-1609D.cpp  -g3 -Wall -Wextra -Wconversion -DONLINE_JUDGE -D_GLIBCXX_DEBUG    -fsanitize=undefined -ftrapv        
suzan1234-1609D.cpp: In function ‘int find_par(int)’:
suzan1234-1609D.cpp:92:28: warning: conversion from ‘__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type’ {aka ‘long long int’} to ‘int’ may change value [-Wconversion]
   92 |     int x = find_par(par[a]);
      |                            ^
suzan1234-1609D.cpp: In function ‘void solve()’:
suzan1234-1609D.cpp:151:32: warning: conversion from ‘long long int’ to ‘std::__debug::set<int>::value_type’ {aka ‘int’} may change value [-Wconversion]
  151 |                 temp.insert(abs(par[j]));
      |                             ~~~^~~~~~~~
suzan1234-1609D.cpp:117:9: warning: unused variable ‘addon’ [-Wunused-variable]
  117 |     int addon = 0;
      |         ^~~~~
[simon@simon-laptop][20:51:03]
[~/devel/hackerrank/otherpeoples]>gdb ./a.out 
GNU gdb (Ubuntu 9.2-0ubuntu1~20.04) 9.2
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./a.out...
(gdb) r < 1609D-testcase-sample1.txt                  
Starting program: /home/simon/devel/hackerrank/otherpeoples/a.out < 1609D-testcase-sample1.txt
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
1
1
3
3
3
6

Program received signal SIGSEGV, Segmentation fault.
0x000055555556c84d in std::__cxx1998::vector<long long, std::allocator<long long> >::size (this=<error reading variable: Cannot access memory at address 0x7fffff7feff8>)
    at /usr/include/c++/9/bits/stl_vector.h:915
915           size() const _GLIBCXX_NOEXCEPT
(gdb) bt
#0  0x000055555556c84d in std::__cxx1998::vector<long long, std::allocator<long long> >::size (this=<error reading variable: Cannot access memory at address 0x7fffff7feff8>)
    at /usr/include/c++/9/bits/stl_vector.h:915
#1  0x000055555556cc74 in std::__cxx1998::vector<long long, std::allocator<long long> >::operator[] (this=0x55555558b4b8 <par+24>, __n=0) at /usr/include/c++/9/bits/stl_vector.h:1042
#2  0x000055555556a1ec in std::__debug::vector<long long, std::allocator<long long> >::operator[] (this=0x55555558b4a0 <par>, __n=0) at /usr/include/c++/9/debug/vector:428
#3  0x000055555556610a in find_par (a=0) at suzan1234-1609D.cpp:88
#4  0x0000555555566185 in find_par (a=0) at suzan1234-1609D.cpp:92
#5  0x0000555555566185 in find_par (a=0) at suzan1234-1609D.cpp:92
#6  0x0000555555566185 in find_par (a=0) at suzan1234-1609D.cpp:92
#7  0x0000555555566185 in find_par (a=0) at suzan1234-1609D.cpp:92
#8  0x0000555555566185 in find_par (a=0) at suzan1234-1609D.cpp:92
#9  0x0000555555566185 in find_par (a=0) at suzan1234-1609D.cpp:92
#10 0x0000555555566185 in find_par (a=0) at suzan1234-1609D.cpp:92
#11 0x0000555555566185 in find_par (a=0) at suzan1234-1609D.cpp:92
#12 0x0000555555566185 in find_par (a=0) at suzan1234-1609D.cpp:92
#13 0x0000555555566185 in find_par (a=0) at suzan1234-1609D.cpp:92
#14 0x0000555555566185 in find_par (a=0) at suzan1234-1609D.cpp:92
#15 0x0000555555566185 in find_par (a=0) at suzan1234-1609D.cpp:92
#16 0x0000555555566185 in find_par (a=0) at suzan1234-1609D.cpp:92
#17 0x0000555555566185 in find_par (a=0) at suzan1234-1609D.cpp:92
#18 0x0000555555566185 in find_par (a=0) at suzan1234-1609D.cpp:92
#19 0x0000555555566185 in find_par (a=0) at suzan1234-1609D.cpp:92
#20 0x0000555555566185 in find_par (a=0) at suzan1234-1609D.cpp:92
#21 0x0000555555566185 in find_par (a=0) at suzan1234-1609D.cpp:92
#22 0x0000555555566185 in find_par (a=0) at suzan1234-1609D.cpp:92
#23 0x0000555555566185 in find_par (a=0) at suzan1234-1609D.cpp:92
#24 0x0000555555566185 in find_par (a=0) at suzan1234-1609D.cpp:92
#25 0x0000555555566185 in find_par (a=0) at suzan1234-1609D.cpp:92
#26 0x0000555555566185 in find_par (a=0) at suzan1234-1609D.cpp:92
#27 0x0000555555566185 in find_par (a=0) at suzan1234-1609D.cpp:92
#28 0x0000555555566185 in find_par (a=0) at suzan1234-1609D.cpp:92
#29 0x0000555555566185 in find_par (a=0) at suzan1234-1609D.cpp:92
#30 0x0000555555566185 in find_par (a=0) at suzan1234-1609D.cpp:92
#31 0x0000555555566185 in find_par (a=0) at suzan1234-1609D.cpp:92
#32 0x0000555555566185 in find_par (a=0) at suzan1234-1609D.cpp:92
#33 0x0000555555566185 in find_par (a=0) at suzan1234-1609D.cpp:92
#34 0x0000555555566185 in find_par (a=0) at suzan1234-1609D.cpp:92
#35 0x0000555555566185 in find_par (a=0) at suzan1234-1609D.cpp:92
#36 0x0000555555566185 in find_par (a=0) at suzan1234-1609D.cpp:92
#37 0x0000555555566185 in find_par (a=0) at suzan1234-1609D.cpp:92
#38 0x0000555555566185 in find_par (a=0) at suzan1234-1609D.cpp:92
#39 0x0000555555566185 in find_par (a=0) at suzan1234-1609D.cpp:92
#40 0x0000555555566185 in find_par (a=0) at suzan1234-1609D.cpp:92
--Type <RET> for more, q to quit, c to continue without paging--