You are given a list of text commands commands that operate a registry of named regions, each at an integer latitude and longitude with a capacity. Process the commands in order. Return one output line per command.
REGISTER <name> <lat> <lon> <capacity>: add a region. The output is OK, or ERROR (with no change made) if any rule fails:
lat must be in [-90, 90] and lon in [-180, 180].capacity must be greater than 0.name must not already be registered.A newly registered region is healthy and has capacity units of remaining capacity.
SET_HEALTHZ <name> <true|false>: mark a registered region healthy or unhealthy. The output is OK, or ERROR if the name is not registered.
DISTANCE <lat1> <lon1> <lat2> <lon2>: the output is the great-circle distance in kilometres between the two points, computed with the Haversine formula below and rounded half-up to an integer. These arguments are not range-checked.
ROUTE <lat> <lon>: route a request. The output is ERROR if lat or lon is outside the ranges above. Otherwise:
commands.length ≤1000