Two squares or not two squares

SPOJ - TWOSQRS