BEGIN {
	lastUrl = "";
	performanceHistory[1] = 0;
	hitCount = 0;
	total = 0;
	print "Page\tCount\t95th\tAverage";
}

function EraseData()
{
	for (i in performanceHistory) {
		delete performanceHistory[i];
	}
	hitCount = 0;
	total = 0;
}

function OutputLine()
{
	if (lastUrl == "") {
		return;
	}
	targetElt = int(0.95 * hitCount);
	if (0 == targetElt) {
		targetElt++;
	}
	print lastUrl "\t" hitCount "\t" performanceHistory[targetElt] "\t" (total / hitCount);
}

// {
	nextUrl = tolower($1);
	if (nextUrl != lastUrl) {
		OutputLine();
		EraseData();
		lastUrl = nextUrl;
	}
	hitCount++;
	performanceHistory[hitCount] = $2;
	total += $2;
}

END {
	OutputLine();
}