Finding the minimum difference in a list of numbers
You're worrying about the wrong problems: there isn't a lot more performance to be squeezed out of your code, but you could make substantial improvements to readability.


Choose a better file format
Why are you encoding the number of lines to be read into the file itself? That seems like redundant information. Just read all the lines there are and use those. You are also redundantly encoding the number of numbers per line: int N = int.Parse(sr.ReadLine());
You aren't doing anything with the parsed value, which is an indication that it shouldn't be in the file to start with.
Make your code reusable
Why not define the algorithm for finding the smallest difference inside an extension method? This allows you to separate the concerns of I/O and your minimum difference finding logic.

public static int SmallestDifference(this IEnumerable&lt;int&gt; source)
{
    var numbers = source as int[] ?? source.ToArray();
    Array.Sort(numbers);
    int difference = int.MaxValue;
    for (int i = 1; i &lt; numbers.Length; i++)
    {
        difference = Math.Min(difference, numbers[i] - numbers[i - 1]);
    }
    return difference;
}

Be expressive
Using the deferred execution streaming File.ReadLines method together with an expressive LINQ query, you can write code that reads fluently and makes sense rather than confusing the reader with details:

var minDifferences = from line in File.ReadLines("IN.in")
                     let numbers = from number in line.Split(' ')
                                   select int.Parse(number)
                     select numbers.SmallestDifference().ToString();
File.WriteAllLines("OUT.out", minDifferences);



Now here's a tiny surprise left for the end:


  This solution consistently performs at least as well as your original code.
  (On average, it's a couple of milliseconds faster per fifty thousand lines, but that's in the realm of microbenchmarking which should be avoided. Just trying to give you a rough idea.)
  So stop worrying about performance; strive for clean code instead.


EDIT: I understand that you can't change the format (as per your comment), so I've added the code below to allow you to stick with your current file layout. The modification required is tiny: simply skip the first line, and only look for the smallest difference in lines that have more than one number.

var minDifferences = from line in File.ReadLines("IN.in").Skip(1)
                     let numbers = from number in line.Split(' ')
                                   select int.Parse(number)
                     where numbers.Count() &gt; 1
                     select numbers.SmallestDifference().ToString();
File.WriteAllLines("OUT.out", minDifferences);