Checkout the editorial of the problem here

Basically N can be written as:

2020*x+2021*y=N

=> 2020*x+2020*y+y=N

=> 2020*(x+y)=N-y

=>x=(N-y)/(2020) -y

So now simply check if x is greater than 0 and RHS is a whole number. If true YES, else NO.

2020x+2021y=N

x=(N-2021y)/2020

Since x>0

N-2021y > 0

=> y<N/2021

Run a loop of y from 1 to floor(N/2021) and check if any integer solution of x exists.