Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np


n, k = map(int, input().split())
h_arr = np.array(list(map(int, input().split())))
cost_arr = np.zeros(n)
for i in range(1, n):
    start = max(i-k, 0)
    cost_arr[i] = np.min(abs(h_arr[start:i] - h_arr[i]) + cost_arr[start:i])
print(int(cost_arr[-1]))


Fixed submission:
import numpy as np

n, k = map(int, input().split())
h_arr = np.array(list(map(int, input().split())))
cost_arr = np.zeros(n, dtype=int)
for i in range(1, n):
    start = max(i-k, 0)
    cost_arr[i] = (abs(h_arr[start:i] - h_arr[i]) + cost_arr[start:i]).min()
print(int(cost_arr[-1]))

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
h_list = list(map(int, input().split()))
cost_list = [0, abs(h_list[0] - h_list[1])]
for i, hi in enumerate(h_list):
    if i >= 2:
        cost = 10 ** 9
        start = max(i - k, 0)
        for j, hj in enumerate(h_list):
            if j >= start:
                if i > j:
                    cost = min(cost, abs(hj - hi) + cost_list[j])
                else:
                    break
        cost_list.append(cost)
print(cost_list[-1])


Fixed submission:
import numpy as np

n, k = map(int, input().split())
h_arr = np.array(list(map(int, input().split())))
cost_arr = np.zeros(n, dtype=int)
for i in range(1, n):
    start = max(i-k, 0)
    cost_arr[i] = (abs(h_arr[start:i] - h_arr[i]) + cost_arr[start:i]).min()
print(int(cost_arr[-1]))

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
h_list = list(map(int, input().split()))
cost_list = [0, abs(h_list[0] - h_list[1])]
for i in range(2, n):
    cost = 10**9
    h = h_list[i]
    for j in range(max(i-k, 0), i):
        cost = min(cost, abs(h_list[j] - h) + cost_list[j])
    cost_list.append(cost)
print(cost_list[-1])


Fixed submission:
import numpy as np

n, k = map(int, input().split())
h_arr = np.array(list(map(int, input().split())))
cost_arr = np.zeros(n, dtype=int)
for i in range(1, n):
    start = max(i-k, 0)
    cost_arr[i] = (abs(h_arr[start:i] - h_arr[i]) + cost_arr[start:i]).min()
print(int(cost_arr[-1]))

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
h_list = list(map(int, input().split()))
cost_list = [0, abs(h_list[0] - h_list[1])]
for i in range(2, n):
    cost = 10**9
    for j in range(max(i-k, 0), i):
        cost = min(cost, abs(h_list[j] - h_list[i]) + cost_list[j])
    cost_list.append((cost))
print(cost_list[-1])


Fixed submission:
import numpy as np

n, k = map(int, input().split())
h_arr = np.array(list(map(int, input().split())))
cost_arr = np.zeros(n, dtype=int)
for i in range(1, n):
    start = max(i-k, 0)
    cost_arr[i] = (abs(h_arr[start:i] - h_arr[i]) + cost_arr[start:i]).min()
print(int(cost_arr[-1]))
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np


def check_value(before_key, values):
    if before_key == 0:
        k, v = np.argmax(values[1:])+1, np.max(values[1:])
    elif before_key == 1:
        k, v = np.argmax(values[::2])*2, np.max(values[::2])
    else:
        k, v = np.argmax(values[:-1]), np.max(values[:-1])
    return k, v


if __name__ == '__main__':
    n = int(input())
    happy_list = []
    for _ in range(n):
        happy_list.append(list(map(int, input().split())))
    a_key, b_key, c_key = 0, 1, 2
    a_sum, b_sum, c_sum = happy_list[0][0], happy_list[0][1], happy_list[0][2]
    for happy in happy_list[1:]:
        key, value = check_value(a_key, happy)
        a_key = key
        a_sum += value
        key, value = check_value(b_key, happy)
        b_key = key
        b_sum += value
        key, value = check_value(c_key, happy)
        c_key = key
        c_sum += value
    print(max(a_sum, b_sum, c_sum))


Fixed submission:
n = int(input())
ha, hb, hc = 0, 0, 0
for _ in range(n):
    a, b, c = map(int, input().split())
    ha, hb, hc = max(hb, hc) + a, max(hc, ha) + b, max(ha, hb) + c
print(max(ha, hb, hc))
Buggy python submission (verdict: Time Limit Exceeded):
import sys


