eval(%w(
          TRE
         ES,MA
        KE   UP
      =ge     ts.
     ch        omp
    .sp         li
    t(32.chr).map(&
    :to         _i)
    ;he         igh
    t=[         ];m
    
    
         in=nil;
      TREES.times{;
    hei          ght<
   <ge            ts.t
  o_i;             };he
  ight                 
  .sor                 
   t!;0            .upt
    o(TR          EES-
      MAKE      UP){
         |i|;if(

    min=   =nil   )||(
    (hei   ght[   i+MA
    KEUP   -1]-   heig
    ht[i   ])<m   in);
    min=   heig   ht[i
    +MAK   EUP-   1]-h
    eigh   t[i]   ;end

    ;};p   uts(   min);

).join)
#AC