Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
index = len(A)
det =True
count = 0
while det:
    for i in index:
        if (A[i] % 2) != 0:
            det = False
            break
        A[i] = A[i] // 2
    if det != False:
        count += 1
print(count)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
count = 0
det = True
while det:
    for i in range(N):
        if A[i] % 2 == 0:
            A[i] = A[i] // 2
        else:
            det = False
            break
    if det != False:
        count += 1
print(count)

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
index = len(A)
det =True
count = 0
while det:
    for i in index:
        if (A[i] % 2) != 0:
            det = False
            break
    if det != False:
        count += 1
print(count)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
count = 0
det = True
while det:
    for i in range(N):
        if A[i] % 2 == 0:
            A[i] = A[i] // 2
        else:
            det = False
            break
    if det != False:
        count += 1
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
a = list(map(int, input().split()))
if N == K:
    print(0)
else:
    d = {str(i):0 for i in a}
    bucket = sorted([a.count(int(i)) for i in d])
    print(sum(bucket[0:len(bucket) - K:]))

Fixed submission:
from collections import Counter
N, K = map(int, input().split())
a = Counter(list(map(int, input().split())))
if N == K:
    print(0)
else:
    num = list(a.values())
    if len(num) <= K:
        print(0)
    else:
        print(sum(sorted(num)[:-K]))

Buggy python submission (verdict: Time Limit Exceeded):
def quicksort(x):
    if x==[]: return []
    smallerSorted = quicksort([a for a in x[1:] if a <= x[0]])
    biggerSorted = quicksort([a for a in x[1:] if a > x[0]])
    return smallerSorted+[x[0]]+biggerSorted
N, K = map(int, input().split())
a = list(map(int, input().split()))
if N == K:
    print(0)
else:
    l = set(a)
    bucket = quicksort([a.count(i) for i in l])
    print(sum(bucket[0:len(bucket) - K:]))

Fixed submission:
from collections import Counter
N, K = map(int, input().split())
a = Counter(list(map(int, input().split())))
if N == K:
    print(0)
else:
    num = list(a.values())
    if len(num) <= K:
        print(0)
    else:
        print(sum(sorted(num)[:-K]))

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
a = list(map(int, input().split()))
l = set(a)
bucket = sorted([a.count(i) for i in l])
print(sum(bucket[0:len(bucket) - K:] + [0]))

Fixed submission:
from collections import Counter
N, K = map(int, input().split())
a = Counter(list(map(int, input().split())))
if N == K:
    print(0)
else:
    num = list(a.values())
    if len(num) <= K:
        print(0)
    else:
        print(sum(sorted(num)[:-K]))

Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
a = list(map(int, input().split()))
if N == K:
    print(0)
else: 
    print(sum(sorted([a.count(i) for i in set(a)])[0:len(bucket) - K:]))

Fixed submission:
from collections import Counter
N, K = map(int, input().split())
a = Counter(list(map(int, input().split())))
if N == K:
    print(0)
else:
    num = list(a.values())
    if len(num) <= K:
        print(0)
    else:
        print(sum(sorted(num)[:-K]))

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
a = list(map(int, input().split()))
if N == K:
    print(0)
else:
    l = set(a)
    bucket = sorted([a.count(i) for i in l])
    print(sum(bucket[0:len(bucket) - K:]))

Fixed submission:
from collections import Counter
N, K = map(int, input().split())
a = Counter(list(map(int, input().split())))
if N == K:
    print(0)
else:
    num = list(a.values())
    if len(num) <= K:
        print(0)
    else:
        print(sum(sorted(num)[:-K]))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(input()) for i in range(N)]
setA = set(A)
B = len([A.count(i) for i in setA if A.count(i) % 2 != 0])
print(B)

Fixed submission:
N = int(input())
A = {}
for i in range(N):
    a = int(input())
    A.setdefault(a, 0)
    if a in A:
        A[a]+=1
count = 0
for v in A.values():
    if v%2!=0:
        count += 1
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
B = set(A)
cnt = 0
for i in B:
    a, b, c = A.count(i), A.count(i+1), A.count(i+2)
    sums = a+b+c
    if sums > cnt:
        cnt = sums
