If the person is a female I know, and hugging them will not make me messy in some way, I will accept a hug to avoid a confrontation.
If the person is an uncle or grandpa, I feel it is my duty to accept a hug annually.
Children get all the hugs they want because they're children.
Brothers, male cousins, and good male friends may get a 1-armed hug if they move quickly. Otherwise they get a tight handshake.
On a rare occasion, I will meet a guy I actually like to hug. The first time this happened, I sometimes bribed the guy to hug me using sodas.
If a person I don't know or a male I find repulsive tried to hug me, I would shove them away. If a male, I may follow it up with a kick.