Why my code exceeded time limit
program fram;
label 1,2,3,4,5;
var i,j,k,a,b,t,r,x:byte;
d:word;
f:boolean;
m:array[0..19,0..49]of char;
p,q,v:array[1..15]of byte;
begin
assign(input,'fram.in');
reset(input);
assign(output,'fram.out');
rewrite(output);
for i:=0 to 19 do
begin
for j:=0 to 49 do
begin
read(m[i,j]);
if m[i,j]<>'.' then
inc(d);
end;
readln;
end;
while d>0 do
begin
for i:=0 to 18 do
for j:=0 to 48 do
for k:=2 to 20 do
begin
a:=i+k-1;
f:=false;
b:=j+j-1;
if(a<=19)and(b<=49)then
begin
t:=ord(m[i,j]);
if t=218 then
begin
f:=true;
goto 2;
end;
if t=48 then
begin
2:t:=ord(m[i,b]);
if t=191 then
begin
f:=true;
goto 3;
end;
if t=48 then
begin
3:t:=ord(m[a,j]);
if t=192 then
begin
f:=true;
goto 4;
end;
if t=48 then
begin
4:t:=ord(m[a,b]);
if t=217 then
begin
f:=true;
goto 5;
end;
if t=48 then
begin
5:for r:=j+1 to b-1 do
begin
t:=ord(m[i,r]);
if t=196 then
f:=true
else
if t<>48 then
goto 1;
t:=ord(m[a,r]);
if t=196 then
f:=true
else
if t<>48 then
goto 1;
end;
for r:=i+1 to a-1 do
begin
t:=ord(m[r,j]);
if t=179 then
f:=true
else
if t<>48 then
goto 1;
t:=ord(m[r,b]);
if t=179 then
f:=true
else
if t<>48 then
goto 1;
end;
if f=false then
goto 1;
inc(x);
p[x]:=i;
q[x]:=j;
v[x]:=k;
for r:=j to b do
begin
if m[i,r]<>'0' then
begin
dec(d);
m[i,r]:='0';
end;
if m[a,r]<>'0' then
begin
dec(d);
m[a,r]:='0';
end;
end;
for r:=i+1 to a-1 do
begin
if m[r,j]<>'0' then
begin
dec(d);
m[r,j]:='0';
end;
if m[r,b]<>'0' then
begin
dec(d);
m[r,b]:='0';
end;
end;
end;
end;
end;
end;
end
else
break;
1: end;
end;
writeln(x);
for i:=x downto 1 do
writeln(q[i],' ',p[i],' ',v[i]);
end.