Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
n, *a = map(int, open(0).read().split())
b = [0] * 60
c = [0] * 60
ans = 0
for i in range(n):
    for j in range(60):
        c[j] += i - b[j] if a[i] >> j & 1 else b[j]
        b[j] += a[i] >> j & 1
for j in range(60):
    ans += c[j] << j
print(ans % (10**9 + 7))

Fixed submission:
#!/usr/bin/env python3
n, *a = map(int, open(0).read().split())
b = [0] * 60
ans = 0
for i in range(n):
    for j in range(60):
        ans += (i - b[j] if a[i] >> j & 1 else b[j]) << j
    ans %= 10**9 + 7
    for j in range(60):
        b[j] += a[i] >> j & 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
n, *a = map(int, open(0).read().split())
b = [0] * 60
c = [0] * 60
ans = 0
for i in range(n):
    for j in range(60):
        c[j] += i - b[j] if a[i] >> j & 1 else b[j]
        b[j] += a[i] >> j & 1
for j in range(60):
    ans += c[j] << j
print(ans % (10**9 + 7))


Fixed submission:
#!/usr/bin/env python3
n, *a = map(int, open(0).read().split())
b = [0] * 60
ans = 0
for i in range(n):
    for j in range(60):
        ans += (i - b[j] if a[i] >> j & 1 else b[j]) << j
    ans %= 10**9 + 7
    for j in range(60):
        b[j] += a[i] >> j & 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
n, *a = map(int, open(0).read().split())
b = [0] * 60
c = [0] * 60
ans = 0
for i in range(n):
    for j in range(60):
        c[j] += i - b[j] if a[i] >> j & 1 else b[j]
        b[j] += a[i] >> j & 1
for j in range(60):
    ans += c[j] << j
    ans %= 10**9 + 7
print(ans)


Fixed submission:
#!/usr/bin/env python3
n, *a = map(int, open(0).read().split())
b = [0] * 60
ans = 0
for i in range(n):
    for j in range(60):
        ans += (i - b[j] if a[i] >> j & 1 else b[j]) << j
    ans %= 10**9 + 7
    for j in range(60):
        b[j] += a[i] >> j & 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
n, *a = map(int, open(0).read().split())
b = [0] * 60
ans = 0
for i in range(n):
    for j in range(60):
        ans += (i - b[j] if a[i] >> j & 1 else b[j]) << j
    ans %= 10**9 + 7
    for j in range(60):
        b[j] += a[i] >> j & 1
print(ans)


Fixed submission:
#!/usr/bin/env python3
n, *a = map(int, open(0).read().split())
b = [0] * 60
ans = 0
for i in range(n):
    for j in range(60):
        ans += (i - b[j] if a[i] >> j & 1 else b[j]) << j
    ans %= 10**9 + 7
    for j in range(60):
        b[j] += a[i] >> j & 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
n, *a = map(int, open(0).read().split())
b = [0] * 60
ans = 0
for i in range(n):
    for j in range(60):
        ans += 2**j * (i - b[j] if a[i] >> j & 1 else b[j])
        ans %= 10**9 + 7
    for j in range(len(bin(a[i])) - 2):
        b[j] += a[i] >> j & 1
print(ans)


Fixed submission:
#!/usr/bin/env python3
n, *a = map(int, open(0).read().split())
b = [0] * 60
ans = 0
for i in range(n):
    for j in range(60):
        ans += (i - b[j] if a[i] >> j & 1 else b[j]) << j
    ans %= 10**9 + 7
    for j in range(60):
        b[j] += a[i] >> j & 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
n, *a = map(int, open(0).read().split())
s = sum(a)
r = [sum(a[:i + 1]) for i in range(n)]
print(min(abs(2 * i - s) for i in r))


Fixed submission:
#!/usr/bin/env python3
n, *a = map(int, open(0).read().split())
s = sum(a)
r = [a[0]]
for i in range(1, n):
    r.append(r[i - 1] + a[i])
print(min(abs(2 * i - s) for i in r))
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3
h, w, k = map(int, input().split())
s = [input() for _ in range(h)]
ans = []
c = 1
for i in s:
    if i == "." * w:
        ans.append([0] * w)
    else:
        f = i.index("#")
        ans.append([c] * (f + 1))
        for j in i[f + 1:]:
            if j == "#":
                c += 1
            ans[-1].append(c)
        c += 1
for i in range(h):
    if s[i] == "."*w:
        ans[i] = ans[i-1 if i > 1 else i +1]

