Feedback for EID problem

Problem Link: EID Problem - CodeChef
The output in codechef is different from the one I’m getting on vs code
I would like you to please clarify the output for this problem

Feedback

I tried to copy paste my code on vs code and tried to get the output , i got the same output .
maybe u should just try running the code with one test case.(try running both the test cases seperately by putting the value 1 in the while loop.)

I also pasted my code over here just in case .

#include<bits/stdc++.h>
using namespace std;
int main()
    {    int t;
        cin>>t;
        while(t--)
        {   int c=0,ans=0;
            int n;
            cin>>n;
            int a[n];
            for(int i=0;i<n;i++)
            {
               cin>>a[i]; 
            }
            sort(a,a+n);
            int m=INT_MAX;
            for(int i=1;i<n;i++)
            {
                int d=abs(a[i]-a[i-1]);
                m=min(m,d);//updation of least value 
            }
            cout<<m<<endl;
        }
           
        return 0;
    }