The perfectly competitive firm

A firm among many sellers of an identical good takes the market price as given, so its demand curve and marginal revenue are a flat line at that price; it produces where price equals marginal cost and its profit or loss is the rectangle between price and average total cost.

From AP Microeconomics.