406332: GYM102365 B Balanced Fighters
Description
Coaches Aram, Lucca, and David couldn't agree on who should order pizza. To avoid a fight in real life, they decided to battle in a video game while everyone else starves.
In this game, there are many fighters to choose from. Each fighter has a name and three integer stats HP, AT, DF: the fighters' starting health points, attack strength and defence armour. One-on-one combat between Fighters $$$A$$$ and $$$B$$$ progresses in a series of rounds. In each round, Fighter $$$A$$$'s HP decreases by $$$\max(0, \text{AT}_B - \text{DF}_A)$$$, while Fighter $$$B$$$'s HP simultaneously decreases by $$$\max(0, \text{AT}_A - \text{DF}_B)$$$. A fighter wins if, at the end of some round, their HP is positive while their opponent's HP is not. If this situation never occurs, the fight is ruled a draw with no winner.
Aram, Lucca, and David want a free-for-all. They decided that it would only be fun if they choose three fighters that form an intransitive triple. $$$A$$$, $$$B$$$ and $$$C$$$ are said to form an intransitive triple if, in one-on-one combat, $$$A$$$ would win against $$$B$$$, $$$B$$$ would win against $$$C$$$, and $$$C$$$ would win against $$$A$$$.
Can you find all intransitive triples that Aram, Lucca, and David can choose from?
InputOn the first line is a single integer $$$N$$$ $$$(1\le N \le 100)$$$, the number of fighters.
On each of the next $$$N$$$ lines is a name consisting of 1 to 15 upper or lower case Latin letters, followed by three space-separated integers HP, AT and DF ($$$1\le \text{HP}, \text{AT}, \text{DF} \le 10\,000$$$) denoting the health points, attack strength, and defence armour for that fighter.
The names of all the fighters are distinct from one another.
OutputOutput on the first line a single integer K, the number of intransitive triples.
On each of the next $$$K$$$ lines, output the names of three intransitive fighters separated by spaces. No two lines should describe the same set of fighters. Any ordering of intransitive triples, and of fighter names within an intransitive triple, will be accepted.
ExamplesInput5 TheStrong 90 60 10 TheInvincible 10000 10000 10000 TheTough 70 50 25 TheBrick 3 1 4159 TheResilient 160 40 10Output
1 TheResilient TheStrong TheToughInput
1 TheLonely 500 500 500Output
0