Update distance_loop.cpp