Code for counting a form of ranged proportional representation that groups range ballots based on affinity