I have a 2008 Subaru Legacy naturally aspirated automatic with 105K miles. I just had a head gasket job done, and every so often, mainly when the car has been sitting for a little while but has not fully cooled down, the car would crank and would not start. When this happens, I get the check engine light on with P0335, which seems odd to me because the tachometer reads like it should. I just need to wait about 15-30 seconds with the key in the ON position before the car starts up like normal and runs great afterwards. The light will not go away until I erase the code and it does not come back until this happens again. I don't think it's a fuel pump because I can accelerate and maintain highway speeds (and faster) no problem.
That code is for crankshaft position sensor. Pray I is only the sensor otherwise things get complicated.