2000 GMC 2500 6.0, it has a rough idle but not all the time. Replaced MAF. Help! on 2000 GMC Sierra 2500

I haven't found a vaccum leak, cleaned IAC and it still shows codes 171/174.

Asked by for the 2000 GMC Sierra 2500
these codes are lean bank one and two could be fuel pressure, fuel filter,but try cleaning you mass air flow sensor 1st, this is a common problem