Buggy python submission (verdict: Runtime Error):
class Bridge:
    def __init__(self, nodeA, nodeB):
        self.edges = [BridgeEdge(nodeA, self), BridgeEdge(nodeB, self)]
        nodeA.addEdge(self.edges[1])
        nodeB.addEdge(self.edges[0])
        self.dir = True
        self.vec = None

class BridgeEdge:
    def __init__(self, node, edge):
        self.edge = edge
        self.node = node
    def another(self):
        return self.edge.edges[1 if self.edge.edges[0] == self else 0]

class Node:
    def __init__(self, id):
        self.id = id
        self.bridges = []
        self.parent = None
        self.judge = 0
    def addEdge(self, bridgeEdge):
        self.bridges.append(bridgeEdge)
    def __repr__(self):
        return str((self.id, None if self.parent is None else self.parent.node.id))

N, M = map(int, input().split())

nodes = [Node(i) for i in range(N+1)]
bridges = []
for A, B in (map(int, input().split()) for _ in range(N)):
    bridges.append(Bridge(nodes[A], nodes[B]))

s = [(None, nodes[1])]
idx = 0
ok = True
while idx < len(s):
    pre, cur = s[idx]
    idx += 1


    for nxt in cur.bridges:
        if nxt.node.judge <= 0:
            nxt.node.parent = nxt.another()
            cur.judge += 1
            nxt.edge.vec = (cur.id, nxt.node.id)
            s.append((cur, nxt.node))


    if cur.judge % 2 == 1:
        ok = not ok
        wrk = cur
        while wrk.parent is not None:
            br = wrk.parent.edge
            br.dir = not br.dir
            wrk = wrk.parent.node

if ok:
    for br in bridges:
        if br.dir:
            print("{} {}".format(br.vec[1], br.vec[0]))
        else:
            print("{} {}".format(br.vec[0], br.vec[1]))
else:
    print("-1")


Fixed submission:
from collections import Counter

N= int(input())

a = list(map(int, input().split()))

x = Counter(a)

ok = False
if len(x) == 3 and len(a) % 3 == 0:
    for i in a:
        if x[i] != len(a) // 3:
            break
    else:
        w = 0
        for j in x:
            w ^= j
        if w == 0:
            ok = True
elif len(x) == 1:
    if x.get(0) is not None:
        ok = True
elif len(x) == 2 and len(a) % 3 == 0:
    if x.get(0) is not None and x[0] == len(a) // 3:
        ok = True

if ok:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Time Limit Exceeded):
from bisect import bisect_left

n = int(input())
a = list(map(int, input().split()))
a = sorted(a)

table = [[-1 for _ in range(n)] for _ in range(n)]
c = [0 for _ in range(n)]

for i in range(n):
    for j in range(n):
        table[i][j] = a[i] ^ a[j]
        if i != j:
            k = bisect_left(a, table[i][j])
            if k < len(c) and a[k] == table[i][j]:
                c[k] += 1
if all((cc == 2 for cc in c)):
    print('Yes')
else:
    print('No')



Fixed submission:
from collections import Counter

N= int(input())

a = list(map(int, input().split()))

x = Counter(a)

ok = False
if len(x) == 3 and len(a) % 3 == 0:
    for i in a:
        if x[i] != len(a) // 3:
            break
    else:
        w = 0
        for j in x:
            w ^= j
        if w == 0:
            ok = True
elif len(x) == 1:
    if x.get(0) is not None:
        ok = True
elif len(x) == 2 and len(a) % 3 == 0:
    if x.get(0) is not None and x[0] == len(a) // 3:
        ok = True

if ok:
    print("Yes")
else:
    print("No")