1.During contest, 2. In practice mode, and 3.after reading editorial. Sometimes, when I can't prove the correctness of the approach of the editorial(because the editorial says "the proof is obvious", and skips the proof entirely), and there aren't any proofs in comments section too. I can't decide how much time should be spent thinking about the proof. I think and think until and unless I am able to prove it. Is this the right thing to do, even if it takes a few days sometimes?
During contest
I try to disprove my approach with test cases instead of looking for mathematical proof.
During practice
I try to think of a proper proof, then try to disprove the proof with test cases.
Editorial I try to think of a proper proof, then try to disprove the proof with test cases.