Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
def main():
    n, k = map(int, input().split())

    mod = 10 ** 9 + 7
    fact = [1]
    for i in range(1, 2000):
        fact.append(fact[-1] * i)

    def comb(l, r):
        return fact[l] // fact[r] // fact[l - r]

    for i in range(1, k + 1):
        print((comb(n - k + 1, i) * comb(k - 1, i - 1)) % mod)


if __name__ == "__main__":
    main()


Fixed submission:
def main():
    n, k = map(int, input().split())

    mod = 10 ** 9 + 7
    fact = [1]
    for i in range(1, 2001):
        fact.append(fact[-1] * i)

    def comb(l, r):
        return fact[l] // fact[r] // fact[l - r]

    for i in range(1, k + 1):
        print((comb(n - k + 1, i) * comb(k - 1, i - 1)) % mod)


if __name__ == "__main__":
    main()

Buggy python submission (verdict: Runtime Error):
from scipy.special import comb

n, k = map(int, input().split())

for i in range(1, k+1):
    if n-k+1 < i:
        print(0)
    else:
        print(int((comb(n-k+1, i, exact=True) * comb(k-1, i-1, exact=True)) % (10**9 + 7)))


Fixed submission:
def main():
    n, k = map(int, input().split())

    mod = 10 ** 9 + 7
    fact = [1]
    for i in range(1, 2001):
        fact.append(fact[-1] * i)

    def comb(l, r):
        return fact[l] // fact[r] // fact[l - r]

    for i in range(1, k + 1):
        print((comb(n - k + 1, i) * comb(k - 1, i - 1)) % mod)


if __name__ == "__main__":
    main()

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

n, k = map(int, input().split())

sys.setrecursionlimit(n+1)

def f(x):
    if x == 0:
        return 1
    else:
        return f(x-1) * x

for i in range(1, k+1):
    if n-k+1 < i:
        print(0)
        continue
    print(int((f(n-k+1)/(f(i)*f(n-k+1-i)) * f(k-1)/(f(i-1)*f(k-i))) % (10**9 + 7)))


Fixed submission:
def main():
    n, k = map(int, input().split())

    mod = 10 ** 9 + 7
    fact = [1]
    for i in range(1, 2001):
        fact.append(fact[-1] * i)

    def comb(l, r):
        return fact[l] // fact[r] // fact[l - r]

    for i in range(1, k + 1):
        print((comb(n - k + 1, i) * comb(k - 1, i - 1)) % mod)


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())

if k <= (n - 1) * (n - 2) // 2:
    raise Exception
else:
    print(-1)


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

if k <= (n - 1) * (n - 2) // 2:
    g = [0] * (n * n)
    for i in range(n * n):
        u = i // n
        v = i % n
        if u < v:
            g[i] = 1

    i = 0
    for _ in range(k):
        while g[i] == 0 or i % n == n - 1:
            i += 1
        g[i] = 0

    cnt = sum(g)
    print(cnt)
    for i, e in enumerate(g):
        if e:
            u = i // n + 1
            v = i % n + 1
            print(u, v)

else:
    print(-1)

Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())

mn = n - 2
mx = (n - 1) * (n - 2) // 2

if mn <= k <= mx:
    raise Exception

else:
    print(-1)


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

if k <= (n - 1) * (n - 2) // 2:
    g = [0] * (n * n)
    for i in range(n * n):
        u = i // n
        v = i % n
        if u < v:
            g[i] = 1

    i = 0
    for _ in range(k):
        while g[i] == 0 or i % n == n - 1:
            i += 1
        g[i] = 0

    cnt = sum(g)
    print(cnt)
    for i, e in enumerate(g):
        if e:
            u = i // n + 1
            v = i % n + 1
            print(u, v)

else:
    print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
s = list(map(int, input().split()))
t = list(map(int, input().split()))
mod = 10 ** 9 + 7

dp = [[0] * (m + 1) for _ in range(n + 1)]

for i, ei in enumerate(s, 1):
    for j, ej in enumerate(t, 1):
        if ei == ej:
            dp[i][j] = dp[i-1][j] + dp[i][j-1] + 1
        else:
            dp[i][j] = dp[i-1][j] + dp[i][j-1] - dp[i-1][j-1]

        dp[i][j] %= mod

ans = dp[n][m] + 1
ans %= mod
print(ans)


