Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    R, G, B, N = map(int, input().split())
    R, G, B = sorted([R, G, B])
    result = 0
    for i in range(N // G + 1):
        for j in range(N // B + 1):
            if (N - G*i - B*j) // R >= 0 and (N - G*i - B*j) % R == 0:
                result += 1
    print(result)
main()

Fixed submission:
def main():
    R, G, B, N = map(int, input().split())
    R, G, B = sorted([R, G, B])
    result = 0
    for i in range(N // G + 1):
        for j in range(N // B + 1):
            if (N - G*i - B*j) < 0:
                break
            elif (N - G*i - B*j) % R == 0:
                result += 1
    print(result)
main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    R, G, B, N = map(int, input().split())
    result = 0
    for i in range(N // G + 1):
        for j in range(N // B + 1):
            if (N - G*i - B*j) // R >= 0 and (N - G*i - B*j) % R == 0:
                result += 1
    print(result)
main()

Fixed submission:
def main():
    R, G, B, N = map(int, input().split())
    R, G, B = sorted([R, G, B])
    result = 0
    for i in range(N // G + 1):
        for j in range(N // B + 1):
            if (N - G*i - B*j) < 0:
                break
            elif (N - G*i - B*j) % R == 0:
                result += 1
    print(result)
main()
Buggy python submission (verdict: Runtime Error):
import fractions
n = int(input())
A = list(map(int, input().split()))
work = A[0]
for i in range(1, N):
    work = fractions.gcd(work, A[i])
print(work)

Fixed submission:
import fractions
n = int(input())
A = list(map(int, input().split()))
work = A[0]
for i in range(1, n):
    work = fractions.gcd(work, A[i])
print(work)

Buggy python submission (verdict: Runtime Error):
import fractions
n = int(input())
A = list(map(int, input().split())))
work = A[0]
for i in range(1, N):
    work = fractions.gcd(work, A[i])
print(work)

Fixed submission:
import fractions
n = int(input())
A = list(map(int, input().split()))
work = A[0]
for i in range(1, n):
    work = fractions.gcd(work, A[i])
print(work)

Buggy python submission (verdict: Runtime Error):
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)
n = int(input())
A = sorted(list(map(int, input().split())))
print(gcd(*A))

Fixed submission:
import fractions
n = int(input())
A = list(map(int, input().split()))
work = A[0]
for i in range(1, n):
    work = fractions.gcd(work, A[i])
print(work)
Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**6)
import numpy as np
N, K = map(int, input().split())
h = np.array(list(map(int, input().split())))
dp = np.zeros(N,dtype=int)
for i in range(1, N):
    s=max(0, i-k)
    dp[i] = min(dp[s:i]+abs(h[s:i]-h[i]))
print(dp[-1])

Fixed submission:
import sys
sys.setrecursionlimit(10**5)
N = int(input())
h = list(map(int, input().split()))
dp = [-1 for i in range(N)]
def rec(n):
    if dp[n] == -1:
        if n == 0:
            dp[n] = 0
        elif n == 1:
            dp[n] = abs(h[1]-h[0])
        else:
            dp[n] = min(rec(n-2)+abs(h[n]-h[n-2]), rec(n-1)+abs(h[n]-h[n-1]))
    return dp[n]
rec(N-1)
print(dp[N-1])

Buggy python submission (verdict: Runtime Error):
N = int(input())
h = list(map(int, input().split()))
dp = [-1 for i in range(N)]
def rec(n):
    if dp[n] == -1:
        if n == 0:
            dp[n] = 0
        elif n == 1:
            dp[n] = abs(h[1]-h[0])
        else:
            dp[n] = min(rec(n-2)+abs(h[n]-h[n-2]), rec(n-1)+abs(h[n]-h[n-1]))
    return dp[n]
print(rec(N-1))

Fixed submission:
import sys
sys.setrecursionlimit(10**5)
N = int(input())
h = list(map(int, input().split()))
dp = [-1 for i in range(N)]
def rec(n):
    if dp[n] == -1:
        if n == 0:
            dp[n] = 0
        elif n == 1:
            dp[n] = abs(h[1]-h[0])
        else:
            dp[n] = min(rec(n-2)+abs(h[n]-h[n-2]), rec(n-1)+abs(h[n]-h[n-1]))
    return dp[n]
rec(N-1)
print(dp[N-1])

Buggy python submission (verdict: Runtime Error):
N = int(input())
h = list(map(int, input().split()))
dp = [10**6 for i in range(N)]
def rec(n):
    if dp[n] == 10**6:
        if n == 0:
            dp[n] = 0
        elif n == 1:
            dp[n] = abs(h[1]-h[0])
        else:
            dp[n] = min(rec(n-2)+abs(h[n]-h[n-2]), rec(n-1)+abs(h[n]-h[n-1]))
    return dp[n]
print(rec(N-1))

Fixed submission:
import sys
sys.setrecursionlimit(10**5)
N = int(input())
h = list(map(int, input().split()))
dp = [-1 for i in range(N)]
def rec(n):
    if dp[n] == -1:
        if n == 0:
            dp[n] = 0
        elif n == 1:
            dp[n] = abs(h[1]-h[0])
        else:
            dp[n] = min(rec(n-2)+abs(h[n]-h[n-2]), rec(n-1)+abs(h[n]-h[n-1]))
    return dp[n]
rec(N-1)
print(dp[N-1])
Buggy python submission (verdict: Runtime Error):
import math
n, X = map(int, input().split())
x = list(map(int, input().split()))
ans = abs(x[0]-X)
for el in x[1:]:
    ans = math.gcd(ans, abs(el - X))
print(ans)


Fixed submission:
from fractions import gcd

N, X = map(int, input().split())
x = list(map(int, input().split()))
z = list(map(lambda i: abs(X - i), x))
ans = z[0]
for i in range(1, N):
	ans = gcd(ans, z[i])
print(ans)

Buggy python submission (verdict: Runtime Error):
import math
n, X = map(int, input().split())
x = list(map(int, input().split()))
ans = abs(x[0]-X)
for el in x[1:]:
    ans = math.gcd(ans, abs(el - X))
print(ans)

Fixed submission:
from fractions import gcd

N, X = map(int, input().split())
x = list(map(int, input().split()))
z = list(map(lambda i: abs(X - i), x))
ans = z[0]
for i in range(1, N):
	ans = gcd(ans, z[i])
print(ans)
Buggy python submission (verdict: Runtime Error):
H, W = map(int, input().split())
s = [["."]*W]
for i in range(H):
    temp = "."
    temp += input()
    temp += "."
    s.append(temp)
s.append(["."]*W)
flag = True
for i in range(1, H+1):
    for j in range(1, W+1):
        if s[i][j] == "#" and s[i-1][j] == "." and s[i+1][j] == "." and s[i][j-1] == "." and s[i][j+1] == ".":
            flag = False
            break
    if not flag:
        break
if flag:
    result = "Yes"
else:
    result = "No"
print(result)

Fixed submission:
H, W = map(int, input().split())
s = ["."*(W+2)]
for i in range(H):
    temp = "."
    temp += input()
    temp += "."
    s.append(temp)
s.append("."*(W+2))
flag = True
for i in range(1, H+1):
    for j in range(1, W+1):
        if s[i][j] == "#" and s[i-1][j] == "." and s[i+1][j] == "." and s[i][j-1] == "." and s[i][j+1] == ".":
            flag = False
            break
    if not flag:
        break
if flag:
    result = "Yes"
else:
    result = "No"
print(result)
Buggy python submission (verdict: Time Limit Exceeded):
Q = int(input())
lr = [list(map(int, input().split())) for _ in range(Q)]
prime = [True] * (10**5)
prime[0] = prime[1] = False
for i in range(2, int((10**5)**0.5) + 1):
    if prime[i]:
        for j in range(i*2, 10**5, i):
            prime[j] = False
for l, r in lr:
    result = 0
    for i in range(l, r+1, 2):
        if prime[i] and prime[(i+1)//2]:
            result += 1
    print(result)

Fixed submission:
Q = int(input())
lr = [list(map(int, input().split())) for _ in range(Q)]
n=10**5 + 1
prime = [True] * (n)
prime[0] = prime[1] = False
for i in range(2, int((n)**0.5) + 1):
    if prime[i]:
        for j in range(i*2, n, i):
            prime[j] = False
counter = 0
work = [0] * (n)
for i in range(2, n):
    if prime[i] and prime[(i+1)//2]:
        counter += 1
    work[i] = counter
for l, r in lr:
    print(work[r] - work[l-1])
Buggy python submission (verdict: Runtime Error):
x, y = map(int, input().split())
count = 1
while x <= y:
    x *= 2
    count += 1
print(count-1

Fixed submission:
x, y = map(int, input().split())
count = 1
while x <= y:
    x *= 2
    count += 1
print(count-1)
Buggy python submission (verdict: Runtime Error):
from math import gcd
n = int(input())
T = [int(input()) for i in range(n)]
ans = 1
for t in T:
    ans = int(ans*t/gcd(ans,t))
print(ans)

Fixed submission:
from fractions import gcd
n = int(input())
T = [int(input()) for i in range(n)]
ans = 1
for t in T:
    ans = ans*t//gcd(ans,t)
print(ans)

Buggy python submission (verdict: Runtime Error):
from math import gcd
n = int(input())
T = [int(input()) for i in range(n)]
ans = 1
for t in T:
    ans = ans*t//gcd(ans,t)
print(ans)

Fixed submission:
from fractions import gcd
n = int(input())
T = [int(input()) for i in range(n)]
ans = 1
for t in T:
    ans = ans*t//gcd(ans,t)
print(ans)
Buggy python submission (verdict: Runtime Error):
from math import gcd
N, K = map(int, input().split())
A = list(map(int, input().split()))
if max(A) < K:
    print("IMPOSSIBLE")
else:
    temp = A[0]
    for a in A[1:]:
        temp = gcd(a, temp)
    if K % temp == 0:
        print("POSSIBLE")
    else:
        print("IMPOSSIBLE")

Fixed submission:
from fractions import gcd
N, K = map(int, input().split())
A = list(map(int, input().split()))
if max(A) < K:
    print("IMPOSSIBLE")
else:
    temp = A[0]
    for a in A[1:]:
        temp = gcd(a, temp)
    if K % temp == 0:
        print("POSSIBLE")
    else:
        print("IMPOSSIBLE")
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
array = []
for i in range(n):
    a, b = map(int, input().split())
    for j in range(b):
        array.append(a)
array.sort()
print(array[k-1])


Fixed submission:
n, k = map(int, input().split())
number = [[0,0] for i in range(n)]
for i in range(n):
    number[i] = list(map(int, input().split()))
number.sort(key=lambda x:(x[0],x[1]))
count = 0
result = 0
for el in number:
    count += el[1]
    if count >= k:
        result = el[0]
        break
print(result)
Buggy python submission (verdict: Runtime Error):
n = int(input())
A, B = [], []
for _ in range(n):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)
result = 0
for a, b in zip(A[::-1], B[::-1]):
    piyo = (a+result) % b
    if piyo == 0:
        continue
    result += b - piyo
print(result

Fixed submission:
n = int(input())
A, B = [], []
for _ in range(n):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)
result = 0
for a, b in zip(A[::-1], B[::-1]):
    piyo = (a+result) % b
    if piyo == 0:
        continue
    result += b - piyo
print(result)
Buggy python submission (verdict: Runtime Error):
import math
n = int(input())
a = list(map(int, input().split()))
work = math.round(sum(a)/n, 0) 
result = 0
for el in a:
    result += (work-el)**2
print(result)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
work = sum(a)/n
work = int(work) if work-int(work)<0.5 else int(work)+1
result = 0
for el in a:
    result += (work-el)**2
print(result)
Buggy python submission (verdict: Runtime Error):
a, b = int(input.split())
print(a * b)

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

c = a * b
print(c)
Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())

if a * b % 2 == 0:
    print("Even")
else:
    print("Odd")

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

if a * b % 2 == 0:
    print("Even")
else:
    print("Odd")
Buggy python submission (verdict: Runtime Error):
x1, x2, x3, x4, x5 = int(input().split( ))
x = []
x.append(x1)
x.append(x2)
x.append(x3)
x.append(x4)
x.append(x5)
ans = 0
for i, j in enumerate(x):
  if i+1 != j:
  	ans = j
print(type(0 2 3 4 5),j)

Fixed submission:
x1, x2, x3, x4, x5 = input().split()
x = list()
x.append(x1)
x.append(x2)
x.append(x3)
x.append(x4)
x.append(x5)
ans = 0
for i, j in enumerate(x):
  if int(j) == 0:
  	ans = i+1
print(int(ans))

Buggy python submission (verdict: Runtime Error):
x1, x2, x3, x4, x5 = int(input().split())
x = list()
x.append(x1)
x.append(x2)
x.append(x3)
x.append(x4)
x.append(x5)
ans = 0
for i, j in enumerate(x):
  if i+1 != j:
  	ans = j
print(type(0 2 3 4 5),j)

Fixed submission:
x1, x2, x3, x4, x5 = input().split()
x = list()
x.append(x1)
x.append(x2)
x.append(x3)
x.append(x4)
x.append(x5)
ans = 0
for i, j in enumerate(x):
  if int(j) == 0:
  	ans = i+1
print(int(ans))

Buggy python submission (verdict: Runtime Error):
x1, x2, x3, x4, x5 = int(input().split())
x = list()
x.append(x1)
x.append(x2)
x.append(x3)
x.append(x4)
x.append(x5)
ans = 0
for i, j in enumerate(x):
  if i+1 != j:
  	ans = j
print(j)

Fixed submission:
x1, x2, x3, x4, x5 = input().split()
x = list()
x.append(x1)
x.append(x2)
x.append(x3)
x.append(x4)
x.append(x5)
ans = 0
for i, j in enumerate(x):
  if int(j) == 0:
  	ans = i+1
print(int(ans))

Buggy python submission (verdict: Runtime Error):
x1, x2, x3, x4, x5 = int(input().split())
x = list()
x.append(x1)
x.append(x2)
x.append(x3)
x.append(x4)
x.append(x5)
ans = 0
for i, j in enumerate(x):
  if i+1 != j
  ans = j
print(j)


Fixed submission:
x1, x2, x3, x4, x5 = input().split()
x = list()
x.append(x1)
x.append(x2)
x.append(x3)
x.append(x4)
x.append(x5)
ans = 0
for i, j in enumerate(x):
  if int(j) == 0:
  	ans = i+1
print(int(ans))
Buggy python submission (verdict: Runtime Error):
T_list = input()
T = list(T_list)
nT = [0]*len(T)
for i in range(len(T)):
    if T[i] != '?':
        nT[i] = T[i]
    else:
        if 0<i:
            if T[i-1] == 'P':
                nT[i] = 'D'
                T[i] = 'D'
            elif T[i+1] == 'D':
                nT[i] = 'P'
                T[i] = 'P'
            elif T[i+1] == '?':
                nT[i] = 'P'
                T[i] = 'P'
            else:
                nT[i] = 'D'
                T[i] = 'D'
nT=''.join(nT)              
print(nT)       


Fixed submission:
T_list = input()
T = list(T_list)
nT = [0]*len(T)
if T[len(T)-1] == '?':
    T[len(T)-1] = 'D'
for i in range(len(T)):
    if T[i] != '?':
        nT[i] = T[i]
    else:
        if 0<i and i<len(T)-1:
            if T[i-1] == 'P':
                nT[i] = 'D'
                T[i] = 'D'
            elif T[i+1] == 'D':
                nT[i] = 'P'
                T[i] = 'P'
            elif T[i+1] == '?':
                nT[i] = 'P'
                T[i] = 'P'
            else:
                nT[i] = 'D'
                T[i] = 'D'
        else:
            if i<len(T)-1:
                if T[i+1] == 'D':
                    nT[i] = 'P'
                    T[i] = 'P'
                elif T[i+1] == '?':
                    nT[i] = 'P'
                    T[i] = 'P'
                else:
                    nT[i] = 'D'
                    T[i] = 'D'
nT=''.join(nT)              
print(nT)

Buggy python submission (verdict: Runtime Error):
T_list = input()
T = list(T_list)
nT = [0]*len(T)
for i in range(len(T)):
    if T[i] != '?':
        nT[i] = T[i]
    else:
        if 0<i:
            if T[i-1] == 'P':
                nT[i] = 'D'
                T[i] = 'D'
            elif T[i+1] == 'D':
                nT[i] = 'P'
                T[i] = 'P'
            elif T[i+1] == '?':
                nT[i] = 'P'
                T[i] = 'P'
nT=''.join(nT)              
print(nT)       

Fixed submission:
T_list = input()
T = list(T_list)
nT = [0]*len(T)
if T[len(T)-1] == '?':
    T[len(T)-1] = 'D'
for i in range(len(T)):
    if T[i] != '?':
        nT[i] = T[i]
    else:
        if 0<i and i<len(T)-1:
            if T[i-1] == 'P':
                nT[i] = 'D'
                T[i] = 'D'
            elif T[i+1] == 'D':
                nT[i] = 'P'
                T[i] = 'P'
            elif T[i+1] == '?':
                nT[i] = 'P'
                T[i] = 'P'
            else:
                nT[i] = 'D'
                T[i] = 'D'
        else:
            if i<len(T)-1:
                if T[i+1] == 'D':
                    nT[i] = 'P'
                    T[i] = 'P'
                elif T[i+1] == '?':
                    nT[i] = 'P'
                    T[i] = 'P'
                else:
                    nT[i] = 'D'
                    T[i] = 'D'
nT=''.join(nT)              
print(nT)
Buggy python submission (verdict: Runtime Error):
import numpy as np
N,K = map( int ,input().split())
A = np.array([[0] * N for i in range(K)])
sum_A = np.array([0]*N)
x = 0
for i in range(K):
    d = int(input())
    num_list = [int(i) for i in input().split()]
    for j in range(len(num_list)):
        A[d-1][num_list[j]-1] = 1
for k in range(K):
    sum_A += A[k] 
for l in range(K):
    if sum_A[l] == 0:
        x += 1
print(x)

Fixed submission:
N,K = map( int ,input().split())
N_list = [0]*N
for i in range(K):
    d = int(input())
    num_list = [int(i) for i in input().split()]
    for j in range(len(num_list)):
        N_list[num_list[j]-1] +=1
print(N_list.count(0))
Buggy python submission (verdict: Time Limit Exceeded):
N,M =  map( int ,input().split())
H_list = list(map( int , input().split()))
link_list = [[0] * N for i in range(N)]
A_B_list = [[0] * 2  for i in range(M)]
J_list = [0]*N
for i in range(M):
    A,B = map( int ,input().split())
    A_B_list[i][0] = A
    A_B_list[i][1] = B
for k in range(M):
    link_list[A_B_list[k][0]-1][A_B_list[k][1]-1] = 1
    link_list[A_B_list[k][1]-1][A_B_list[k][0]-1] = 1
for l in range(N):
    for m in range(N):
        if link_list[l][m] >=1:
            if H_list[l] > H_list[m]:
                J_list[m] = -1
                if J_list[l] != -1:
                    J_list[l] = 1
    if link_list[l].count(0) == N:
        J_list[l] = 1 
print(J_list.count(1))
                

Fixed submission:

N,M =  map( int ,input().split())
H_list = list(map( int , input().split()))
A_B_list = [[0] * 2  for i in range(M)]
bad_list = []
J_list = []
for i in range(M):
    A,B = map( int ,input().split())
    A_B_list[i][0] = A
    A_B_list[i][1] = B
for j in range(M):
    if H_list[A_B_list[j][0]-1] > H_list[A_B_list[j][1]-1]:
        bad_list.append(A_B_list[j][1])
    elif H_list[A_B_list[j][0]-1] < H_list[A_B_list[j][1]-1]:
        bad_list.append(A_B_list[j][0])
    else:
        bad_list.append(A_B_list[j][0])
        bad_list.append(A_B_list[j][1])
J_list = list(set(bad_list))
print(N-len(J_list))
Buggy python submission (verdict: Runtime Error):
from operator import mul
from functools import reduce

def ConZ(i):
    z_num = i+int(i*(i-1)/2)
    return z_num
#def ConN(i):
    #n_num = int(i*(i-1)/2)
    #return n_num

def cmb(n):
    over = reduce(mul, range(n, n - 2, -1))
    under = reduce(mul, range(1,2 + 1))
    return over // under


S = input()[::-1]
keta = 1
A_num = 0
x = 0
mod = [0]*2019
for i in range(len(S)):
    A_num += (int(S[i:i+1])*keta)%2019
    if A_num >= 2019:
        A_num = A_num%2019
    mod[A_num] +=1
    keta*=10
    
#print(mod)
x += ConZ(mod[0])
del mod[0]

for j in range(len(mod)):
    x+=cmb(mod[j])
print(x)


Fixed submission:
S,W = map(int,input().split())
if W>=S:
    print('unsafe')
else:
    print('safe')
Buggy python submission (verdict: Runtime Error):
N,M = map(int, input().split())
A = [0]*M
for i in range(M):
    A[i] = int(input())
SUM = sum(A)
if SUM>N:
    print(-1)
else:
    print(N-SUM)

Fixed submission:
N,M = map(int, input().split())
A = [list(map(int,input().split()))]
SUM = sum(A[0])
if SUM>N:
    print(-1)
else:
    print(N-SUM)
Buggy python submission (verdict: Runtime Error):
M = map(int, input().split())
A = [int(N) for N in input().split()]
X=0
F=int(sum(A)/(4*M))
for i in range(N):
    if A[i] >= F:
        X+=1
if X>=M:
    print('Yes')
else:
    print('No')

Fixed submission:
N,M = map(int, input().split())
A = [int(N) for N in input().split()]
X=0
F=sum(A)/(4*M)
for i in range(N):
    if A[i] >= F:
        X+=1
if X>=M:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
N,K =  map(int, input().split())
i=1
A[0]=N
if K!=1:
    while True:
        A[i]=abs(A[i]-K)
        if A[i] in A:
            break
        i+=1
    print(min(A))
else:
    print(0)

Fixed submission:
N,K =  map(int, input().split())
i=1
X=N%K
A=[]
A.append(X)
if K!=1:
    while True:
        A.append(abs(A[i-1]-K))
        if A[i] in (A):
            break
        i+=1
    print(min(A))
else:
    print(0)
Buggy python submission (verdict: Runtime Error):
K,N = map(int, input().split())
A = [int(N) for N in input().split()]
#print(A[0])
max1 = 0
max2 = 0
for i in range(0,N-1):
    max1 = A[i+1]-A[i]
    if max1>max2:
        max2=max1
if a[0]==0:
    lastlength = 20-A[N-1]
    if lastlength >max2:
        max2=lastlength
else:
    lastlength = A[N-1]-A[0]
    if lastlength>max2:
        max2=lastlength
print(20-max2)

Fixed submission:
K,N = map(int, input().split())
A = [int(N) for N in input().split()]
#print(A[0])
max1 = 0
max2 = 0
for i in range(0,N-1):
    max1 = A[i+1]-A[i]
    if max1>max2:
        max2=max1
if A[0]==0:
    lastlength = K-A[N-1]
    if lastlength >max2:
        max2=lastlength
else:
    lastlength = K-A[N-1]+A[0]
    if lastlength>max2:
        max2=lastlength
print(K-max2)
Buggy python submission (verdict: Time Limit Exceeded):
N,X,Y = map(int, input().split())
Dis = [[0 for i in range(N)] for j in range(N)]
count = [0]*(N-1)
c=0
for i in range(N):
    for j in range(i+1,N):
        if abs(i-j) >= abs(X-i-1)+1+abs(Y-j-1):
            Dis[i][j] = abs(X-i-1)+1+abs(Y-j-1)
        else:
            Dis[i][j] = abs(i-j)
for k in range(1,N):
    for i in range(N):
        for j in range(i+1,N):
            if Dis[i][j] == k:
                c+=1
    count[k-1]=c
    c=0
for i in range(N-1):
    print(count[i])

Fixed submission:
N,X,Y = map(int, input().split())
count = [0]*(N-1)
c=0
for i in range(0,N):
    for j in range(i+1,N):
        if abs(i-j) >= abs(X-i-1)+1+abs(Y-j-1):
            count[abs(X-i-1)+1+abs(Y-j-1)-1] +=1
        else:
            count[abs(i-j)-1] += 1
for i in range(N-1):
    print(count[i])
Buggy python submission (verdict: Runtime Error):
N,K = map(int, input().split())
H = list(map(int,input().split()))
H.sort(reverse=True)
if K-1 ==len(H):
    S = 0
elif K == 0:
    S = sum(H)
else:
    for i in range(K):
        del H[i]
    S =sum(H)
print(S)

Fixed submission:
N,K = map(int, input().split())
H = list(map(int,input().split()))
H.sort(reverse=True)
K = min(N,K)
S = sum(H[K:N])
print(S)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
P = list(map(int,input().split()))
k=0
l=0
for i in range(N):
    for j in range(i+1):
        if P[i]<=P[j]:
            k+=1
        if k ==i+1:
            l+=1
    k=0
print(l)

Fixed submission:
N = int(input())
P = list(map(int,input().split()))
count = 1
min_num = min(P[0:1])
for i in range(1,N):
    if P[i] <= min_num:
        count+=1
        min_num = P[i]
print(count)
Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
PS = [list(map(str,input().split())) for i in range(M)]
A_num = [0]*N
W_num = [0]*N
w=0
#print(PS)
for j in range(M):
    #print(A_num)
    if PS[j][1] == 'WA'and A_num[int(PS[j][0])-1]==0:
        W_num[int(PS[j][0]-1)]=1 
    if PS[j][1]== 'AC' and A_num[int(PS[j][0])-1]==0:
        A_num[int(PS[j][0])-1]=1
s = sum(A_num)
for k in range(N):
    if A_num[k] == 0:
        W_num[k]=0
w = sum(W_num)
print(s,w)

Fixed submission:
N,M = map(int,input().split())
PS = [list(map(str,input().split())) for i in range(M)]
A_num = [0]*N
W_num = [0]*N
w=0
#print(PS)
for j in range(M):
    #print(A_num)
    if PS[j][1] == 'WA'and A_num[int(PS[j][0])-1]==0:
        W_num[int(PS[j][0])-1]+=1 
    if PS[j][1]== 'AC' and A_num[int(PS[j][0])-1]==0:
        A_num[int(PS[j][0])-1]=1
s = sum(A_num)
for k in range(N):
    if A_num[k] == 0:
        W_num[k]=0
w = sum(W_num)
print(s,w)