
LiveCodeBench Style — Competitive Programming
LiveCodeBench collects problems from LeetCode, AtCoder, and Codeforces and tests capabilities including self-repair, code execution, and test output prediction — not just code generation.
Prompt
Solve this competitive programming problem: Given a tree with N nodes (1-indexed), each node has a value. You must answer Q queries, each asking: What is the maximum XOR of values along any path between node u and node v? Constraints: N, Q ≤ 10⁵, values ≤ 10¹⁸ Implement an O((N + Q) log N) solution using LCA + binary lifting + linear basis (XOR basis). Include full I/O handling and edge case tests.
Drag to resize
Drag to resize
Drag to resize
Drag to resize
Drag to resize
Drag to resize
Drag to resize
Response not available
Drag to resize
Drag to resize
Drag to resize
Drag to resize