Summarize this article in one sentence.
Stretching exercises are recommended to relieve the frequency and severity of muscle cramps. In the run up to a marathon, you should aim to do at least 5 to 10 minutes of stretching, three times per day.  As cramps are most frequently experienced in the calves, you should focus on stretching these muscles. One good calf stretch involves starting in a standing position about 60 – 90 centimeter (35.4 in) from the wall, keeping the soles of the feet flat on the floor. Step forwards with one foot and lean your hands against the wall until you feel a stretch in the calf of your back leg. Hold for 10 to 15 seconds before switching to the other leg. For more information on beneficial stretches, see this article. There are a couple of things you can try to prevent calf muscle shortening (and the resultant cramps) during sleep. These include:  Keeping the legs slightly elevated by placing a pillow under the feet while sleeping on your back. Hanging the feet over the edge of the bed while sleeping on your front. Dehydration or the loss of fluids is the major cause of cramps. Therefore, it is essential to stay hydrated while you are training for a marathon, while you are running during a marathon and after the marathon is over.  Before training (or the marathon itself) it is recommended that you pre-hydrate by drinking only water - sports drinks will not benefit you at this stage, as no electrolytes have yet been lost. You should also avoid caffeinated drinks in the lead up to the race, as these have a diuretic effect that can lead to water loss. Rehydrate with water during the first 60 minutes of exercise, and with a sports drink after 60 minutes of exercise. After an hour of exercise, your body loses energy and electrolytes which the sports drink helps to replace. To maintain proper body hydration, it is recommended to drink 5 to 12 ounces (148 to 355 millilitres) of water for every 20 minutes of activity. Before and after running, take in 4 to 8 ounces (118 to 237 millilitres) of water. The amount of fluid intake will also depend on the body weight of the runner. It is suggested to seek professional advice on the amount of fluid to be taken. Make sure that you are wearing properly fitted running shoes. Shoes that do not fit properly cause stress to the muscles and tendons that puts the runner at higher risk of developing muscle cramps. Be aware of which foods and drinks can contribute to (or prevent) muscle cramps during a run. For instance:  Caffeinated beverages contain substances that worsen muscle cramps due to dehydration. Don’t consume foods that are high in protein or fat in the 4 to 5 hours before running. Eat foods that are high in carbohydrates instead. It is recommended to eat bananas while running because they contain high levels of potassium, a substance that helps prevent muscle cramps. Prolonged exercise duration greater than 90 minutes puts the body at risk for cramps. The body gets deprived of its main energy fuel, glucose, as the muscles scurry for the final stretch. Carbohydrate loading is a technique that focuses on storing glucose in the liver and muscles which can be tapped into for energy later  During the training period for a marathon, you should be getting 60% of your daily calories from carbohydrates, 25% from fat and 15% from protein.  Some examples of good carbohydrate sources are rice, bread, pasta, sweet potatoes, and potatoes. In the final days before a marathon, you should increase your carb intake to getting 70% to 80% of your total calories from carbs, with the remaining 20% to 30% of your calorie intake divided between protein and fat. After the marathon, you should resume a normal diet. Carbohydrate loading is not advised for long-term use because it may lead to a rise in blood glucose levels and diabetes. A well maintained and consistent pace of running will help you to avoid muscle cramps.  Take your overall health and fitness levels into account in order to determine the appropriate pace for you, both during training and during the marathon itself. Wear a watch or use a phone app that tracks your pace and alerts you if you are running too fast or slow. This prevents overtraining and reduces the risk of injury. Tapering is very important in a marathon race, when it is coupled with carbohydrate loading to maximize glycogen storage rates. Getting an adequate amount of rest will ensure that your muscles recuperate well in between training sessions and that they are not already damaged or worn down by the day of the marathon.  Hitting the sack for at least 7 hours per night is necessary for optimal regeneration of muscle damage and prevents overtraining. Unfortunately, sleep may be difficult to come by in the night before the event, as it is normal for a person to experience extreme anxiety and excitement in anticipation of the day ahead. Therefore, the most crucial sleep happens two nights before the event. It is essential that you get a full  8 hours sleep two nights before the event to ensure that your body is well-rested and prepared.
Perform stretching exercises. Keep your legs in the correct position while sleeping. Hydrate properly before, during and after the run. Change the type or brand of running shoe you wear. Maintain a healthy diet. Try carb loading. Make sure that you are pacing yourself properly. Try to taper off the intensity of your training as the marathon approaches.Tapering is defined as gradual reduction of exercise intensity as a competition draws near. Ensure that you are getting enough sleep.