\(P=x^3+x^2y-2x^2-xy-y^2+3y+x+2017\)
\(P=x^2\left(x+y\right)-2x^2-xy-y^2+3y+x+2017\)
\(P=2x^2-2x^2-xy-y^2+3y+x+2017\)
\(P=-xy-y^2+3y+x+2017\)
\(P=-y\left(x+y\right)+3y+x+2017\)
\(P=-2y+3y+x+2017\)
\(P=x+y+2017\)
\(P=2+2017=2019\)
P=x2(x+y)-2x2-y(y+x)+3y+x+2017
P=2x2-2x2-2y+3y+x+2017
P=2019