These cheats flat out don't work; the alternative solutions are below.
Instead of Rare Candies, defeat the trainer at the top left of the Dresco Battle House; he has an Audino and Blissey. Make sure you are on at least Difficult difficulty as otherwise the trainers' mons won't scale with yours. Farm 6 Lucky Eggs from wild Happiny at Route 9 and if you are in the postgame, increase their levels to level 10 (to do this collect 28 Big Pearls - Shellder and Clamperl will hold this most likely and 9 Pearl Strings - you can collect them from raids); that way you will get much more experience from a battle.
Instead of Master Balls try to buy and use the best ball for different kind of encounters. If it is night, use Dusk Ball. If at early turns, try to use Quick Ball. If you are about to catch Bug- or Water-type mon, use Net Ball. If the opposing mon is heavy, use Heavy Ball. If the opposing mon is fast (base Speed stat of at least 100), use Fast Ball. If it is a roaming encounter (Lati@s, Tornadus, Thundurus, Raikou, Entei) lower the target's HP to 1 with False Swipe mon and then bring a mon with Shadow Tag on the next encounter; throw balls until caught.