more Calculate Distance, Valid parentheses

C