Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding utf-8 -*-
from collections import defaultdict

MOD = 10 ** 9 + 7
N, Q = map(int, input().split())

tree = defaultdict(set)
for i in range(N - 1):
    a, b = map(int, input().split())
    tree[a].add(b)
    tree[b].add(a)

counter = defaultdict(int)
for i in range(Q):
    p, x = map(int, input().split())
    counter[p] += x

cur_node = set()
cur_node.add(1)
pre_node = set()
while len(cur_node) != 0:
    next_node = set()
    for ni in cur_node:
        for nj in tree[ni]:
            if nj in pre_node:
                continue
            counter[nj] += counter[ni]
            next_node.add(nj)
    pre_node = cur_node
    cur_node = next_node

print(' '.join((str(counter[i]) for i in range(1, N + 1))))


Fixed submission:
# -*- coding utf-8 -*-
from collections import defaultdict

MOD = 10 ** 9 + 7
N, Q = map(int, input().split())

tree = defaultdict(set)
for i in range(N - 1):
    a, b = map(int, input().split())
    tree[a].add(b)
    tree[b].add(a)

counter = defaultdict(int)
for i in range(Q):
    p, x = map(int, input().split())
    counter[p] += x

cur_node = set()
cur_node.add(1)
pre_node = set()
while len(cur_node) != 0:
    next_node = set()
    for ni in cur_node:
        for nj in tree[ni]:
            if {nj} <= pre_node:
                continue
            counter[nj] += counter[ni]
            next_node.add(nj)
    pre_node = cur_node
    cur_node = next_node

print(' '.join((str(counter[i]) for i in range(1, N + 1))))
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding utf-8 -*-
import bisect

N = int(input())

c = [int(input())]

for ai in range(1, N):
    a = int(input())
    if a <= c[0]:
        c = [a] + c
    else:
        i = bisect.bisect_left(c, a) - 1
        c[i] = a

print(len(c))


Fixed submission:
import bisect
from collections import deque

N = int(input())

# c = [int(input())]
c = deque()
c.appendleft(int(input()))


for ai in range(1, N):
    a = int(input())
    if a <= c[0]:
        c.appendleft(a)
    else:
        i = bisect.bisect_left(c, a) - 1
        c[i] = a

print(len(c))

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

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

c = []

ans = 0

for a in A:
    if len(c) == 0:
        c.append(a)
    elif a <= c[0]:
        c = [a] + c
    else:
        i = bisect.bisect_left(c, a) - 1
        c[i] = a

print(len(c))


Fixed submission:
import bisect
from collections import deque

N = int(input())

# c = [int(input())]
c = deque()
c.appendleft(int(input()))


for ai in range(1, N):
    a = int(input())
    if a <= c[0]:
        c.appendleft(a)
    else:
        i = bisect.bisect_left(c, a) - 1
        c[i] = a

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

H, W = map(int, input().split())
field = []    # field[h][w]

for i in range(H):
    field.append(list(input()) + ['#'])
field.append(['#'] * (W + 1))

ans = 0

beam_h = [[0] * W for _ in range(H)]
for h in range(H):
    l = 0
    r = 0
    while r < W + 1:
        num = 0
        while field[h][r] == '.':
            r += 1
            num += 1
        if l != r:
            beam_h[h][l:r] = [num] * num
            ans = max(ans, num)
            l = r
        l += 1
        r += 1

beam_w = [[0] * W for _ in range(H)]
for w in range(W):
    l = 0
    r = 0
    while r < H + 1:
        num = 0
        while field[r][w] == '.':
            r += 1
            num += 1
        if l != r:
            # beam_w[l:r][w] = [num] * num
            for i in range(l, r):
                beam_w[i][w] = num
                ans = max(ans, beam_w[i][w] + beam_h[i][w] - 1)
            l = r
        l += 1
        r += 1

print(ans)


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

H, W = map(int, input().split())
field = []    # field[h][w]

for i in range(H):
    field.append(list(input()) + ['#'])
field.append(['#'] * (W + 1))

ans = 0

beam_h = [[0] * W for _ in range(H)]
for h in range(H):
    l = 0
    r = 0
    while r < W + 1:
        num = 0
        while field[h][r] == '.':
            r += 1
            num += 1
        if l != r:
            beam_h[h][l:r] = [num] * num
            ans = max(ans, num)
            l = r
        l += 1
        r += 1

