T mới làm thử vd 1 à, vd 2 chưa thử .-.
const fi='xethang.inp';
fo='xethang.out';
var n,i,j,t:integer;
k,c:real;
a: array [1..100] of integer;
d:array [1..100] of byte;
procedure sort;
begin
for i:=1 to n-1 do
for j:=i+1 to n do
if a[i]>a[j] then
begin
t:=a[j];
a[j]:=a[i];
a[i]:=t;
end;
end;
begin
assign(input,fi);
reset(input);
readln(n,k);
for i:=1 to n do
begin
read(c);
a[i]:=trunc(c*10);
end;
close(input);
sort;
for i:=1 to n do inc(d[a[i]]);
assign(output,fo);
rewrite(output);
if a[n]>k then writeln(a[n]/10-k:0:1) else writeln(0);
writeln(d[a[n]],' ',a[n]/10:0:1);
if d[a[n]]>1 then writeln(0) else writeln(d[a[n-1]],' ',a[n-1]/10:0:1);
if d[a[n-d[a[n]]]]>1 then writeln(0) else writeln(d[a[n-d[a[n]]]],' ',a[n-d[a[n]]]/10:0:1);
close(output);
end.