Both codes mentioned are not found in my database. Can you please reconfirm?
When it was difficult to start, did you test if sparks were available and bright blue in color?
Fuel pressure tested?
Your other expert is currently offline.
Please confirm the year model also, this is a 2000 right?
Does the car seem to lack power when accelerating?
A p0171 means the computer recognizes lean mixture in the exhaust system.
90% of the time this is caused by a vaccum leak or a mass air flow sensor issue however you usually don't have starting issues because of this.....usually it has a hesitation on acceleration or very poor fuel economy or high idle speed.
P0171 can also be caused by low fuel pressure....I would suspect this first on your car because of the conditions you have stated.
Fuel issues are very rare on this car. Unlike american cars the fuel pump does not "prime" when you turn the key to the "on" position, rather it is commanded when engine speed is recognized, so if the fuel system is leaking down pressure then the engine will have to be cranked for several seconds until the pump repressurizes the system.
As far as where to check for a leak in the system.....unless you have smoke at startup indicating a leaking injector or 1 spark plug fouling out I would suspect a pressure regulator or a bad pump causing this.