SIGSEGV Error

Why i am getting Runtime error (SIGSEGV) in this code CodeChef: Practical coding for everyone? Please Tell…
Problem: CodeChef: Practical coding for everyone

Try to submit in non IDE mode.

1 Like

Same error.

Remove first three line.

in int main()

https://www.codechef.com/viewsolution/37137506
Same Error

@admin

Half-asleep, but:

[simon@simon-laptop][05:17:11]
[~/devel/hackerrank/otherpeoples]>./compile-latest-cpp.sh 
Compiling vivekdest-INPSTFIX.cpp
+ g++ -std=c++14 vivekdest-INPSTFIX.cpp -O3 -g3 -Wall -Wextra -Wconversion -DONLINE_JUDGE -D_GLIBCXX_DEBUG -fsanitize=undefined -ftrapv
+ set +x
Successful
[simon@simon-laptop][05:17:16]
[~/devel/hackerrank/otherpeoples]>echo "1
5
A*B+C
" | ./a.out
AB*/usr/include/c++/7/bits/stl_stack.h:200: std::stack<_Tp, _Sequence>::reference std::stack<_Tp, _Sequence>::top() [with _Tp = char; _Sequence = std::__debug::deque<char, std::allocator<char> >; std::stack<_Tp, _Sequence>::reference = char&]: Assertion '__builtin_expect(!this->empty(), true)' failed.
Aborted (core dumped)
1 Like

Sorry didn’t understand

Line 49, If s.size() equals zero then in: if(s.top()==’(’ || s.size()==0)
First s.top is checked and if s is empty it’ll show error.

Thank You… It’s working

:fist_right: :fist_left: