The "if" can only contain one statement. That semicolon counts as your one statement. What the compiler sees is:
if (cm > 10)
;
{ //check left
digitalWrite(left, HIGH);
}
else {
servo.write(180); //turn to right
delay(100);
}