Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
lst = list(map(int, input().split()))

for _ in range(M):
    n = max(lst)
    idx = lst.index(n)
    lst[idx] = n // 2
print(sum(lst))

Fixed submission:
import heapq

N, M = map(int, input().split())
lst = [int(x) * -1 for x in input().split()]
heapq.heapify(lst)
for _ in range(M):
    n = heapq.heappop(lst)
    n = n * -1 // 2 * -1
    heapq.heappush(lst, n)
print(sum(lst) * -1)
Buggy python submission (verdict: Time Limit Exceeded):
print(sum(range(1, int(input()))))


Fixed submission:
N = int(input())
print(((N - 1) * N // 2))
Buggy python submission (verdict: Runtime Error):
N = input()
lst1 = list(map(int, input().split()))
lst2 = sorted(lst1)

n = 0
for x, y in zip(lst1, lst2):
    if x != y:
        n += 1
        if n > 2:
            break

if n > 2:
    print('NO')
else:
    print('YES')


Fixed submission:
A, B = map(int, input().split())
if (A - B) % 2 == 1:
    print('IMPOSSIBLE')
else:
    print(abs(A + B) // 2)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
lst = [int(input()) for _ in range(N)]
for n in range(N):
    print(max(lst[0:n] + lst[n+1:]))

Fixed submission:
N = int(input())
lst = [int(input()) for _ in range(N)]
sort_lst =sorted(lst, reverse=True)
for x in range(N):
    if sort_lst[0] == lst[x]:
        print(sort_lst[1])
    else:
        print(sort_lst[0])
Buggy python submission (verdict: Runtime Error):
W, H, x, y = map(int, input().split())

s = W * H
if x == 0:
    a = W * y
    b = W * (H - y)
    p = 1 if a == b else 0
elif y == 0:
    a = H * x
    b = H * (W - x)
elif W % x == 0 and H % y == 0:
    a = b = W * H // 2
else:
    a = W * y
    b = H * x

p = 1 if a == b else 0
print("{0} {1}".format(min(a, b), p))


Fixed submission:
X, A = map(int, input().split())
if X >= A:
    print(10)
else:
    print(0)
Buggy python submission (verdict: Runtime Error):
W, H, x, y = map(int, input().split())

s = W * H
if W % x == 0 and H % y == 0:
    print("{0} {1}".format(W * H // 2, 1))
else:
    a = W * y
    b = H * x
    p = 1 if a == b else 0
    print("{0} {1}".format(min(a, b), p))


Fixed submission:
W, H, x, y = map(int, input().split())
if W / 2 == x and H / 2 == y:
    p = 1
else:
    p = 0

print("{} {}".format(W * H / 2, p))
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())

lst = [0] * N
skips = [int(input()) for _ in range(M)]
for x in range(N):
    if x in skips:
        lst[x] = 0
    elif x in [0, 1]:
        lst[x] = 1
    else:
        lst[x] = (lst[x - 1] + lst[x - 2]) % 1000000007

if N == 1:
    print(lst[-1])
else:
    print((lst[-1] + lst[-2]) % 1000000007)

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

lst = [0] * N
pre1 = 0
pre2 = 0
skips = set([int(input()) for _ in range(M)])
for x in range(N):
    if x in skips:
        lst[x] = 0
    elif x in [0, 1]:
        lst[x] = 1
    else:
        lst[x] = (lst[x - 1] + lst[x - 2]) % 1000000007

if N == 1:
    print(lst[-1])
else:
    print((lst[-1] + lst[-2]) % 1000000007)

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

lst = [0] * N
skips = [int(input()) for _ in range(M)]
for x in range(N):
    if x in skips:
        lst[x] = 0
    elif x in [0, 1]:
        lst[x] = 1
    else:
        lst[x] = lst[x - 1] + lst[x - 2]

if N == 1:
    print(lst[-1] % 1000000007)
else:
    print((lst[-1] + lst[-2]) % 1000000007)


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

lst = [0] * N
pre1 = 0
pre2 = 0
skips = set([int(input()) for _ in range(M)])
for x in range(N):
    if x in skips:
        lst[x] = 0
    elif x in [0, 1]:
        lst[x] = 1
    else:
        lst[x] = (lst[x - 1] + lst[x - 2]) % 1000000007

if N == 1:
    print(lst[-1])
else:
    print((lst[-1] + lst[-2]) % 1000000007)
Buggy python submission (verdict: Time Limit Exceeded):
lst= [int(input()), 0, 0, 0, 0]
moves = [int(input()) for _ in range(5)]

def hoge(lst):
    l1 = [max(x -y , 0) for x, y in zip(lst, moves)]
    l2 = [min(x ,y) for x, y in zip(lst, moves)]
    l1.append(0)
    l2.insert(0,0)
    tmp = [ a + b for a, b in zip(l1, l2)]
    return tmp[0:5]

ret = 0
while sum(lst) > 0:
    lst = hoge(lst)
    ret += 1

print(ret)    


Fixed submission:
import math
N = int(input())
n = min([int(input()) for _ in range(5)])
print(math.ceil(N / n) + 4)
Buggy python submission (verdict: Time Limit Exceeded):
N, Q = map(int, input().split())
S = input()
lst = []
idx = 0
for x in range(len(S) - 1):
    if S[x] == 'A' and S[x + 1] == 'C':
        lst.append(1)
    else:
        lst.append(0)

for x in range(Q):
    a, b = map(int, input().split())
    print(sum(lst[a-1:b-1]))

Fixed submission:
from itertools import accumulate

N, Q = map(int, input().split())
S = input()
lst = [0]
idx = 0
for x in range(len(S) - 1):
    if S[x] == 'A' and S[x + 1] == 'C':
        lst.append(1)
    else:
        lst.append(0)

lst2 = list(accumulate(lst))
for x in range(Q):
    a, b = map(int, input().split())
    print(lst2[b-1] - lst2[a-1])

Buggy python submission (verdict: Time Limit Exceeded):
N, Q = map(int, input().split())
S = input()
for x in range(Q):
    a, b = map(int, input().split())
    s = S[a-1:b]

    a = ''
    ret = 0
    for b in s:
        if a == 'A' and b == 'C':
            ret += 1
        a = b
    print(ret)

Fixed submission:
from itertools import accumulate

N, Q = map(int, input().split())
S = input()
lst = [0]
idx = 0
for x in range(len(S) - 1):
    if S[x] == 'A' and S[x + 1] == 'C':
        lst.append(1)
    else:
        lst.append(0)

lst2 = list(accumulate(lst))
for x in range(Q):
    a, b = map(int, input().split())
    print(lst2[b-1] - lst2[a-1])

Buggy python submission (verdict: Time Limit Exceeded):
N, Q = map(int, input().split())
S = input()
for x in range(Q):
    a, b = map(int, input().split())
    s1 = S[a-1:b]
    s2 = s1.replace('AC', '')
    print(int((len(s1) - len(s2)) / 2))

Fixed submission:
from itertools import accumulate

N, Q = map(int, input().split())
S = input()
lst = [0]
idx = 0
for x in range(len(S) - 1):
    if S[x] == 'A' and S[x + 1] == 'C':
        lst.append(1)
    else:
        lst.append(0)

lst2 = list(accumulate(lst))
for x in range(Q):
    a, b = map(int, input().split())
    print(lst2[b-1] - lst2[a-1])

Buggy python submission (verdict: Time Limit Exceeded):
import re

N, Q = map(int, input().split())
S = input()
for x in range(Q):
    a, b = map(int, input().split())
    s = S[a-1:b]
    print(len(re.findall('AC', s)))

Fixed submission:
from itertools import accumulate

N, Q = map(int, input().split())
S = input()
lst = [0]
idx = 0
for x in range(len(S) - 1):
    if S[x] == 'A' and S[x + 1] == 'C':
        lst.append(1)
    else:
        lst.append(0)

lst2 = list(accumulate(lst))
for x in range(Q):
    a, b = map(int, input().split())
    print(lst2[b-1] - lst2[a-1])

Buggy python submission (verdict: Time Limit Exceeded):
N, Q = map(int, input().split())
S = input()
for x in range(Q):
    a, b = map(int, input().split())
    print(S[a-1:b].count('AC'))

Fixed submission:
from itertools import accumulate

N, Q = map(int, input().split())
S = input()
lst = [0]
idx = 0
for x in range(len(S) - 1):
    if S[x] == 'A' and S[x + 1] == 'C':
        lst.append(1)
    else:
        lst.append(0)

lst2 = list(accumulate(lst))
for x in range(Q):
    a, b = map(int, input().split())
    print(lst2[b-1] - lst2[a-1])
Buggy python submission (verdict: Time Limit Exceeded):
S = input()
n = len(S)
while S.find('01') >= 0 or S.find('10') >= 0:
    S = S.replace('01', '').replace('10', '')
    S = S.replace('10', '').replace('01', '')
print(n - len(S))

Fixed submission:
S = input()
lst1 = sum([1 for x in S if x == '1'])
lst2 = sum([1 for x in S if x == '0'])
print(min(lst1, lst2) * 2)

Buggy python submission (verdict: Time Limit Exceeded):
S = input()
SS = S
while SS.find('01') >= 0 or SS.find('10') >= 0:
    SS = SS.replace('01', '').replace('10', '')
    SS = SS.replace('10', '').replace('01', '')

print(len(S) - len(SS))

Fixed submission:
S = input()
lst1 = sum([1 for x in S if x == '1'])
lst2 = sum([1 for x in S if x == '0'])
print(min(lst1, lst2) * 2)
Buggy python submission (verdict: Runtime Error):
import math

N, K = map(int, input().split())
lst = [int(x) for x in input().split()]
dp = [math.inf] * N
dp[0] = 0
dp[1] = abs(lst[0] - lst[1])
for i in range(2, N):
    j = K
    while j > 0:
        if i - j >= 0:
            dp[i] = min(dp[i], dp[i - j] + abs(lst[i - j] - lst[i]))
        j -= 1
print(dp[-1])


Fixed submission:
import numpy as np

N, K = map(int, input().split())
lst = np.array([int(x) for x in input().split()])
dp = np.zeros(N, dtype=int)

for i in range(1, N):
    start = max(i - K, 0)
    dp[i] = np.min(dp[start:i] + np.abs(lst[start:i] - lst[i]))
print(dp[-1])

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
lst = [int(x) for x in input().split()]
dp = [100 ** 10] * N
dp[0] = 0
dp[1] = abs(lst[0] - lst[1])
for i in range(2, N):
    j = K
    while j > 0:
        if i - j >= 0:
            tmp = dp[i - j] + abs(lst[i - j] - lst[i])
            dp[i] = min(dp[i], tmp)
        j -= 1
print(dp[-1])


Fixed submission:
import numpy as np

N, K = map(int, input().split())
lst = np.array([int(x) for x in input().split()])
dp = np.zeros(N, dtype=int)

for i in range(1, N):
    start = max(i - K, 0)
    dp[i] = np.min(dp[start:i] + np.abs(lst[start:i] - lst[i]))
print(dp[-1])
Buggy python submission (verdict: Runtime Error):
N, W = map(int, input().split())
dp = [[0] * (W + 1) for _ in range(N + 1)]
for i in range(1, N + 1):
    w, v = map(int, input().split())
    for j in range(W + 1):
        if j < w:
            dp[i][j] = max(dp[i][j], dp[i - 1][j])
        else:
            dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - w] + v)
print(dp[-1][-1])

Fixed submission:
import numpy as np

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

dp = np.full(N * 1000 + 1, W + 1, dtype=np.int64)
dp[0] = 0

for _ in range(N):
    w, v = map(int, input().split())
    np.minimum(dp[:-v] + w, dp[v:], out=dp[v:])

print(((dp <= W) * np.arange(N * 1000 + 1)).max())
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
lst = []
for _ in range(N):
    lst.append(int(input()))
lst = sorted(lst)
ret = 100000000000
 
for idx, x in enumerate(lst[:-K+1], 0):
    tmp = lst[idx + K-1] - x
    if tmp < ret:
        ret = tmp
print(ret)

Fixed submission:
D = int(input())
lst = ['Christmas'] + ['Eve'] * (25 - D)
print(' '.join(lst))
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
ret = 0
for x in range(1, N + 1):
    for y in [y for y in range(K - x, N + 1, K) if y > 0]:
        for z in [z for z in range(K - y, N + 1, K) if z > 0]:
            cnt += 1     
            if  (z + x) % K == 0:
                ret += 1
print(ret)

Fixed submission:
N, K = map(int, input().split())
n = sum([1 for x in range(K, N + 1, K)])
if K % 2 == 1:
    print(n ** 3)
else:
    m = sum([1 for x in range(K // 2, N + 1, K)])
    print(n ** 3 + m ** 3)

Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
ret = 0
for x in range(1, N + 1):
    for y in [y for y in range(K - x, N + 1, K) if y > 0]:
        for z in [z for z in range(K - y, N + 1, K) if z > 0]:
            cnt += 1     
            if  (z + x) % K == 0:
                ret += 1
print(ret)

Fixed submission:
N, K = map(int, input().split())
n = sum([1 for x in range(K, N + 1, K)])
if K % 2 == 1:
    print(n ** 3)
else:
    m = sum([1 for x in range(K // 2, N + 1, K)])
    print(n ** 3 + m ** 3)

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
ret = 0
for x in range(1, N + 1):
    for y in range(K - x, N + 1, K):
        for z in range(K - y, N + 1, K):
            if  y > 0 and z > 0 and (z + x) % K == 0:
                ret += 1
print(ret)

Fixed submission:
N, K = map(int, input().split())
n = sum([1 for x in range(K, N + 1, K)])
if K % 2 == 1:
    print(n ** 3)
else:
    m = sum([1 for x in range(K // 2, N + 1, K)])
    print(n ** 3 + m ** 3)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()

ret = N
for i in range(N):
    a = S[:i]
    b = S[i + 1 :]
    n = a.count("W") + b.count("E")
    if n == 0:
        continue
    ret = min(ret, n)
print(ret)


Fixed submission:
N = int(input())
S = input()
x = 0
a = 0
idx = 0

for i in range(N):
    if S[i] == "W":
        x += 1
    else:
        x -= 1

    if x < a:
        a = x
        idx = i

w = S[0:idx].count("W")
e = S[idx + 1 : N].count("E")
print(w + e)
Buggy python submission (verdict: Runtime Error):
A, B, C = sorted([int(x) for x in input().split()])
if A == B and B == C:
    print(0)
    exit()

ret = 0
while True:
    if A < B and B < C:
        A += 1
        B += 1
    elif A < B and B == C:
        A += 2
    elif A > B and B == C:
        B += 1
        C += 1
    else:
        # 想定外
        exit(1)

    ret += 1
    if A == B and B == C:
        print(ret)
        exit()


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

ret = 0
while True:
    if A == B and B == C:
        print(ret)
        exit()

    ret += 1
    A, B, C = sorted([A, B, C])
    if B < C:
        A += 1
        B += 1
    elif B == C:
        A += 2

Buggy python submission (verdict: Runtime Error):
A, B, C = sorted([int(x) for x in input().split()])
ret = 0
while True:
    if A < B and B < C:
        A += 1
        B += 1
    elif A < B and B == C:
        A += 2
    elif A > B and B == C:
        B += 1
        C += 1
    else:
        # 想定外
        exit(1)

    ret += 1
    if A == B and B == C:
        print(ret)
        exit()


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

ret = 0
while True:
    if A == B and B == C:
        print(ret)
        exit()

    ret += 1
    A, B, C = sorted([A, B, C])
    if B < C:
        A += 1
        B += 1
    elif B == C:
        A += 2
Buggy python submission (verdict: Runtime Error):

H, W = map(int, input().split())
S = [list(input()) for _ in range(H)]

def aaa(i, j):
    cnt = 0
    for x in [-1, 0, 1]:
        for y in [-1, 0, 1]:
            if (not 0 <= i + y < H) or (not 0 <= j + x < W):
                continue
            if S[i + y][j + x] == '#':
                cnt += 1    
    return str(cnt)

for i in range(H):
    for j in range(W):
        if S[i][j] == '#':
            continue
        S[i][j] = aaa(i, j)
for s in S:
    print("".join(s))

Fixed submission:
A, B, C = input().split()
if A == B:
    print(C)
elif B == C:
    print(A)
else:
    print(B)
Buggy python submission (verdict: Runtime Error):
N = int(input())
lst = [int(input()) for _ in range(N)]


def gcd(x, y):
    if y == 0:
        return x
    return gcd(y, x % y)


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


ret = lcm(lst[0], lst[1])
for x in lst[2:]:
    ret = lcm(ret, x)
print(ret)


Fixed submission:
N = int(input())
lst = [1] + [int(input()) for _ in range(N)]


def gcd(x, y):
    if y == 0:
        return x
    return gcd(y, x % y)


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


ret = lcm(lst[0], lst[1])
for x in lst[2:]:
    ret = lcm(ret, x)
print(ret)
Buggy python submission (verdict: Runtime Error):
fn main() {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    println!("ABC{}", s.trim())
}


Fixed submission:
print('ABC' + input())
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
s1 = set()
s2 = set()

for _ in range(M):
    a, b = map(int, input().split())
    if a == 1:
        s1.add(b)
    if b == N:
        s2.add(a)

for x in s1:
    if s2.count(x) >= 1:
        print("POSSIBLE")
        exit()

print("IMPOSSIBLE")


Fixed submission:
N, M = map(int, input().split())
s1 = set()
s2 = set()

for _ in range(M):
    a, b = map(int, input().split())
    if a == 1:
        s1.add(b)
    if b == N:
        s2.add(a)

if len(s1.intersection(s2)) > 0:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
s1 = set()
s2 = set()

for _ in range(M):
    a, b = map(int, input().split())
    if a == 1:
        s1.append(b)
    if b == N:
        s2.append(a)

for x in s1:
    if s2.count(x) >= 1:
        print("POSSIBLE")
        exit()

print("IMPOSSIBLE")


Fixed submission:
N, M = map(int, input().split())
s1 = set()
s2 = set()

for _ in range(M):
    a, b = map(int, input().split())
    if a == 1:
        s1.add(b)
    if b == N:
        s2.add(a)

if len(s1.intersection(s2)) > 0:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

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

for _ in range(M):
    a, b = map(int, input().split())
    if a == 1:
        lst1.append(b)
    if b == N:
        lst2.append(a)

for x in lst1:
    if lst2.count(x) >= 1:
        print("POSSIBLE")
        exit()

print("IMPOSSIBLE")


Fixed submission:
N, M = map(int, input().split())
s1 = set()
s2 = set()

for _ in range(M):
    a, b = map(int, input().split())
    if a == 1:
        s1.add(b)
    if b == N:
        s2.add(a)

if len(s1.intersection(s2)) > 0:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")
Buggy python submission (verdict: Runtime Error):
N = int(input())
lst = [0] * 9

for x in [int(x) for x in input().split()]:
    if x <= 399:
        lst[0] = 1
    elif x <= 799:
        lst[1] = 1
    elif x <= 1199:
        lst[2] = 1
    elif x <= 1599:
        lst[3] = 1
    elif x <= 1999:
        lst[4] = 1
    elif x <= 2399:
        lst[5] = 1
    elif x <= 2799:
        lst[6] = 1
    elif x <= 3199:
        lst[7] = 1
    else:
        lst[8] += 1

a = sum(lst[:-1])
b = lst[8]
if a == 0 and b > 0:
    print("1 {0}".format(b))
else:
    print("{0} {1}".format(a, a + b))


Fixed submission:
n = int(input().replace(' ', ''))
if n % 4 == 0:
    print('YES')
else:
    print('NO')
Buggy python submission (verdict: Runtime Error):
fn read() -> (i32, i32) {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    let vec: Vec<i32> = s
        .trim()
        .split_whitespace()
        .map(|x| x.parse().unwrap())
        .collect();
    (vec[0], vec[1])
}

fn main() {
    let (a, b) = read();
    if a + b < 10 {
        println!("{}", a + b);
    } else {
        println!("error");
    }
}


Fixed submission:
n = sum(map(int, input().split()))
if n < 10:
    print(n)
else:
    print('error')
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
if N == 0:
    print(0)
elif N >= M:
    print(M // 2)
else:
    ret = N
    M -= N * 2
    ret += M // 4
    print(ret)

Fixed submission:
N = int(input())
print(N * 800 - N // 15 * 200)
Buggy python submission (verdict: Time Limit Exceeded):
K, S = map(int, input().split())
ret = 0
for x in range(K + 1):
    for y in range(K + 1):
        if x + y > S:
            break
        for z in range(K + 1):
            if x + y + z == S:
                ret += 1
            if x + y + z >= S:
                break

print(ret)

Fixed submission:
K, S = map(int, input().split())
ret = 0
for x in range(K + 1):
    for y in range(K + 1):
        if x + y <= S and  S - x - y <= K:
            ret += 1

print(ret)
Buggy python submission (verdict: Runtime Error):
W, H, N = map(int, input().split())
x1 = y1 = 0
x2 = W
y2 = H
for _ in range(N):
    x, y, a = map(int, input().split())
    if a == 1:
        x1 = max(x1, x)
    elif a == 2:
        x2 = min(x2, x)
    elif a == 3:
        y1 = max(y1, y)
    else:
        y2 = min(y2, y)

print(max(0, (x2 - x1)) * max(0, (y2 - y1)))

Fixed submission:
lst = sorted([int(x) for x in input().split()])
if lst[0] + lst[1] == lst[2]:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
import math
from fractions import Fraction

N = int(input())
a, b = map(int, input().split())
ret_a = a
ret_b = b
for _ in range(1, N):
    a, b = map(int, input().split())
    x = math.ceil(max(Fraction(ret_a, a), Fraction(ret_b, b)))
    ret_a = a * x
    ret_b = b * x
print(ret_a + ret_b)


Fixed submission:
s = set([x for x in input().split()])
print(len(s))
Buggy python submission (verdict: Runtime Error):
N, A = map(int, input().split())
lst = [int(x) - A for x in input().split()]
dp = [[0] * (2 * N + 1) for _ in range(N + 1)]
dp[0][1 * N] = 1
for i in range(N):
    for j in range(1, 2 * N + 1 - 1):
        dp[i + 1][j] = dp[i][j] + dp[i][j - lst[i]]
print(dp[N][1 * N] - 1)

Fixed submission:
N, A = map(int, input().split())
lst = [int(x) - A for x in input().split()]
dp = [[0] * (100 * N + 1) for _ in range(N + 1)]
dp[0][50 * N] = 1
for i in range(N):
    for j in range(50, 100 * N + 1 - 50):
        dp[i + 1][j] = dp[i][j] + dp[i][j - lst[i]]
print(dp[N][50 * N] - 1)

Buggy python submission (verdict: Runtime Error):
N, A = map(int, input().split())
lst = [int(x) - A for x in input().split()]
dp = [[0] * (2 * N + 1) for _ in range(N + 1)]
dp[0][1 * N] = 1
for i in range(N):
    for j in range(1, 2 * N + 1 - 1):
        dp[i + 1][j] = dp[i][j] + dp[i][j - lst[i]]
print(dp[N][1 * N] - 1)

print(dp)

Fixed submission:
N, A = map(int, input().split())
lst = [int(x) - A for x in input().split()]
dp = [[0] * (100 * N + 1) for _ in range(N + 1)]
dp[0][50 * N] = 1
for i in range(N):
    for j in range(50, 100 * N + 1 - 50):
        dp[i + 1][j] = dp[i][j] + dp[i][j - lst[i]]
print(dp[N][50 * N] - 1)

Buggy python submission (verdict: Time Limit Exceeded):
N, A = map(int, input().split())
lst = [int(x) for x in input().split()]
ret = 0
for i in range(2 ** N):
    n = 0
    cnt = 0
    for j in range(N):
        if i >> j & 1:
            n += lst[j]
            cnt += 1
    if cnt > 0 and n / cnt == A:
        ret += 1
print(ret)


Fixed submission:
N, A = map(int, input().split())
lst = [int(x) - A for x in input().split()]
dp = [[0] * (100 * N + 1) for _ in range(N + 1)]
dp[0][50 * N] = 1
for i in range(N):
    for j in range(50, 100 * N + 1 - 50):
        dp[i + 1][j] = dp[i][j] + dp[i][j - lst[i]]
print(dp[N][50 * N] - 1)
Buggy python submission (verdict: Runtime Error):
if __name__ == '__main__':
    
    A, B = [int(x) for x in input().split(' ')]
    S = input()

    S = S.split('-')
    if S.length < 2:
        print('No')

    a = S[0]
    b = S[1]

    if a.length == A:
        if b.length == B:
            print('YES')
            exit()

    print('No')


Fixed submission:
if __name__ == '__main__':
    
    A, B = [int(x) for x in input().split(' ')]
    S = input()

    S = S.split('-')
    if len(S) != 2:
        print('No')
        exit()

    a = S[0]
    b = S[1]

    if len(a) == A:
        if len(b) == B:
            print('Yes')
            exit()

    print('No')
Buggy python submission (verdict: Runtime Error):
import math
li = input()
n = int(li.split()[0])
d = int(li.split()[1])
max_distance = math.sqrt(d**2)
ans = 0
for _ in range(n):
    li = input()
    x = int(li.split[0])
    y = int(li.split[1])
    distance = math.sqrt(x**2 + y**2)
    if distance <= max_distance:
        ans += 1
print(ans)

Fixed submission:
import math
li = input()
n = int(li.split()[0])
d = int(li.split()[1])
max_distance = math.sqrt(d**2)
ans = 0
for _ in range(n):
    li = input()
    x = int(li.split()[0])
    y = int(li.split()[1])
    distance = math.sqrt(x**2 + y**2)
    if distance <= max_distance:
        ans += 1
print(ans)

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

def dist(x, y):
    return math.sqrt(x^2+y^2)

# in_values = input()

l = list(map(int, input().split()))
n = l[0]
d = l[1]

count = 0
for _ in range(n):
    l = list(map(int, input().split()))
    if dist(l[0], l[1]) <= d:
        count+=1

print(count)

Fixed submission:
import math

def dist(x, y):
    return math.sqrt(x**2+y**2)

# in_values = input()

l = list(map(int, input().split()))
n = l[0]
d = l[1]

count = 0
for _ in range(n):
    l = list(map(int, input().split()))
    if dist(l[0], l[1]) <= d:
        count+=1

print(count)