Runtime error in one of the test case Pairing

Can you help me with the code? I am getting runtime error after submitting it. Here is my code.

Hello @govilayush you are getting run time error because python codes are slower then the c++ codes and during the execution of large test cases they get more slower and eventually end up by giving run error.
you should try to implement it in c++ or java or c.
Happy Learning!!

So instead of run time error, Python should give TLE right?

I remember than run time error occurs if list is out of bounds or other exceptions.

Yes you are right but because of large test cases it isnot able to accomodate operations in it and as you said the list goes out of bounds or anythong like this happens then it will run time error.
Tle it will give when it is taking more time to compile and execute the code then the normal time it should take.

Therefore it should be TLE and not runtime error if that is the case right?

Can you share the code please…

Run time error when there come some problem during run time.

i have code in c++ but not in python.

Share the C++ code please

Hello @govilayush this is the code in c++ and it is using Disjoint set union in graphs.


if you have any doubt in this you can ask here:
Happy Learning!!

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.