First 2 solutions of PE implemented in cpp