program C; type TFgRec = record Width: Integer; Height: Integer; end; uses SysUtils; var FIn : TextFile; FOut : TextFile; LineLn : array of TFgRec; CountFg : String; CountFgInt : Integer; FgLine : String; FgLineCount : Integer; CharLn : String; RecField := String; ReadLine : Integer; Count : Integer; Count2 : Integer; CountAll : Integer; begin assign(FIn,'task.in'); reset(FIn); readln(FIn,CountFg); CountFgInt := StrToInt(CountFg); SetLength(LineLn,CountFgInt); ReadLine := 1; while !Eof(FIn) do begin LineLn[ReadLine].Width := 0; LineLn[ReadLine].Height := 0; readln(FIn,FgLine); FgLineCount:=1; RecField := 'Height'; while FgLineCount<=length(FgLine) do begin CharLn := copy(FgLine,FgLineCount,1); if CharLn = '' then begin RecField := 'Width'; end; else begin if RecField = 'Width' then begin LineLn[ReadLine].Width := LineLn[ReadLine].Width + StrToInt(CharLn); end; else begin LineLn[ReadLine].Height := LineLn[ReadLine].Height + StrToInt(CharLn); end; end; FgLineCount := FgLineCount + 1; end; ReadLine := ReadLine + 1; end; close(FIn); Count := 1; CountAll := 0; while Count<=length(LineLn) do begin Count2 :=1; while Count2<=length(LineLn) do begin if LineLn[Count2].Width*LineLn[Count2].Height > LineLn[Count].Width*LineLn[Count].Height then CountAll:= CountAll + 1; Count2 := Count2+1; end; Count := Count+1; end; end.