  We show a nearly quadratic separation between deterministic communication
complexity and the logarithm of the partition number, which is essentially
optimal. This improves upon a recent power 1.5 separation of G\"o\"os, Pitassi,
and Watson (FOCS 2015). In query complexity, we establish a nearly quadratic
separation between deterministic (and even randomized) query complexity and
subcube partition complexity, which is also essentially optimal. We also
establish a nearly power 1.5 separation between quantum query complexity and
subcube partition complexity, the first superlinear separation between the two
measures. Lastly, we show a quadratic separation between quantum query
complexity and one-sided subcube partition complexity.
  Our query complexity separations use the recent cheat sheet framework of
Aaronson, Ben-David, and the author. Our query functions are built up in stages
by alternating function composition with the cheat sheet construction. The
communication complexity separation follows from lifting the query separation
to communication complexity.
