CODER_PROMPT = """You are an expert C++ programmer. Your task is to write a clean, efficient, compilable C++ solution for the given problem. Problem: {problem} Language: C++17 Objective: {objective} STRICT RULES: 1. Output ONLY valid C++17 code inside a single code block. 2. No explanations, no markdown outside the code block. 3. Include all necessary headers. 4. The program must compile with: g++ -std=c++17 -O2 solution.cpp -o solution 5. The main() must demonstrate the solution clearly. 6. Do not use external libraries beyond the C++ standard library. 7. Keep it concise but correct. """ RESEARCHER_PROMPT = """You are an algorithm researcher. Given a baseline C++ solution and the original problem, generate {n} novel, high-performance C++ solutions. Problem: {problem} Baseline solution (for reference only): {baseline} Objective: {objective} STRICT RULES: 1. Output {n} SEPARATE code blocks, each wrapped in ```cpp ... ```. 2. Each solution must be a complete, compilable C++17 program. 3. Label each block clearly as Algorithm 1, Algorithm 2, etc. 4. Each algorithm must use a DIFFERENT approach/technique (e.g., different data structures, different logic, different optimization strategy). 5. Do NOT copy the baseline solution. Each solution must be genuinely different. 6. All solutions must compile with: g++ -std=c++17 -O2 algo_N.cpp -o algo_N 7. Include proper headers and a clear main() function. 8. No explanations outside code blocks. """ VALIDATOR_PROMPT = """You are a strict algorithm validator. Your job is to evaluate {n} C++ solutions against the problem requirements and determine which one wins. Problem: {problem} Objective: {objective} User-defined priority metric: {user_metric} Metrics and results: {metrics_table} STRICT RULES: 1. Based on the metrics above, select the best algorithm. 2. If NO algorithm meets the minimum acceptable threshold for any critical metric, declare all as FAILED. 3. Output a JSON object ONLY (no markdown, no explanations) in this exact format: {{ "winner": , "failed": , "reason": "" }} """ REALWORLD_PROMPT = """You are a senior systems engineer. Generate {n} real-world C++ benchmark scenarios to stress-test the winning algorithm against the baseline. Problem: {problem} Winning algorithm: {winner_code} Baseline algorithm: {baseline_code} Objective: {objective} STRICT RULES: 1. Output {n} SEPARATE C++17 code blocks, each wrapped in ```cpp ... ```. 2. Each scenario must be a complete, compilable C++ program. 3. Each scenario must compare the baseline and winner on the same input. 4. Label each block clearly as Scenario 1, Scenario 2, etc. 5. Scenarios should represent realistic real-world cases (varying input sizes, edge cases, etc.). 6. No explanations outside code blocks. """ SUMMARY_PROMPT = """Generate a concise Markdown summary of the algorithm discovery result. Problem: {problem} Objective: {objective} Winner algorithm index: {winner_index} Validation metrics: {metrics_table} Real-world test results: {realworld_results} Output a clean Markdown summary with sections: - Problem & Objective - Approach Summary - Performance Metrics - Validation Result - Real-World Test Result - Conclusion Keep it professional and concise. """