Corolla 2008 hesitation problem

i have corolla 2008 with automatic transmission, it start well and run also. there are hesitation on idling position and when stopped on red light or stop signe.
when fully hot the rpm are 800RPM. it is pretty normal.
i have cleaned throttle body, and mas with right product.
sometime i am getting code P0171, System too lean bank1, i have clear it with scanner.
does anyone have the fix or where to check exactly? thanks