Since C++ submissions are not running these days, is there any good efficient way to solve this using C?