alexjercan/bugnet huggingface dataset:
Problem p03599 (Python) — buggy submission, verdict: Runtime Error

a, b, c, d, e, f = [int(x) for x in input().strip().split()]
a *= 100
b *= 100

water_cands = set()
t = 0
while t <= f:
    water_cands.add(t)
    u = t + b
    while u <= f:
        water_cands.add(u)
        u += b
    t += a

rat, wat, sug = 0.0, a, 0
for w in water_cands:
    if w == 0:
        continue
    suger_limit = min(f - w, w // 100 * e)
    suger_max = 0
    t = 0
    while t <= suger_limit:
        if suger_max < t:
            suger_max = t
        u = t + d
        while u <= suger_limit:
            if suger_max < u:
                suger_max = u
            u += d
        t += c
    if suger_max / (suger_max + w) > rat:
        rat = suger_max / (suger_max + w)
        wat = w
        sug = suger_max

print(wat + sug, sug)


Error: ZeroDivisionError: division by zero
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03599/Python/s072674453.py", line 32, in <module>
    if suger_max / (suger_max + w) > rat:
ZeroDivisionError: division by zero


Fixed submission:

a, b, c, d, e, f = [int(x) for x in input().strip().split()]
a *= 100
b *= 100
if f < a + c:
    print("0 0")
    raise SystemExit

water_cands = set()
t = 0
while t <= f:
    water_cands.add(t)
    u = t + b
    while u <= f:
        water_cands.add(u)
        u += b
    t += a

rat, wat, sug = 0.0, 0, 0
for w in water_cands:
    suger_limit = min(f - w, w // 100 * e)
    suger_max = 0
    t = 0
    while t <= suger_limit:
        if suger_max < t:
            suger_max = t
        u = t + d
        while u <= suger_limit:
            if suger_max < u:
                suger_max = u
            u += d
        t += c
    if suger_max / (suger_max + w) > rat:
        rat = suger_max / (suger_max + w)
        wat = w
        sug = suger_max

print(wat + sug, sug)
Problem p03599 (Python) — buggy submission, verdict: Runtime Error

A, B, C, D, E, F = map(int, input().split())

w = set()
for i in range(F // (100 * A) + 1):
    for j in range(F // (100 * B) + 1):
        a = (A * i + B * j) * 100
        if a < F:
            w.add(a)
w.remove(0)

best_concentration = -1
best_a = -1
best_b = -1
for a in w:
    for i in range((F - a) // C + 1):
        for j in range((F - a) // D + 1):
            b = C * i + D * j
            if a + b > F:
                continue
            if b > E * a // 100:
                continue
            concentration = 100 * b / (a + b)
            if concentration > best_concentration:
                best_concentration = concentration
                best_a = a
                best_b = b
print(best_a + best_b, best_b)


Error: AttributeError: 'set' object has no attribute 'append'
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03599/Python/s680904268.py", line 8, in <module>
    w.append(a)
AttributeError: 'set' object has no attribute 'append'


Fixed submission:

A, B, C, D, E, F = map(int, input().split())

w = set()
for i in range(F // (100 * A) + 1):
    for j in range(F // (100 * B) + 1):
        a = (A * i + B * j) * 100
        if a < F:
            w.append(a)
w.remove(0)

best_concentration = -1
best_a = -1
best_b = -1
for a in w:
    for i in range((F - a) // C + 1):
        for j in range((F - a) // D + 1):
            b = C * i + D * j
            if a + b > F:
                continue
            if b > E * a // 100:
                continue
            concentration = 100 * b / (a + b)
            if concentration > best_concentration:
                best_concentration = concentration
                best_a = a
                best_b = b
print(best_a + best_b, best_b)
Problem p03600 (Python) — buggy submission, verdict: Runtime Error

inf = float("inf")
N = int(input())
A = []
for _ in range(N):
    a = [int(s) for s in input().split()]
    A.append(a)
d = [a[:] for a in A]
ans = 0
for i in range(N - 1):
    for j in range(i + 1, N):
        dmin = min([inf] + [d[i][k] + d[k][j] for k in range(N) if k not in (i, j)])
        if d[i][j] > dmin:
            print(-1)
            exit()
        if d[i][j] != dmin:
            ans += d[i][j]
print(ans)


Error: 0

Fixed submission:

inf = float("inf")
N = int(input())
A = []
for _ in range(N):
    a = [int(s) for s in input().split()]
    A.append(a)
d = [a[:] for a in A]
ans = 0
for i in range(N - 1):
    for j in range(i + 1, N):
        dmin = min([d[i][k] + d[k][j] for k in range(N) if k not in (i, j)])
        if d[i][j] > dmin:
            print(-1)
            exit()
        if d[i][j] != dmin:
            ans += d[i][j]
print(ans)
Problem p03600 (Python) — buggy submission, verdict: Time Limit Exceeded

import itertools
import numpy as np
from scipy.sparse.csgraph import floyd_warshall


def main():
    N = int(input())
    matr = np.array([tuple(map(int, input().split())) for _ in range(N)], dtype=np.int64)
    way = floyd_warshall(matr).astype(int)
    if np.any(way < matr):
        print(-1)
        exit()

    ans = 0
    for a, b in itertools.combinations(range(N), 2):
        eq = matr[a, b] == (matr[a] + matr[:, b])
        eq[a] = eq[b] = False
        if not np.any(eq):
            ans += matr[a, b]
    print(ans)


if __name__ == "__main__":
    main()


Error: TLE

Fixed submission:

import itertools
import numpy as np
from scipy.sparse.csgraph import floyd_warshall


def main():
    N = int(input())
    matr = [tuple(map(int, input().split())) for _ in range(N)]
    way = floyd_warshall(matr).astype(int)
    if np.any(way < matr):
        print(-1)
        exit()

    ans = 0
    for a, b in itertools.combinations(range(N), 2):
        for c in range(N):
            if c == a or c == b:
                continue
            if matr[a][b] == matr[a][c] + matr[c][b]:
                break
        else:
            ans += matr[a][b]
    print(ans)


if __name__ == "__main__":
    main()
Problem p03600 (Python) — buggy submission, verdict: Runtime Error

from scipy.sparse.csgraph import floyd_warshall
from scipy.sparse import csr_matrix

import numpy as np

n = int(input())
a = [list(map(int, input().split())) for _ in range(n)]

a = np.array(a)

g = csr_matrix(a)
dist = floyd_warshall(g)

bl = dist == a

if bl.all():
    sm = dist.sum()
    INF = 10**18 + 1
    inf = np.array([INF] * n)
    inf = np.diag(inf)
    dist += inf
    for u in range(n):
        for v in range(n):
            if u == v:
                continue

            mn = np.min(dist[u] + dist[v])
            if mn == dist[u, v]:
                sm -= dist[u, v]

    ans = int(sm) // 2
    print(ans)

else:
    print(-1)


Error: ModuleNotFoundError: No module named 'scipy'
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03600/Python/s873571990.py", line 1, in <module>
    from scipy.sparse.csgraph import floyd_warshall
ModuleNotFoundError: No module named 'scipy'


Fixed submission:

from scipy.sparse.csgraph import floyd_warshall
from scipy.sparse import csr_matrix

import numpy as np

n = int(input())
a = [list(map(int, input().split())) for _ in range(n)]

a = np.array(a)

g = csr_matrix(a)
dist = floyd_warshall(g)

bl = dist == a

if bl.all():
    sm = dist.sum()
    for u in range(n):
        for v in range(n):
            if u == v:
                continue
            rmv = [u, v]
            i_rmv = np.ones(n, dtype=bool)
            i_rmv[rmv] = False

            mn = np.min(dist[u, i_rmv] + dist[v, i_rmv])
            if mn == dist[u, v]:
                sm -= dist[u, v]

    ans = int(sm) // 2
    print(ans)

else:
    print(-1)
Problem p03600 (Python) — buggy submission, verdict: Time Limit Exceeded

import sys

input = sys.stdin.buffer.readline
sys.setrecursionlimit(10**7)


def road():
    N = int(input())
    A = tuple(tuple(map(int, input().split())) for _ in range(N))

    res = 0
    for s in range(N - 1):
        for t in range(s + 1, N):
            # s-t間に辺を張るかを決める
            dist = A[s][t]
            is_connect = True
            for m in range(N):
                if m in [s, t]:
                    continue
                d = A[s][m] + A[m][t]
                if d < dist:
                    return -1
                elif d == dist:
                    is_connect = False
            if is_connect:
                res += dist
    return res


if __name__ == "__main__":
    print(road())


Error: TLE

Fixed submission:

N = int(input())
A = [tuple(map(int, input().split())) for _ in range(N)]
seen = [[False] * N for _ in range(N)]

ans = 0

for i in range(N - 1):
    for j in range(i + 1, N):
        # iからjに行くルートを考える
        path_IJ = A[i][j]
        use = [(i, j)]
        for k in range(N):
            if i == k or j == k:
                continue
            path_IKJ = A[i][k] + A[k][j]

            if path_IJ > path_IKJ:
                print(-1)
                exit()
            elif path_IJ == path_IKJ:
                use = [(i, k), (k, j)]
            else:
                pass

        for x, y in use:
            x, y = min(x, y), max(x, y)
            if not seen[x][y]:
                ans += A[x][y]
                seen[x][y] = True
print(ans)
Problem p03601 (Python) — buggy submission, verdict: Time Limit Exceeded

A, B, C, D, E, F = map(int, input().split())

tmp = 0
ans_A = 0
ans_B = 0
for a in range(31):
    for b in range(31):
        x = 100 * (a * A + b * B)
        if x > F:
            break
        for c in range((x // 100 * E) // C + 1):
            for d in range(((x // 100 * E) - c) // D + 1):
                y = c * C + d * D
                if x + y > F or y > x * E // 100:
                    break
                if x + y != 0:
                    if y / (x + y) > tmp:
                        ans_A = x + y
                        ans_B = y
                        tmp = y / (x + y)

if ans_A == 0:
    print(100 * A, 0)
else:
    print(ans_A, ans_B)


Error: TLE

Fixed submission:

A, B, C, D, E, F = map(int, input().split())

tmp = 0
ans_A = 0
ans_B = 0
for a in range(31):
    for b in range(31):
        x = 100 * (a * A + b * B)
        for c in range((x // 100 * E) // C + 1):
            for d in range(((x // 100 * E) - c) // D + 1):
                y = c * C + d * D
                if x + y > F or y > x * E // 100:
                    break
                if x + y != 0:
                    if y / (x + y) > tmp:
                        ans_A = x + y
                        ans_B = y
                        tmp = y / (x + y)

if ans_A == 0:
    print(100 * A, 0)
else:
    print(ans_A, ans_B)
Problem p03601 (Python) — buggy submission, verdict: Runtime Error

from itertools import product

a, b, c, d, e, f = map(int, input().split())

lima = [100 * a * i for i in range(f // (100 * a) + 1)]
limb = [100 * b * i for i in range(f // (100 * b) + 1)]
setw = set([i + j for i, j in product(lima, limb) if 0 < i + j <= f])
limc = [c * i for i in range(f // c + 1)]
limd = [d * i for i in range(f // d + 1)]
sets = set([i + j for i, j in product(limc, limd) if 0 < i + j <= f])

cnt, ans = 0, (max(setw), 0)
for w in setw:
    for s in sets:
        if (cnt <= 100 * s / w <= e) and (s + w <= f):
            cnt = 100 * s / w
            ans = s + w, s
else:
    print(*ans)


Error: 0

Fixed submission:

from itertools import product

a, b, c, d, e, f = map(int, input().split())

lima = [100 * a * i for i in range(f // (100 * a) + 1)]
limb = [100 * b * i for i in range(f // (100 * b) + 1)]
setw = set([i + j for i, j in product(lima, limb) if 0 < i + j <= f])
limc = [c * i for i in range(f // c + 1)]
limd = [d * i for i in range(f // d + 1)]
sets = set([i + j for i, j in product(limc, limd) if 0 < i + j <= f])

cnt = 0
for w in setw:
    for s in sets:
        if (cnt <= 100 * s / w <= e) and (s + w <= f):
            cnt = 100 * s / w
            ans = s + w, s
else:
    print(*ans)
Problem p03602 (Python) — buggy submission, verdict: Runtime Error

def solve(n, tbl):
    ans = 0
    for i, row_i in enumerate(tbl):
        for j in range(i + 1, n):
            row_j = tbl[j]
            ij = row_i[j]
            mind = min(
                (ik + kj for ik, kj in zip(row_i, row_j) if ik and kj),
                default=float("inf"),
            )
            if ij > mind:
                return -1
            if ij < mind:
                ans += ij
    return ans


n = int(input())
tbl = [list(map(int, input().split())) for _ in range(n)]
print(solve(n, tbl))


Error: 0

Fixed submission:

def solve(n, tbl):
    ans = 0
    for i, row_i in enumerate(tbl):
        for j in range(i + 1, n):
            row_j = tbl[j]
            ij = row_i[j]
            mind = min(ik + kj for ik, kj in zip(row_i, row_j) if ik and kj)
            if ij > mind:
                return -1
            if ij < mind:
                ans += ij
    return ans


n = int(input())
tbl = [list(map(int, input().split())) for _ in range(n)]
print(solve(n, tbl))
Problem p03606 (Python) — buggy submission, verdict: Runtime Error

n = int(input())
s = 0
for i in range(n):
    l, r = map(int, input().split())
    s += r - l + 1
print(s)


Error: AttributeError: 'int' object has no attribute 'split'
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03606/Python/s375896966.py", line 4, in <module>
    lr[i] = list(map(int, int().split()))
AttributeError: 'int' object has no attribute 'split'


Fixed submission:

n = int(input())
lr = [0] * n
for i in range(n):
    lr[i] = list(map(int, int().split()))
s = 0
for i, j in lr:
    s += j - i + 1
print(s)
Problem p03607 (Python) — buggy submission, verdict: Time Limit Exceeded

# -*- coding: utf-8 -*-
from itertools import permutations, combinations
from fractions import gcd
from collections import Counter
from math import sqrt
import sys

input = sys.stdin.readline


def lcm(x, y):
    return x * y // gcd(x, y)


def small_letters():
    return [chr(i) for i in range(97, 97 + 26)]


def capital_letters():
    return [chr(i) for i in range(65, 65 + 26)]


def main():
    """ここに書いてね"""
    N = int(input())
    A_list = [int(input()) for i in range(N)]
    ans = 0
    counter = Counter(A_list)
    for i in counter.values():
        if i % 2 == 1:
            ans += 1
    print(ans)


if __name__ == "__main__":
    main()


Error: TLE

Fixed submission:

N = int(input())
ans = 0
A_list = [int(input()) for i in range(N)]
A_set = set(A_list)
for i in A_set:
    if A_list.count(i) % 2 == 1:
        ans += 1
print(ans)
Problem p03607 (Python) — buggy submission, verdict: Time Limit Exceeded

from collections import defaultdict

n = int(input())
d = defaultdict(int)
cnt = 0

for _ in range(n):
    d[int(input())] += 1

for i in d.values():
    if i % 2 == 1:
        cnt += 1

print(cnt)


Error: TLE

Fixed submission:

n = int(input())

ls = []

for _ in range(n):
    a = int(input())
    if a not in ls:
        ls.append(a)
    else:
        ls.remove(a)

print(len(ls))
Problem p03607 (Python) — buggy submission, verdict: Time Limit Exceeded

n = int(input())

a = [int(input()) for _ in range(n)]

a = sorted(a)

ans = n
flag = 0
for i in range(1, n):
    if a[i] != a[i - 1] or flag == 1:
        flag = 0
    else:
        flag = 1
        ans -= 2

print(ans)


Error: TLE

Fixed submission:

n = int(input())

a = []
for _ in range(n):
    p = int(input())
    if p not in a:
        a.append(p)
    else:
        a.remove(p)

print(len(a))
Problem p03607 (Python) — buggy submission, verdict: Runtime Error

n = int(input())
m = set()
while n:
    x = int(input())
    if x in m:
        m.remove(x)
    else:
        m.add(x)
    n -= 1
print(len(m))


Error: EOFError: EOF when reading a line
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03607/Python/s158359519.py", line 4, in <module>
    x = int(input())
EOFError: EOF when reading a line


Fixed submission:

n = int(input())
m = set()
while n:
    x = int(input())
    if x in m:
        m.remove(x)
    else:
        m.add(x)
print(len(m))
Problem p03607 (Python) — buggy submission, verdict: Runtime Error

from collections import Counter

N = int(input())
A = [int(input()) for _ in range(N)]
c = Counter(A).values()

print(len([i for i in c if i % 2 == 1]))


Error: TypeError: dict.values() takes no arguments (1 given)
Traceback (most recent call last):
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03607/Python/s453374209.py", line 6, in <module>
    print(len([i for i in c if c.values(i) % 2 == 1]))
  File "/home/alex/Documents/bug-detection/input/Project_CodeNet/data/p03607/Python/s453374209.py", line 6, in <listcomp>
    print(len([i for i in c if c.values(i) % 2 == 1]))
TypeError: dict.values() takes no arguments (1 given)


Fixed submission:

from collections import Counter

N = int(input())
A = [int(input()) for _ in range(N)]
c = Counter(A)
print(len([i for i in c if c.values(i) % 2 == 1]))
Problem p03607 (Python) — buggy submission, verdict: Time Limit Exceeded

n = int(input())
A = [int(input()) for i in range(n)]

b = set()
lenB = 0
for a in A:
    b.add(a)
    lenB += 1
    if len(b) != lenB:
        b.remove(a)
        lenB -= 2
print(len(b))


Error: TLE

Fixed submission:

n = int(input())
A = [int(input()) for i in range(n)]

b = list()
lenB = 0
for a in A:
    b.append(a)
    lenB += 1
    if len(set(b)) != lenB:
        b.pop(-1)
        b.remove(a)
        lenB -= 2
print(len(b))
Problem p03607 (Python) — buggy submission, verdict: Time Limit Exceeded

import collections

N = int(input())
A = list([int(input()) for _ in range(N)])
A = collections.Counter(A).values()

ans = [x for x in A if x & 1]
print(len(ans))


Error: TLE

Fixed submission:

N = int(input())
A = list([int(input()) for _ in range(N)])
ans = []

for a in A:
    if a not in ans:
        ans.append(a)
    else:
        ans.remove(a)
print(len(ans))
Problem p03607 (Python) — buggy submission, verdict: Time Limit Exceeded

import collections

n = int(input())
a = [int(input()) for _ in range(n)]
c = collections.Counter(a)

print(len(list(filter(lambda x: x[1] % 2 == 1, c.items()))))


Error: TLE

Fixed submission:

n = int(input())
ans = []
for _ in range(n):
    a = int(input())
    if a in ans:
        ans.pop(ans.index(a))
    else:
        ans.append(a)
print(len(ans))
Problem p03607 (Python) — buggy submission, verdict: Time Limit Exceeded

N = int(input())
maps = {}

for _ in range(N):
    A = int(input())
    if A in maps:
        maps.pop(A)
    else:
        maps[A] = 1

print(len(maps))


Error: TLE

Fixed submission:

N = int(input())
A = [int(input()) for _ in range(N)]
counter = 0

while A:
    x = A[0]
    if A.count(x) % 2 == 1:
        counter += 1
    A = [i for i in A if i != x]

print(counter)
Problem p03607 (Python) — buggy submission, verdict: Time Limit Exceeded

N = int(input())
L = set()
for i in range(N):
    L ^= {input()}
print(len(L))


Error: TLE

Fixed submission:

count = 0
N = int(input())
string = list(map(int, [input() for i in range(N)]))
for i in set(string):
    if string.count(i) % 2 != 0:
        count += 1
print(count)
Problem p03607 (Python) — buggy submission, verdict: Time Limit Exceeded

import sys
import collections

n = int(sys.stdin.readline())
a_list = [int(x) for x in sys.stdin.readlines()]
a_list_counter = collections.Counter(a_list)
count = 0
for i in a_list_counter:
    if a_list_counter[i] % 2 != 0:
        count += 1
    else:
        continue
print(count)


Error: TLE

Fixed submission:

import sys

n = int(sys.stdin.readline())
a_list = [int(x) for x in sys.stdin.readlines()]
a_list_index = list(set(a_list))
count = 0
for i in a_list_index:
    if a_list.count(i) % 2 == 0:
        continue
    else:
        count += 1

print(count)
Problem p03607 (Python) — buggy submission, verdict: Time Limit Exceeded

from collections import Counter

N = int(input())
A = [int(input()) for _ in range(N)]

res = 0

c = Counter(A)

for i in c.values():
    if i % 2 != 0:
        res += 1

print(res)


Error: TLE

Fixed submission:

N = int(input())
A = [int(input()) for _ in range(N)]

p = []

for i in A:
    if i not in p:
        p.append(i)
    else:
        p.remove(i)

print(len(p))
Problem p03607 (Python) — buggy submission, verdict: Time Limit Exceeded

import collections

N = int(input())
A = [int(input()) for i in range(N)]

Adic = collections.Counter(A)

B = [n % 2 for n in Adic.values()]

print(B.count(1))


Error: TLE

Fixed submission:

import collections

N = int(input())
A = [int(input()) for i in range(N)]

Adic = collections.Counter(A)

B = [n % 2 for n in Adic.values()]

while 0 in B:
    B.remove(0)

print(len(B))
Problem p03607 (Python) — buggy submission, verdict: Runtime Error

N = int(input())
A = [int(input()) for _ in range(N)]

paper = {}

for a in A:
    paper.setdefault(a - 1, 0)
    paper[a - 1] += 1

ans = len(list(filter(lambda x: x % 2 == 1, paper.values())))
print(ans)


Error: 0

Fixed submission:

N = int(input())
A = [int(input()) for _ in range(N)]

paper = [0] * 100000

for a in A:
    paper[a - 1] += 1

ans = len(list(filter(lambda x: x % 2 == 1, paper)))
print(ans)
Problem p03607 (Python) — buggy submission, verdict: Time Limit Exceeded

n = int(input())
a = [int(input()) for _ in range(n)]
a.sort()

y = a[0]
c = 1
ans = 0
for i in range(1, n):
    if a[i] == y:
        c += 1
    else:
        if c % 2 == 1:
            ans += 1
        y = a[i]
        c = 1

if c % 2 == 1:
    ans += 1

print(ans)


Error: TLE

Fixed submission:

n = int(input())
a = [int(input()) for _ in range(n)]

c = [a.count(x) for x in set(a)]
print(len([x for x in c if x % 2 == 1]))
Problem p03607 (Python) — buggy submission, verdict: Time Limit Exceeded

N = int(input())
A = [int(input()) for _ in range(N)]
A.sort()
A.append(10**9 + 1)

now = 0
cnt = 0
ans = 0
for a in A:
    if a == now:
        cnt += 1
    else:
        now = a
        ans += cnt % 2
        cnt = 1

print(ans)


Error: TLE

Fixed submission:

N = int(input())
A = [int(input()) for _ in range(N)]
B = []
for a in A:
    if a in B:
        B.remove(a)
    else:
        B.append(a)

print(len(B))
Problem p03607 (Python) — buggy submission, verdict: Time Limit Exceeded

from collections import Counter

n = int(input())
a = Counter([int(input()) for _ in range(n)])

ans = 0
for key in a.keys():
    if a[key] % 2:
        ans += 1

print(ans)


Error: TLE

Fixed submission:

n = int(input())
a = [int(input()) for _ in range(n)]

d = []
for i in range(n):
    if a[i] in d:
        d.remove(a[i])
    else:
        d.append(a[i])
print(len(d))
Problem p03607 (Python) — buggy submission, verdict: Time Limit Exceeded

loops = int(input())
d = {}

# 10^6
for _ in range(loops):
    key = input()
    if key not in d:  # ?
        d[key] = 1
    else:
        d[key] += 1

# 10^6
ans = 0
for k, v in d.items():
    if v % 2 != 0:
        ans += 1
print(ans)


Error: TLE

Fixed submission:

loops = int(input())
paper = []

# 1 <= loops <= 10^6
for _ in range(loops):
    num = int(input())
    if num in paper:
        paper.remove(num)
    else:
        paper.append(num)
print(len(paper))
Problem p03607 (Python) — buggy submission, verdict: Time Limit Exceeded

import collections

N = int(input())
W = [int(input()) for _ in range(N)]
c = collections.Counter(W)
print(len([i for i in c.values() if i % 2 != 0]))


Error: TLE

Fixed submission:

N = int(input())
W = []
for _ in range(N):
    n = input()
    if n in W:
        W.remove(n)
    else:
        W.append(n)
print(len(W))
Problem p03607 (Python) — buggy submission, verdict: Time Limit Exceeded

import collections

N = int(input())
A = [int(input()) for _ in range(N)]

ans = 0
Acount = collections.Counter(A)

for i in Acount:
    if Acount[i] % 2 == 1:
        ans += 1

print(ans)


Error: TLE

Fixed submission:

N = int(input())
A = [int(input()) for _ in range(N)]

paper = []
for i in range(N):
    if not A[i] in paper:
        paper.append(A[i])
    else:
        paper.remove(A[i])

print(len(paper))