CSES uses standard competitive programming I/O format. No fancy JSON or API calls. First line: two integers and , the number of pupils and the number of friendships. Next lines: each contains two integers and meaning pupils and are friends.
You read from stdin and write to stdout. Build the adjacency list yourself from the edge pairs. Pupils are numbered to , not to . Remember to size your arrays so.