I AM JUST CHECKING FOR WHICH TWO CONSECUTIVE PAIRS THE FIRST CAR SPEED IS GREATER THAN THAT OF SECOND ONE AND INCREMENTS THE COUNT. FIRST CAR WILL ALWAYS MOVE AT ITS MAX SPEED SO INITIAL VALUE OF COUNT IS SET TO ONE , BUT WHERE I AM GOING WRONG?

#include <bits/stdc++.h>
using namespace std;

int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t;
cin>>t;
while(t--){
int n,count=1;
cin>>n;
long int arr[n];
for(int i=0;i<n;i++)
cin>>arr[i];
for(int i=1;i<n;i++){
if(arr[i-1]>arr[i])
count++;
}
cout<<count<<endl;
}
return 0;
}

consider a test case 4 8 5 3
as the first car speed is at 4 the second car has to reduce its speed at 4 so the third car cannot be at its maximum speed at 5 as the car in front of him is at 4 but by your code you will count the third car at its maximum speed.

int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);

int t;
cin>>t;
while(t--){
int n,count=1;
cin>>n;
long int arr[n];
for(int i=0;i<n;i++)
cin>>arr[i];
maximum = arr[0] // maximum speed at
present//
count = 1 // first one will always be in its
maximum speed //
for(int i=1;i<n;i++){
if(maximum >= arr[i]);
maximum = arr[i]
count ++
}
cout<<count<<endl;
}
return 0;
}

// this should be the correct answerâ€¦ hope you understand
// please donâ€™t just copy and paste it there might be some error but the approach is correct.