beam_w = [[0] * W for _ in range(H)]
for w in range(W):
    l = 0
    r = 0
    while r < H + 1:
        num = 0
        while field[r][w] == '.':
            r += 1
            num += 1
        if l != r:
            # beam_w[l:r][w] = [num] * num
            for i in range(l, r):
                beam_w[i][w] = num
                ans = max(ans, beam_w[i][w] + beam_h[i][w] - 1)
            l = r
        l += 1
        r += 1

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding utf-8 -*-
N, M = map(int, input().split())
LR = [list(map(int, input().split())) for _ in range(M)]

ids = [1] * N
for i in range(M):
    ids[:LR[i][0]-1] = [0] * len(ids[:LR[i][0]-1])
    ids[(LR[i][1]):] = [0] * len(ids[(LR[i][1]):])

print(sum(ids))


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

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

max_L, min_R = 0, N+1
for i in range(M):
    L, R = map(int, input().split())
    max_L = max(max_L, L)
    min_R = min(min_R, R)

ans = max(min_R - (max_L - 1), 0)

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


def calc_C(n, r):
    return (math.factorial(n) // (math.factorial(n - r) * math.factorial(r))) % (10**9 + 7)


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

ans = 0

# row
for i in range(N):
    ans += i * (N - i) * M * M % (10**9 + 7)

# col
for i in range(M):
    ans += i * (M - i) * N * N % (10**9 + 7)

ans = ans % (10**9 + 7)
ans = ans * calc_C(N * M - 2, K - 2) % (10**9 + 7)
print(ans)


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


def calc_C(n, r):
    return (math.factorial(n) // (math.factorial(n - r) * math.factorial(r))) % (10**9 + 7)


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

ans = 0

# row
for i in range(N):
    ans += i * (N - i) * M * M % (10**9 + 7)

# col
for i in range(M):
    ans += i * (M - i) * N * N % (10**9 + 7)

ans = ans % (10**9 + 7)
ans = ans * calc_C(N * M - 2, K - 2) % (10**9 + 7)
print(ans)

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


def calc_C(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


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

ans = 0

# row
for i in range(N):
    ans += i * (N - i) * M * M

# col
for i in range(M):
    ans += i * (M - i) * N * N

ans = ans * calc_C(N * M - 2, K - 2) % (10**9 + 7)
print(ans)


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


def calc_C(n, r):
    return (math.factorial(n) // (math.factorial(n - r) * math.factorial(r))) % (10**9 + 7)


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

ans = 0

# row
for i in range(N):
    ans += i * (N - i) * M * M % (10**9 + 7)

# col
for i in range(M):
    ans += i * (M - i) * N * N % (10**9 + 7)

ans = ans % (10**9 + 7)
ans = ans * calc_C(N * M - 2, K - 2) % (10**9 + 7)
print(ans)
Buggy python submission (verdict: Runtime Error):
# -*- coding utf-8 -*-
N = int(input())
S = input()
K = int(input())

for s in 'abcdefghijklmnopqrstuvwxyz':
    if s != S[K]:
        S = S.replace(s, '*')
        
print(S)


Fixed submission:
# -*- coding utf-8 -*-
N = int(input())
S = input()
K = int(input())

t = S[K - 1]
for s in 'abcdefghijklmnopqrstuvwxyz':
    if s != t:
        S = S.replace(s, '*')
        
print(S)
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding utf-8 -*-

N, K = map(int, input().split())
S = input()

counts = [0] if S[0] == '0' else []
s = '1' if S[0] == '1' else '0'
c = 0
for i in range(N):
    if S[i] != s:
        counts.append(c)
        c = 0
        if s == '1':
            s = '0'
        else:
            s = '1'
    c += 1
counts.append(c)

ans = 0
for i in range(len(counts)):
    if i % 2 == 1:
        continue
    ans = max(ans, sum(counts[i: i + 2 * K + 1]))
print(ans)



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

N, K = map(int, input().split())
S = input()

counts = [0] if S[0] == '0' else []
s = '1' if S[0] == '1' else '0'
c = 0
for i in range(N):
    if S[i] != s:
        counts.append(c)
        c = 0
        if s == '1':
            s = '0'
        else:
            s = '1'
    c += 1
counts.append(c)

ans = 0
cumsum = [0] * (len(counts) + 1)
for i in range(len(counts)):
    cumsum[i + 1] = cumsum[i] + counts[i]
for i in range(len(counts)):
    if i % 2 == 1:
        continue
    # ans = max(ans, sum(counts[i: i + 2 * K + 1]))
    r = min(i + 2 * K + 1, len(counts))
    l = i
    if r == l:
        ans = max(ans, counts[i])
    else:
        ans = max(ans, cumsum[r] - cumsum[l])
    # ans = max(ans, cumsum[r] - cumsum[l])
    # print(l, r, cumsum[r] - cumsum[l])
print(ans)
Buggy python submission (verdict: Runtime Error):
N, Q = map(int, input().split())
S = input()

ac = [0] * (N + 1)
for i in range(N):
    ac[i + 1] = ac[i] + (1 if S[i ] == 'A' and S[i + 1] == 'C' else 0)
for i in range(Q):
    l, r = map(int, input().split())
    print(ac[r-1] - ac[l-1])

Fixed submission:
N, Q = map(int, input().split())
S = input()

ac = [0] * (N + 1)
for i in range(N - 1):
    ac[i + 1] = ac[i] + (1 if S[i] == 'A' and S[i + 1] == 'C' else 0)
for i in range(Q):
    l, r = map(int, input().split())
    print(ac[r-1] - ac[l-1])

Buggy python submission (verdict: Time Limit Exceeded):
N, Q = map(int, input().split())
S = input()

ac_place = [False] * N
for i in range(N - 1):
    if(S[i] == 'A' and S[i + 1] == 'C'):
        ac_place[i] = True

for i in range(Q):
    l, r = map(int, input().split())
    s = ac_place[l - 1: r - 1] 
    print(sum(s))

Fixed submission:
N, Q = map(int, input().split())
S = input()

ac = [0] * (N + 1)
for i in range(N - 1):
    ac[i + 1] = ac[i] + (1 if S[i] == 'A' and S[i + 1] == 'C' else 0)
for i in range(Q):
    l, r = map(int, input().split())
    print(ac[r-1] - ac[l-1])

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())
    s = S[l - 1: r] 
    print(s.count('AC'))

Fixed submission:
N, Q = map(int, input().split())
S = input()

ac = [0] * (N + 1)
for i in range(N - 1):
    ac[i + 1] = ac[i] + (1 if S[i] == 'A' and S[i + 1] == 'C' else 0)
for i in range(Q):
    l, r = map(int, input().split())
    print(ac[r-1] - ac[l-1])
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
X = map(int, input().split())

k = []
# print(X)

k0 = abs(X[0])
for n in range(0+1, K):
    k0 += X[n] - X[n-1]
# print(k0)
k.append(k0)
for i in range(1, len(X)-K+1):
    # print(i, i-1, i+K, i+K-1)
    ki = k[i-1] - (X[i] - X[i-1]) + (X[i+K-1] - X[i+K-2]) - abs(X[i-1]) + abs(X[i])
    k.append(ki)
print(min(k))


Fixed submission:
N, K = map(int, input().split())
X = list(map(int, input().split()))

k = []
# print(X)

k0 = abs(X[0])
for n in range(0+1, K):
    k0 += X[n] - X[n-1]
k.append(k0)
for i in range(1, len(X)-K+1):
    ki = k[i-1] - (X[i] - X[i-1]) + (X[i+K-1] - X[i+K-2]) - abs(X[i-1]) + abs(X[i])
    k.append(ki)
# print(min(k))

l = []
l0 = abs(X[N-1])
for n in range(N-1, N-K, -1):
    l0 += X[n] - X[n-1]
# print(l0)
l.append(l0)
for i in range(1, len(X)-K+1):
    # print(i, i-1, i+K, i+K-1)
    li = l[i-1] - (X[N-i] - X[N-i-1]) + (X[N-K-i+1] - X[N-K-i]) - abs(X[N-i]) + abs(X[N-i-1])
    # print(li)
    l.append(li)
print(min(min(k), min(l)))
Buggy python submission (verdict: Runtime Error):
A = int(input())
B = int(input())
print((A-1) * (B-1))

Fixed submission:
A, B = map(int, input().split())
print((A-1) * (B-1))

Buggy python submission (verdict: Runtime Error):
A, B = int(input()), int(input())
print((A-1) * (B-1))

Fixed submission:
A, B = map(int, input().split())
print((A-1) * (B-1))

Buggy python submission (verdict: Runtime Error):
A, B = int(input()), int(input())
print((A-1) * (B-1))

Fixed submission:
A, B = map(int, input().split())
print((A-1) * (B-1))
Buggy python submission (verdict: Time Limit Exceeded):
N, M, Q = map(int, input().split())
Mi = [list(map(int, input().split())) for i in range(M)]
Qi = [list(map(int, input().split())) for i in range(Q)]
qi = [Qi[i].extend([0, i]) for i in range(Q)]
Mi.sort()
Qi.sort()

for mi in Mi:
    for i in range(Q):
        if mi[0] < Qi[i][0]:
            continue
        if mi[0] >= Qi[i][0] and mi[1] <= Qi[i][1]:
            Qi[i][2] += 1
Qi.sort(key=lambda x: x[3])
for a in Qi:
    print(a[2])

Fixed submission:
N, M, Q = map(int, input().split())
LR = [[0] * (N+1) for _ in range(N+1)]
for m in range(M):
    l, r = map(int, input().split())
    LR[l][r] += 1

# 二次元累積和をとる
LR_sum = [[0] * (N+1) for _ in range(N+1)]
LR_sum[1][1] = LR[1][1]
## 初期化
for i in range(1, N+1):
    LR_sum[1][i] = LR_sum[1][i-1] + LR[1][i]
    LR_sum[i][1] = LR_sum[i-1][1] + LR[i][1]
## 累積和をとる
for i in range(2, N+1):
    for j in range(2, N+1):
        LR_sum[i][j] = LR_sum[i-1][j] + LR_sum[i][j-1] - LR_sum[i-1][j-1] + LR[i][j]

for q in range(Q):
    l, r = map(int, input().split())
    print(LR_sum[r][r] - LR_sum[r][l-1] - LR_sum[l-1][r] + LR_sum[l-1][l-1])

Buggy python submission (verdict: Time Limit Exceeded):
N, M, Q = map(int, input().split())
ans = [0] * Q
Mi = [list(map(int, input().split())) for _ in range(M)]
Qi = [list(map(int, input().split())) for _ in range(Q)]
Mi.sort()
# Qi.sort()

for mi in Mi:
    for i in range(Q):
        if mi[0] >= Qi[i][0] and mi[1] <= Qi[i][1]:
            ans[i] += 1
for a in ans:
    print(a)

Fixed submission:
N, M, Q = map(int, input().split())
LR = [[0] * (N+1) for _ in range(N+1)]
for m in range(M):
    l, r = map(int, input().split())
    LR[l][r] += 1

# 二次元累積和をとる
LR_sum = [[0] * (N+1) for _ in range(N+1)]
LR_sum[1][1] = LR[1][1]
## 初期化
for i in range(1, N+1):
    LR_sum[1][i] = LR_sum[1][i-1] + LR[1][i]
    LR_sum[i][1] = LR_sum[i-1][1] + LR[i][1]
## 累積和をとる
for i in range(2, N+1):
    for j in range(2, N+1):
        LR_sum[i][j] = LR_sum[i-1][j] + LR_sum[i][j-1] - LR_sum[i-1][j-1] + LR[i][j]

for q in range(Q):
    l, r = map(int, input().split())
    print(LR_sum[r][r] - LR_sum[r][l-1] - LR_sum[l-1][r] + LR_sum[l-1][l-1])
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
an = list(map(int, input().split()))

ans = 0
for left in range(N):
    ans += 1    # left equal right
    xor_sum = an[left]
    arith_sum = an[left]
    for right in range(left + 1, N):
        xor_sum ^= an[right]
        arith_sum += an[right]
        if xor_sum == arith_sum:
            ans += 1
        else:
            break

print(ans)

Fixed submission:
N = int(input())
an = list(map(int, input().split()))

ans = 0
right = 0
arith_sum = 0
for left in range(N):
    while right < N and arith_sum ^ an[right] == arith_sum + an[right]:
        arith_sum += an[right]
        right += 1
    ans += right - left
    if left == right:
        right += 1
    else:
        arith_sum -= an[left]

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

N = int(input())
an = list(map(int, input().split()))

cumsum_an = [0]
cumsum_an.extend(np.cumsum(an).tolist())

ans = 0
for left in range(N):
    ans += 1    # left equal right
    xor_sum = an[left]
    for right in range(left + 1, N):
        xor_sum = xor_sum ^ an[right]
        arith_sum = cumsum_an[right + 1] - cumsum_an[left]
        if xor_sum == arith_sum:
            ans += 1
        else:
            break

print(ans)

Fixed submission:
N = int(input())
an = list(map(int, input().split()))

ans = 0
right = 0
arith_sum = 0
for left in range(N):
    while right < N and arith_sum ^ an[right] == arith_sum + an[right]:
        arith_sum += an[right]
        right += 1
    ans += right - left
    if left == right:
        right += 1
    else:
        arith_sum -= an[left]

print(ans)

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

match = [2**i - 1for i in range(21)]
count = N
cands = []

def is_arriviable(val, past_num, added_num):
    return added_num==0 or val == past_num+added_num

for i in range(N):
#     print(i, cands, A_N[i])
    next_cands = []
    for c in cands:
        n = c ^ A_N[i]
        if is_arriviable(n, c, A_N[i]):
#             print('add {}'.format(n))
            count += 1
            next_cands.append(n)
    cands = next_cands
    cands.append(A_N[i])
print(count)

Fixed submission:
N = int(input())
an = list(map(int, input().split()))

ans = 0
right = 0
arith_sum = 0
for left in range(N):
    while right < N and arith_sum ^ an[right] == arith_sum + an[right]:
        arith_sum += an[right]
        right += 1
    ans += right - left
    if left == right:
        right += 1
    else:
        arith_sum -= an[left]

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

ans = 1
for i in range(n):
    ans *= a[i]

print(ans if ans <= 1000000000000000000 else -1)


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

ans = 1

if 0 in a:
    print(0)
    exit()
for i in range(n):
    ans *= a[i]
    if ans > 1000000000000000000:
        print(-1)
        exit()

print(ans)
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
ac = [0] * N
wa = [0] * N

ac = 0
wa = 0

for i in range(M):
    p, S = input().split()
    p = int(p)

    if S == "AC":
        if ac[p-1] == 0:
            ac += 1
            
    else:
        if ac[N-1] == 0:
            wa += 1

print(ac, wa)


Fixed submission:
C = input()
alphabet = "abcdefghijklmnopqrltuvwxyz"

for i in range(len(alphabet)):
    if alphabet[i] == C:
        print(alphabet[i+1])
        exit()
Buggy python submission (verdict: Runtime Error):
import math

A, B = map(int, input().split())


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


print(lcm(A, B))


Fixed submission:
import math
A, B = map(int, input().split())


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

# a,bの最小公倍数


def lcm(a, b):
    return a * b // gcd(a, b)


print(lcm(A, B))
Buggy python submission (verdict: Runtime Error):
from itertools import combinations_with_replacement

X = list(input())
tmp = X
num = int("".join(tmp))

X.pop()
X.pop()
X = int("".join(X))

food = [100, 101, 102, 103, 104, 105, 106]

for i in combinations_with_replacement(food, X):
    if sum(i) == num:
        print(1)
        exit()

print(0)


Fixed submission:
from itertools import combinations_with_replacement

X = list(input())
tmp = X
num = int("".join(tmp))

if num < 100:
    print(0)
    exit()

X.pop()
X.pop()
X = int("".join(X))

food = [100, 101, 102, 103, 104, 105]

for i in combinations_with_replacement(food, X):
    if sum(i) == num:
        print(1)
        exit()

print(0)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
ans = float("inf")


def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors


for i in make_divisors(N):
    for j in make_divisors(N):
        if i * j == N:
            x = i - 1
            y = j - 1

            ans = min(ans, (i-1)+(j-1))
print(ans)


Fixed submission:
N = int(input())


def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors


div = make_divisors(N)

if div[-1] ** 2 == N:
    print(div[-1]*2 - 2)

else:
    x = div[-2] - 1
    y = div[-1] - 1

    print(x + y)
Buggy python submission (verdict: Runtime Error):
import itertools
N = int(input())
L = list(map(int, input().split()))
num = []
ans = 0

for i in itertools.permutations(L, r=3):
    i = list(i)
    i.sort()
    if i not in num:
        num.append(i)

for i in range(len(num)):
    if num[i][0] + num[i][1] > num[i][2]　and num[i][1] + num[i][2] > num[i][0] and num[i][0] + num[i][2] > num[i][1]:
        ans += 1
print(ans)


Fixed submission:
A, B = map(int, input().split())
B *= 2

if B >= A:
    print(0)

else:
    print(A-B)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
ans = sum(B)

for i in range(len(A)-1):
    if A[i] + 1 == A[i+1]:
        if N % 2 == 1 or N == 2:
            ans += C[i-1]
        else:
            ans += C[i+1]

print(ans)


Fixed submission:
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

ans = 0

for i in range(len(A)-1):
    if A[i] + 1 == A[i+1]:
        ans += C[A[i]-1]

print(ans+sum(B))
Buggy python submission (verdict: Runtime Error):
A, B = map(int, input().split())
ans = 1


while True:
    if A > B:
        break
    else:
        A += A
        ans += 1
print(ans)


Fixed submission:
S = input()
T = input()

ans = 0

for i in range(len(S)):
    if S[i] == T[i]:
        ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
K, X = map(int, input().split())

ans = [X]

for i in range(K-1):
    ans.append(X+i+1)

ans.reverse()
for i in range(K-1):
    ans.append(X-(i+1))

ans.reverse()
print("".join(ans))


Fixed submission:
K, X = map(int, input().split())
cule = [i for i in range(X-K+1, X+K)]

print(" ".join(repr(i) for i in cule))
Buggy python submission (verdict: Runtime Error):
N = int(input())
H = list(map(int, input().split()))

for i in range(N):
    if i != N-1:
        if H[i] > H[i+1]:
            H[i] -= 1
    if i == N:
        if H[i] < H[i-1]:
            H[i-1] -= 1

for i in range(N):
    if i < N-1:
        if H[i] > H[i+1]:
            print("No")
            exit()
    if i == N:
        if H[i-1] > H[i]:
            print("No")
            exit()
print("Yes")


Fixed submission:
A, B, C = map(int, input().split())

A -= B
C -= A

if C < 0:
    print(0)
else:
    print(C)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = []

for i in range(N):
    a = int(input())
    A.append(a)

for i in range(N):
    ans = A[:i] + A[i+1:]
    print(max(ans))


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

for i in range(N):
    a = int(input())
    A.append(a)

x = sorted(A, reverse=True)

for i in range(N):
    if A[i] == x[0]:
        print(x[1])
    else:
        print(x[0])

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = []

for i in range(N):
    a = int(input())
    A.append(a)

for i in range(N):
    memo = A
    A = A[:i] + A[i+1:]
    print(max(A))
    A = memo


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

for i in range(N):
    a = int(input())
    A.append(a)

x = sorted(A, reverse=True)

for i in range(N):
    if A[i] == x[0]:
        print(x[1])
    else:
        print(x[0])
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
d = list(map(int, input().split()))

ans = 0

for i in range(min(d), max(d)+1):
    d_list = [x for x in d if i <= x]

    if len(d_list) == N // 2:
        ans += 1
print(ans)


Fixed submission:
N = int(input())
d = list(map(int, input().split()))
d.sort()

print(d[N//2]-d[N//2-1])

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
d = list(map(int, input().split()))
ans = 0

K = 1
while max(d) >= K:
    abc = []
    arc = []
    for i in d:
        if i >= K:
            arc.append(i)

        else:
            abc.append(i)
    if len(abc) == len(arc):
        ans += 1
    K += 1
print(ans)


Fixed submission:
N = int(input())
d = list(map(int, input().split()))
d.sort()

print(d[N//2]-d[N//2-1])
Buggy python submission (verdict: Runtime Error):
W, H, x, y = map(int, input().split())
s = H*W/2

if x*2 == W and y*2 == H:
    print(s, 1)
else:
    print(s, 0)

Fixed submission:
X, A = map(int, input().split())
if X < A:
    print(0)
else:
    print(10)