With two sticks, installed in the A2 and B2 slots, which is where they BELONG with only two sticks installed, and are the second and fourth slots over from the CPU socket, you should have zero problems with clearance.
Even IF you had four DIMMs installed, and HAD to slide the front fan UP the heatsink a few millimeters, it wouldn't hurt performance much if at all anyhow.
With only two DIMMs installed you shouldn't need to do that anyhow.
I did notice something on the Ninja 5 product page however that you ought to be aware of and verify.
Please note that an original backplate with screw mounting is needed for
installation on mainboards with AMD sockets. Please check before buying if the backplate is fixed by screws (
example)! If the backplate uses plastic-pins, mounting of this cooler is not possible.
On the Thermalright Macho rev.B, there is no such issue, as it clearly states:
the cooler is equipped with mounting material for the new AMD AM4 Ryzen processors and can be mounted on the new Intel LGA 2066 processors.
So if you have a backplate with actual fasteners, you can use the Ninja 5 but if it uses push pins, it wouldn't work.
I wasn't aware of that previously, so I apologize for that oversight. Still, those will be good options. Below, in the event those coolers don't do the trick, are my recommended list of coolers in general, which might offer you a flavor that you prefer AND they are all good coolers although obviously some are better than others.
Below is my list of preferred CPU AIR coolers, also known as Heatsink fans (HSF).
Do not look here for recommendations on water/liquid cooling solutions. There are none to be found.
They are basically listed in order of preference, from top to bottom. To some degree that preference is based on known performance on similarly overclocked configurations, but not entirely. There are likely a couple of units that are placed closer to the top not because they offer purely better performance than another cooler which is below it, but potentially due to a variety of reasons.
One model might be placed higher than another with the same or similar performance, but has quieter or higher quality fans. It may have the same performance but a better warranty. Long term quality may be higher. It may be less expensive in some cases. Maybe it performs slightly worse, but has quieter fans and a better "fan pitch". Some fans with equal decibel levels do not "sound" like they are the same as the specific pitch heard from one fan might be less annoying than another.
In any case, these are not "tiered" and are not a 100% be all, end all ranking. They are simply MY preference when looking at coolers for a build or when making recommendations. Often, which HSF gets chosen depends on what is on this list and fits the budget or is priced right at the time due to a sale or rebate. Hopefully it will help you and you can rest assured that every cooler listed here is a model that to some degree or other is generally a quality unit which is a lot more likely to be worth the money spent on it than on many other models out there that might look to be a similarly worthwhile investment.
Certainly there are a great many other very good coolers out there, but these are models which are usually available to most anybody building a system or looking for a cooler, regardless of what part of the world they might live in. As always, professional reviews are usually an absolutely essential part of the process of finding a cooler so if you are looking at a model not listed here, I would highly recommend looking at at least two or three professional reviews first.
If you cannot find two reviews of any given cooler, it is likely either too new to have been reviewed yet or it sucked, and nobody wanted to buy one in order to review it plus the manufacturer refused to send samples out to the sites that perform reviews because they knew it would likely get bad publicity.
IMO, nobody out there is making better fans, overall, than Noctua, followed pretty closely by Thermalright. So if you intend to match case fans to the same brand on your HSF, those are pretty hard to beat. Of course, Corsair has it's Maglev fans, and those are pretty damn good too, but since they don't make CPU air cooling products, only AIO water coolers, they cannot join the party.
Noctua NH-D14 (Replace stock fans with NF-A14 industrialPPC 2000rpm)
Noctua NH-D15/D15 SE-AM4
Noctua NH-D14 (With original fans)
Thermalright Silver arrow IB-E Extreme
Phanteks PH-TC14PE (BK,BL, OR or RD)
Cryorig R1 Ultimate or Universal
Thermalright Legrand Macho RT
Scythe Ninja 5
FSP Windale 6
Scythe Mugen 5 rev.b
Noctua NH-U14S
Thermalright Macho rev.B
Thermalright Macho (Direct, 120)
Scythe Mugen max
BeQuiet dark rock pro (3 or 4)
BeQuiet dark rock (3 or 4)
Deepcool Assassin II
Thermalright true spirit 140 (Direct, Power, BW)
Cryorig H5
Noctua NH-U12S
Phanteks PH-TC12DX (Any)
Phanteks PH-TC14S
Cryorig H7
Deepcool Gammaxx 400
Cooler Master Hyper 212 (EVO, X, RGB. I'd only recommend this cooler if no other good aftermarket models are available to you.)
It may not be obvious, but is probably worth mentioning, that not all cooler models will fit all CPU sockets as aftermarket coolers generally require an adapter intended for use with that socket. Some coolers that fit an AMD platform might not fit a later AMD platform, or an Intel platform. Often these coolers come with adapters for multiple types of platforms but be sure to verify that a specific cooler WILL work with your platform before purchasing one and finding out later that it will not.