for i in ans:
    print(*i)


Fixed submission:
#!/usr/bin/env python3
h, w, k = map(int, input().split())
s = [input() for _ in range(h)]
ans = []
c = 1
for i in s:
    if i == "." * w:
        if ans:
            ans.append(ans[-1])
        else:
            ans.append([0]*w)
    else:
        f = i.index("#")
        ans.append([c] * (f + 1))
        for j in i[f + 1:]:
            if j == "#":
                c += 1
            ans[-1].append(c)
        c += 1
for i in range(h):
    if ans[i] != [0]*w:
        for j in range(i):
            ans[j] = ans[i]
        break
for i in ans:
    print(*i)
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3
from functools import reduce

x, y = map(int, input().split())

mod = 10**9 + 7


def cmb(n, r, m):
    def mul(a, b):
        return a * b % m

    r = min(n - r, r)
    if r == 0:
        return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1, r + 1))
    return (over * pow(under, m - 2, m))%m


r = abs(x - y)
l = (min(x, y) - r) // 3
r += l
if l*2+r*1 in (x,y):
    print(cmb(r + l, r, mod))
else:
    print(0)


Fixed submission:
#!/usr/bin/env python3
from functools import reduce

x, y = map(int, input().split())

mod = 10**9 + 7


def cmb(n, r, m):
    def mul(a, b):
        return a * b % m

    r = min(n - r, r)
    if r == 0:
        return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1, r + 1))
    return (over * pow(under, m - 2, m))%m


r = abs(x - y)
l = (min(x, y) - r) // 3
r += l
if l*2+r*1 in (x,y) and l >= 0:
    print(cmb(r + l, l, mod))
else:
    print(0)
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
from itertools import combinations
n, *L = map(int, open(0).read().split())
print(sum(a < b + c and b < c + a and c < b + a for a, b, c in combinations(L, 3)))


Fixed submission:
#!/usr/bin/env python3
from bisect import bisect_right

n, *L = map(int, open(0).read().split())
L.sort()
ans = 0
c = [0] * (2 * 10**3 + 1)
for i in range(2 * 10**3 + 1):
    c[i] = bisect_right(L, i)
for i in range(n):
    for j in range(i + 1, n):
        ans += c[L[i] + L[j] - 1] - c[L[j] - L[i]] - 1 - (L[j] - L[i]*2 < 0)