print(cnt)

Fixed submission:
from collections import Counter 
N = int(input())
A = Counter(list(map(int, input().split())))
cnt = 0
for i in A:
    sums = A[i] + A[i+1] + A[i+2]
    if sums > cnt:
        cnt = sums
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
cnt = 0
for i in A:
    a, b, c = A.count(i), A.count(i+1), A.count(i+2)
    sums = a+b+c
    if sums > cnt:
        cnt = sums
print(cnt)

Fixed submission:
from collections import Counter 
N = int(input())
A = Counter(list(map(int, input().split())))
cnt = 0
for i in A:
    sums = A[i] + A[i+1] + A[i+2]
    if sums > cnt:
        cnt = sums
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = sorted(list(map(int, input().split())))
cnt = 0
for i in A:
    a, b, c = A.count(i), A.count(i+1), A.count(i+2)
    sums = a+b+c
    if sums > cnt:
        cnt = sums
print(cnt)

Fixed submission:
from collections import Counter 
N = int(input())
A = Counter(list(map(int, input().split())))
cnt = 0
for i in A:
    sums = A[i] + A[i+1] + A[i+2]
    if sums > cnt:
        cnt = sums
print(cnt)
Buggy python submission (verdict: Runtime Error):
s = input()
print(s[0] + (len(s) - 2) + s[-1])

Fixed submission:
s = input()
print(s[0] + str(len(s) - 2) + s[-1])
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
x = [0] + [int(input()) for i in range(n)]
cnt = 1
idx = min(x[1:])
while True:
    if x[idx] == 2:
        ans = cnt
        break
    elif x[idx] == x.index(x[idx]):
        ans = -1
        break
    elif x.index(x[idx]) == x.index(min(x[1:])):
        ans = -1
        break
    idx = x[idx]
    cnt += 1
print(ans)

Fixed submission:
def train(n):
    x =[0] + [int(input()) for i in range(n)]
    idx = 1
    for i in range(n+1):
        if x[idx] == 2:
            return i + 1
        idx = x[idx]
    return -1
n = int(input())
print(train(n))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
x = [0] + [int(input()) for i in range(n)]
cnt = 1
idx = min(x[1:])
while True:
    if x[idx] == 2:
        ans = cnt
        break
    elif x.index(x[idx]) == x.index(min(x[1:])):
        ans = -1
        break
    idx = x[idx]
    cnt += 1
print(ans)

Fixed submission:
def train(n):
    x =[0] + [int(input()) for i in range(n)]
    idx = 1
    for i in range(n+1):
        if x[idx] == 2:
            return i + 1
        idx = x[idx]
    return -1
n = int(input())
print(train(n))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [0] + [int(input()) for i in range(N)]
record = [0] * (N + 1)
loop = True
pushing = min(A[1:])
ans = -1
while loop:
    record[A[pushing]] += 1
    if record[2] == 1:
        ans = sum(record)
        loop = False
    if record.count(2) == True:
        loop = False
    pushing = A[pushing]
print(ans)

Fixed submission:
def train(n):
    x =[0] + [int(input()) for i in range(n)]
    idx = 1
    for i in range(n+1):
        if x[idx] == 2:
            return i + 1
        idx = x[idx]
    return -1
n = int(input())
print(train(n))
Buggy python submission (verdict: Runtime Error):
r, g, b = map(str, input().split())
if int(a+g+b) % 4 == 0:
    print("YES")
else:
    print("NO")

Fixed submission:
r, g, b = map(str, input().split())
if (int(r+g+b) % 4) == 0:
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = sorted(list(map(int, input().split())), reverse=True)
idx = 0
for i in range(N - 1):
    a.insert(2+idx, a.pop())
    idx += 3
print(sum(a[1::3]))

