use strict;
use warnings;

my $template = "A15 A8 A4";
my %tradenum;

while(<>) {
    chomp;
    my ($date, $time) = (unpack $template, $_)[1,2];
    next if(($date lt "20000101") || ($date gt "20001231"));
    next if(($date eq "20000104") or ($date eq  "20001229") or ($date eq "20000417"));
    next if($time lt "0755");
    next if(($time gt "1055") &&  ($time lt "1115"));
    next if($time gt "1425");
    $tradenum{$date}{$time}++;
}

foreach my $d (sort keys %tradenum) {
    foreach my $t ("0755" .. "1425") {
	next if((unpack "A2A2", $t)[1] >= 60);
	next if(($t gt "1015") && ($t lt "1115"));
	if(!defined($tradenum{$d}{$t})) {
	    $tradenum{$d}{$t} = 0;
	}
# 取引日、取引時間、取引回数を表示
	print "$d,$t,$tradenum{$d}{$t}\n";
    }
}