Fixed submission:
n, m = map(int, input().split())
s = list(map(int, input().split()))
t = list(map(int, input().split()))
mod = 10 ** 9 + 7

dp = [[0] * (m + 1) for _ in range(n + 1)]
for i in range(n + 1):
    dp[i][0] = 1
for j in range(m + 1):
    dp[0][j] = 1


for i, es in enumerate(s, 1):
    for j, et in enumerate(t, 1):
        if es == et:
            dp[i][j] = dp[i-1][j] + dp[i][j-1]
        else:
            dp[i][j] = dp[i-1][j] + dp[i][j-1] - dp[i-1][j-1]

        dp[i][j] %= mod

ans = dp[n][m]
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
s = list(map(int, input().split()))
t = list(map(int, input().split()))
mod = 10 ** 9 + 7

dp = [[0] * (m + 1) for _ in range(n + 1)]
for i in range(n + 1):
    dp[i][0] = 1
for j in range(m + 1):
    dp[0][j] = 1


for i, es in enumerate(s, 1):
    for j, et in enumerate(t, 1):
        if es == et:
            dp[i][j] = dp[i-1][j] + dp[i][j-1]
        else:
            dp[i][j] = dp[i-1][j] + dp[i][j-1] - dp[i-1][j-1]

        dp[i][j] %= mod

ans = dp[n][m]
print(ans)


Fixed submission:
n, m = map(int, input().split())
s = list(map(int, input().split()))
t = list(map(int, input().split()))
mod = 10 ** 9 + 7

dp = [[0] * (m + 1) for _ in range(n + 1)]
for i in range(n + 1):
    dp[i][0] = 1
for j in range(m + 1):
    dp[0][j] = 1


for i, es in enumerate(s, 1):
    for j, et in enumerate(t, 1):
        if es == et:
            dp[i][j] = dp[i-1][j] + dp[i][j-1]
        else:
            dp[i][j] = dp[i-1][j] + dp[i][j-1] - dp[i-1][j-1]

        dp[i][j] %= mod

ans = dp[n][m]
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
def f(c):
    return ord(c) - ord("A")


def main():
    s = list(map(f, input()))
    ln = len(s)

    abc = [0, 1, 2]
    bca = [1, 2, 0]

    ans = 0
    for i in range(ln - 2):
        if s[i:i+3] == abc:
            s[i:i+3] = bca
            ans += 1
            j = i - 1
            while j >= 0 and s[j:j+3] == abc:
                s[j:j+3] = bca
                ans += 1
                j -= 1
            i += 1

    print(ans)


if __name__ == "__main__":
    main()


Fixed submission:
s = input()

s = s.replace("BC", "D")

ans = 0
a_cnt = 0
for e in s:
    if e == "A":
        a_cnt += 1

    elif e == "D":
        ans += a_cnt

    else:
        a_cnt = 0

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    s = list(input())
    ln = len(s)

    abc = ["A", "B", "C"]
    bca = ["B", "C", "A"]

    ans = 0
    for i in range(ln - 2):
        if s[i:i+3] == abc:
            s[i:i+3] = bca
            ans += 1
            j = i - 1
            while j >= 0 and s[j:j+3] == abc:
                s[j:j+3] = bca
                ans += 1
                j -= 1

    print(ans)


if __name__ == "__main__":
    main()


Fixed submission:
s = input()

s = s.replace("BC", "D")

ans = 0
a_cnt = 0
for e in s:
    if e == "A":
        a_cnt += 1

    elif e == "D":
        ans += a_cnt

    else:
        a_cnt = 0

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
s = list(input())
ln = len(s)

abc = ["A", "B", "C"]
bca = ["B", "C", "A"]

ans = 0
for i in range(ln - 2):
    if s[i:i+3] == abc:
        s[i:i+3] = bca
        ans += 1
        j = i - 1
        while j >= 0 and s[j:j+3] == abc:
            s[j:j+3] = bca
            ans += 1
            j -= 1

print(ans)


Fixed submission:
s = input()

s = s.replace("BC", "D")

ans = 0
a_cnt = 0
for e in s:
    if e == "A":
        a_cnt += 1

    elif e == "D":
        ans += a_cnt

    else:
        a_cnt = 0

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
s = list(input())
ln = len(s)

abc = ["A", "B", "C"]
bca = ["B", "C", "A"]

