Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
x = list(map(int, input().split()))
ans = 10**9 + 10

for i in range(n-k+1):
    left = i
    right = i+k
    to_right = abs(x[left]) + abs(x[right]-x[left])
    to_left = abs(x[right]) + abs(x[right]-x[left])
    if min(to_right, to_left) < ans:
        ans = min(to_right, to_left)

print(ans)

Fixed submission:
n, k = map(int, input().split())
x = sorted(list(map(int, input().split())) + [0])
ans = 10**9 + 10

for i in range(n-k+1):
    left = i
    right = i+k
    to_right = abs(x[left]) + abs(x[right]-x[left])
    to_left = abs(x[right]) + abs(x[right]-x[left])
    if min(to_right, to_left) < ans:
        ans = min(to_right, to_left)

print(ans)
Buggy python submission (verdict: Runtime Error):
s = input()
j = len(s)-2

if s.index('A')==0 and s[2:-1].count('C')==1:
    for i in s:
        j -= i.islower()

if j > 0:
    print('WA')
else:
    print('AC')

Fixed submission:
s = input()

if s[0]=='A' and s[2:-1].count('C')==1 and (s[1:s.find('C')]+s[s.find('C')+1:]).islower():
    print('AC')
else:
    print('WA')
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = list(map(int, input().split()))
even_a = [i for i in a if i%2==0]
even_a.sort()
num = len(even_a)
count = 0

if num == 0:
    print(0)
    exit()

i = 0
while even_a[i] % 2 == 0:
    even_a[i] //= 2
    count += 1
    for j in range(i+1, num):
        even_a[j] *= 3
    if even_a[i] % 2 != 0:
        i += 1
    if i == num:
        break

print(count)

Fixed submission:
N = int(input())
a = list(map(int, input().split()))
count = 0

for i in a:
    while i % 2 == 0:
        i //= 2
        count += 1

print(count)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()
ans = [0] * n

for i in range(n):
    ans[i] = s[:i].count('W') + s[i:].count('E')

print(min(ans))

Fixed submission:
n = int(input())
s = input()
ans = [s[1:].count('E')]

for i in range(1, n):
    num = ans[i - 1]
    if s[i - 1] == 'E':
        num -= 1
    if s[i] == 'W':
        num += 1
    ans.append(num)

print(min(ans))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()
ans = 10**9 + 10

for i in range(n):
    west = s[:i].count('W')
    east = s[i:].count('E')
    if west + east < ans:
        ans = west + east

print(ans)

Fixed submission:
n = int(input())
s = input()
ans = [s[1:].count('E')]

for i in range(1, n):
    num = ans[i - 1]
    if s[i - 1] == 'E':
        num -= 1
    if s[i] == 'W':
        num += 1
    ans.append(num)

print(min(ans))
Buggy python submission (verdict: Time Limit Exceeded):
A, B, C, K = map(int, input().split())
num = 10**18

for i in range(K):
    A, B, C = B+C, A+C, A+B
    if A == B == C:
        print(0)
        exit()

if (A - B) > num:
    print('Unfair')
else:
    print(A - B)

Fixed submission:
A, B, C, K = map(int, input().split())
num = 10**18

if K % 2 == 0:
    ans = A - B
else:
    ans = B - A

if ans > num:
    print('Unfair')
else:
    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
