#!/usr/bin/perl -w

use strict;
use v5.30;

$_ = <>; # header
$_ = <>; # header
$; = ',';

my (%size, %used);
while (<>) {
	my ($x, $y, $size, $used) = m|/dev/grid/node-x(\d+)-y(\d+)\s+(\d+)T\s+(\d+)T|;
	die "no match at $_" if !defined $used;
	$size{$x,$y} = $size;
	$used{$x,$y} = $used;
}

my $count = 0;
for my $n1 (keys %size) {
for my $n2 (keys %size) {
	next if $n1 eq $n2;
	next if !$used{$n1};
	$count++ if $used{$n1} <= $size{$n2} - $used{$n2};
} }
say $count;
	
