I hope my logic is correct. If it is why am I getting TLE??
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
int t;
cin>>t;
while( t-- ){
int n;
cin>>n;
int ans = 0;
long int s, max_speed = INT_MAX;
n++;
while( n-- ){
cin>>s;
//cout<<s<<endl;
if( s < max_speed ){
ans++;
//cout<<s<<" "<<ans<<endl;
max_speed = s;
}
}
cout<<ans<<endl;
}
}