For a great while of my CP career I had no idea how such, at a first glance, insignificant things might affect the runtime of the code. And till this day I keep seeing many beginners having lack of knowledge about this so-called effect, that's why I would like to share it here and hope it'll help you out someday.
1st code 164992399 executes in a time of 1918ms.
2nd code 164991769 executes in a time of 280ms.
Notice 2 drastically different runtimes (6x difference!). The reason for that is pretty straightforward: in this code one of three IF statements gets a true response way more often than others (IF statement with == 2). While the first code has an IF statement with 2 at the end, the second code has such IF statement at the beginning.
Knowing this we can make a conclusion: the order of IF statements matters, and sometimes matters a lot (you get AC or TLE). So whenever you hit (or feel you might hit) the bound of the time limit you always want to check whether all IF statements are placed in the right order and if not — a little change might make you happier by seeing this lovely green Accepted word.