print(ans//3)

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
from itertools import combinations
n, *L = map(int, open(0).read().split())
print(sum(a < b + c and b < c + a and c < b + a for a, b, c in combinations(L, 3)))


Fixed submission:
#!/usr/bin/env python3
from bisect import bisect_right

n, *L = map(int, open(0).read().split())
L.sort()
ans = 0
c = [0] * (2 * 10**3 + 1)
for i in range(2 * 10**3 + 1):
    c[i] = bisect_right(L, i)
for i in range(n):
    for j in range(i + 1, n):
        ans += c[L[i] + L[j] - 1] - c[L[j] - L[i]] - 1 - (L[j] - L[i]*2 < 0)
print(ans//3)
Buggy python submission (verdict: Time Limit Exceeded):
n,*a=map(int,open(0).read().split());print(*[-~a.index(-~i)for i in range(n)])

Fixed submission:
n,*a=map(int,open(0).read().split())
s=[[j,i] for i,j in zip(range(1,n+1),a)]
s.sort()
print(*[i[1] for i in s])
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3

from bisect import insort_right
from collections import deque

n, m, *a = map(int, open(0).read().split())

a = deque(sorted(a))
for _ in range(m):
    insort_right(a, a.pop() >> 1)
print(sum(a))


Fixed submission:
#!/usr/bin/env python3

from bisect import insort_right

n, m, *a = map(int, open(0).read().split())
a.sort()
for _ in range(m):
    insort_right(a, a.pop() >> 1)
print(sum(a))

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3

from bisect import insort_right

n, m, *a = map(int, open(0).read().split())

a.sort()
for _ in range(m):
    insort_right(a, a.pop() >> 1)
print(sum(a))


Fixed submission:
#!/usr/bin/env python3

from bisect import insort_right

n, m, *a = map(int, open(0).read().split())
a.sort()
for _ in range(m):
    insort_right(a, a.pop() >> 1)
print(sum(a))
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
s = input()
ans = [0] * len(s)
for i in range(len(s)):
    if s[i] == "R":
        L = s[i:].index("L")
        ans[L + i - L % 2] += 1
    else:
        R = s[:i + 1][::-1].index("R")
        ans[i - R + R % 2] += 1

print(*ans)


Fixed submission:
#!/usr/bin/env python3
s = input()
ans = [0] * len(s)
R = 0
L = 0
for i in range(len(s)):
    if s[i] == "R":
        R += 1
    else:
        ans[i] += R // 2
        ans[i - 1] += -(-R // 2)
        R = 0
    if s[-i - 1] == "L":
        L += 1
    else:
        ans[-i - 1] += L // 2
        ans[-i] += -(-L // 2)
        L = 0

print(*ans)

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
s = input()
ans = [0] * len(s)
for i in range(len(s)):
    if s[i] == "R":
        L = s[i:].index("L")
        ans[L + i - L % 2] += 1
    else:
        R = s[:i + 1][::-1].index("R")
        ans[i - R + R % 2] += 1

print(*ans)


Fixed submission:
#!/usr/bin/env python3
s = input()
ans = [0] * len(s)
R = 0
L = 0
for i in range(len(s)):
    if s[i] == "R":
        R += 1
    else:
        ans[i] += R // 2
        ans[i - 1] += -(-R // 2)
        R = 0
    if s[-i - 1] == "L":
        L += 1
    else:
        ans[-i - 1] += L // 2
        ans[-i] += -(-L // 2)
        L = 0

print(*ans)
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3
from collections import defaultdict

(n, ), *p = [[*map(int, i.split())] for i in open(0)]
d = defaultdict(int)
for i in range(n):
    for j in range(n):
        if i != j:
            d[(p[i][0] - p[j][0], p[i][1] - p[j][1])] += 1
print(n - max(d.values()))


Fixed submission:
#!/usr/bin/env python3
from collections import defaultdict

(n, ), *p = [[*map(int, i.split())] for i in open(0)]
d = defaultdict(int)
for i in range(n):
    for j in range(n):
        if i != j:
            d[(p[i][0] - p[j][0], p[i][1] - p[j][1])] += 1
print(n*(n<2) or n - max(d.values()))
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
s = input()
n = len(s)
while True:
    ns = s.replace("01", "").replace("10", "")
    if ns == s:
        break
    s = ns
print(n - len(s))


Fixed submission:
#!/usr/bin/env python3
s = input()
n = len(s)
c = 0
p = ""
count = 0
for i in s:
    if i == p:
        count += 1
    else:
        c = count - c
        count = 1
    p = i
c = count - c
print(n - abs(c))

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
s = input()
c = 0
while True:
    ns = ""
    p = ""
    f = [1] * len(s)
    for i in range(len(s)):
        if f[i] > 0:
            if i == len(s)-1:
                ns += s[i]
            elif s[i] != s[i + 1]:
                c += 2
                f[i + 1] = 0
            else:
                ns += s[i]
    if ns == s:
        break
    s = ns
print(c)


Fixed submission:
#!/usr/bin/env python3
s = input()
n = len(s)
c = 0
p = ""
count = 0
for i in s:
    if i == p:
        count += 1
    else:
        c = count - c
        count = 1
    p = i
c = count - c
print(n - abs(c))
Buggy python submission (verdict: Runtime Error):
n,x,*a=map(int,open(0).read().split())
a.sort()
s=0
i=0
while s<x or i<=n:
    i+=1
    s+=a[i]
print(~-i)

Fixed submission:
n,x,*a=map(int, open(0).read().split())
a.sort()
for i in range(n):
    x-=a[i]
    if x<0:
      print(i)
      exit()
    elif x==0:
      print(-~i)
      exit()
print(n-1)
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
print((n // k)**3 + (~k & 1) * (n // (k // 2) - n // k)**3)


Fixed submission:
#!/usr/bin/env python3
n, k = map(int, input().split())
ans = (n // k)**3
if k % 2 < 1:
    ans += (n // (k // 2) - n // k)**3
print(ans)
Buggy python submission (verdict: Runtime Error):
(d, g), *s = [list(map(int, i.split())) for i in open(0)]
s = [[i[0] * -~n * 100 + i[1], i[0]] for n, i in enumerate(s)]
a = 10**9
for b in range(1 << d):
    su = sum(s[i][0] * (b >> i & 1) for i in range(d))
    n = sum(s[i][1] * (b >> i & 1) for i in range(d))
    if su <= g:
        m = d-bin(b)[2:].zfill(d).find("0")
        if m==-1:
            if su==g:
              print(n)
              exit()
            continue
        e =-~(g-su)//(m*100)
        if e < s[m-1][1]:
            a = min(a,n + e)
    if su > g:
        a = min(a,n)
print(a)

Fixed submission:
(d, g), *s = [list(map(int, i.split())) for i in open(0)]
def c(i,t,l):
    if i==d:
        if t>=g:
            return sum(l)
        else:
            m=d-l[::-1].index(0)
            e = (t - g) // (m * 100)
            if -e < s[m-1][0]:
                return sum(l)-e
            else:
                return 10**3
    return min(c(i+1,t,l+[0]),c(i+1,t+s[i][0]*-~i*100+s[i][1],l+[s[i][0]]))
print(c(0,0,[]))

Buggy python submission (verdict: Runtime Error):
(d, g), *s = [list(map(int, i.split())) for i in open(0)]
s = [[i[0] * -~n * 100 + i[1], i[0]] for n, i in enumerate(s)]
a = 10**9
for b in range(1 << d):
    su = sum(s[i][0] * (b >> i & 1) for i in range(d))
    n = sum(s[i][1] * (b >> i & 1) for i in range(d))
    if su <= g:
        m = d-bin(b)[2:].zfill(d).find("0")
        e =-~(g-su)//(m*100)
        if e < s[m-1][1]:
            a = min(a,n + e)
    if su > g:
        a = min(a,n)
print(a)

Fixed submission:
(d, g), *s = [list(map(int, i.split())) for i in open(0)]
def c(i,t,l):
    if i==d:
        if t>=g:
            return sum(l)
        else:
            m=d-l[::-1].index(0)
            e = (t - g) // (m * 100)
            if -e < s[m-1][0]:
                return sum(l)-e
            else:
                return 10**3
    return min(c(i+1,t,l+[0]),c(i+1,t+s[i][0]*-~i*100+s[i][1],l+[s[i][0]]))
print(c(0,0,[]))

Buggy python submission (verdict: Runtime Error):
(d, g), *s = [list(map(int, i.split())) for i in open(0)]
s = [[i[0] * -~n * 100 + i[1], i[0]] for n, i in enumerate(s)]
a = 10**9
for b in range(1 << d):
    su = sum(s[i] * (b >> i & 1) for i in range(d))
    n = sum(s[i][1] * (b >> i & 1) for i in range(d))
    if su <= g:
        m = d-bin(b)[2:].zfill(d).find("0")
        e =-~(g-su)//(m*100)
        if e < s[m-1][1]:
            a = min(a,n + e)
    if su > g:
        a = min(a,n)
print(a)

Fixed submission:
(d, g), *s = [list(map(int, i.split())) for i in open(0)]
def c(i,t,l):
    if i==d:
        if t>=g:
            return sum(l)
        else:
            m=d-l[::-1].index(0)
            e = (t - g) // (m * 100)
            if -e < s[m-1][0]:
                return sum(l)-e
            else:
                return 10**3
    return min(c(i+1,t,l+[0]),c(i+1,t+s[i][0]*-~i*100+s[i][1],l+[s[i][0]]))
print(c(0,0,[]))
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
n,*a=map(int,open(0).read().split())
s = [0]
ans = 0
for i in a:
    s.append(s[-1]+i)
for i in range(1,n+1):
    ans += s[:i].count(s[i])
print(ans)


Fixed submission:
#!/usr/bin/env python3
from collections import defaultdict
n,*a=map(int,open(0).read().split())
d = defaultdict(int)
s = 0
ans = 0
d[0] += 1
for i in a:
    s += i
    ans += d[s]
    d[s] += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
a, b, k = map(int, input().split())
print(*sorted({*range(a, b + 1)} & ({*range(a, a + k)} | {*range(b - k + 1, b + 1)})),sep="\n")


Fixed submission:
#!/usr/bin/env python3
a, b, k = map(int, input().split())
if (b - a) // 2 + 1 < k:
    print(*range(a, b + 1), sep="\n")
else:
    print(*sorted(set([*range(a, a + k)] + [*range(b - k + 1, b + 1)])),
          sep="\n")

Buggy python submission (verdict: Time Limit Exceeded):
a, b, k = map(int, input().split())
print(*sorted({*range(a, b + 1)} & ({*range(a, a + k)} | {*range(b - k + 1, b + 1)})),sep="\n")


Fixed submission:
#!/usr/bin/env python3
a, b, k = map(int, input().split())
if (b - a) // 2 + 1 < k:
    print(*range(a, b + 1), sep="\n")
else:
    print(*sorted(set([*range(a, a + k)] + [*range(b - k + 1, b + 1)])),
          sep="\n")

Buggy python submission (verdict: Time Limit Exceeded):
a, b, k = map(int, input().split())
print(*sorted({*range(a, b + 1)} & {*range(a, a + k), *range(b - k + 1, b + 1)}),sep="\n")


Fixed submission:
#!/usr/bin/env python3
a, b, k = map(int, input().split())
if (b - a) // 2 + 1 < k:
    print(*range(a, b + 1), sep="\n")
else:
    print(*sorted(set([*range(a, a + k)] + [*range(b - k + 1, b + 1)])),
          sep="\n")

Buggy python submission (verdict: Time Limit Exceeded):
a, b, k = map(int, input().split())
print(*sorted({*range(a, b + 1)} & {*range(a, a + k), *range(b - k + 1, b + 1)}),sep="\n")


Fixed submission:
#!/usr/bin/env python3
a, b, k = map(int, input().split())
if (b - a) // 2 + 1 < k:
    print(*range(a, b + 1), sep="\n")
else:
    print(*sorted(set([*range(a, a + k)] + [*range(b - k + 1, b + 1)])),
          sep="\n")
Buggy python submission (verdict: Runtime Error):
_, *a = map(int, open(0).read().split())
a.sorted()
print(sum(a[-1::2]) - sum(a[-2::2]))


Fixed submission:
_, *a = map(int, open(0).read().split())
a.sort()
print(sum(a[-1::-2]) - sum(a[-2::-2]))

Buggy python submission (verdict: Runtime Error):
_, *a = map(int, open(0).read().split())
a.sorted()
print(sum(a[-1::2] - a[-2::2]))

Fixed submission:
_, *a = map(int, open(0).read().split())
a.sort()
print(sum(a[-1::-2]) - sum(a[-2::-2]))
Buggy python submission (verdict: Runtime Error):
from collections import deque
h,w = map(int,input().split())
map = [list(input()) for _ in range(h)]
dx = (1, 0, -1, 0)
dy = (0, 1, 0, -1)

def bfs():
    q = deque([])
    q.append((0,0))
    d = [([-1]*m)for _ in range(n)]

    d[0][0] = 0

    while q:
        x,y = q.popleft()
        if (x,y) == (h-1,w-1):
            break
        for i in range(4):
            nx = x+dx[i]
            ny = y+dy[i]
            if 0<=nx<h and 0<=ny<w and d[nx][ny]==-1 and map[nx][ny]!="#":
                q.append((nx,ny))
                d[nx][ny]= d[x][y]+1
    if map[h-1][w-1]:
        return h*w - d[h-1][w-1] - 1 - sum(1 for i in range(h) for j in range(w) if map[i][j] == "#")
    else:
        return -1

print(bfs())

Fixed submission:
from collections import deque
h,w = map(int,input().split())
map = [list(input()) for _ in range(h)]
dx = (1, 0, -1, 0)
dy = (0, 1, 0, -1)

def bfs():
    q = deque([])
    q.append((0,0))
    d = [([-1]*w)for _ in range(h)]

    d[0][0] =  ~-sum(1 for i in range(h) for j in range(w) if map[i][j] == ".")

    while q:
        x,y = q.popleft()
        if (x,y) == (h-1,w-1):
            break
        for i in range(4):
            nx = x+dx[i]
            ny = y+dy[i]
            if 0<=nx<h and 0<=ny<w and d[nx][ny]==-1 and map[nx][ny]!="#":
                q.append((nx,ny))
                d[nx][ny]= d[x][y] -1
    return d[h-1][w-1]
print(bfs())
Buggy python submission (verdict: Runtime Error):
c,*s=input()
for b in range(1<<n):
    t = c + ""
    for i in range(n):
        t += ["-","+"][b>>i & 1] + s[i]
    if eval(t) == 7:
        print(t+"=7")
        exit()

Fixed submission:
c,*s=input()
n=len(s)
for b in range(1<<n):
    t = c + ""
    for i in range(n):
        t += ["-","+"][b>>i & 1] + s[i]
    if eval(t) == 7:
        print(t+"=7")
        exit()
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
input()
d = input().split()
input()
t = input().split()
a = sum(d.count(i) < t.count(i) for i in set(t))
print("YNEOS"[a > 0::2])


Fixed submission:
#!/usr/bin/env python3
from collections import Counter
input()
d = Counter(input().split())
input()
t = Counter(input().split())
for k, v in t.items():
    if k not in d or d[k] < v:
        print("NO")
        exit()
print("YES")
Buggy python submission (verdict: Time Limit Exceeded):
n, *a = map(int, open(0).read().split())
b = set()
for i in a:
    b = b ^ {i}
print(len(b))

Fixed submission:
#!/usr/bin/env python3
from collections import defaultdict
n, *a = map(int, open(0).read().split())
b = defaultdict(int)
for i in a:
    b[i] += 1
print(sum(i % 2 > 0 for i in b.values()))

Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3
n, *a = map(int, open(0).read().split())
b = [0] * (10**5 + 1)
for i in a:
    b[i] += 1
print(sum(i % 2 > 0 for i in b))


Fixed submission:
#!/usr/bin/env python3
from collections import defaultdict
n, *a = map(int, open(0).read().split())
b = defaultdict(int)
for i in a:
    b[i] += 1
print(sum(i % 2 > 0 for i in b.values()))

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
n, *a = map(int, open(0).read().split())
b = set()
for i in a:
    b = b ^ {i}
print(len(b))


Fixed submission:
#!/usr/bin/env python3
from collections import defaultdict
n, *a = map(int, open(0).read().split())
b = defaultdict(int)
for i in a:
    b[i] += 1
print(sum(i % 2 > 0 for i in b.values()))
Buggy python submission (verdict: Runtime Error):
*a, = map(int, input().split())
a = [bin(abs(a[i+1]-a[i]))[::-1].find('1') for i in range(2)].sort()
print(a[1] if a[0]*a[1]<0 else a[0])

Fixed submission:
# my solution
*a, = map(int,input().split())
if any(map(lambda x: bin(x)[-1]== "1", a)):
    print("0")
    exit()
a = [bin(abs(a[i+1]-a[i]))[::-1].find('1') for i in range(2)]
print(max(a) if a[0]*a[1]<0 else min(a))
Buggy python submission (verdict: Time Limit Exceeded):
k,s = map(int,input().split())
c=0
for i in range(k+1):
    for j in range(i,k+1):
        for k in range(j,k+1):
            if i+j+k == s:
                l = len({i,j,k})
                c += l*(l+1)//2
print(c)

Fixed submission:
k,s = map(int,input().split())
c=0
for i in range(k+1):
    for j in range(k+1):
         c += 1*(0 <= s - i -j <= k)
print(c)

Buggy python submission (verdict: Time Limit Exceeded):
import itertools
k,s = map(int,input().split())
c=0
for i in itertools.product(range(k+1), repeat=3):
    c += 1*(sum(i)==s)
print(c)

Fixed submission:
k,s = map(int,input().split())
c=0
for i in range(k+1):
    for j in range(k+1):
         c += 1*(0 <= s - i -j <= k)
print(c)
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
a.sort()
i=n-1
res=1
z=10**18
for i in a:
    if(i==0):
        res=0
        break
while(i>=0):
    if(res>z/a[i]):
        res=z+1
        break
    res*=a[i]
    if(a[i]>z):
        break
    i-=1
if(res>z):
    res=-1
print(res)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
a.sort()
res=1
z=10**18
for i in a:
    if(i==0):
        res=0
        break
i=n-1
while(i>=0):
    if(a[i]==0):
        res=0
        break
    if(res>z/a[i]):
        res=z+1
        break
    res*=a[i]
    if(a[i]>z):
        break
    i-=1
if(res>z):
    res=-1
print(res)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
a.sort()
i=n-1
res=1
z=10**18
while(i>=0):
    res*=a[i]
    if(a[i]>z):
        break
    i-=1
if(res>z):
    res=-1
print(res)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
a.sort()
res=1
z=10**18
for i in a:
    if(i==0):
        res=0
        break
i=n-1
while(i>=0):
    if(a[i]==0):
        res=0
        break
    if(res>z/a[i]):
        res=z+1
        break
    res*=a[i]
    if(a[i]>z):
        break
    i-=1
if(res>z):
    res=-1
print(res)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
res=1

z=10**18
for i in a:
    res*=i
    if(i>z):
        break
if(res>z):
    print(-1)
else:
    print(res)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
a.sort()
res=1
z=10**18
for i in a:
    if(i==0):
        res=0
        break
i=n-1
while(i>=0):
    if(a[i]==0):
        res=0
        break
    if(res>z/a[i]):
        res=z+1
        break
    res*=a[i]
    if(a[i]>z):
        break
    i-=1
if(res>z):
    res=-1
print(res)