ans = 0
for i in range(ln - 2):
    if s[i:i+3] == abc:
        s[i:i+3] = bca
        ans += 1
        j = i - 1
        while j >= 0 and s[j:j+3] == abc:
            s[j:j+3] = bca
            ans += 1
            j -= 1

print(ans)


Fixed submission:
s = input()

s = s.replace("BC", "D")

ans = 0
a_cnt = 0
for e in s:
    if e == "A":
        a_cnt += 1

    elif e == "D":
        ans += a_cnt

    else:
        a_cnt = 0

print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
r = []
for i in range(n):
    city, score = map(str, input().split())
    score = int(score)
    r.append((city, score, i+1))

r.sort(key=lambda x: x[1], reverse=True)
r.sort(key=lambda x: x[0])

for x in r:
    print(x[2])


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

print((3*a + p) // 2)
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
a = list(map(int, input().split()))
bc = [list(map(int, input().split())) for _ in range(m)]

bc.sort(key=lambda x: x[1], reverse=True)
d = []
i = 0

while len(d) <= n and i < len(bc):
    d += ([bc[i][1]] * bc[i][0])
    i += 1

if len(d) > n:
    d = d[:n]

a += d
a.sort(reverse=True)

print(sum(a[:n]))


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

if a >= 13:
    print(b)
elif a >= 6:
    print(b//2)
else:
    print(0)
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
a = list(map(int, input().split()))
bc = [list(map(int, input().split())) for _ in range(m)]

a.sort()
bc.sort(key=lambda x: x[1], reverse=True)
d = []
i = 0

while len(d) <= n and i < len(bc):
    d += ([bc[i][1]] * bc[i][0])
    i += 1

if len(d) > n:
    d = d[:n]

sum_max = sum(a)
for x in range(len(d)):
    a[x] = d[x]
    sum_a = sum(a)
    if sum_a > sum_max:
        sum_max = sum_a

print(sum_max)


Fixed submission:
n, m = map(int, input().split())
a = list(map(int, input().split()))
bc = [list(map(int, input().split())) for _ in range(m)]

bc.sort(key=lambda x: x[1], reverse=True)
d = []
i = 0

while len(d) <= n and i < len(bc):
    d += ([bc[i][1]] * bc[i][0])
    i += 1

if len(d) > n:
    d = d[:n]

a += d
a.sort(reverse=True)

print(sum(a[:n]))
Buggy python submission (verdict: Runtime Error):
m, k = map(int, input().split())

if m == 0:
    if k == 0:
        ans = [0, 0]
    else:
        ans = []

elif m == 1:
    if k == 0:
        ans = [0, 0, 1, 1]
    else:
        ans = []

elif k < 2 ** m:
    li = list(range(1,  2 ** m))
    li.remove(k)
    ans = li + [k] + li[::-1] + [k]

else:
    ans = []

if ans:
    print(*ans)
else:
    print(-1)


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

if m == 0:
    if k == 0:
        ans = [0, 0]
    else:
        ans = []

elif m == 1:
    if k == 0:
        ans = [0, 0, 1, 1]
    else:
        ans = []

elif k < 2 ** m:
    li = list(range(2 ** m))
    li.remove(k)
    ans = li + [k] + li[::-1] + [k]

else:
    ans = []

if ans:
    print(*ans)
else:
    print(-1)
Buggy python submission (verdict: Runtime Error):
s = input()

s.append("X")
pat = ["A", "C", "G", "T"]
mx = 0
count = 0

for i in range(len(s)):
    if s[i] in pat:
        count += 1
    else:
        if count > mx:
            mx = count
        count = 0

print(mx)


Fixed submission:
s = input()

s += "X"
pat = ["A", "C", "G", "T"]
mx = 0
count = 0

for i in range(len(s)):
    if s[i] in pat:
        count += 1
    else:
        if count > mx:
            mx = count
        count = 0

print(mx)
Buggy python submission (verdict: Time Limit Exceeded):
n, q = map(int, input().split())
s = input()
lr = [list(map(int, input().split())) for _ in range(q)]

t = [0] * n

for i in range(1, n):
    if s[i] == "C":
        if s[i-1] == "A":
            t[i-1] = 1

for i in range(q):
    l, r = lr[i][0]-1, lr[i][1]-1
    print(sum(t[l:r]))


Fixed submission:
n, q = map(int, input().split())
s = input()
lr = [list(map(int, input().split())) for _ in range(q)]

t = [0] * (n+1)

for i in range(n):
    t[i+1] = t[i] + (1 if s[i:i+2] == "AC" else 0)

for i in range(q):
    l, r = lr[i][0]-1, lr[i][1]-1
    print(t[r] - t[l])

Buggy python submission (verdict: Time Limit Exceeded):
n, q = map(int, input().split())
s = input()
lr = [list(map(int, input().split())) for _ in range(q)]

import re

pat = "AC"

m_iter = re.finditer(pat, s)

import numpy as np
m_start = np.array([])
for m in m_iter:
    m_start = np.append(m_start, m.start())
    
for i in range(q):
    l = lr[i][0] - 1
    r = lr[i][1] - 1
    contain = (l <= m_start) * (m_start <= r-1)
    print(sum(contain))


Fixed submission:
n, q = map(int, input().split())
s = input()
lr = [list(map(int, input().split())) for _ in range(q)]

t = [0] * (n+1)

for i in range(n):
    t[i+1] = t[i] + (1 if s[i:i+2] == "AC" else 0)

for i in range(q):
    l, r = lr[i][0]-1, lr[i][1]-1
    print(t[r] - t[l])

Buggy python submission (verdict: Time Limit Exceeded):
n, q = map(int, input().split())
s = input()
lr = [list(map(int, input().split())) for _ in range(q)]

import re

pat = "AC"

for i in range(q):
    s_part = s[lr[i][0]-1:lr[i][1]]
    m = re.findall(pat, s_part)
    print(len(m))


Fixed submission:
n, q = map(int, input().split())
s = input()
lr = [list(map(int, input().split())) for _ in range(q)]

t = [0] * (n+1)

for i in range(n):
    t[i+1] = t[i] + (1 if s[i:i+2] == "AC" else 0)

for i in range(q):
    l, r = lr[i][0]-1, lr[i][1]-1
    print(t[r] - t[l])
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

import math

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

ans = a[0]
for a_val in a:
    ans = math.gcd(ans, a_val)

print(ans)

Fixed submission:
# -*- coding: utf-8 -*-

def gcd(a, b):
    big, small = max(a, b), min(a,b)
    if big % small == 0:
        return small
    return gcd(small, big%small)


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

ans = a[0]
for a_val in a:
    ans = gcd(ans, a_val)

print(ans)
Buggy python submission (verdict: Runtime Error):
import sys
#sys.setrecursionlimit(10 ** 7)

dct = {"#": 0, ".": 1, "-": 2}


def f(c):
    return dct[c]


h, w = map(int, input().split())
s = [[2] * (w + 2)]
for _ in range(h):
    s.append([2] + list(map(f, input())) + [2])
s.append([2] * (w + 2))

d = [(-1, 0), (1, 0), (0, -1), (0, 1)]


def dfs(col, hh, ww):
    if s[hh][ww] != col:
        return

    cnt[col] += 1
    s[hh][ww] = 2

    for dh, dw in d:
        nh = hh + dh
        nw = ww + dw
        dfs(1-col, nh, nw)


ans = 0
for hi in range(1, h + 1):
    for wi in range(1, w + 1):
        cnt = [0, 0]
        if s[hi][wi] != 2:
            dfs(s[hi][wi], hi, wi)
        ans += cnt[0] * cnt[1]

print(ans)


Fixed submission:
import sys
sys.setrecursionlimit(10 ** 7)

dct = {"#": 0, ".": 1, "-": 2}


def f(c):
    return dct[c]


h, w = map(int, input().split())
s = [[2] * (w + 2)]
for _ in range(h):
    s.append([2] + list(map(f, input())) + [2])
s.append([2] * (w + 2))

d = [(-1, 0), (1, 0), (0, -1), (0, 1)]


def dfs(col, hh, ww):
    if s[hh][ww] != col:
        return

    cnt[col] += 1
    s[hh][ww] = 2

    for dh, dw in d:
        nh = hh + dh
        nw = ww + dw
        dfs(1-col, nh, nw)


ans = 0
for hi in range(1, h + 1):
    for wi in range(1, w + 1):
        cnt = [0, 0]
        if s[hi][wi] != 2:
            dfs(s[hi][wi], hi, wi)
        ans += cnt[0] * cnt[1]

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
h = list(map(int, input().split()))
INF = 10 ** 18

dp = [INF] * n
dp[0] = 0

for i, ei in enumerate(h):
    for j in range(i - 1, max(0, i - k) - 1, -1):
        ej = h[j]
        dp[i] = min(dp[i], dp[j] + abs(ei - ej))

ans = dp[-1]
print(ans)


Fixed submission:
import numpy as np

n, k = map(int, input().split())
h = np.array(list(map(int, input().split())), np.int64)
INF = 10 ** 18

dp = np.full(n, INF, np.int64)
dp[0] = 0

for i, e in enumerate(h[1:], 1):
    lb = max(0, i - k)
    dp[i] = np.min(dp[lb:i] + np.abs(h[lb:i] - e))

ans = dp[-1]
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
from numba import njit

s = input()
t = input()


@njit
def f():
    dp = [[0] * (len(t) + 1) for _ in range(len(s) + 1)]

    for i, ei in enumerate(s, 1):
        for j, ej in enumerate(t, 1):
            dp[i][j] = max(dp[i-1][j], dp[i][j-1], (dp[i-1][j-1] + 1) * (ei == ej))

    return dp


dp = f()

i = len(s)
j = len(t)
ans = []
while i and j:
    if dp[i-1][j] == dp[i][j]:
        i -= 1
    elif dp[i][j-1] == dp[i][j]:
        j -= 1
    else:
        ans.append(s[i-1])
        i -= 1
        j -= 1

ans = "".join(ans[::-1])
print(ans)


Fixed submission:
s = input()
t = input()


dp = [[0] * (len(t) + 1) for _ in range(len(s) + 1)]

for i, ei in enumerate(s, 1):
    for j, ej in enumerate(t, 1):
        dp[i][j] = max(dp[i-1][j], dp[i][j-1], (dp[i-1][j-1] + 1) * (ei == ej))

i = len(s)
j = len(t)
ans = []
while i and j:
    if dp[i-1][j] == dp[i][j]:
        i -= 1
    elif dp[i][j-1] == dp[i][j]:
        j -= 1
    else:
        ans.append(s[i-1])
        i -= 1
        j -= 1

ans = "".join(ans[::-1])
print(ans)

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

dp = [[0] * (len(t) + 1) for _ in range(len(s) + 1)]

for i, ei in enumerate(s, 1):
    for j, ej in enumerate(t, 1):
        dp[i][j] = max(dp[i-1][j], dp[i][j-1], (dp[i-1][j-1] + 1) * (ei == ej))

i = len(s)
j = len(t)
ans = []
while i and j:
    if dp[i-1][j] == dp[i][j]:
        i -= 1
    elif dp[i][j-1] == dp[i][j]:
        j -= 1
    else:
        ans.append(s[i-1])
        i -= 1
        j -= 1

ans = "".join(ans[::-1])
print(ans)


Fixed submission:
s = input()
t = input()


dp = [[0] * (len(t) + 1) for _ in range(len(s) + 1)]

for i, ei in enumerate(s, 1):
    for j, ej in enumerate(t, 1):
        dp[i][j] = max(dp[i-1][j], dp[i][j-1], (dp[i-1][j-1] + 1) * (ei == ej))

i = len(s)
j = len(t)
ans = []
while i and j:
    if dp[i-1][j] == dp[i][j]:
        i -= 1
    elif dp[i][j-1] == dp[i][j]:
        j -= 1
    else:
        ans.append(s[i-1])
        i -= 1
        j -= 1

ans = "".join(ans[::-1])
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np


def main():
    s = input()

    b = np.array([])
    cnt = 0
    for i, e in enumerate(s):
        if e == "B":
            b = np.append(b, i)
            cnt += 1

    b_fin = np.arange(len(s) - cnt, len(s))

    ans = int(np.sum(b_fin - b))

    print(ans)


if __name__ == "__main__":
    main()


Fixed submission:
import numpy as np


def main():
    s = input()

    b = []
    cnt = 0
    for i, e in enumerate(s):
        if e == "B":
            b.append(i)
            cnt += 1

    b = np.array(b)
    b_fin = np.arange(len(s) - cnt, len(s))

    ans = int(np.sum(b_fin - b))

    print(ans)


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-                                                                              

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

a, p = [1], [1]

for i in range(N):
    a.append(a[i] * 2 + 3)
    p.append(p[i] * 2 + 1)


def f(N, X):
    if N == 0:
	return 0 if X <= 0 else	1
    elif X <= 1	+ a[N-1]:
        return f(N-1, X-1)
    else:
        return p[N-1] +	1 + f(N-1, X-2-a[N-1])


print(f(N, X))


Fixed submission:
# -*- coding: utf-8 -*-                                                                              

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

a, p = [1], [1]

for i in range(N):
    a.append(a[i] * 2 + 3)
    p.append(p[i] * 2 + 1)


def f(N, X):
    if N == 0:
        return 0 if X <= 0 else 1
    elif X <= 1 + a[N-1]:
        return f(N-1, X-1)
    else:
        return p[N-1] + 1 + f(N-1, X-2-a[N-1])


print(f(N, X))
Buggy python submission (verdict: Runtime Error):
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))

