In a pinch, you can probably find a friendly local who will welcome you into their home for the night. Ask if they prefer you to pay them for food and/or lodging. Sometimes people are welcoming you as an honored guest and it would be odd to pay.