Getting WA please help Question STICKS

link to question
here is my code .
I have put comment lines which indicated the purpose
and and since am a beginner here my Time limit is a lot but i will optimise it more but here am getting WA which i am unable to understand.
link to solution.

Consider the test case
3 3 2 2 3 3
Your code outputs 6.
The second largest need not be lesser than than the largest.

1 Like

thanks a ton @everule1 means a lot.

1 Like

@everule1 i then submitted with after sorting and got AC
but then i found max two times but i was getting runtime error i dont why

Sigsegv, sigfpe?

i think to do something with around line 79 .
getting sigsegv while submitting and for sample test case getting SIGTSTP