Problem p02975 (python)

Fixed submission:
import collections 

n = int(input())
input_list = [int(i) for i in input().split(' ')]

counter = collections.Counter(input_list)


unique_list = list(counter.keys())
counts = list(counter.values())

if (all(num == 0 for num in unique_list)):
    print('Yes')
else:
    if n % 3 == 0:
        zero_count = counter[0] 
        if zero_count == n / 3 and len(unique_list) == 2:
            print('Yes')
        else: 
            if len(unique_list) != 3:
                print('No')
            elif (unique_list[0] ^ unique_list[1] == unique_list[2]):
                if (all(counts[0] == num for num in counts)):
                    print('Yes')
                else:
                    print('No')
            else:
                print('No')
    else:
        print('No')

Buggy submission (verdict: Runtime Error):
import collections 

n = int(input())
input_list = [int(i) for i in input().split(' ')]

counter = collections.Counter(input_list)


unique_list = list(counter.keys())
counts = list(counter.values())

if (all(num == 0 for num in unique_list)):
    print('Yes')
else:
    if n % 3 == 0:
        zero_count = counter[0] 
        if zero_count == n / 3 and len(unique_list) == 2:
            print('Yes')
        else: 
            if len(unique_list) != 3:
                print('No')
            else if (unique_list[0] ^ unique_list[1] == unique_list[2]):
                if (all(counts[0] == num for num in counts)):
                    print('Yes')
                else:
                    print('No')
            else:
                print('No')
    else:
        print('No')

Buggy submission (verdict: Runtime Error):
import collections 

n = int(input())
input_list = [int(i) for i in input().split(' ')]

counter = collections.Counter(input_list)


unique_list = list(counter.keys())
counts = list(counter.values())

if (all(num == 0 for num in unique_list)):
    print('Yes')
else:
    if n % 3 == 0:
        zero_count = counter[0] 
        if zero_count == n / 3 and len(unique_list) == 2:
            print('Yes')
        else: 
            if len(unique_list) != 3:
                print('No')
            if (unique_list[0] ^ unique_list[1] == unique_list[2]):
                if (all(counts[0] == num for num in counts)):
                    print('Yes')
                else:
                    print('No')
            else:
                print('No')
    else:
        print('No')

Buggy submission (verdict: Runtime Error):
import collections 

n = int(input())
input_list = [int(i) for i in input().split(' ')]

counter = collections.Counter(input_list)


unique_list = list(counter.keys())
counts = list(counter.values())

if (all(num == 0 for num in unique_list)):
    print('Yes')
else:
    if n % 3 == 0:
        zero_count = counter[0] 
        if zero_count == n / 3 and len(unique_list) == 2:
            print('Yes')
        else: 
            if len(counter) != 3:
                print('No')
            if (unique_list[0] ^ unique_list[1] == unique_list[2]):
                if (all(counts[0] == num for num in counts)):
                    print('Yes')
            else:
                print('No')
    else:
        print('No')

Buggy submission (verdict: Runtime Error):
import collections 

n = int(input())
input_list = [int(i) for i in input().split(' ')]

counter = collections.Counter(input_list)


unique_list = list(counter.keys())
counts = list(counter.values())

if (all(num == 0 for num in unique_list)):
    print('Yes')
else:
    if len(counter) != 3:
        print('No')
    if (unique_list[0] ^ unique_list[1] == unique_list[2]):
        if (all(counts[0] == num for num in counts)):
            print('Yes')
    print('No')

Buggy submission (verdict: Runtime Error):
import collections 

n = int(input())
input_list = [int(i) for i in input().split(' ')]

if n % 3 != 0:
    print('No')

counter = collections.Counter(input_list)
if len(counter) != 3:
    print('No')

unique_list = list(counter.keys())
counts = list(counter.values())
if (unique_list[0] ^ unique_list[1] == unique_list[2]):
    if (all(counts[0] == num for num in counts)):
        print('Yes')
print('No')

