Search for pair production of third-generation scalar leptoquarks and top squarks in proton-proton collisions at s=8 TeV