A sensor includes: a substrate; a first magnetoresistance element and a second magnetoresistance element, each of which is a magnetoresistance element whose resistance value measured changes depending on a direction of an input magnetic field; and a soft magnetic thin film disposed adjacent to the first and second magnetoresistance elements wherein one of the first and second magnetoresistance elements is positioned on one of end sides of the soft magnetic thin film and other of the first and second magnetoresistance elements is positioned on other of the end sides of the soft magnetic thin film in a plan view in a direction perpendicular to a film surface of the soft magnetic thin film.