x = list(map(int, input().split()))
num = (n // 2) - 1

for i in range(n):
    l = x[:]
    l.pop(i)
    l.sort()
    print(l[num])

Fixed submission:
n = int(input())
x = list(map(int, input().split()))
y = sorted(x[:])

for i in range(n):
    if x[i] < y[n//2]:
        print(y[n//2])
    else:
        print(y[n//2 - 1])

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
x = list(map(int, input().split()))
num = (n // 2) - 1

for i in range(n):
    l = x[:]
    l.pop(i)
    l.sort(reverse=True)
    print(l[num])

Fixed submission:
n = int(input())
x = list(map(int, input().split()))
y = sorted(x[:])

for i in range(n):
    if x[i] < y[n//2]:
        print(y[n//2])
    else:
        print(y[n//2 - 1])
Buggy python submission (verdict: Time Limit Exceeded):
a, b, k = map(int, input().split())

for i in range(a, b+1):
    if b - k < i or i < a + k:
        print(i)
    else:
        continue

Fixed submission:
a, b, k = map(int, input().split())

for i in range(a, min(a+k, b+1)):
    print(i)
for i in range(max(a+k, b+1-k), b+1):
    print(i)

Buggy python submission (verdict: Time Limit Exceeded):
a, b, k = map(int, input().split())
k -= 1

for i in range(a, b+1):
    if i <= a + k:
        print(i)
    elif i >= b - k:
        print(i)

Fixed submission:
a, b, k = map(int, input().split())

for i in range(a, min(a+k, b+1)):
    print(i)
for i in range(max(a+k, b+1-k), b+1):
    print(i)
Buggy python submission (verdict: Time Limit Exceeded):
S = input()
s_ex = 'AKIHABARA'

N = len(S) + 1

for i in range(2**N):
    L = [''] * N
    for j in range(N):
        if (i >> j) & 1:
            L[N - j - 1] = 'A'
    # print(L)
    check = ''
    for k in range(N*2-1):
        if k % 2 == 0:
            check += L[k // 2]
        else:
            check += S[k // 2]
    if check == s_ex:
        print('YES')
        exit()

print('NO')

Fixed submission:
import re

S = input()
L = 'A?KIHA?BA?RA?$'

if re.match(L, S):
    print('YES')
else:
    print('NO')

Buggy python submission (verdict: Runtime Error):
S = input()
len_s = len(S)
L = 'AKIHABARA'

if S == L:
    print('YES')
    exit()
if len_s > 9:
    print('NO')
    exit()

S = [s for s in S]

for i in range(9):
    if S[i] == L[i]:
        pass
    elif S[i] == L[i+1]:
        S.insert(i, 'A')
    else:
        print('NO')
        exit()
    if i == 7:
        S.append('A')

S = ''.join(S)
if S == L:
    print('YES')
else:
    print('NO')

Fixed submission:
import re

S = input()
L = 'A?KIHA?BA?RA?$'

if re.match(L, S):
    print('YES')
else:
    print('NO')
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(input()) for _ in range(n)]
check = set(a)
ans = len(check)

for i in check:
    if a.count(i) % 2 == 0:
        ans -= 1

print(ans)

Fixed submission:
n = int(input())
array = {}

for i in range(n):
    a = int(input())
    if a not in array:
        array[a] = 1
    elif array[a] == 1:
        array[a] -= 1
    else:
        array[a] += 1

print(sum(array.values()))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

plus = []
minus = []

for i in a:
    minus.append(i-1)
    plus.append(i+1)

all_l = a + minus + plus
set_all = list(set(all_l))

ans = 0
for i in set_all:
    if all_l.count(i) > ans:
        ans = all_l.count(i)

print(ans)

Fixed submission:
import collections

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

plus = []
minus = []

for i in a:
    minus.append(i-1)
    plus.append(i+1)

all_l = a + minus + plus
ans = collections.Counter(all_l)
print(ans.most_common(1)[0][1])

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

plus = []
minus = []

for i in a:
    minus.append(i-1)
    plus.append(i+1)

all_l = a + minus + plus
all_l.sort()
set_all = list(set(all_l))

ans = 0
for i in set_all:
    if all_l.count(i) > ans:
        ans = all_l.count(i)

print(ans)

Fixed submission:
import collections

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

plus = []
minus = []

for i in a:
    minus.append(i-1)
    plus.append(i+1)

all_l = a + minus + plus
ans = collections.Counter(all_l)
print(ans.most_common(1)[0][1])
Buggy python submission (verdict: Runtime Error):
import fractions

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

def lcm(A, B):
    return (A * B) // fractions.gcd(A, B)

num = lcm(T[0], T[1])
for i in range(2, N):
    num = lcm(num, T[i])

print(num)

Fixed submission:
import fractions
from functools import reduce

def lcm_base(A, B):
    return (A * B) // fractions.gcd(A, B)

def lcm(numbers):
    return reduce(lcm_base, numbers, 1)

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

print(lcm(T))

Buggy python submission (verdict: Runtime Error):
import math

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

def lcm(A, B):
    return (A * B) // math.gcd(A, B)

num = lcm(T[0], T[1])
for i in range(2, N):
    num = lcm(num, T[i])

print(num)

Fixed submission:
import fractions
from functools import reduce

def lcm_base(A, B):
    return (A * B) // fractions.gcd(A, B)

def lcm(numbers):
    return reduce(lcm_base, numbers, 1)

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

print(lcm(T))
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
c = []

for i in range(M):
    a, b = map(int, input().split())
    if a == 1:
        c.append(b)
    elif b == N:
        c.append(a)

for i in range(N):
    if c.count(i) == 2:
        print('POSSIBLE')
        exit()

print('IMPOSSIBLE')

Fixed submission:
N, M = map(int, input().split())
A = set()
B = set()

for i in range(M):
    a, b = map(int, input().split())
    if a == 1:
        A.add(b)
    elif b == N:
        B.add(a)

if A & B:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
c = []

for i in range(M):
    a, b = map(int, input().split())
    if a == 1:
        c.append(b)
    elif b == N:
        c.append(a)

for i in range(N):
    if c.count(i) == 2:
        print('POSSIBLE')
        exit()

print('IMPOSSIBLE')

Fixed submission:
N, M = map(int, input().split())
A = set()
B = set()

for i in range(M):
    a, b = map(int, input().split())
    if a == 1:
        A.add(b)
    elif b == N:
        B.add(a)

if A & B:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(M)]
ab.sort()
c = []

for i in range(M):
    if ab[i][0] == 1:
        c.append(ab[i][1])
    if ab[i][0] in c and ab[i][1] == N:
        print('POSSIBLE')
        exit()

print('IMPOSSIBLE')

Fixed submission:
N, M = map(int, input().split())
A = set()
B = set()

for i in range(M):
    a, b = map(int, input().split())
    if a == 1:
        A.add(b)
    elif b == N:
        B.add(a)

if A & B:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(M)]
ab.sort(reverse=True)
c = []

for i in range(M):
    if ab[i][1] == N:
        c.append(ab[i][0])
    if ab[i][1] in c:
        if ab[i][0] == 1:
            print('POSSIBLE')
            exit()

print('IMPOSSIBLE')

Fixed submission:
N, M = map(int, input().split())
A = set()
B = set()

for i in range(M):
    a, b = map(int, input().split())
    if a == 1:
        A.add(b)
    elif b == N:
        B.add(a)

if A & B:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(M)]
ab.sort()
c = []

for i in range(M):
    if ab[i][0] == 1:
        c.append(ab[i][1])
    if ab[i][0] in c:
        if ab[i][1] == N:
            print('POSSIBLE')
            exit()

print('IMPOSSIBLE')

Fixed submission:
N, M = map(int, input().split())
A = set()
B = set()

for i in range(M):
    a, b = map(int, input().split())
    if a == 1:
        A.add(b)
    elif b == N:
        B.add(a)

if A & B:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
A = list(map(int, input().split()))

if max(A) < K:
    print('IMPOSSIBLE')
    exit()

if K in A:
    print('POSSIBLE')
    exit()

arr = []
for i in range(N):
    for j in range(len(A)):
        for k in range(len(A)):
            if j != k:
                arr.append(abs(A[j] - A[k]))
        arr = list(set(arr))
        A += arr
        A = list(set(A))
        if K in A:
            print('POSSIBLE')
            exit()
    arr = []

print('IMPOSSIBLE')


Fixed submission:
import fractions
from functools import reduce

def gcd(*numbers):
    return reduce(fractions.gcd, numbers)

N, K = map(int, input().split())
A = list(map(int, input().split()))

G = gcd(*A)
M = max(A)

if K % G == 0 and M >= K:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
A = list(map(int, input().split()))

if max(A) < K:
    print('IMPOSSIBLE')
    exit()

if K in A:
    print('POSSIBLE')
    exit()

for i in range(len(A)):
    for j in range(i+1, len(A)):
        if i != j:
            A.append(abs(A[i] - A[j]))

set_A = list(set(A))

for i in range(len(set_A)):
    for j in range(i+1, len(set_A)):
        if abs(set_A[i] - set_A[j]) == K:
            print('POSSIBLE')
            exit()

print('IMPOSSIBLE')

Fixed submission:
import fractions
from functools import reduce

def gcd(*numbers):
    return reduce(fractions.gcd, numbers)

N, K = map(int, input().split())
A = list(map(int, input().split()))

G = gcd(*A)
M = max(A)

if K % G == 0 and M >= K:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = list(map(int, input().split()))
ans = 10**10

for i in range(1, N):
    x = sum(a[:i])
    y = sum(a[i:])
    check = abs(x - y)
    if ans > check:
        ans = check

print(ans)

Fixed submission:
N = int(input())
a = list(map(int, input().split()))
ans = 10**10

for i in range(1, N):
    if i == 1:
        x = sum(a[:i])
        y = sum(a[i:])
    else:
        x += a[i-1]
        y -= a[i-1]
    check = abs(x - y)
    if ans > check:
        ans = check

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
b = []

for i in range(n):
    if i % 2 == 0:
        b.append(a[i])
    else:
        b.insert(0, a[i])

if n % 2 != 0:
    b.reverse()

print(*b, sep=' ')

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
even = []
odd = []
b = []

for i in range(n):
    if i % 2 == 0:
        even.append(a[i])
    else:
        odd.append(a[i])

if n % 2 != 0:
    even.reverse()
    b = even + odd
else:
    odd.reverse()
    b = odd + even

print(*b, sep=' ')

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

for i in range(n):
    b.append(a[i])
    b.reverse()

print(*b, sep=' ')

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
even = []
odd = []
b = []

for i in range(n):
    if i % 2 == 0:
        even.append(a[i])
    else:
        odd.append(a[i])

if n % 2 != 0:
    even.reverse()
    b = even + odd
else:
    odd.reverse()
    b = odd + even

print(*b, sep=' ')
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
mod = 10**9 + 7
num = abs(N - M)

if num > 1:
    print(0)
    exit()

n = 1
for i in range(1, N+1):
    n *= i

if N == M:
    m = n
    ans = (2 * n * m) % mod
else:
    if N < M:
        m = M * n
    else:
        m = n // N
    ans = (n * m) % mod

print(ans)

Fixed submission:
import math

N, M = map(int, input().split())
mod = 10**9 + 7

if abs(N - M) > 1:
    print(0)
    exit()

n = math.factorial(N)
if N == M:
    m = n
    ans = (2 * n * m) % mod
else:
    if N < M:
        m = M * n
    else:
        m = n // N
    ans = (n * m) % mod

print(ans)
Buggy python submission (verdict: Runtime Error):
N, C, K = map(int, input().split())
T = [int(input()) for _ in range(N)]
T.sort()

bus = 0
member = 1
time = T[0] + K

for i in range(1, N):
    member += 1
    if time < T[i]:
        bus += 1
        member = 1
        time = T[i] + K
    elif time > T[i] and member >= C:
        if C % member == 0:
            bus += C // member
        else:
            bus += C // member + 1
        member = 0
        time = T[i+1] + K
    else:
        pass

if member > 0:
    bus += 1

print(bus)

Fixed submission:
N, C, K = map(int, input().split())
T = [int(input()) for _ in range(N)]
T.sort()

bus = [T[0]]
count = 1

for i in range(1, N):
    if T[i] <= bus[0] + K and len(bus) < C:
        bus.append(T[i])
    else:
        count += 1
        bus = []
        bus.append(T[i])

print(count)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())+1
num = 10**9+7
power = 1

for i in range(1, n):
    power = power * i

ans = power % num
print(ans)

Fixed submission:
n = int(input()) + 1
mod = 10**9 + 7
power = 1

for i in range(1, n):
    power *= i
    power %= mod

print(power)
Buggy python submission (verdict: Runtime Error):
N = int(input())
ab = [list(map(int, input().split())) for _ in range(N)]
ab.reverse()
count = 0

for i in range(N):
    ab[i][0] += count
    if ab[i][1] == 1:
        continue
    else:
        if ab[i][0] > ab[i][1]:
            num = ab[i][1] - ab[i][0] % ab[i][1]
        elif ab[i][0] < ab[i][1]:
            num = ab[i][0] - ab[i][1] % ab[i][0] - 1
        count += num
        ab[i][0] += num

print(count)

Fixed submission:
N = int(input())
A = []
B = []
ans = 0

for i in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)

for i in range(N-1, -1, -1):
    a, b = (A[i] + ans), B[i]
    if a % b != 0:
        ans += b - a % b

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(input()) for _ in range(N)]
B = [int(input()) for _ in range(N)]
A.sort()
B.sort()
ans = [0] * N
mod = 10**9 + 7

for i in range(N):
    for j in range(N):
        ans[j-i] += (abs(A[i]-B[j])) % mod

print(ans.count(min(ans)))

Fixed submission:
N = int(input())
Q = sorted([[int(input()), i//N] for i in range(2*N)])

mod = 10**9 + 7
ans = 1
S = [0, 0]

for i in Q:
    if S[1-i[1]] == 0:
        S[i[1]] += 1
    else:
        ans = (ans*S[1-i[1]]) % mod
        S[1-i[1]] -= 1

print(ans)
Buggy python submission (verdict: Runtime Error):
s = input()

c = int(s.index('C'))
f = max(int(s.index('F')), int(s.rindex('F')))

if c <= f:
    print('Yes')
else:
    print('No')

Fixed submission:
s = input()

if 'C' in s and 'F' in s:
    c = int(s.index('C'))
    f = max(int(s.index('F')), int(s.rindex('F')))
    if c <= f:
        print('Yes')
    else:
        print('No')
else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
X = input()
num = len(X) // 2

for j in range(num):
    X = X.replace('ST', '')
    if 'ST' not in X:
        break

print(len(X))

Fixed submission:
X = input()
s = cnt = 0

for i in range(len(X)):
    if X[i] == 'S':
        s += 1
    elif s != 0:
        cnt += 2
        s -= 1

ans = len(X) - cnt
print(ans)

Buggy python submission (verdict: Runtime Error):
X = input()

for j in range(len(X//2)):
    X = X.replace('ST', '')
    if 'ST' not in X:
        break

print(len(X))

Fixed submission:
X = input()
s = cnt = 0

for i in range(len(X)):
    if X[i] == 'S':
        s += 1
    elif s != 0:
        cnt += 2
        s -= 1

ans = len(X) - cnt
print(ans)

Buggy python submission (verdict: Runtime Error):
X = input()

for j in range(X//2):
    X = X.replace('ST', '')
    if 'ST' not in X:
        break

print(len(X))

Fixed submission:
X = input()
s = cnt = 0

for i in range(len(X)):
    if X[i] == 'S':
        s += 1
    elif s != 0:
        cnt += 2
        s -= 1

ans = len(X) - cnt
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
X = input().replace('ST', '')

for j in range(len(X)//2):
    X = X.replace('ST', '')
    if 'ST' not in X:
        break

print(len(X))

Fixed submission:
X = input()
s = cnt = 0

for i in range(len(X)):
    if X[i] == 'S':
        s += 1
    elif s != 0:
        cnt += 2
        s -= 1

ans = len(X) - cnt
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
X = input()

for j in range(len(X)):
    X = X.replace('ST', '')
    if 'ST' not in X:
        break

print(len(X))

Fixed submission:
X = input()
s = cnt = 0

for i in range(len(X)):
    if X[i] == 'S':
        s += 1
    elif s != 0:
        cnt += 2
        s -= 1

ans = len(X) - cnt
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n,q=map(int,input().split())
s=input()
for i in range(q):
    l,r=map(int,input().split())
    print(s[l-1:r].count("AC"))


Fixed submission:
n,q=map(int,input().split())
s=input()
cnt=[0]*n
for i in range(n):
    cnt[i]=cnt[i-1]
    if s[i-1:i+1]=="AC":
        cnt[i]+=1
for i in range(q):
    l,r=map(int,input().split())
    print(cnt[r-1]-cnt[l-1])
Buggy python submission (verdict: Runtime Error):
#include<bits/stdc++.h>
using namespace std;

using ll=long long; 

void solve(){
	string a,b;
	cin>>a>>b;
	if(a.size()!=b.size()){
		if(a.size()>b.size()){
			cout<<"GREATER"<<endl;
		}
		else if (a.size()<b.size()){
			cout<<"LESS"<<endl;
		}
		else{
			cout<<"EQUAL"<<endl;
		}
	}
	else{
		for(int i=0; i<a.size(); i++){
			if(a[i]>b[i]){
				cout<<"GREATER"<<endl;
				return;
			}
			else if(a[i]<b[i]){
				cout<<"LESS"<<endl;
				return;
			}
		}
		cout<<"EQUAL"<<endl;
		return;
	}

}

signed main(){
	//while(1)
	solve();
}

Fixed submission:
a=int(input())
b=int(input())
if a>b:
	print("GREATER")
elif a<b:
	print("LESS")
else:
	print("EQUAL")
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
ai=[int(x) for x in input().split()]
if (ai.count(0)==1 or ai.count(0)==0)and all([ai.count(i)==0 or ai.count(i)==2 for i in range(1,n)]):
    nd=n//2
    ans=1
    for i in range(nd):
        ans*=2
        ans%=10**9+7
    print(ans)
else:
    print(0)

Fixed submission:
n=int(input())
ai=[int(x) for x in input().split()]
#print(len(set(ai)), -(-n // 2))
if (ai.count(0)==0 or ai.count(0)==1) and len(set(ai))==-(-n//2):
    ans=1
    for i in range(n//2):
        ans*=2
        ans%=10**9+7
    print(ans)
else:
    print(0)
Buggy python submission (verdict: Time Limit Exceeded):
import itertools

N = int(input())
nums = []
for _ in range(N):
    num = input().split(".")
    if len(num) == 2:
        nums.append([int(num[0]), int(num[1]), len(num[1])])
    else:
        nums.append([int(num[0]),0,0])
ans = 0
for i,j in itertools.combinations(range(N),2):
    l = nums[i][1]*nums[j][1] + nums[i][0]*nums[j][1]*(10**nums[i][2]) + nums[i][1]*nums[j][0]*(10**nums[j][2])
    if l%(10**(nums[i][2]+nums[j][2])) == 0:
        ans += 1
print(ans)    

Fixed submission:
from collections import defaultdict
from math import gcd
nums = defaultdict(int)
for _ in range(int(input())):
  nums[gcd(round(float(input())*(10**9)),10**18)] += 1
nums = tuple(nums.items())
ans = 0
for i, (a,b) in enumerate(nums):
  if a*a%(10**18) == 0:
    ans += b*(b-1)//2
  for (c,d) in nums[i+1:]:
    if a*c%(10**18) == 0:
      ans += b*d
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import heapq

N,K = [int(i) for i in input().split()]
A = [[-int(i),int(i),0] for i in input().split()]
heapq.heapify(A)
for _ in range(K):
    a = heapq.heappop(A)
    a[2] += 1
    a[0] = -(a[1]//(a[2]+1))-1
    heapq.heappush(A, a)
print(-A[0][0])

Fixed submission:
N,K = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
M = max(A)
m = 1
mid = (M+1)//2
while m<M:
  n = 0
  for a in A:
    n += -(-a//mid)-1
    if n > K:
      m = mid+1
      break
  else:
    M = mid
  mid = (M+m)//2
print(mid)
Buggy python submission (verdict: Runtime Error):
N = int(input())
ans = [0]*(N+1)
for i in range(1,int((N-2)**0.5)):
    for j in range(1,i+1):
        for k in range(1,j+1):
            a = i**2 + j**2 + k**2 + i*j + j*k + k*i
            if a > N:
                continue
            t = 1
            if (i == j and j > k) or (i>j and j==k):
                t = 3
            elif i > j and j > k:
                t = 6
            ans[a] += t
for i in range(1,N+1):
    print(ans[i])

Fixed submission:
N = int(input())
t = 1
if N > 1:
    t = int((N-2)**0.5)
ans = [0]*(N+1)
for i in range(1,t):
    for j in range(1,i+1):
        for k in range(1,j+1):
            a = i**2 + j**2 + k**2 + i*j + j*k + k*i
            if a > N:
                continue
            t = 1
            if (i == j and j > k) or (i>j and j==k):
                t = 3
            elif i > j and j > k:
                t = 6
            ans[a] += t
for i in range(1,N+1):
    print(ans[i])