Вітаю Вас, Гость

Задача А
var n,m,k,i:longint;
    rez,r,p:longint;
    a,b,c:array[-100000..100000] of int64;
begin
  readln(n,m,k);
  for i:=1 to n do
    read(a[i]);
  rez:=0;
  r:=1000000300;
  while rez<r-1 do
    begin
      fillchar(c,sizeof(c),0);
      p:=(rez+r) div 2;
      for i:=1 to n do
        if a[i]>p then b[i]:=0 else b[i]:=p-a[i];
      for i:=1 to n do
        begin
          b[i]:=b[i]-c[i-1]+c[i-k];
          if b[i]>0 then c[i]:=c[i-1]+b[i] else c[i]:=c[i-1]
        end;
      if c[n]>m then r:=(r+rez) div 2 else rez:=(rez+r) div 2
    end;
  writeln(rez)
end.

Задача B
var
   s7,s11,s13,n,k:Word;
   f : boolean;
begin
 Readln(s7,s11,s13);
 k:=0; f := false;
 While (k*13+s13<1000) and not f do
    begin
        n:=k*13+s13;
        if (n mod 7 = s7) and (n mod 11 = s11) then f:= true;
        k:=k+1;
    end;
 Writeln(n)
end.

Задача C
var
k:array[1..100] of integer;
n,i,j,s:integer;
t1,t2:text;
begin
 readln(n);
 for i:=1 to n do read(k[i]);
 for i:=1 to n-1 do
  for j:=i+1 to n do
  if k[i]>k[j] then begin s:=k[i]; k[i]:=k[j];k[j]:=s end;
 s:=0;
 for i:=1 to n div 2+1 do s:=s+(k[i] div 2+1);
 writeln(s);
end.

Задача D
var
n,i,k,a:integer; s:real;
t1,t2:text;
begin
 readln(n);
 for i:=1 to n do begin read(a); if a<30 then k:=k+1 end;
 s:= k/5;
 writeln(s:0:1);
end.

Задача E
var s:string;
    p,d:byte;
begin
  readln(s);
  p:=byte(s[1])-96;
  d:=byte(s[2])-48;
  if (p-2>0) and (d-1>0) then writeln(chr(p-2+96),d-1);
  if (p-2>0) and (d+1<9) then writeln(chr(p-2+96),d+1);
  if (p-1>0) and (d-2>0) then writeln(chr(p-1+96),d-2);
  if (p-1>0) and (d+2<9) then writeln(chr(p-1+96),d+2);
  if (p+1<9) and (d-2>0) then writeln(chr(p+1+96),d-2);
  if (p+1<9) and (d+2<9) then writeln(chr(p+1+96),d+2);
  if (p+2<9) and (d-1>0) then writeln(chr(p+2+96),d-1);
  if (p+2<9) and (d+1<9) then writeln(chr(p+2+96),d+1)
end.