min_i =	0
min_temp = abs(T - H[0] * 0.006 - A)

for i in range(1, N):
    if abs(T-H[i]*0.006-A) < min_temp:
	min_temp = abs(T-H[i]*0.006-A)
        min_i =	i

print(min_i+1)


Fixed submission:
# -*- coding: utf-8 -*-                                                                              

N = int(input())
T, A = map(int, input().split())

import numpy as	np

ans = (T-A) / 0.006

h = np.abs(np.array(list(map(int, input().split()))) - ans)

print(np.argmin(h) + 1)

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-                                                                              

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

min_i =	0
min_temp = abs(T - H[0] * 0.006 - A)

for i in range(1, N):
    if abs(T-H[i]*0.006-A) < min_temp:
	min_temp = abs(T-H[i]*0.006-A)
        min_i =	i

print(min_i+1)


Fixed submission:
# -*- coding: utf-8 -*-                                                                              

N = int(input())
T, A = map(int, input().split())

import numpy as	np

ans = (T-A) / 0.006

h = np.abs(np.array(list(map(int, input().split()))) - ans)

print(np.argmin(h) + 1)

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-                                                                              

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

min_i =	0
min_temp = abs(T - H[0] * 0.006 - A)

for i in range(1, N):
    if abs(T-H[i]*0.006-A) < min_temp:
	min_temp = abs(T-H[i]*0.006-A)
        min_i =	i

