Problem p02975 (python)

Fixed submission:
std_n = int(input())
std_list = tuple(map(int, input().split()))
std_set = set(std_list)

if std_set == {0}:
    print("Yes")
    exit()
elif len(std_set) == 2:
    if 0 in std_set:
        if std_list.count(0) * 3 == std_n:
            print("Yes")
            exit()
        else:
            print("No")
            exit()
    else:
        print("No")
        exit()
elif len(std_set) == 3:
    a, b, c = tuple(std_set)
    if (std_list.count(a) == std_list.count(b)) and (std_list.count(b) == std_list.count(c)):
        if a ^ b == c:
            print("Yes")
            exit()
        else:
            print("No")
            exit()
    else:
        print("No")
        exit()
else:
    print("No")
    exit()

############


n = int(input())
nums = list(map(int, input().split()))

unq = list(set(nums))


def answer(ans):
    print(ans)
    exit()


if len(unq) > 3:
    answer("No")

if len(unq) == 3:
    a, b, c = unq
    if a ^ b ^ c != 0:
        answer("No")
    if nums.count(a) == nums.count(b) == nums.count(c):
        answer("Yes")
    else:
        answer("No")

if len(unq) == 2:
    a, b = sorted(unq)
    if a != 0:
        answer("No")
    if nums.count(a) * 2 == nums.count(b):
        answer("Yes")
    else:
        answer("No")

if len(unq) == 1:
    a = unq[0]
    if a != 0:
        answer("No")
    else:
        answer("Yes")

Buggy submission (verdict: Runtime Error):
std_n = int(input())
std_list = tuple(map(int, input().split()))
std_set = set(std_list)

if std_set == {0}:
    print("Yes")
    exit()
elif len(std_set) == 2:
    if 0 in std_set:
        if std_list.count(0) * 3 == std_n:
            print("Yes")
            exit()
        else:
            print("No")
            exit()
    else:
        print("No")
        exit()
elif len(std_set) == 3:
    a, b, c = tuple(std_set)
    if (std_list.count(a) == std_list.count(b)) and (std_list.count(b) == std_list.count(c)):
        if int(str(int(format(a, "b")) ^ int(format(b, "b"))), 2) == c:
            print("Yes")
            exit()
        else:
            print("No")
            exit()
    else:
        print("No")
        exit()
else:
    print("No")
    exit()

Buggy submission (verdict: Runtime Error):
std_n = int(input())
std_list = tuple(map(int, input().split()))
std_set = set(std_list)

if std_set == {0}:
    print("Yes")
elif len(std_set) == 2:
    if 0 in std_set:
        if std_list.count(0) * 3 == std_n:
            print("Yes")
        else:
            print("No")
    else:
        print("No")
elif len(std_set) == 3:
    a, b, c = tuple(std_set)
    if (std_list.count(a) == std_list.count(b)) and (std_list.count(b) == std_list.count(c)):
        if int(str(int(format(a, "b")) ^ int(format(b, "b"))), 2) == c:
            print("Yes")
        else:
            print("No")
    else:
        print("No")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
import sys

std_n = int(sys.stdin.readline().strip())
std_list = tuple(map(int, sys.stdin.readline().strip().split()))
std_set = set(std_list)

if std_set == {0}:
    print("Yes")
elif len(std_set) == 2:
    if 0 in std_set:
        if std_list.count(0) * 3 == std_n:
            print("Yes")
        else:
            print("No")
    else:
        print("No")
elif len(std_set) == 3:
    a, b, c = tuple(std_set)
    if (std_list.count(a) == std_list.count(b)) and (std_list.count(b) == std_list.count(c)):
        if int(str(int(format(a, "b")) ^ int(format(b, "b"))), 2) == c:
            print("Yes")
        else:
            print("No")
    else:
        print("No")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
import sys

std_n = int(sys.stdin.readline().strip())
std_tuple = tuple(map(int, sys.stdin.readline().strip().split()))
std_set = set(std_tuple)

if std_set == {0}:
    print("Yes")
