kbhit is a Microsoft Windows platform specific command. OnlineGDB is running on a Linux server, hence Windows specific functions are not supported.
Instead, you could use "ncurses".
Please, have a look at this: https://stackoverflow.com/questions/4025891/create-a-function-to-check-for-key-press-in-unix-using-ncurses