Help me in solving PLAYFIT problem

My issue

plz look into this code & what is mistake in this

My code

#include <bits/stdc++.h>
#define ll long long int
using namespace std;

int main() {
	// your code goes here
	
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	int t;
	cin>>t;
	while(t--){
	    ll n;
	    cin>>n;
	    vector<int>v(n);
	    ll ans=0;
	  for(ll i=0;i<n;i++)cin>>v[i];
	  
	    for(ll i=0;i<n-1;i++){
	        ans=max(ans,(v[i+1]-v[i]));
	    }
	    
	    if(ans<=0)cout<<"UNFIT\n";
	    else cout<<ans<<endl;
	   
	}
	    
	return 0;
}

Problem Link: PLAYFIT Problem - CodeChef

 #include <bits/stdc++.h>
#define ll long long int
using namespace std;

int main() {
	// your code goes here
	
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	int t;
	cin>>t;
	while(t--){
	    ll n;
	    cin>>n;
	    vector<int>v(n);
	    int ans=0,minm = INT_MAX;
	  for(ll i=0;i<n;i++)cin>>v[i];
	  
	    for(ll i=0;i<n;i++){
	        minm = min(minm,v[i]);
	        ans=max(ans,(v[i]-minm));
	    }
	    
	    if(ans<=0)cout<<"UNFIT\n";
	    else cout<<ans<<endl;
	   
	}
	    
	return 0;
}

Your corrected code.