Fixed submission:
N = int(input())
a = sorted(list(map(int, input().split())), reverse=True)
print(sum(a[1:len(a)-N:2]))
Buggy python submission (verdict: Runtime Error):
N = int(input())
rootn = int(N**0.5) +1
A = range(1, rootn)
min_digits = 11
for i in A:
    if (N % A) == 0:
        B = N // A
        p, q =len(str(A)), len(str(B))
        if (p > q) and p < min_digits:
            min_digits = p
        elif (p <= q) and q < min_digits:
            min_digits = q
print(min_digits)

Fixed submission:
def f(n):
    rootn = int((N**0.5)+1)
    A = range(1, rootn)
    min_output = 11
    for i in A:
        if (N % i) == 0:
            ilen = len(str(i))
            B = len(str(N//i))
            if ilen < B:
                if min_output > B:
                    min_output = B
            else:
                if min_output > ilen:
                    min_output = ilen
    return min_output
N = int(input())
print(f(N))

Buggy python submission (verdict: Runtime Error):
N = int(input())
rootn = int(N*0.5) +1
A = range(1, rootn)
min_digits = 11
for i in A:
    if (N % A) == 0:
        B = N // A
        p, q =len(str(A)), len(str(B))
        if (p > q) and p < min_digits:
            min_digits = p
        elif (p <= q) and q < min_digits:
            min_digits = q
print(min_digits)
            
      

Fixed submission:
def f(n):
    rootn = int((N**0.5)+1)
    A = range(1, rootn)
    min_output = 11
    for i in A:
        if (N % i) == 0:
            ilen = len(str(i))
            B = len(str(N//i))
            if ilen < B:
                if min_output > B:
                    min_output = B
            else:
                if min_output > ilen:
                    min_output = ilen
    return min_output
N = int(input())
print(f(N))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
ans = 1
for i in range(1, N+1):
    ans *= i
print(ans%(10**9+7))

Fixed submission:
N = int(input())
ans = 1
for i in range(1, N+1):
    ans *= i
    if ans >= (10**9 + 7):
        ans %= (10**9+7)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
from copy import deepcopy as dc
import sys

def main():
    input = sys.stdin.readline
    n, m = map(int, input().split())
    ab = [list(map(int, input().split())) for i in range(m)]
    g = [[] for i in range(n+1)]
    for i in ab:
        g[i[0]].append(i[1])
        g[i[1]].append(i[0])
    que = deque()
    que.append([1,-1,0,set([1])])
    ans = 0
    while que:
        v, p, cnt, check = que.popleft()
        if cnt >= n - 1:
            if len(check) == n:
                ans += 1
            continue
        for nv in g[v]:
            if nv == p:
                continue
            a = dc(check)
            a.add(nv)
            que.append([nv, v, cnt+1, a])
    print(ans)

if __name__ == "__main__":
    main()


Fixed submission:
from collections import deque
from copy import copy as dc
import sys

def main():
    input = sys.stdin.readline
    n, m = map(int, input().split())
    ab = [list(map(int, input().split())) for i in range(m)]
    g = [[] for i in range(n+1)]
    for i in ab:
        g[i[0]].append(i[1])
        g[i[1]].append(i[0])
    que = deque()
    que.append([1,-1,0,set([1])])
    ans = 0
    while que:
        v, p, cnt, check = que.popleft()
        if cnt >= n - 1:
            if len(check) == n:
                ans += 1
            continue
        for nv in g[v]:
            if nv == p:
                continue
            a = dc(check)
            a.add(nv)
            que.append([nv, v, cnt+1, a])
    print(ans)

if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
from copy import deepcopy as dc
import sys

def main():
    input = sys.stdin.readline
    n, m = map(int, input().split())
    ab = [list(map(int, input().split())) for i in range(m)]
    g = [[] for i in range(n+1)]
    for i in ab:
        g[i[0]].append(i[1])
        g[i[1]].append(i[0])
    que = deque()
    que.append([1,-1,0,set([1])])
    ans = 0
    while que:
        v, p, cnt, check = que.popleft()
        if cnt >= n - 1:
            if len(check) == n:
                ans += 1
            continue
        for nv in g[v]:
            if nv == p:
                continue
            a = dc(check)
            a.add(nv)
            que.append([nv, v, cnt+1, a])
    print(ans)

if __name__ == "__main__":
    main()

Fixed submission:
from collections import deque
from copy import copy as dc
import sys

def main():
    input = sys.stdin.readline
    n, m = map(int, input().split())
    ab = [list(map(int, input().split())) for i in range(m)]
    g = [[] for i in range(n+1)]
    for i in ab:
        g[i[0]].append(i[1])
        g[i[1]].append(i[0])
    que = deque()
    que.append([1,-1,0,set([1])])
    ans = 0
    while que:
        v, p, cnt, check = que.popleft()
        if cnt >= n - 1:
            if len(check) == n:
                ans += 1
            continue
        for nv in g[v]:
            if nv == p:
                continue
            a = dc(check)
            a.add(nv)
            que.append([nv, v, cnt+1, a])
    print(ans)

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
k, s = map(int, input().split())
x = range(k+1)
y = range(k+1)
cnt = 0
for i in x:
    for p in y:
        if (s-x+y) <= k:
            cnt += 1
print(cnt)

Fixed submission:
K, S = map(int, input().split())
X = range(K + 1)
Y = range(K + 1)
Z = range(K + 1)

count = 0

for i in X:
    for p in Y:
        if (S - (i + p)) in Z:
            count += 1

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
K, S = map(int, input().split())
X = range(K + 1)
Y = range(K + 1)
Z = range(K + 1)
count = 0
for i in X:
    for p in Y:
        for o in Z:
            if (S - (i + p)) > K:
                break
            if (i + p + o) == S:
                count += 1
            elif (i + p + o) > S:
                break
print(count)

Fixed submission:
K, S = map(int, input().split())
X = range(K + 1)
Y = range(K + 1)
Z = range(K + 1)

count = 0

for i in X:
    for p in Y:
        if (S - (i + p)) in Z:
            count += 1

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
K, S = map(int, input().split())
X = range(K + 1)
Y = range(K + 1)
Z = range(K + 1)
count = 0
for i in X:
    for p in Y:
        for o in Z:
            if (S - (i + p)) > K:
                break
            if (i + p + o) == S:
                count += 1
print(count)

Fixed submission:
K, S = map(int, input().split())
X = range(K + 1)
Y = range(K + 1)
Z = range(K + 1)

count = 0

for i in X:
    for p in Y:
        if (S - (i + p)) in Z:
            count += 1

print(count)
Buggy python submission (verdict: Runtime Error):
W, H, N = map(int, input().spllit())
a = [list(map(int, input().split())) for i in range(N)]
x, y = 0, 0
for i in a:
    if (i[2]==1) and (x < i[0]):
        x = i[0]
    elif (i[2]==2) and (W > i[0]):
        W = i[0]
    elif (i[2]==3) and (y < i[1]):
        y = i[1]
    elif (i[2]==4) and (H > i[1]):
        H = i[1]
if ((W-x)<=0) or ((H-y)<=0):
    print(0)
else:
    print((W-x)*(H-y))

Fixed submission:
W,H,N = map(int, input().split())
p = [list(map(int, input().split())) for i in range(N)]
x, y = 0, 0
for i in p:
    if (i[2] == 1) and (x < i[0]):
        x = i[0]
    elif (i[2] == 2) and (W > i[0]):
        W = i[0]
    elif (i[2] == 3) and (y < i[1]):
        y = i[1]
    elif (i[2] == 4) and (H > i[1]):
        H = i[1]
area = (W-x)*(H-y)
if ((W-x) <= 0) or ((H-y) <= 0):
    print(0)
else:
    print(area)
Buggy python submission (verdict: Runtime Error):
s = input()
op = ['','+']
if len(s) == 1:
    print(s)
else:
    s = s + 'X'*(10 -len(s))
    ans = []
    for a in op:
        for b in op:
            for c in op:
                for d in op:
                    for e in op:
                        for f in op:
                            for g in op:
                                for h in op:
                                    for i in op:
                                        　　　ans.append(s[0]+a+s[1]+b+s[2]+c+s[3]+d+s[4]+e+s[5]+f+s[6]+g+s[7]+h+s[8]+i+s[9])
    for i in range(len(ans)):
        for j in range(len(ans[i])):
            if ans[i][j] == 'X':
                if ans[i][j-1] == '+':
                    ans[i] = ans[i][:j-1]
                else:
                    ans[i] = ans[i][:j]
                break
    sums = 0
    for i in set(ans):
        sums += eval(i)
    print(sums)


Fixed submission:
s = input()
op_cnt = len(s) - 1
ans = []
for i in range(2**op_cnt):
    op = ['']*op_cnt
    for j in range(op_cnt):
        if ((i >> j) & 1):
            op[op_cnt - 1 - j] = '+'
    f = s[0]
    for p, q in zip(op, s[1:]):
        f += p + q
    ans.append(f)
sums = 0
for i in ans:
    sums += eval(i)
print(sums)
Buggy python submission (verdict: Runtime Error):
N, L = map(int, input().split())
S = sorted([input() for i in range(N)])
print(''.join(S))

Fixed submission:
x = sorted(list(map(int, input().split())))
if (x[0]==x[1]==5) and x[2]==7:
    print('YES')
else:
    print('NO')
Buggy python submission (verdict: Runtime Error):
N, L = map(int, input().split())
S = sorted([input() for i in range(N)])
print(sum(S))

Fixed submission:
N, L = map(int,input().split())
S = sorted([input() for i in range(N)])
print(''.join(S))
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
def dif(n, k):
    if abs(n - k) <= n:
        return dif(abs(n-k), k)
    else:
        return n

print(dif(N,K))

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

def dif(n, k):
    if abs(n - k) <= n:
        return dif(abs(n-k), k)
    else:
        return n

if N % K == 0:
    print(0)
else:
    N = N % K
    print(dif(N,K))
Buggy python submission (verdict: Runtime Error):
import math

X = int(input())

def era(n):
    O = [i + 2 for i in range(n-1)]
    P = []
    for i in range(int(math.sqrt(n))):
        P.append(O[0])
        O = [o for o in O if o % P[-1] != 0]
    for o in O:
        P.append(o)
    return P

print(max(P))
for i in range(len(P)):
    if X <= P[i]:
        print(P[i])
        break

Fixed submission:
import math

X = int(input())

def era(n):
    O = [i + 2 for i in range(n-1)]
    P = []
    for i in range(int(math.sqrt(n))):
        P.append(O[0])
        O = [o for o in O if o % P[-1] != 0]
    for o in O:
        P.append(o)
    return P

P = era(2*X)
for i in range(len(P)):
    if X <= P[i]:
        print(P[i])
        break
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

B = [i+1 for i in range(N)]
d = dict(zip(A, B))
s = ''
for i in range(N):
    s = s + str(d[i+1]) + ' '
print(s)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
B = [0]*N
for i in range(N):
    B[A[i]-1] = i+1
print(' '.join(map(str, B)))

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

B = [i+1 for i in range(N)]
d = dict(zip(B, A))
d = sorted(d.items(), key=lambda x: x[1])
s = ''
for i in range(N):
    s = s + str(d[i][0]) + ' '
print(s)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
B = [0]*N
for i in range(N):
    B[A[i]-1] = i+1
print(' '.join(map(str, B)))

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

B = []
for i in range(N):
    B.append(A.index(i+1) + 1)

print(' '.join(map(str, B)))

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
B = [0]*N
for i in range(N):
    B[A[i]-1] = i+1
print(' '.join(map(str, B)))

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

B = []
for i in range(N):
    B.append(A.index(i+1) + 1)

print(' '.join(map(str, B)))

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
B = [0]*N
for i in range(N):
    B[A[i]-1] = i+1
print(' '.join(map(str, B)))
Buggy python submission (verdict: Runtime Error):
import math

A,B = input().split()

print(math.ceil((B-1)/(A-1)))

Fixed submission:
import math
A,B = input().split()
A = int(A)
B= int(B)
print(str(math.ceil((B-1)/(A-1))))
Buggy python submission (verdict: Runtime Error):
S = input()
print("No" if S.count(A) == 3 or S.count(B)  ==3 else "Yes")

Fixed submission:
S = input()
print("No" if S.count("A") == 3 or S.count("B")  ==3 else "Yes")
Buggy python submission (verdict: Runtime Error):
List = []
for _ in range(6):
  List.append(int(input()))
Count = 5
MIN = min(List[1],List[2],List[3],List[4],List[5],)
Count += List[0]//MIN if List[0]%MIN != 0 else Count += (List[0]//MIN)-1

print(Count)


Fixed submission:
List = []
for _ in range(6):
  List.append(int(input()))
Count = 5
MIN = min(List[1],List[2],List[3],List[4],List[5],)
Count += List[0]//MIN if List[0]%MIN != 0 else (List[0]//MIN)-1

print(Count)
Buggy python submission (verdict: Time Limit Exceeded):
N,W = map(int,input().split())
wv =[[0,0]]
dp = []
Counting = []
for _ in range(N):
    wv.append(list(map(int,input().split())))
for _ in range(N+1):
    dp.append([0]*(W+1))
    Counting.append([0]*(W+1))
for i in range(1,N+1):
    for sum_w in range(W+1):
        if Counting[i-1][sum_w] > sum_w:
            continue
        elif sum_w-wv[i][0]<0:
            dp[i][sum_w] =  dp[i-1][sum_w]
            Counting[i][sum_w]  = Counting[i-1][sum_w]
        else:
            if dp[i-1][sum_w] < dp[i-1][sum_w-wv[i][0]]+wv[i][1]:
                Counting[i][sum_w]  = Counting[i-1][sum_w-wv[i][0]]  + wv[i][0]
            else:
                Counting[i][sum_w]  = Counting[i-1][sum_w]
            dp[i][sum_w] = max(dp[i-1][sum_w],dp[i-1][sum_w-wv[i][0]]+wv[i][1])
print(dp[-1][-1])


Fixed submission:
N,W = map(int,input().split())
wv =[[0,0]]
dp = []
Counting = []
for _ in range(N):
    wv.append(list(map(int,input().split())))
for _ in range(N+1):
    dp.append([0]*(W+1))
    Counting.append([0]*(W+1))
for i in range(1,N+1):
    for sum_w in range(W+1):
        if Counting[i-1][sum_w] > sum_w:
            continue
        elif sum_w-wv[i][0]<0:
            dp[i][sum_w] =  dp[i-1][sum_w]
            Counting[i][sum_w]  = Counting[i-1][sum_w]
        else:
            if dp[i-1][sum_w] < dp[i-1][sum_w-wv[i][0]]+wv[i][1]:
                Counting[i][sum_w]  = Counting[i-1][sum_w-wv[i][0]]  + wv[i][0]
            else:
                Counting[i][sum_w]  = Counting[i-1][sum_w]
            dp[i][sum_w] = max(dp[i-1][sum_w],dp[i-1][sum_w-wv[i][0]]+wv[i][1])
print(dp[-1][-1])
Buggy python submission (verdict: Runtime Error):
import copy
N = int(input())
Listx = list(map(int,input().split()))
Listxs = sorted(Listx)
A = Listxs[N//2]
B = Listxs[N//2-1]

for i in range(N):
    print(A if  B>= Listx[i] and else B)


Fixed submission:
import copy
N = int(input())
Listx = list(map(int,input().split()))
Listxs = sorted(Listx)
A = Listxs[N//2]
B = Listxs[N//2-1]

for i in range(N):
    print(A if  B>= Listx[i] else B)

Buggy python submission (verdict: Runtime Error):
import copy
N = int(input())
Listx = list(map(int,input().split()))
Listxs = sorted(Listx)
A = Listxs[N//2]
B = Listxs[N//2-1]

for i in range(N):
    print(A if  B>= Listx[i] and else B)


Fixed submission:
import copy
N = int(input())
Listx = list(map(int,input().split()))
Listxs = sorted(Listx)
A = Listxs[N//2]
B = Listxs[N//2-1]

for i in range(N):
    print(A if  B>= Listx[i] else B)