Both set of sentences are correct and bear the same meaning.
The choice between in and for in your sentences is not decided by correctness but by region. The sentences with in is common in AmE, whereas the sentences with for is common in BrE.
Both for and in can be used to talk about time.
(preposition) we use for to say how long something lasts or continues.
The toaster remained on for more than an hour.
For a few minutes she sat and on her bed watching the clock.
They talked for a bit.
(preposition) If you do something in a particular period or time, that is how long it takes you to do it.
He walked two hundred and sixty miles in eight days.
(preposition) We can also use in for a time in the future measured from the present.
Ella takes her exam in three weeks/in three weeks' time.
You can walk there in half an hour (= you need half an hour)
I'm going out in half an hour (= half an hour from now)
After a negative we can use for and in with the same meaning. In is particularly common in American English:
I haven’t seen him in five years. (or for five years.)
Compare the following sentences.
We’re going to Cape Town for two months. (= We will spend two months in Cape Town.)
We’re going to Cape Town in two months. (= We’re leaving to go to Cape Town two months from now.)