There could be a number of penalties/bonuses the overpopulated/underpopulated village gets.
The way you calculate those bonuses would be by village_population/(players-akat)*100. Idealy this should be 33%. And then village_pop/33% to see how much off the population is right now.
Ie 30 ppl and 15 in leaf -> 50% leaf -> 50/33 = rougly 1.52 . Then you take that last number and calculate the penalties/bonuses.
Hosp time
Max amount of change should be 50% no matter how small or big the village pop is. So incase of that example above leaf would have 1.52 hosp time but because of the 50% limit it would be 1.50 hosp time.
Dmg/def bonus inside village
Right now its 15% dmg/def bonus. Same like hosp time. Max change would be 50% in either direction. So leaf would have 50% less bonus. So 7.5% dmg/def bonus.
Inf/exp gain
Max change should be 25% here. For every 0.02 a village is off it would be changed by 1%. Incase of leaf above...1.52 so leaf is off by 0.52 -> 26% but cause of max 25% less inf/exp gain. This bonus/penalty would be added after all the calculations like current inf, amount of int you got, etc are added up.