'i get runtime error when doing kattis oddmanout challenge

Hi im new to Kattis ive done this assignment "oddmanout" and it works when i compile it locally but i get runtime error doing it via Kattis. Im not sure why?

from collections import Counter

cases = int(input())
i = 0
case = 0

while cases > i:
    list = []
    i = 1 + i
    case = case + 1

    guests = int(input())   

    f = 0

    while f < guests:
        f = f + 1

        invitation_number = int(input()) 

        list.append(invitation_number)

        d =  Counter(list)
        res = [k for k, v in d.items() if v == 1]

        resnew = str(res)[1:-1] 

    print(f'Case#{case}: {resnew}')


Solution 1:[1]

Looking at the input data on Kattis : invitation_number = int(input()) reads not just the first integer, but the whole line of invitation numbers at once in the third line of the input. A ValueError is the result.

With invitation_numbers = list(map(int, input().split())) or alternatively invitation_numbers = [int(x) for x in input().split()] you will get your desired format directly.

You may have to rework your approach afterwards, since you have to get rid of the 2nd while loop. Additionally you don't have to use a counter, running through a sorted list and pairwise comparing the entries, may give you the solution aswell.

Additionally try to avoid naming your variables like the datatypes (list = list()).

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 caskuda