20 men is the answer:

First convert into meters per day/man: 20*15 = 300 meters per day/40 men = 7.5 meters per day/man

Then answer the question by using the new parameters: (50 meters)(3 days) = 150 meters per day/7.5 meters per day/man = meters per day canceling out leaving: 20 men are the new requirement.

Correction:

500 men is the correct answer.

The answer can be arrived at by increasing the number of men according to the following ratios:

40 men*(50m/20m)*(15days/3days) = 40men*2.5*5 = 500men

BTW: a thank you to those that provided the correct answer. Learning from mistakes allows a person to try different solutions.

And by being provided with the correct answer you can work the problem backwards, similar to reverse engineering.