How do you reduce the pain in leg cramps after marathon?

Massage,fluids. Massage is great. Some marathons have massage students available for you after the race. Keep fluids up and many do well with ibuprofen. You can get "the stick" and use to massage your legs -- it is helpful. Hot soaks in the tub are also good.
Replenish. Replenish electrolytes - all the muscle activity and sweating depletes the body of vital nutrients and electrolytes. Drink water, some of the sorts drinks have electrolytes just be careful as many have high sugar content. Foods like banana that are good source of potassium are good. (be careful there too everything in moderation.).