why does one small if condition max out the time limit by one whole second?

here is a snippet of my lazers code which got me only partial points

for(long long i=0;i<n-1;i++)

{

```
{
struct Point p1 = {s[i].xcoord, s[i].ycoord}, q1 = {s[i+1].xcoord,s[i+1].ycoord};
if( i+1!=x2) //(this if condition is wrong I had used someother if condition to get 30 points this is only for light weight testing of time )
count++;
}
}
```

if I comment the if condition it gives wa obviously but takes 0.82 seconds but with the if condition it takes more than 2.01 seconds but why tho?

full code for reference (yes I have taken some code from gfg )

#include <bits/stdc++.h>

using namespace std;

struct coords{

long long xcoord;

long long ycoord;

};

struct Point

{

long long x;

long long y;

};

long long orientation(Point p, Point q, Point r)

{

```
long long val = (q.y - p.y) * (r.x - q.x) -
(q.x - p.x) * (r.y - q.y);
if (val == 0) return 0; // colinear
return (val > 0)? 1: 2; // clock or counterclock wise
```

}

bool doIntersect(Point p1, Point q1, Point p2, Point q2)

{

```
long long o1 = orientation(p1, q1, p2);
long long o2 = orientation(p1, q1, q2);
long long o3 = orientation(p2, q2, p1);
long long o4 = orientation(p2, q2, q1);
// General case
if (o1 != o2 && o3 != o4)
return true;
return false; // Doesn't fall in any of the above cases
```

}

int main()

{

ios_base::sync_with_stdio(false);

cin.tie(NULL);

int t;

cin>>t;

while(t–)

{

```
int n,q;
cin>>n>>q;
struct coords s[n];
for(int i=0;i<n;i++)
{
cin>>s[i].ycoord;
s[i].xcoord=i+1;
}
for(int i=0;i<q;i++)
{
int x1,x2,y;
cin>>x1>>x2>>y;
struct Point p2 = {x1, y}, q2 = {x2,y};
int count=0;
for(long long i=0;i<n-1;i++)
{
{
struct Point p1 = {s[i].xcoord, s[i].ycoord}, q1 = {s[i+1].xcoord,s[i+1].ycoord};
if( i+1!=x2)
count++;
}
}
cout<<count<<endl;
}
}
```

}

ps how do I insert code properly here it the code box comes only for some stuff