Buggy submission (verdict: Runtime Error):
def is_circle(current_list, rest_list):
    if rest_list == []:
        if (current_list[-1] ^ current_list[0]) == current_list[1]:
            return True
        else:
            return False
    if len(current_list) == 1:
        for index, num in enumerate(rest_list):
            if is_circle(current_list + [num], rest_list[:index] + rest_list[index+1:]):
                return True
            """
            next_int = current_list[0] ^ num
            if next_int in rest_list:
                if is_circle(current_list + [num], rest_list[:index] + rest_list[index+1:]):
                    return True
            """
        return False

    next_int = current_list[-1] ^ current_list[-2]
    if next_int in rest_list:
        current_list.append(next_int)
        rest_list.remove(next_int)
        return is_circle(current_list, rest_list)
    else:
        return False
        

n = int(input())
input_list = [int(i) for i in input().split(' ')]

if is_circle([input_list[0]], input_list[1:]):
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
def is_circle(current_list, rest_list):
    if rest_list == []:
        if (current_list[-1] ^ current_list[0]) == current_list[1]:
            return True
        else:
            return False
    if len(current_list) == 1:
        for index, num in enumerate(rest_list):
            next_int = current_list[0] ^ num
            if next_int in rest_list:
                if is_circle(current_list + [num], rest_list[:index] + rest_list[index+1:]):
                    return True
        return False

    next_int = current_list[-1] ^ current_list[-2]
    if next_int in rest_list:
        current_list.append(next_int)
        rest_list.remove(next_int)
        return is_circle(current_list, rest_list)
    else:
        return False
        

n = int(input())
input_list = [int(i) for i in input().split(' ')]

if is_circle([input_list[0]], input_list[1:]):
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
def is_circle(current_list, rest_list):
    if rest_list == []:
        if (current_list[-1] ^ current_list[0]) == current_list[1]:
            return True
        else:
            return False
    if len(current_list) == 1:
        for num in rest_list:
            current_temp = current_list.copy()
            rest_temp = rest_list.copy()
            current_temp.append(num)
            rest_temp.remove(num)
            if is_circle(current_temp, rest_temp):
                return True
        return False

    next_int = current_list[-1] ^ current_list[-2]
    if next_int in rest_list:
        current_list.append(next_int)
        rest_list.remove(next_int)
        return is_circle(current_list, rest_list)
    else:
        return False
        

n = int(input())
input_list = [int(i) for i in input().split(' ')]

if is_circle([input_list[0]], input_list[1:]):
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
def is_circle(current_list, rest_list):
    if rest_list == []:
        if (current_list[-1] ^ current_list[0]) == current_list[1]:
            return True
        else:
            return False
    if len(current_list) == 1:
        for num in rest_list:
            current_list.append(num)
            rest_list.remove(num)
            if is_circle(current_list, rest_list):
                return True
        return False

    next_int = current_list[-1] ^ current_list[-2]
    if next_int in rest_list:
        current_list.append(next_int)
        rest_list.remove(next_int)
        return is_circle(current_list, rest_list)
    else:
        return False
        

n = int(input())
input_list = [int(i) for i in input().split(' ')]

if is_circle([input_list[0]], input_list[1:]):
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
def is_circle(current_list, rest_list):
    if rest_list == []:
        if (current_list[-1] ^ current_list[0]) == current_list[1]:
            return True
        else:
            return False
    if len(current_list) == 1:
        for num in rest_list:
            current_list.append(num)
            rest_list.remove(num)
            if is_circle(current_list, rest_list):
                return True
        return False

    next_int = current_list[-1] ^ current_list[-2]
    if next_int in input_list:
        current_list.append(next_int)
        rest_list.remove(next_int)
        return is_circle(current_list, rest_list)
    else:
        return False
        

n = int(input())
input_list = [int(i) for i in input().split(' ')]

if is_circle([input_list[0]], input_list[1:]):
    print('Yes')
else:
    print('No')