/GRAVI - Trọng lực

<Problem>

http://ntucoder.net/Problem/Details/119
              Uses Crt;
        Type arr=array[0..10000,0..10000] of longint;
        Var n,m,i,j,k,z:longint;
            a:arr;
        Begin
            readln(n,m);
            for i:=1 to n do
             for j:=1 to m do read(a[i,j]);
            k:=0;
            for i:=1 to n do
             for j:=1 to m do
              if a[i,j]=1 then
               for z:=i+1 to n do if a[z,j]<>1 then inc(k);
            writeln(k);
        End.