`B=x^3-y^2+x+x^2y-2x^2+2021+3y-xy`
`=(x^3+x^2y)+(-xy-y^2)+x+3y-2x^2+2021`
`=x^2(x+y)-y(x+y)+x+3y-2x^2+2021`
`=2x^2-2y+x+3y-2x^2+2021`
`=(2x^2-2x^2)+x+(3y-2y)+2021`
`=x+y+2021`
`=2+2021`
`=2023`
\(B=\left(x^3+x^2y\right)-\left(y^2+xy\right)-2x^2+x+3y+2021=\)
\(=x^2\left(x+y\right)-y\left(x+y\right)-2x^2+x+3y+2021=\)
\(=2x^2-2y-2x^2+x+3y+2021=\)
\(=x+y+2021=2023\)