Parallelogram Counting

LightOJ - 1058