I read a book in high school, it was about a foster kid who ran away too many times so he got sent to a boarding school in the mountains. In the boarding school kids could bid on contracts for what chores needed to be done, they were in gangs and before they made the system where certain groups would bid on contracts there had been much fighting and a few deaths.
The contracts were for different jobs at the boarding school. For example, some worked security, some cooked, and some also did medical stuff (I think) since they were gangs certain gangs would bid on whatever contracts.
There was also a girl that the protagonist liked, and she got beaten to death during a school dance (she was actually a robot) and the protagonist follows the robot to a secret door where the robot plugs itself in to try and be repaired.