input = sys.stdin.readline
n, p = map(int, input().split())
if n == 1:
    ans = p
else:
    ans = 1
    for i in range(2, 10**6+1):
        check = i**n
        if check > p:
            break
        elif p % check == 0:
            ans = i
print(ans)


Fixed submission:
import sys


input = sys.stdin.readline
n, p = map(int, input().split())
if n == 1:
    ans = p
elif n > 10**6:
    ans = 1
else:
    ans = 1
    for i in range(2, 10**6+1):
        check = i**n
        if check > p:
            break
        elif p % check == 0:
            ans = i
print(ans)

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


def new_pow(x, n):
    if n == 0:
        return 1
    if n % 2 == 0:
        return new_pow(x ** 2, n // 2)
    else:
        return x * new_pow(x ** 2, (n - 1) // 2)

input = sys.stdin.readline
n, p = map(int, input().split())
if n == 1:
    ans = p
else:
    ans = 1
    for i in range(2, new_pow(10, 6)+1):
        check = new_pow(i, n)
        if check > p:
            break
        elif p % check == 0:
            ans = i
print(ans)


Fixed submission:
import sys


input = sys.stdin.readline
n, p = map(int, input().split())
if n == 1:
    ans = p
elif n > 10**6:
    ans = 1
else:
    ans = 1
    for i in range(2, 10**6+1):
        check = i**n
        if check > p:
            break
        elif p % check == 0:
            ans = i
print(ans)

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


input = sys.stdin.readline
n, p = map(int, input().split())
if n == 1:
    ans = p
else:
    ans = 1
    for i in range(1, 10**6+1):
        if i**n > p:
            break
        elif p % i**n == 0:
            ans = i
print(ans)


Fixed submission:
import sys


input = sys.stdin.readline
n, p = map(int, input().split())
if n == 1:
    ans = p
elif n > 10**6:
    ans = 1
else:
    ans = 1
    for i in range(2, 10**6+1):
        check = i**n
        if check > p:
            break
        elif p % check == 0:
            ans = i
print(ans)
Buggy python submission (verdict: Runtime Error):
import numpy as np
n = int(input())
a = np.array(list(map(int, input().split())))
check = np.arange(1, n+1)
c = sorted(list(a - check))
b1 = c[int(n/2)]
b2 = c[int(n/2)+1]
count1 = 0
count2 = 0
for i in range(1, n+1):
    count1 += abs(a[i-1] - i - b1)
    count2 += abs(a[i-1] - i - b2)
print(min(count1, count2))


Fixed submission:
import numpy as np
n = int(input())
if n == 1:
    a = input()
    print(0)
else:
    a = np.array(list(map(int, input().split())))
    check = np.arange(1, n+1)
    c = sorted(list(a - check))
    b1 = c[int(n/2)]
    b2 = c[int(n/2)+1]
    count1 = 0
    count2 = 0
    for i in range(1, n+1):
        count1 += abs(a[i-1] - i - b1)
        count2 += abs(a[i-1] - i - b2)
    print(min(count1, count2))

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
import collections
n = int(input())
a = np.array(list(map(int, input().split())))
check = np.arange(1, n+1)
c = list(a - check)
b = collections.Counter(c)
b = np.array(list(b.keys()))
count = 0
for i in range(1, n+1):
    count += abs(a[i-1] - i - b)
print(min(count))


Fixed submission:
import numpy as np
n = int(input())
if n == 1:
    a = input()
    print(0)
else:
    a = np.array(list(map(int, input().split())))
    check = np.arange(1, n+1)
    c = sorted(list(a - check))
    b1 = c[int(n/2)]
    b2 = c[int(n/2)+1]
    count1 = 0
    count2 = 0
    for i in range(1, n+1):
        count1 += abs(a[i-1] - i - b1)
        count2 += abs(a[i-1] - i - b2)
    print(min(count1, count2))
Buggy python submission (verdict: Time Limit Exceeded):
import math
n, h = map(int, input().split())
a_list = []
b_list = []
for i in range(n):
    a, b = map(int, input().split())
    a_list.append(a)
    b_list.append(b)
all_list = a_list + b_list
all_list = sorted(all_list, reverse=True)
count = 0
for i in range(len(all_list)):
    if all_list[i] in a_list:
        count += math.ceil(h/all_list[i])
        break
    else:
        h -= all_list[i]
        count += 1
print(count)


Fixed submission:
import math
n, h = map(int, input().split())
a_max = 0
b_list = []
for i in range(n):
    a, b = map(int, input().split())
    a_max = max(a_max, a)
    b_list.append(b)
b_list = sorted(b_list, reverse=True)
count = 0
flag = 0
for i in range(len(b_list)):
    if a_max < b_list[i]:
        h -= b_list[i]
        count += 1
    else:
        flag = 1
        count += math.ceil(h/a_max)
        break
    if h <= 0:
        flag = 1
        break
if flag == 0:
    count += math.ceil(h/a_max)
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
t = []
for i in range(n-1):
    t.append(list(map(int, input().split())))
ans = []
for i in range(n-1):
    tmp = t[i]
    ans.append(tmp[0]+tmp[1])
    for j in range(i):
        if ans[j] > tmp[1]:
            tmp_ans = tmp[1]
            while True:
                tmp_ans += tmp[2]
                if ans[j] <= tmp_ans:
                    ans[j] = tmp_ans
                    break
        else:
            ans[j] = tmp[1]
        ans[j] += tmp[0]
ans.append(0)
for a in ans:
    print(a)


Fixed submission:
n = int(input())
t = []
ans = []
for i in range(n-1):
    t.append(list(map(int, input().split())))
    tmp = t[i]
    ans.append(tmp[0]+tmp[1])
    for j in range(i):
        if ans[j] > tmp[1]:
            if ans[j] % tmp[2] != 0:
                ans[j] = ans[j] + tmp[2] - (ans[j] % tmp[2])
        else:
            ans[j] = tmp[1]
        ans[j] += tmp[0]
ans.append(0)
for a in ans:
    print(a)
Buggy python submission (verdict: Runtime Error):
n = input()
if n[0] == n[1]:
    if n[0] == n[2] or n[0] == n[3]:
        print("Yes")
    else:
        print("No")
else:
    if n{1} != n[2]:
        print("No")
    else:
        print("Yes")


Fixed submission:
n = input()
if n[0] == n[1]:
    if n[0] == n[2]:
        print("Yes")
    else:
        print("No")
else:
    if n[1] != n[2] or n[1] != n[3]:
        print("No")
    else:        
        print("Yes")
Buggy python submission (verdict: Runtime Error):
num = list(map(int, input().split()))
if sum(num) == 7:
    print(str(num[0]) + "+" + str(num[1]) + "+" + str(num[2]) + "+" + str(num[3]) + "=7")
elif num[0] + num[1] + num[2] - num[3] == 7:
    print(str(num[0]) + "+" + str(num[1]) + "+" + str(num[2]) + "-" + str(num[3]) + "=7")
elif num[0] + num[1] - num[2] - num[3] == 7:
    print(str(num[0]) + "+" + str(num[1]) + "-" + str(num[2]) + "+" + str(num[3]) + "=7")
elif num[0] + num[1] - num[2] - num[3] == 7:
    print(str(num[0]) + "+" + str(num[1]) + "-" + str(num[2]) + "-" + str(num[3]) + "=7")
elif num[0] - num[1] + num[2] + num[3] == 7:
    print(str(num[0]) + "-" + str(num[1]) + "+" + str(num[2]) + "+" + str(num[3]) + "=7")
elif num[0] - num[1] + num[2] - num[3] == 7:
    print(str(num[0]) + "-" + str(num[1]) + "+" + str(num[2]) + "-" + str(num[3]) + "=7")
elif num[0] - num[1] - num[2] + num[3] == 7:
    print(str(num[0]) + "-" + str(num[1]) + "-" + str(num[2]) + "+" + str(num[3]) + "=7")
elif num[0] - num[1] - num[2] - num[3] == 7:
    print(str(num[0]) + "-" + str(num[1]) + "-" + str(num[2]) + "-" + str(num[3]) + "=7")


Fixed submission:
n = input()
num = [int(n[0]), int(n[1]), int(n[2]), int(n[3])]
if sum(num) == 7:
    print(str(num[0]) + "+" + str(num[1]) + "+" + str(num[2]) + "+" + str(num[3]) + "=7")
elif num[0] + num[1] + num[2] - num[3] == 7:
    print(str(num[0]) + "+" + str(num[1]) + "+" + str(num[2]) + "-" + str(num[3]) + "=7")
elif num[0] + num[1] - num[2] + num[3] == 7:
    print(str(num[0]) + "+" + str(num[1]) + "-" + str(num[2]) + "+" + str(num[3]) + "=7")
elif num[0] + num[1] - num[2] - num[3] == 7:
    print(str(num[0]) + "+" + str(num[1]) + "-" + str(num[2]) + "-" + str(num[3]) + "=7")
elif num[0] - num[1] + num[2] + num[3] == 7:
    print(str(num[0]) + "-" + str(num[1]) + "+" + str(num[2]) + "+" + str(num[3]) + "=7")
elif num[0] - num[1] + num[2] - num[3] == 7:
    print(str(num[0]) + "-" + str(num[1]) + "+" + str(num[2]) + "-" + str(num[3]) + "=7")
elif num[0] - num[1] - num[2] + num[3] == 7:
    print(str(num[0]) + "-" + str(num[1]) + "-" + str(num[2]) + "+" + str(num[3]) + "=7")
elif num[0] - num[1] - num[2] - num[3] == 7:
    print(str(num[0]) + "-" + str(num[1]) + "-" + str(num[2]) + "-" + str(num[3]) + "=7")
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
d = list(map(int, input().split()))
m = int(input())
t = list(map(int, input().split()))

flag = 0
for i in range(m):
    if t[i] in d:
        d.remove(t[i])
    else:
        flag = 1
        break

if flag == 0:
    print("YES")
else:
    print("NO")


Fixed submission:
from collections import deque
n = int(input())
d = list(map(int, input().split()))
m = int(input())
t = list(map(int, input().split()))
a = deque(sorted(d))
b = deque(sorted(t))
flag = 0
if n >= m:
    for i in range(n):
        if a[0] == b[0]:
            b.popleft()
        a.popleft()
        if len(b) == 0:
            print("YES")
            flag = 1
            break
if flag == 0:
    print("NO")
Buggy python submission (verdict: Time Limit Exceeded):
import heapq
n = int(input())
a_list = []

for i in range(n):
    a = int(input())
    if a in a_list:
        a_list.remove(a)
    else:
        heapq.heappush(a_list, a)

print(len(a_list))


Fixed submission:
n = int(input())
d = dict()
for i in range(n):
    a = int(input())
    if a in d:
        if d[a] == 0:
            d[a] = 1
        else:
            d[a] = 0
    else:
        d[a] = 1

print(sum(d.values()))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a_list = []

for i in range(n):
    a = int(input())
    if a in a_list:
        a_list.remove(a)
    else:
        a_list.append(a)

print(len(a_list))


Fixed submission:
n = int(input())
d = dict()
for i in range(n):
    a = int(input())
    if a in d:
        if d[a] == 0:
            d[a] = 1
        else:
            d[a] = 0
    else:
        d[a] = 1

print(sum(d.values()))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(input().split())
num_list = []

for i in range(len(a)-1):
    for j in range(i+1, len(a)):
        if a[i] == a[j] and int(a[i]) not in num_list:
            num_list.append(int(a[i]))
            break

if len(num_list) < 2:
    print("0")
else:
    num_list.sort()
    print(num_list[-1]*num_list[-2])


Fixed submission:
n = int(input())
a_in = list(input().split())
a = list(map(int,a_in))
a.sort(reverse=True)
ans = 0
t = 0
c = 1

for i in range(n-1):
    if a[i] == a[i+1]:
        c = c + 1
        if t == 0:
            t = int(a[i])
        elif t != int(a[i]):
            ans = t * int(a[i])
            break
        elif c == 4:
            ans = t * t
            break
    else:
        c = 1

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
num_list = list(map(int, input().split()))
dis = n * 10**9

for i in range(1,n):
    a = sum(num_list[:i])
    b = sum(num_list[i:])
    if abs(a-b) < dis:
        dis = abs(a-b)

print(dis)


Fixed submission:
n = int(input())
num_list = list(map(int, input().split()))
total = sum(num_list)
dis = []
a=0

for i in range(n-1):
    a += num_list[i]
    b = total - a
    dis.append(abs(a-b))

print(min(dis))

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

for i in range(1,n):
    a = sum(num_list[:i])
    b = sum(num_list[i:])
    dis.append(abs(a-b))

print(min(dis))


Fixed submission:
n = int(input())
num_list = list(map(int, input().split()))
total = sum(num_list)
dis = []
a=0

for i in range(n-1):
    a += num_list[i]
    b = total - a
    dis.append(abs(a-b))

print(min(dis))
Buggy python submission (verdict: Time Limit Exceeded):
n = input()
b = []
b_old = []
for i in range(int(n)):
    tmp = input()
    b.append(int(tmp))

count = 1
s = b[0]
if s == 2:
    print(count)
else:
    b_old.append(s)
    n_b = s
    flag = 0
    while(True):
        count += 1
        n_b = b[n_b-1]
        if n_b == 2:
            print(count)
            flag = 1
            break
        elif n_b in b_old:
            print("-1")
            flag = 1
            break
        elif count == int(n):
            print("-1")
            break
        else:
            b_old.append(n_b)


Fixed submission:
n = int(input())
b = []
b_old = []
for i in range(n):
    tmp = int(input())
    b.append(tmp)
n_b = 1
count = 0
flag = 0
while(count < n):
    n_b = b[n_b-1]
    count += 1
    if n_b == 2:
        print(count)
        flag = 1
        break
if flag == 0:
    print("-1")

Buggy python submission (verdict: Time Limit Exceeded):
n = input()
b = []
b_old = []
for i in range(int(n)):
    tmp = input()
    b.append(int(tmp))

count = 1
s = b[0]
if s == 2:
    print(count)
else:
    b_old.append(s)
    n_b = s
    flag = 0
    for i in range(int(n)):
        count += 1
        n_b = b[n_b-1]
        if n_b == 2:
            print(count)
            flag = 1
            break
        elif n_b in b_old:
            print("-1")
            flag = 1
            break
        else:
            b_old.append(n_b)

    if flag == 0:
        print("-1")


Fixed submission:
n = int(input())
b = []
b_old = []
for i in range(n):
    tmp = int(input())
    b.append(tmp)
n_b = 1
count = 0
flag = 0
while(count < n):
    n_b = b[n_b-1]
    count += 1
    if n_b == 2:
        print(count)
        flag = 1
        break
if flag == 0:
    print("-1")
Buggy python submission (verdict: Runtime Error):
n = input()
a = int(n.split()[0])
b = int(n.split()[1])
c = int(n.split()[2])

if a<=c and c<=b:
	print("Yes")
else:
	print("No")


Fixed submission:
n = input()
tmp_n = n.split(" ")

N = tmp_n[0]
M = tmp_n[1]
n_list = []

for i in range(int(M)):
    num = input()
    tmp_num = num.split()
    n_list.append(int(tmp_num[0]))
    n_list.append(int(tmp_num[1]))
    
for j in range(1,int(N)+1):
    count = 0
    for k in n_list:
        if k == j:
            count = count + 1        
    print(count)
Buggy python submission (verdict: Runtime Error):
O = input()
E = input()

password = O[0] + E[0]

if len(O)-len(E)==1:
    for i in range(1, len(O)-1):
        password = password + O[i] + E[i]
    password = password + O[i]
else:
    for i in range(1, len(O)):
        password = password + O[i] + E[i]

print(password)


Fixed submission:
O = input()
E = input()

password = O[0] + E[0]

if len(O)-len(E)==1:
    for i in range(1, len(O)-1):
        password = password + O[i] + E[i]
    password = password + O[-1]
else:
    for i in range(1, len(O)):
        password = password + O[i] + E[i]

print(password)

Buggy python submission (verdict: Runtime Error):
O = input()
E = input()

password = []

for i in range(len(O)-1):
    password.append(O[i])
    password.append(E[i])
if len(O)-len(E)==1:
    password.append(O[len(O)])

print(password)


Fixed submission:
O = input()
E = input()

password = O[0] + E[0]

if len(O)-len(E)==1:
    for i in range(1, len(O)-1):
        password = password + O[i] + E[i]
    password = password + O[-1]
else:
    for i in range(1, len(O)):
        password = password + O[i] + E[i]

print(password)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = len(str(n))
b = 0
j = 2*i
if a%2 == 0:
    for j in range(a//2):
        b += 10**(2*j+1)-10**(2*j)
    print(b)
else:
    for j in range(a//2):
        b += 10**(2*j+1)
    print(n-10**(a-1)+b)

Fixed submission:
n = int(input())
a = len(str(n))
b = 0
c = a//2

if a%2 == 0:
    for j in range(c):
        b += 9*100**j
    print(b)
else:
    for j in range(c):
        b += 9*100**j
    print(n-10**(a-1)+1+b)
Buggy python submission (verdict: Runtime Error):
n = int(input())
h = list(map(int,input().split()))
c = 0

for i in range(n-1):
    if (h[i+1]-h[i] == 1) and (h[i+2] >= h[i]):
        c += 1
    else:
        pass
if c <= 1:
    print('Yes')
else:
    print('No')

Fixed submission:
n = int(input())
h = list(map(int,input().split()))
c = 0

for i in range(n-1):
    if h[i] <= h[i+1]-1:
        h[i+1] = h[i+1]-1
    elif h[i] == h[i+1]:
        continue
    else:
        c = 1
if c == 1:
    print('No')
else:
    print('Yes')

Buggy python submission (verdict: Runtime Error):
n = int(input())
h = list(map(int,input().split()))
c =0

for i in range(n-1):
    if (h[i+1]-h[i] <= 1) and (h[i+2] >= h[i]):
        c += 1
    else:
        pass
if c == 1:
    print('Yes')
else:
    print('No')

Fixed submission:
n = int(input())
h = list(map(int,input().split()))
c = 0

for i in range(n-1):
    if h[i] <= h[i+1]-1:
        h[i+1] = h[i+1]-1
    elif h[i] == h[i+1]:
        continue
    else:
        c = 1
if c == 1:
    print('No')
else:
    print('Yes')

Buggy python submission (verdict: Runtime Error):
n = int(input())
h = list(map(int,input().split()))
c =0

for i in range(n-1):
    if (h[i+1]-h[i] == 1) and (h[i+2] >= h[i]):
        c += 1
    else:
        pass
if c == 1:
    print('Yes')
else:
    print('No')

Fixed submission:
n = int(input())
h = list(map(int,input().split()))
c = 0

for i in range(n-1):
    if h[i] <= h[i+1]-1:
        h[i+1] = h[i+1]-1
    elif h[i] == h[i+1]:
        continue
    else:
        c = 1
if c == 1:
    print('No')
else:
    print('Yes')
Buggy python submission (verdict: Runtime Error):
n = int(input())
p = list(map(int,input().split()))    
p2 = sorted(p)   

if p == p2:
    print('YES')
else:
    for i in range(1,n-1):
        if p[i] == p2[n-i]:
            p3 = p.remove(p[i],p[n-1])
            p4 = sorted(p3)
            if p3 == p4:
                print('YES')
            else:
                print('NO')
        else:
            print('NO')

Fixed submission:
n = int(input())
p = list(map(int,input().split()))    
a = [0]*n
b = 0  

for i in range(n):
    a[i] = p[i]-sorted(p)[i]
    if a[i] != 0:
        b += 1

if sum(a) == 0 and (b == 2 or b == 0):
    print('YES')
else:
    print('NO')
Buggy python submission (verdict: Runtime Error):
n = int(input())
d = list(map(int,input().split())) 
D = sorted(d)
if D[n//2-1]==D[n//2]:
    print(0)
else:
    print(D[n//2+1]-D[n//2]+1)

Fixed submission:
n = int(input())
d = list(map(int,input().split())) 
D = sorted(d)
if D[n//2-1]==D[n//2]:
    print(0)
else:
    print(D[n//2]-D[n//2-1])

Buggy python submission (verdict: Runtime Error):
n = int(input())
d = list(map(int,input().split())) 
D = sorted(d)
if D[n//2+1]==D[n//2]:
    print(0)
else:
    print(D[n//2+1]-D[n//2]+1)

Fixed submission:
n = int(input())
d = list(map(int,input().split())) 
D = sorted(d)
if D[n//2-1]==D[n//2]:
    print(0)
else:
    print(D[n//2]-D[n//2-1])
Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().sprit())
if k == 1:
  print('0')
else:
  print(n-k)

Fixed submission:
n,k = map(int,input().split())
if k == 1:
  print('0')
else:
  print(n-k)
Buggy python submission (verdict: Runtime Error):
x = int(input())
if x = 7:
     print('YES')
 elif x = 5:
     print('YES')
 elif x =3:
     print('YES')
 else:
     print('NO')

Fixed submission:
x = int(input())
if x == 7:
     print('YES')
elif x == 5:
     print('YES')
elif x == 3:
     print('YES')
else:
     print('NO')
Buggy python submission (verdict: Runtime Error):
a, b = input().split(" ")
a = int(a)
b = int(b)
if a-2b < 0:
  print(0)
else:
  print(a-2b)

Fixed submission:
a, b = input().split(" ")
a = int(a)
b = int(b)
if a-2*b < 0:
  print(0)
else:
  print(a-2*b)