198392013 I got wrong while using GNU C++20 as compiler. But the same solution is accepted by GNU C++17 compiler.
198391568 This is the accepted solution using GNU C++17 compiler.
I wasted 5 to 6 hrs in searching of error, but it was the compiler. It's really frustrating while searching for errors, when there's not any.
Are the additional library in GNU C++20 causing this issue? I have used set in this problem, which seems to be not handled properly by this compiler.