harbor run -t openthoughts/tasktrove-exp-rpt-taco-v2-taco-4521harbor download openthoughts/tasktrove-exp-rpt-taco-v2-taco-4521The Berland National team is participating in a local Football championship consisting of a group stage. Below are the formal rules of the championship:
Teams are ranked based on the following criteria, in order of priority:
The Berland team finds itself in a group stage where the results of 5 out of 6 games are already known. The only remaining game is between Berland and another team. Your task is to determine a score X:Y, where X is the number of goals scored by Berland and Y is the number of goals scored by the opponent, such that:
X > Y (Berland wins the game).X - Y is minimized. If there are still multiple options, select the score with the smallest Y.If there is no way for Berland to finish in the top 2, print "IMPOSSIBLE".
The input consists of five lines. Each line describes a game in the format:
team1 team2 goals1:goals2
Where team1 and team2 are the names of the teams (non-empty strings consisting of uppercase English letters, max length 20 characters) and goals1 and goals2 are integers from 0 to 9.
The Berland team is identified as "BERLAND". It is guaranteed that Berland and one other team have played exactly 2 games, while the other teams have played exactly 3 games.
Print the score for the final game as X:Y, where X is the number of goals Berland scored, and Y is the number of goals the opponent scored. If it is impossible for Berland to secure the required placement, print "IMPOSSIBLE".
Example 1:
Input:
AERLAND DERLAND 2:1
DERLAND CERLAND 0:3
CERLAND AERLAND 0:1
AERLAND BERLAND 2:0
DERLAND BERLAND 4:0
Output:
6:0
Example 2:
Input:
AERLAND DERLAND 2:2
DERLAND CERLAND 2:3
CERLAND AERLAND 1:3
AERLAND BERLAND 2:1
DERLAND BERLAND 4:1
Output:
IMPOSSIBLE
In the first example, if Berland wins against "CERLAND" with a score of 6:0, the final rankings will be:
In the second example, the existing results indicate that "AERLAND" and "DERLAND" have won too many points (7 and 4 respectively) for Berland to have any chance of qualifying, even if they win their final game.
Please place your solution in the /app/ directory.
Important: place your implementation at /app/solution.py so the verifier can run it.