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