elif len(std_set) == 2:
    if 0 in std_set:
        if std_tuple.count(0) * 3 == std_n:
            print("Yes")
        else:
            print("No")
    else:
        print("No")
elif len(std_set) == 3:
    a, b, c = tuple(std_set)
    if (std_tuple.count(a) == std_tuple.count(b)) and (std_tuple.count(b) == std_tuple.count(c)):
        if int(str(int(format(a, "b")) ^ int(format(b, "b"))), 2) == c:
            print("Yes")
        else:
            print("No")
    else:
        print("No")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
std_n = int(input())
std_tuple = tuple(map(int, input().split()))
std_set = set(std_tuple)

if std_set == {0}:
    print("Yes")
elif len(std_set) == 2:
    if 0 in std_set:
        if std_tuple.count(0) * 3 == std_n:
            print("Yes")
        else:
            print("No")
    else:
        print("No")
elif len(std_set) == 3:
    a, b, c = tuple(std_set)
    if (std_tuple.count(a) == std_tuple.count(b)) and (std_tuple.count(b) == std_tuple.count(c)):
        if int(str(int(format(a, "b")) ^ int(format(b, "b"))), 2) == c:
            print("Yes")
        else:
            print("No")
    else:
        print("No")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
std_n = int(input())
std_tuple = tuple(map(int, input().split()))
std_set = set(std_tuple)

if std_set == {0}:
    print("Yes")
elif len(std_set) == 2:
    if 0 in std_set:
        if std_tuple.count(0) * 3 == std_n:
            print("Yes")
        elif std_tuple.count(0) * 3 == std_n * 2:
            print("Yes")
        else:
            print("No")
    else:
        print("No")
elif len(std_set) == 3:
    a, b, c = tuple(std_set)
    if std_tuple.count(a) == std_tuple.count(b) == std_tuple.count(c):
        if int(str(int(format(a, "b")) ^ int(format(b, "b"))), 2) == c:
            print("Yes")
        else:
            print("No")
    else:
        print("No")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
std_n = int(input())
std_tuple = tuple(map(int, input().split()))
std_set = set(std_tuple)

if std_set == {0}:
    print("Yes")
elif len(std_set) == 2:
    if 0 in std_set:
        if std_tuple.count(0) * 3 == std_n:
            print("Yes")
        else:
            print("No")
    else:
        print("No")
elif len(std_set) == 3:
    a, b, c = tuple(std_set)
    if std_tuple.count(a) == std_tuple.count(b) == std_tuple.count(c):
        if int(str(int(format(a, "b")) ^ int(format(b, "b"))), 2) == c:
            print("Yes")
        else:
            print("No")
    else:
        print("No")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
std_n = int(input())
std_tuple = tuple(map(int, input().split()))
std_set = set(map(int, input().split()))

if std_set == {0}:
    print("Yes")
elif len(std_set) == 2:
    if 0 in std_set:
        if std_tuple.count(0) * 3 == std_n:
            print("Yes")
        else:
            print("No")
    else:
        print("No")
elif len(std_set) == 3:
    a, b, c = tuple(std_set)
    if std_tuple.count(a) == std_tuple.count(b) == std_tuple.count(c):
        if int(str(int(format(a, "b")) ^ int(format(b, "b"))), 2) == c:
            print("Yes")
        else:
            print("No")
    else:
        print("No")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
std_n = int(input())
std_set = set(map(int, input().split()))

if len(std_set) == 3:
    a, b, c = tuple(std_set)
    if int(str(int(format(a, "b")) ^ int(format(b, "b"))), 2) == c:
        print("Yes")
    else:
        print("No")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
import sys

std_n = int(sys.stdin.readline())
std_set = set(map(int, (sys.stdin.readline()).split()))

if len(std_set) == 3:
    a, b, c = tuple(std_set)
    if int(str(int(format(a, "b")) ^ int(format(b, "b"))), 2) == c:
        print("Yes")
    else:
        print("No")
else:
    print("No")