A small group of corys would be fine in your 40gal(say 4-8 of them would be good dending on the species) but the image of corys being a good clean up crew is very misleading, here is some info on corys;
a. Corys need to be in groups of at least 3-4 as they are sociable fish but if you are going for mixed types of corys you need at least 3 of each type as although they will get along they won't interact with other species/types of corys in the same way they do with their own.
b. Corys need a very clean tank, no water quality problems at all as ammonia is more concentrated at the bottom of the tank where corys spend most of their time and thus they are more sensitive to toxins in the water.
c. Corys prefer sand or fine gravel substrate as they like to filter through the substrate with their barbels(whiskers) to feed, although they help eat left over food they will not eat food that is older than a day old in the tank and they will not clean the substrate very much.
Because of this you will still need to clean you substrate on a weekly basis(corys are very prone to getting bacterial infections from eating off dirty of poorly suited substrate) and you cannot rely on them to scavenge off food alone as they need their own food just as much as other fish do
.
d. Corys do not eat algae growing in the tank but do take algae wafers, they also enjoy many other foods like catfish pelets and frozen bloodworms and krill- as with most fish, a mix of vegetable and high protein based foods is the key to having healthy corys
.
e. Corys are partly nocturnal, so although you will see them during the day they also appreiciate having some cover where they can get out of the glare of the tank lights when they need to- when buying corys, make sure you acclimatise them to the tank for at least 30mins and make sure their barbels/whiskers are all intact when you buy them as corys can suffer from eroded barbels which is a bacterial infection and can be difficult to treat.