Counting Triangles

HDU - 1396