Task 4 will be revealed 19.11.2026 at 18:00 CET
Login required
The Double-Cross Pit Wall
1. Story
The night shift began on the temporary race circuit beneath the rounded peaks of the Tatras, while the pit board shows a white double cross with two horizontal bars. The crew trusts the timing system, but the result screen keeps selecting impossible stops. The chief engineer has one instruction: repair the existing analyzer before the next car arrives.
First submission field: identify the country suggested by the story.
2. Mission
The timing system records every pit stop during the race. For each car, it measures the total pit-stop time as well as the individual wheel-service times for the front-left, front-right, rear-left and rear-right wheels.
The engineering team uses this data to identify the best valid pit stop of the race. However, the current analysis program contains correctness, type-handling, validation and tie-breaking defects and no longer produces reliable results.
Your objective is to determine the correct result for the complete competition dataset according to the rules defined below.
You may either:
- repair the supplied program,
- partially reuse it,
- or create a completely new implementation in any programming language.
Regardless of the chosen approach, your solution must follow all rules in this specification and produce the exact required output.
3. Rules
- A record is eligible only when status is OK.
- All four wheel-service values must be integers from 0 through 5,000 milliseconds, inclusive.
- raw_time = pit_out_ms - pit_in_ms.
- A record is invalid when raw_time is smaller than the slowest wheel-service time, because the car cannot leave before every wheel is finished.
- adjusted_time = raw_time + penalty_ms.
- Choose the record with the smallest adjusted_time.
- Tie-break 1: smaller slowest wheel-service time, calculated as max(front_left_ms, front_right_ms, rear_left_ms, rear_right_ms).
- Tie-break 2: smaller car_id.
- Tie-break 3: smaller stop_id.
4. Input format
UTF-8 comma-separated plain-text file with one header row. The competition file contains 50,000 data rows. All numeric fields are base-10 integers.
|
Field |
Meaning |
|
stop_id |
Unique stop identifier |
|
car_id |
Car identifier |
|
Lap |
Lap number |
|
pit_in_ms |
Pit-lane entry timestamp in ms |
|
pit_out_ms |
Pit-lane exit timestamp in ms |
|
front_left_ms … rear_right_ms |
Four wheel-service times in ms |
|
penalty_ms |
Penalty added to raw time |
|
Status |
OK, SENSOR_ERROR or UNSAFE_RELEASE |
5. Required output
Print exactly five lines, with no additional text:
COUNTRY=<country>
BEST_STOP=<stop_id>
CAR=<car_id>
LAP=<lap>
ADJUSTED_TIME_MS=<milliseconds>
6. Supplied broken program
The supplied program is provided as a starting point and as part of the Pit Stop theme of this round.
Participants are free to repair the existing implementation or to develop their own solution from scratch. The final result must always comply with the rules defined in this task.
File: CoderGames_Day4_buggy.py. Known fact: the code contains several independent defects. The number and location of defects are intentionally not disclosed to participants.
import csv
def find_best(filename):
with open(filename, encoding="utf-8") as f:
rows = list(csv.DictReader(f))
best = None
for row in rows:
if row["status"] != "OK":
continue
wheel_times = [row["front_left_ms"], row["front_right_ms"],
row["rear_left_ms"], row["rear_right_ms"]]
raw_time = row["pit_out_ms"] - row["pit_in_ms"]
if min(wheel_times) < 0 or max(wheel_times) > 5000:
continue
if raw_time < min(wheel_times):
continue
adjusted = raw_time
if row["penalty_ms"] == 0:
adjusted += row["penalty_ms"]
candidate = (adjusted, row["car_id"], row["stop_id"])
if best is None or candidate < best:
best = candidate
return best
print(find_best("CoderGames_Day4_PitStop_input.txt"))
7. Example 1
Sample input
stop_id,car_id,lap,pit_in_ms,pit_out_ms,front_left_ms,front_right_ms,rear_left_ms,rear_right_ms,penalty_ms,status
1,7,10,100000,102600,1900,1950,1920,1940,0,OK
2,3,11,200000,202500,1800,1810,1790,1805,200,OK
3,5,12,300000,302300,2400,2200,2100,2150,0,OK
Expected output
COUNTRY= XXXXX (We do not provide the correct answer in the example.)
BEST_STOP=1
CAR=7
LAP=10
ADJUSTED_TIME_MS=2600
8. Example 2: validation and tie-breaks
Sample input
stop_id,car_id,lap,pit_in_ms,pit_out_ms,front_left_ms,front_right_ms,rear_left_ms,rear_right_ms,penalty_ms,status
10,9,20,1000,3500,1900,1850,1800,1880,0,OK
11,4,21,5000,7500,1700,1700,1700,1700,0,OK
12,2,22,8000,10400,2500,2000,1900,1800,0,OK
13,1,23,11000,13400,1600,1600,1600,1600,0,SENSOR_ERROR
Expected output
COUNTRY= XXXXX (We do not provide the correct answer in the example.)
BEST_STOP=11
CAR=4
LAP=21
ADJUSTED_TIME_MS=2500
9. Submission
- Country identified from the story
- Exact five-line result for the competition input
- Source code in any common programming language. Participants may submit either a corrected version of the supplied Python program or their own implementation.
10. Input
You can download the input file HERE.
Output
You can download the correct result HERE.