вот программа на языке PASCALABC
uses crt;
const max=20;
var a:array [1..max,1..max] of byte;
n,i,j,k,s,s1,s2,s3:integer;
x:char;
begin
x:=x;
repeat
Writeln('vvedite kol-vo komand N');
Readln(N);
until N in [1..max];
for i:=1 to N do
for j:=1 to N do
A[i,j]:=random(3);
For i:=1 to N do
begin
for j:=1 to N do
if i=j then write(#204:4)
else Write(a[i,j]:4);
writeln;
end;
writeln('íîìåðà êîìàíä, èìåþùèõ áîëüøå ïîáåä íà ÷óæîì ïîëå');
k:=0;
s:=0;
s3:=0;
for i:=1 to n do
begin
for j:=1 to n do
begin
if a[i,j]=2 then s1:=s+1;
if a[j,i]=0 then s2:=s3+1;
s:=s1;
s3:=s2;
end;
end;
if s2>s1 then
begin
writeln('Nomer komandy - ',i,' Kol. pobed = ',s2);
k:=1
end;
if k=0 then writeln('takih komand net');
end.
Задачка из олимпиады) Простенькая вроде программулька
var
n,i,k,j,f:integer;
m:array [1..100] of string;
p:array[1..100] of string;
sl,por:string;
b:boolean;
f1,f2:text;
begin
assign(f1, 'input.txt');
reset(f1);
readln(f1,n);
for i:=1 to n do
readln(f1,m[i]);
close (f1);
k:=0;
for i:=1 to n do begin
por:='';
b:=false;
sl:=m[i];
for j:=1 to length(sl) do begin
if (Ord(sl[j])>=48) and (Ord(sl[j])<=57) then
por:=por+sl[j];
end;
for f:=1 to k do begin
if por=p[f] then
b:=true;
end;
if b=false then begin
k:=k+1;
p[k]:=por;
end;
end;
assign(f2, 'output.txt');
rewrite(f2);
writeln (f2,k);
for i:=1 to k do
writeln (f2,p[i]);
close (f2);
end.
REM
SCREEN
LINE(80,280)-(100,180),6,B
LINE(100,260)-(120.240),6,B
LINE(120.240)-(140,220),6,B
LINE(140,280)-(160,180),6,B
LINE(180,280)-(200,180),6,B
LINE(200,200)-(220,180),6,B
LINE(220,220)-(240,200),6,B
LINE(200,240)-(220,220),6,B
LINE(260,280)-(260,180),6,B
LINE(260,260)-(280,240),6,B
LINE(280,240)-(300,220),6,B
LINE(300,280)-(320,180),6,B
LINE(320,280)-(340,180),6,B
LINE(360,240)-(380,220),6,B
LINE(380.280)-(400,180),6,B
LINE(440,280)-(440.200),6,B
LINE(440,240)-(460,220),6,B
LINE(460,280)-(480,200),6,B