Write a function to detect collisions or calculate distances between objects in a coordinate space.
Implement collision detection for circular objects. Return every pair of object indices whose circles overlap or touch. Each object is a dictionary with numeric x, y, and radius fields. The result must list pairs as [i, j] with i < j, ordered by the nested input iteration.
Implement def detect_collisions(objects):. Return a list of index pairs. Use squared distances to avoid unnecessary square roots.
def detect_collisions(objects):