print(min_i+1)


Fixed submission:
# -*- coding: utf-8 -*-                                                                              

N = int(input())
T, A = map(int, input().split())

import numpy as	np

ans = (T-A) / 0.006

h = np.abs(np.array(list(map(int, input().split()))) - ans)

print(np.argmin(h) + 1)
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-

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

dct = {}
for i in range(m):
    if py[i][0] in dct.keys():
        dct[py[i][0]].append(py[i][1])
    else:
        dct[py[i][0]] = [py[i][1]]

for key in dct.keys():
    dct[key].sort()

for i in range(m):
    print("{:06}{:06}".format(py[i][0], dct[py[i][0]].index(py[i][1]) + 1))


Fixed submission:
# -*- coding: utf-8 -*-

import bisect

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

dct = {}
for i in range(m):
    if py[i][0] in dct.keys():
        dct[py[i][0]].append(py[i][1])
    else:
        dct[py[i][0]] = [py[i][1]]

for key in dct.keys():
    dct[key].sort()

for i in range(m):
    print("{:06}{:06}".format(py[i][0], bisect.bisect(dct[py[i][0]], py[i][1])))

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-

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

dct = {}
for i in range(m):
    if py[i][0] in dct.keys():
        dct[py[i][0]].append(py[i][1])
    else:
        dct[py[i][0]] = [py[i][1]]

for key in dct.keys():
    dct[key].sort()

for i in range(m):
    print("{:06}{:06}".format(py[i][0], dct[py[i][0]].index(py[i][1]) + 1))


Fixed submission:
# -*- coding: utf-8 -*-

import bisect

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

dct = {}
for i in range(m):
    if py[i][0] in dct.keys():
        dct[py[i][0]].append(py[i][1])
    else:
        dct[py[i][0]] = [py[i][1]]

for key in dct.keys():
    dct[key].sort()

for i in range(m):
    print("{:06}{:06}".format(py[i][0], bisect.bisect(dct[py[i][0]], py[i][1])))