in src/open_r1/utils/competitive_programming/ioi_utils.py [0:0]
def add_includes(code: str, problem_id: str) -> str:
"""
Fix common compilation errors for IOI problems.
"""
if not code:
return code
# has most of the useful functions
code_header = "#include <bits/stdc++.h>\n"
# include the problem header
problem_header_include = f'#include "{problem_id}.h"'
if problem_header_include not in code:
code_header += problem_header_include + "\n"
# use namespace std since models forget std:: often
if "using namespace std;" not in code and "std::" not in code:
code_header += "\nusing namespace std;\n\n"
return code_header + code