Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
a,b= map(int, input())
print(a+(b//2))

Fixed submission:
a,b= map(int, input().split())
print(a+(b//2))
Buggy python submission (verdict: Runtime Error):
S = list(int, map(input().split()))
ans1 = 0
ans2 = 0
for i in range (len(S)):
  if i % 2 == 0:
    if S[i] == 0:
      ans1 += 1
  else:
    if S[i] == 1:
      ans1 += 1
for i in range(len(S)):
  if i % 2 == 0:
    if S[i] == 1:
      ans2 += 1
  else:
    if S[i] == 0:
      ans2 += 1
print(min(ans1, ans2))



Fixed submission:
S = list(map(int, input()))
ans1 = 0
ans2 = 0
for i in range (len(S)):
  if i % 2 == 0 and S[i] == 0:
      ans1 += 1
  elif i %2 ==1 and S[i] == 1:
      ans1 += 1
for i in range(len(S)):
  if i % 2 == 0 and S[i] == 1:
      ans2 += 1
  elif i % 2 ==1 and S[i] == 0:
      ans2 += 1
print(min(ans1, ans2))

Buggy python submission (verdict: Runtime Error):
S = list(int, map(input().split()))
ans1 = 0
ans2 = 0
for i in range (len(S)-1):
  if i % 2 == 0:
    if S[i] == 0:
      ans1 += 1
  else:
    if S[i] == 1:
      ans1 += 1
for i in range(len(S)-1):
  if i % 2 == 0:
    if S[i] == 1:
      ans2 += 1
  else:
    if S[i] == 0:
      ans2 += 1
print(min(ans1, ans2))



Fixed submission:
S = list(map(int, input()))
ans1 = 0
ans2 = 0
for i in range (len(S)):
  if i % 2 == 0 and S[i] == 0:
      ans1 += 1
  elif i %2 ==1 and S[i] == 1:
      ans1 += 1
for i in range(len(S)):
  if i % 2 == 0 and S[i] == 1:
      ans2 += 1
  elif i % 2 ==1 and S[i] == 0:
      ans2 += 1
print(min(ans1, ans2))
Buggy python submission (verdict: Runtime Error):
a, b, c, d, e = [int(input) for i in range(5)]
k = int(input())
if e-a > k*4:
  print(":(")
elif e-b > k*3 or d-a > k*3:
  print(":(")
elif e-c > k*2 or d-b > k*2 or c-a > k*2:
  print(":(")
elif e-d > k or d-c > k or c-b > k or b-a > k:
  print(":(")
else:
  print("Yay!")

Fixed submission:
a, b, c, d, e = [int(input()) for i in range(5)]
k = int(input())
if max(e-a, e-b, d-a, e-c, d-b, c-a, e-d, d-c, c-b, b-a) > k:
  print(":(")
else:
  print("Yay!")
Buggy python submission (verdict: Runtime Error):
L = [int(input()) for i in range(5)]
l = [i*(-1)//10*10*(-1) for i in L]
l1 = [i%10 for i in L]
l2 = sorted(list(set(l1)))
if l2[0] == 0:
  print(sum(l)-l[l1.index(l2[1])]+L[l1.index(l2[1])])
else:
  print(sum(l)-l[l1.index(l2[0])]+L[l1.index(l2[0])])

Fixed submission:
L = [int(input()) for i in range(5)]
l = [i*(-1)//10*10*(-1) for i in L]
l1 = [i%10 for i in L]
l2 = sorted(list(set(l1)))
if l2[0] == 0:
  if len(l2) == 1:
    print(sum(L))
  else:
    print(sum(l)-l[l1.index(l2[1])]+L[l1.index(l2[1])])
else:
  print(sum(l)-l[l1.index(l2[0])]+L[l1.index(l2[0])])
Buggy python submission (verdict: Runtime Error):
n = int(input())
l = [int(input()) for i in range(5)]
m = min(l)
if m % l == 0:
  ans = l // m + 4
else:
  ans = l // m + 5
print(ans)

Fixed submission:
n = int(input())
l = [int(input()) for i in range(5)]
if n % min(l) == 0:
  print(n//min(l)+4)
else:
  print(n//min(l)+5)

Buggy python submission (verdict: Runtime Error):
n = int(input())
l = [int(input()) for i in range(5)]
ans = 0
ans += n//l[0]+1
for i in range(1,5):
  if l(i-1) > l(i):
    ans += (n-n//l(i-1)*l(i))//l(i)+1
  else:
    ans += 1
print(ans)

Fixed submission:
n = int(input())
l = [int(input()) for i in range(5)]
if n % min(l) == 0:
  print(n//min(l)+4)
else:
  print(n//min(l)+5)
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
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):
a, b = map(int, input().split())
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):
import numpy as np 
n = int(input())
e = [[int(i) for i in input().split()] for i in range(2)] 
e3 = np.array(e)
print(np.sort((e3[0] - e3[1]))[::-1][0] + np.sort((e3[0] - e3[1]))[::-1][1])


Fixed submission:
import numpy as np 
n = int(input())
if n  < 2:
    print(0)
    exit()
e = [[int(i) for i in input().split()] for i in range(2)]
e3 = np.array(e)
a = np.sort((e3[0] - e3[1]))
print(a[a>0].sum())
Buggy python submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!

N, M = (int(i) for i in input().split()) 
AB=[list(map(int,input().split())) for _ in range(N)]
# print(AB)
AB.sort()
# print(AB)

money = 0
for a, b in AB:

    # print(M) 
    if M==0:
        break
    elif b < M:
        # print(a*xb)
        money += a*b
        M -= b
    elif b >= M:
        # print(M)
        money += M*a
        M = 0
    # print(M, money)
print(money)
        

Fixed submission:
a, b= (int(i) for i in input().split()) 
c, d = (int(i) for i in input().split()) 
print(((a-c)*(b-d)))
Buggy python submission (verdict: Runtime Error):

# Your code here!
import numpy as np
N, M = (int(i) for i in input().split()) 
e = np.array([[int(i) for i in input().split()] for i in range(N)])
# print(M)
# print(e)

e = e[np.argsort(e[:, 0])]
# print(e)
# arr_index = np.argsort(arr_key)
# return arr[arr_index]
# print(e.sort())
# e = np.sort(e, axis=1)
# print(e)
aaa = np.cumsum(e, axis=0)
# print(aaa)/
# print((aaa[:,1] < M))
# print(np.sum((e[:, 1] * e[:, 0])[aaa[:,1] < M]))
asf = np.sum((e[:, 1] * e[:, 0])[aaa[:,1] < M])
# print(aaa[:,1] )
# print([aaa[:,1] < M])
# print(((aaa[:, 1] * e[:, 0])[aaa[:,1] < M]))
# print(e[:, 0])
# print(aaa[:, 1])
# print(aaa)
# print([aaa[:,1] < M])
# print((e[:, 1] * e[:, 0])[aaa[:,1] <= M])
honsuu = aaa[:,1][aaa[:,1] <= M][-1]
# print(M-honsuu)
nedan = e[:,0][aaa[:,1] > M][0]
# print( e[:,0][aaa[:,1] < M])
# print(aaa[:,1])
# print(e[:,0][aaa[:,1] >= M])
# # print(nedan = e[:,1][aaa[:,1] > M][-1])
# # print(e)
# print((M-honsuu))
# print(nedan)
print(nedan*(M-honsuu)+asf)
# print(asf)

Fixed submission:
# coding: utf-8
# Your code here!

N, M = (int(i) for i in input().split()) 
AB=[list(map(int,input().split())) for _ in range(N)]
# print(AB)
AB.sort()
# print(AB)

money = 0
for a, b in AB:

    # print(M) 
    if M==0:
        break
    elif b < M:
        # print(a*xb)
        money += a*b
        M -= b
    elif b >= M:
        # print(M)
        money += M*a
        M = 0
    # print(M, money)
print(money)
Buggy python submission (verdict: Runtime Error):
N = raw_input()
keys = ['+','-']
x = 0
check = True
for key1 in keys:
    if key1 == '+' and check:
        x = int(N[0]) + int(N[1])
    elif(key1 == '-' and check):
        x = int(N[0]) - int(N[1])
    for key2 in keys:
        if key2 == '+' and check:
            x = x  + int(N[2])
        elif(key2 == '-' and check):
            x = x  - int(N[2])
            
        for key3 in keys:
            if key3 == '+' and check:
                x = x  + int(N[3])
                if (x == 7):
                    ans = N[0] + key1 + N[1] + key2 + N[2] + key3 + N[3]+ '=7'
                    #print N[0] + key1 + N[1] + key2 + N[2] + key3 + N[3]+ '=7'
                    check = False

                else:
                    x = 0
            elif(key3 == '-' and check):
                x = x  - int(N[3])

                if (x == 7):
                    ans =  N[0] + key1 + N[1] + key2 + N[2] + key3 + N[3]+ '=7'
                    check = False

                else:
                    x = 0
print ans

Fixed submission:
N = str(raw_input())
if(N.find(N[0]*3) != -1):
    print 'Yes'
elif(N.find(N[1]*3) != -1):
    print 'Yes'
else:
    print 'No'
Buggy python submission (verdict: Runtime Error):
N = raw_input()
keys = ['+','-']
x = 0
check = True

for key1 in keys:
    if key1 == '+' and check:
        x = int(N[0]) + int(N[1])
    elif(key1 == '-' and check):
        x = int(N[0]) - int(N[1])
    for key2 in keys:
        if key2 == '+' and check:
            x = x  + int(N[2])
        elif(key2 == '-' and check):
            x = x  - int(N[2])
            
        for key3 in keys:
            if key3 == '+' and check:
                x = x  + int(N[3])
                if (x == 7):
                    ans = N[0] + key1 + N[1] + key2 + N[2] + key3 + N[3]+ '=7'
                    #print N[0] + key1 + N[1] + key2 + N[2] + key3 + N[3]+ '=7'
                    check = False
                else:
                    x = 0
            elif(key3 == '-' and check):
                x = x  - int(N[3])

                if (x == 7):
                    ans =  N[0] + key1 + N[1] + key2 + N[2] + key3 + N[3]+ '=7'
                    check = False

                else:
                    x = 0
print ans

Fixed submission:
N = raw_input()
keys = ['+','-']
x = 0
check = True
ans = ''
for key1 in keys:
    if key1 == '+' and check:
        x1 = int(N[0]) + int(N[1])
    elif(key1 == '-' and check):
        x1 = int(N[0]) - int(N[1])
    for key2 in keys:
        if key2 == '+' and check:
            x2 = x1  + int(N[2])
        elif(key2 == '-' and check):
            x2 = x1  - int(N[2])
        
        #print x
        for key3 in keys:
            if key3 == '+' and check:
                #print x
                #print int(N[3])
                x3 = x2  + int(N[3])
                #print x
                if (x3 == 7):
                    ans = N[0] + key1 + N[1] + key2 + N[2] + key3 + N[3]+ '=7'
                    check = False


            elif(key3 == '-' and check):

                x3 = x2  - int(N[3])

                if (x3 == 7):
                    ans =  N[0] + key1 + N[1] + key2 + N[2] + key3 + N[3]+ '=7'
                    check = False

            #print x
print ans
Buggy python submission (verdict: Runtime Error):
a, b = raw_input().split()
a = int(a)
b = int(b)
nnn = a-b
nn = 2**b
n = (1900*b+100*nnn)*nn
print(n)

Fixed submission:
a, b = raw_input().split()

dic = {
    "A":10,
    "B":11,
    "C":12,
    "D":13,
    "E":14,
    "F":15}
aa = dic[a]
bb = dic[b]

if(aa < bb):
    y = "<"
elif(aa > bb):
    y = ">"
else:
    y = "="
    
print(y)

Buggy python submission (verdict: Runtime Error):
a = raw_input()
b = raw_input()
dic = {
    "0":0,
    "1":1,
    "2":2,
    "3":3,
    "4":4,
    "5":5,
    "6":6,
    "7":7,
    "8":8,
    "9":9,
    "A":10,
    "B":11,
    "C":12,
    "D":13,
    "E":14,
    "F":15}
aa = dic[a]
bb = dic[b]

if(aa < bb):
    y = "<"
elif(aa > bb):
    y = ">"
else:
    y = "="
    
print(y)

Fixed submission:
a, b = raw_input().split()

dic = {
    "A":10,
    "B":11,
    "C":12,
    "D":13,
    "E":14,
    "F":15}
aa = dic[a]
bb = dic[b]

if(aa < bb):
    y = "<"
elif(aa > bb):
    y = ">"
else:
    y = "="
    
print(y)

Buggy python submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!
a = raw_input()
b = raw_input()
dic = {
    "0":0,
    "1":1,
    "2":2,
    "3":3,
    "4":4,
    "5":5,
    "6":6,
    "7":7,
    "8":8,
    "9":9,
    "A":10,
    "B":11,
    "C":12,
    "D":13,
    "E":14,
    "F":15,}
aa = dic[a]
bb = dic[b]

if(aa < bb):
    y = "<"
elif(aa > bb):
    y = ">"
else:
    y = "="
    
print(y)

Fixed submission:
a, b = raw_input().split()

dic = {
    "A":10,
    "B":11,
    "C":12,
    "D":13,
    "E":14,
    "F":15}
aa = dic[a]
bb = dic[b]

if(aa < bb):
    y = "<"
elif(aa > bb):
    y = ">"
else:
    y = "="
    
print(y)
Buggy python submission (verdict: Runtime Error):
N = int(input())
while True:
    s = input()
    if len(s) == N:
        break
        
caps = list(s)

if caps.count('R') > N / 2:
    print('Yes')
else:
    print('No')


Fixed submission:
input_length = input().split(' ')

result = ''
x = input_length.count(input_length[0])
if x == len(input_length):
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
import re
N, Q = (int(i) for i in input().split(' ')) 
S = input()
for i in range(Q):
    l_i, r_i = (int(j) for j in input().split())
    matches = re.findall('AC', S[l_i-1:r_i])
    print(len(matches))

Fixed submission:
ACGT = {'A':'T', 'C':'G', 'T':'A', 'G':'C'}
input_ACGT = input()
print(ACGT[input_ACGT])
Buggy python submission (verdict: Runtime Error):
atcoder = input()
ACGT = list('ACGT')

s = ''
sub_list = []
for i, l in enumerate(list(atcoder)):
    if l in ACGT:
        s += l
        if i == len(atcoder)-1:
            sub_list.append(len(s))
    else:
        if s != '':
            sub_list.append(len(s))
        s = ''
print(max(sub_list))


Fixed submission:
atcoder = input()
ACGT = list('ACGT')

s = ''
sub_list = []
for i, l in enumerate(list(atcoder)):
    if l in ACGT:
        s += l
        if i == len(atcoder)-1:
            sub_list.append(len(s))
    else:
        sub_list.append(len(s))
        s = ''
print(max(sub_list))

Buggy python submission (verdict: Runtime Error):
atcoder = input()
ACGT = 'ACGT'

s = ''
sub_list = []
for i, l in enumerate(list(atcoder)):
    if l in list(ACGT):
        s += l
    else:
        if s != '':
            sub_list.append(len(s))
        s = ''

print(max(sub_list))

Fixed submission:
atcoder = input()
ACGT = list('ACGT')

s = ''
sub_list = []
for i, l in enumerate(list(atcoder)):
    if l in ACGT:
        s += l
        if i == len(atcoder)-1:
            sub_list.append(len(s))
    else:
        sub_list.append(len(s))
        s = ''
print(max(sub_list))

Buggy python submission (verdict: Runtime Error):
atcoder = input()
ACGT = 'ACGT'

s = ''
sub_list = []
for i, l in enumerate(list(atcoder)):
    if l in list(ACGT):
        s += l
    else:
        if s != '':
            sub_list.append(len(s))
        s = ''

print(max(sub_list))

Fixed submission:
atcoder = input()
ACGT = list('ACGT')

s = ''
sub_list = []
for i, l in enumerate(list(atcoder)):
    if l in ACGT:
        s += l
        if i == len(atcoder)-1:
            sub_list.append(len(s))
    else:
        sub_list.append(len(s))
        s = ''
print(max(sub_list))
Buggy python submission (verdict: Time Limit Exceeded):
N, Q = (int(i) for i in input().split(' ')) 
S = input()
for i in range(Q):
    l_i, r_i = (int(j) for j in input().split()) 
    print(S[l_i-1:r_i].count('AC'))

Fixed submission:
N, Q = map(int, input().split())
S = input()
t = [0] * (N + 1)
for i in range(N):
    t[i+1] = t[i] + (1 if S[i:i+2] == 'AC' else 0)

for i in range(Q):
    l_i, r_i = map(int, input().split())
    print(t[r_i-1] - t[l_i-1])

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

Fixed submission:
N, Q = map(int, input().split())
S = input()
t = [0] * (N + 1)
for i in range(N):
    t[i+1] = t[i] + (1 if S[i:i+2] == 'AC' else 0)

for i in range(Q):
    l_i, r_i = map(int, input().split())
    print(t[r_i-1] - t[l_i-1])

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

S = input()
AC ='AC'

for i in range(Q):
    l_i, r_i = input().split(' ')
    l_i = int(l_i)
    r_i = int(r_i)
    print(S[l_i-1:r_i].count(AC))

Fixed submission:
N, Q = map(int, input().split())
S = input()
t = [0] * (N + 1)
for i in range(N):
    t[i+1] = t[i] + (1 if S[i:i+2] == 'AC' else 0)

for i in range(Q):
    l_i, r_i = map(int, input().split())
    print(t[r_i-1] - t[l_i-1])

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

S = input()
AC ='AC'

indices = []
for i in range(Q):
    l_i, r_i = input().split(' ')
    l_i = int(l_i)
    r_i = int(r_i)
    indices.append((l_i, r_i))

for idx in indices:
    print(S[idx[0]-1:idx[1]].count(AC))

Fixed submission:
N, Q = map(int, input().split())
S = input()
t = [0] * (N + 1)
for i in range(N):
    t[i+1] = t[i] + (1 if S[i:i+2] == 'AC' else 0)

for i in range(Q):
    l_i, r_i = map(int, input().split())
    print(t[r_i-1] - t[l_i-1])

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

S = input()
AC ='AC'

indices = []
for i in range(Q):
    l_i, r_i = input().split(' ')
    indices.append((int(l_i), int(r_i)))

for idx in indices:
    print(S[idx[0]-1:idx[1]].count(AC))

Fixed submission:
N, Q = map(int, input().split())
S = input()
t = [0] * (N + 1)
for i in range(N):
    t[i+1] = t[i] + (1 if S[i:i+2] == 'AC' else 0)

for i in range(Q):
    l_i, r_i = map(int, input().split())
    print(t[r_i-1] - t[l_i-1])
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split(' ')))
B = list(map(int, input().split(' ')))

diff = []
neg = 0
count = 0

if sum(B) >  sum(A):
    print(-1)
    exit()

for a, b in zip(A, B):
    diff += [a-b]
    if a < b:
        count += 1
        neg += a - b

for d in reverse(diff):
    if neg >= 0:
        break
    count += 1
    neg += d

print(count)

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

sum_A = sum(A)
sum_B = sum(B)

diff = []
neg = 0
count = 0

if sum_B > sum_A:
    print(-1)
    exit()

for a, b in zip(A, B):
    diff += [a-b]
    if a < b:
        count += 1
        neg += a - b

for d in sorted(diff, reverse=True):
    if neg >= 0:
        break
    count += 1
    neg += d

print(count)
Buggy python submission (verdict: Runtime Error):
s = int(input())
a = [0] * 100000
a[0] = s

sum = 0
flag = 0
for i in range(100000):
    if a[i] % 2 == 0:
        a[i+1] = a[i] // 2
    else:
        a[i+1] = 3 * a[i] + 1
    sum += 1
    if a[i] in a[:i]:
        print(sum)
        exit()


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

menseki = a * b // 2

print(menseki)
Buggy python submission (verdict: Runtime Error):
import copy

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

def gcd_list(numbers):
    g = numbers[0]
    for m in numbers:
        g = gcd(g, m)
    return g

N = int(input())
A = list(map(int, input().split(" ")))

gcds = list()
for a in A:
    B = copy.deepcopy(A)
    B.remove(a)
    g = gcd_list(B)
    gcds.append(g)
print(max(gcds))

Fixed submission:
input_str = input().split(" ")
input_int = list(map(int, input_str))
A = input_int[0]
B = input_int[1]
T = input_int[2]

bis_sum = 0
start = 0
end = A
while True:
    if start < T+0.5 and end > T+0.5:
        break
    start += A
    end += A
    bis_sum += B

print(bis_sum)
Buggy python submission (verdict: Runtime Error):
inputs = input().split("\n")
N = int(inputs[0])
V = list(map(int, inputs[1].split(" ")))
C = list(map(int, inputs[2].split(" ")))
Z = 0
for v, c in zip(V, C):
    if v-c>0: Z += v-c
print(Z)

Fixed submission:
N = int(input())
V = list(map(int, input().split(" ")))
C = list(map(int, input().split(" ")))
Z = 0
for v, c in zip(V, C):
    if v-c>0: Z += v-c
print(Z)

Buggy python submission (verdict: Runtime Error):
inputs = input().split("\n")
N = int(inputs[0])
V = list(map(int, inputs[1].split(" ")))
C = list(map(int, inputs[2].split(" ")))
Z = 0
for v, c in zip(V, C):
    if v-c>0: z += v-c
print(Z)

Fixed submission:
N = int(input())
V = list(map(int, input().split(" ")))
C = list(map(int, input().split(" ")))
Z = 0
for v, c in zip(V, C):
    if v-c>0: Z += v-c
print(Z)

Buggy python submission (verdict: Runtime Error):
inputs = input().split("\n")
N = int(inputs[0])
V = list(map(int, inputs[1]))
C = list(map(int, inputs[2]))
Z = 0
for v, c in zip(V, C):
    if v-c>0: z += v-c
print(Z)

Fixed submission:
N = int(input())
V = list(map(int, input().split(" ")))
C = list(map(int, input().split(" ")))
Z = 0
for v, c in zip(V, C):
    if v-c>0: Z += v-c
print(Z)
Buggy python submission (verdict: Time Limit Exceeded):
# N = 4
N = int(input())
# X = [2, 4, 4, 3]
X = list(map(int, input().split(' ')))

# def get_median(l):
#     return median(l)

for i in range(N):
    target_l = X[:i] + X[i+1:]
    target_l = sorted(target_l)
    print(target_l[int((N-1)/2)])

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

# N = 2
# X = [1, 2]

# N = 6
# X = [5, 5, 4, 4, 3, 3]

# target = int((N-1)/2)
first_m = int(N/2)
second_m = first_m - 1
X_ = sorted(X)
for i in range(N):
    if X[i] <= X_[second_m]: print(X_[first_m])
    else: print(X_[second_m])

Buggy python submission (verdict: Runtime Error):
from statistics import median

N = int(input())
X = list(map(int, input().split(' ')))

def get_median(l):
    return median(l)

for i in range(N):
    target_l = X[:i] + X[i+1:]
    target_l = sorted(target_l)
    print(target_l[(N+1)/2])

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

# N = 2
# X = [1, 2]

# N = 6
# X = [5, 5, 4, 4, 3, 3]

# target = int((N-1)/2)
first_m = int(N/2)
second_m = first_m - 1
X_ = sorted(X)
for i in range(N):
    if X[i] <= X_[second_m]: print(X_[first_m])
    else: print(X_[second_m])

Buggy python submission (verdict: Time Limit Exceeded):
from statistics import median

N = int(input())
X = list(map(int, input().split(' ')))

def get_median(l):
    return median(l)

for i in range(N):
    target_l = X[:i] + X[i+1:]
    print(median(target_l))

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

# N = 2
# X = [1, 2]

# N = 6
# X = [5, 5, 4, 4, 3, 3]

# target = int((N-1)/2)
first_m = int(N/2)
second_m = first_m - 1
X_ = sorted(X)
for i in range(N):
    if X[i] <= X_[second_m]: print(X_[first_m])
    else: print(X_[second_m])
Buggy python submission (verdict: Time Limit Exceeded):

Q = int(input().strip('\n'))
for i in range(Q):
    inDatas = input().strip('\n').split(' ')
    a, b = list(map(int, inDatas))
    score = a*b
    if a < b:
        tmp = a
        a = b
        b = tmp
    pa = b
    pb = a - 1
    count = b - 1 + b - 1
    while pb >= b+1:
        if pa == a: pa += 1
        elif pb == b: pb -= 1
        else:
            while pa*pb >= score or pb == b:
                pb -= 1
            if pb >= 1:
                count += 1
                pa += 1
                pb -= 1
    print(count)

Fixed submission:
import math

if __name__ == '__main__':
    q = int(input())
    for i in range(q):
        a, b = list(map(int, input().split()))
        prod = a*b
        rootInt = int(math.sqrt(prod))
        if a == b: print((a-1)*2)
        elif math.sqrt(prod) == rootInt:
            print((rootInt-2)*2+1)
        else:
            if rootInt*(rootInt+1) < prod:
                print((rootInt-1)*2+1)
            else:
                print((rootInt-1)*2)
Buggy python submission (verdict: Runtime Error):
def initBoard(rowSize, colSize):
    board = list()
    for i  in range(rowSize):
        col = [1]*colSize
        board.append(col)
    return board

def canFlip(i, j):
    return i >= 0 and i < rowSize and j >= 0 and j < colSize

def flip(board, i, j):
    if board[i][j] == 0:
        board[i][j] = 1
    elif board[i][j] == 1:
        board[i][j] = 0

def process(board, i, j):
    if canFlip(i, j):
        flip(board, i, j)
    if canFlip(i-1, j+1):
        flip(board, i-1, j+1)
    if canFlip(i, j+1):
        flip(board, i, j+1)
    if canFlip(i+1, j+1):
        flip(board, i+1, j+1)
    if canFlip(i-1, j):
        flip(board, i-1, j)
    if canFlip(i+1, j):
        flip(board, i+1, j)
    if canFlip(i-1, j-1):
        flip(board, i-1, j-1)
    if canFlip(i, j-1):
        flip(board, i, j-1)
    if canFlip(i+1, j-1):
        flip(board, i+1, j-1)

def countBack(board):
    count = 0
    for i in range(len(board)):
        for j in range(len(board[0])):
            if board[i][j] == 0: count += 1
    return count

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

rowSize = N
colSize = M
board = initBoard(rowSize, colSize)
for i in range(N):
    for j in range(M):
        process(board, i, j)
print(countBack(board))

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

if M > N:
    tmp = M
    M = N
    N = tmp

if N == 1 and M == 1: print(1)
elif M == 1: print(N-2)
else: print((N-2)*(M-2))
Buggy python submission (verdict: Runtime Error):
a, b, c = map(int, input().split())

for i in range(a, b+1):
	if i=c:
		print("Yes")
		exit()
print("No")

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

if(a<b):
	for i in range(a, b):
		if i==c:
			print("Yes")
			exit()
if(a>b):
	for i in range(b, a):
		if i==c:
			print("Yes")
			exit()

print("No")