This grammar point is a bit tricky. I’ll try my best to explain it properly!
Do not write:
“He/they had/have/has a hard time to VERB.”
Or:
“He/they had/have/has difficulty to VERB.”
That’s because “had a hard time” and “has difficulty” should be followed by a gerund (not to + infinitive).
So instead of writing “He had a hard time to pass the test” you should write:
“He had a hard time passing the test.”
And instead of writing “They have difficulty to reduce emissions” you should write:
“They have difficulty reducing emissions.”
I fix errors like this quite often in student essays!