The Trump administration has lost or abandoned hundreds of criminal cases against protesters and immigrants, a Times investigation found.