Given a list of records records, where each record is a list [id, value, timestamp], merge all records with the same id. For each id, return one record [id, total_value, latest_timestamp] where total_value is the sum of all values for that id and latest_timestamp is the maximum timestamp seen for that id. Return the final list sorted by id in ascending order.
def merge_records(records):