C implementation passes first test