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

k = int(input())

ans = 0

for a in range(1, k + 1):
    for b in range(1, k + 1):
        for c in range(1,k+1):
            ans += math.gcd(a, math.gcd(b, c))

print(ans)


Fixed submission:
ans = [1, 9, 30, 76, 141, 267, 400, 624, 885, 1249, 1590, 2208, 2689, 3411, 4248, 5248, 6081, 7485, 8530, 10248, 11889, 13687, 15228, 17988, 20053, 22569, 25242, 28588, 31053, 35463, 38284, 42540, 46581, 50893, 55362, 61824, 65857, 71247, 76884, 84388, 89349, 97881, 103342, 111528, 120141, 128047, 134580, 146316, 154177, 164817, 174438, 185836, 194157, 207927, 218812, 233268, 245277, 257857, 268182, 288216, 299257, 313635, 330204, 347836, 362973, 383709, 397042, 416448, 434025, 456967, 471948, 499740, 515581, 536073, 559758, 583960, 604833, 633651, 652216, 683712, 709065, 734233, 754734, 793188, 818917, 846603, 874512, 909496, 933081, 977145, 1006126, 1041504, 1073385, 1106467, 1138536, 1187112, 1215145, 1255101, 1295142, 1342852, 1373253, 1422195, 1453816, 1502376, 1553361, 1595437, 1629570, 1691292, 1726717, 1782111, 1827492, 1887772, 1925853, 1986837, 2033674, 2089776, 2145333, 2197483, 2246640, 2332104, 2379085, 2434833, 2490534, 2554600, 2609625, 2693919, 2742052, 2813988, 2875245, 2952085, 3003306, 3096024, 3157249, 3224511, 3306240, 3388576, 3444609, 3533637, 3591322, 3693924, 3767085, 3842623, 3912324, 4027884, 4102093, 4181949, 4270422, 4361548, 4427853, 4548003, 4616104, 4718640, 4812789, 4918561, 5003286, 5131848, 5205481, 5299011, 5392008, 5521384, 5610705, 5739009, 5818390, 5930196, 6052893, 6156139, 6239472, 6402720, 6493681, 6623853, 6741078, 6864016, 6953457, 7094451, 7215016, 7359936, 7475145, 7593865, 7689630, 7886244, 7984165, 8130747, 8253888, 8403448, 8523897, 8684853, 8802826, 8949612, 9105537, 9267595, 9376656, 9574704, 9686065, 9827097, 9997134, 10174780, 10290813, 10493367, 10611772, 10813692]
print(ans[int(input())-1])
Buggy python submission (verdict: Time Limit Exceeded):
x, y, a, b, c = map(int, input().split())
p = sorted(list(map(int, input().split())),reverse = True)
q = sorted(list(map(int, input().split())),reverse = True)
r = sorted(list(map(int, input().split())),reverse = True)


ans = 0

while (p[0] > r[0]):
    ans += p.pop(0)
    x -= 1
    if (x == 0):
        break
while (q[0] > r[0]):
    ans += q.pop(0)
    y-=1
    if (y == 0):
        break

if (x == 0 and y == 0):
    print(ans)
else:
    aps = sorted(p[0: x] + q[0: y] + r[0: x + y], reverse=True)
    #print(aps)
    print(ans+sum(aps[0:x+y]))



Fixed submission:
x, y, a, b, c = map(int, input().split())
p = sorted(list(map(int, input().split())),reverse = True)
q = sorted(list(map(int, input().split())),reverse = True)
r = sorted(list(map(int, input().split())),reverse = True)

px = p[:x]
qx = q[:y]

aps = sorted(px + qx + r, reverse=True)

print(sum(aps[0:x+y]))

Buggy python submission (verdict: Runtime Error):
x, y, a, b, c = map(int, input().split())
p = sorted(list(map(int, input().split())))
q = sorted(list(map(int, input().split())))
r = sorted(list(map(int, input().split())))

ps = -1
qs = -1
rs = -1

ans = 0
for i in range(x):
    if (p[ps] > r[rs]):
        ans += p[ps]
        ps -= 1
    else:
        ans += r[rs]
        rs -= 1

for i in range(y):
    if (q[qs] > r[rs]):
        ans += q[qs]
        qs -= 1
    else:
        ans += r[rs]
        rs -= 1

print(ans)

Fixed submission:
x, y, a, b, c = map(int, input().split())
p = sorted(list(map(int, input().split())),reverse = True)
q = sorted(list(map(int, input().split())),reverse = True)
r = sorted(list(map(int, input().split())),reverse = True)

px = p[:x]
qx = q[:y]

aps = sorted(px + qx + r, reverse=True)

print(sum(aps[0:x+y]))
Buggy python submission (verdict: Time Limit Exceeded):
h,w = map(int, input().split())

board = [[0 for i in range(w)] for j in range(h)]

board[0][0] = 1
queue = [[0,0]]


def dfsx(y, x):
    dx = [-1, -1, 1, 1]
    dy = [-1, 1, -1, 1,]

    for i in range(4):
        xx = x + dx[i]
        yy = y + dy[i]
        if (0 <= xx < w and 0 <= yy < h and board[yy][xx] == 0):
            board[yy][xx] = 1
            queue.append([yy, xx])


while(len(queue) != 0):
    dfsx(queue[0][0], queue[0][1])
    queue.pop(0)

print(sum([sum(board[i]) for i in range(h)]))



Fixed submission:
import math

h,w = map(int, input().split())
if (h == 1 or w == 1):
    print(1)
else:
    print(math.ceil(h/2)*math.ceil(w/2)+math.floor(h/2)*math.floor(w/2))
Buggy python submission (verdict: Time Limit Exceeded):
s = list(input())
q = int(input())

revs = 0

for i in range(q):
    ins = input().split()
    if(ins[0] == "1"):
        revs += 1
    else:
        if (ins[1] == "1" and revs%2 == 0 or ins[1] =="2" and revs%2 == 1):
            s.insert(0, ins[2])
        else:
            s.append(ins[2])

if(revs %2 == 0):
    for j in s:
        print(j, end="")
else:
    for j in reversed(s):
        print(j, end="")
print()


Fixed submission:
s = list(input())
q = int(input())

revs = 0
front = []
rear = []

for i in range(q):
    ins = input().split()
    if(ins[0] == "1"):
        revs += 1
    else:
        if (ins[1] == "1" and revs%2 == 0 or ins[1] =="2" and revs%2 == 1):
            front.extend(ins[2])
        else:
            rear.extend(ins[2])

if (revs % 2 == 0):
    for j in reversed(front):
        print(j, end="")
    for j in s:
        print(j, end="")
    for j in rear:
        print(j, end="")
else:
    for j in reversed(rear):
        print(j, end="")
    for j in reversed(s):
        print(j, end="")
    for j in front:
        print(j, end="")
print()

Buggy python submission (verdict: Time Limit Exceeded):
s = list(input())
q = int(input())

def rev(sts):
    for i in range(len(sts)//2):
        sts[i],sts[-i-1] = sts[-i-1],sts[i]


for i in range(q):
    ins = input().split()
    if(ins[0] == "1"):
        rev(s)
    else:
        if (ins[1] == "1"):
            s.insert(0, ins[2])
        else:
            s.append(ins[2])

for j in s:
    print(j, end="")
print()


Fixed submission:
s = list(input())
q = int(input())

revs = 0
front = []
rear = []

for i in range(q):
    ins = input().split()
    if(ins[0] == "1"):
        revs += 1
    else:
        if (ins[1] == "1" and revs%2 == 0 or ins[1] =="2" and revs%2 == 1):
            front.extend(ins[2])
        else:
            rear.extend(ins[2])

if (revs % 2 == 0):
    for j in reversed(front):
        print(j, end="")
    for j in s:
        print(j, end="")
    for j in rear:
        print(j, end="")
else:
    for j in reversed(rear):
        print(j, end="")
    for j in reversed(s):
        print(j, end="")
    for j in front:
        print(j, end="")
print()
Buggy python submission (verdict: Runtime Error):
import collections

n = int(input())

l = []

for i in range(n):
    l.append(input())
c = collections.Counter(l)
cx = c.most_common()
nm = cx[0][1]
for i in range(n):
    if (nm == cx[i][1]):
        print(cx[i][0])
    else:
        break

Fixed submission:
import collections

n = int(input())

l = []

for i in range(n):
    l.append(input())
c = collections.Counter(l)
cx = c.most_common()
nm = cx[0][1]
ans = []
ans.append(cx[0][0])
for i in range(1, len(cx)):
    if (nm == cx[i][1]):
        ans.append(cx[i][0])
    else:
        break

ansx = sorted(ans)
for i in range(len(ans)):
    print(ansx[i])
Buggy python submission (verdict: Runtime Error):
red blue
3 4
red


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

ans = a-(s == u)

print("{} {}\n".format(a-(s == u), b-(t == u)))
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
p = list(map(int, input().split()))
px = [(1 + p[i])/2 for i in range(n)]

ans = sum(px[0: 0 + k])
bef = sum(px[0: 0 + k])
for i in range(i, n - k + 1):
    bef = bef-px[i-1]+px[i+k-1]
    ans = max(ans, bef)
print(ans)


Fixed submission:
n, k = map(int, input().split())
p = list(map(int, input().split()))
px = [(1 + p[i])/2 for i in range(n)]

ans = sum(px[0: 0 + k])
bef = sum(px[0: 0 + k])
for i in range(1, n - k + 1):
    bef = bef-px[i-1]+px[i+k-1]
    ans = max(ans, bef)
print(ans)

Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
p = list(map(int, input().split()))
px = [(1 + p[i])/2 for i in range(n)]

ans = sum(px[i: i + k])
bef = sum(px[i: i + k])
for i in range(i, n - k + 1):
    bef = bef-px[i-1]+px[i+k-1]
    ans = max(ans, bef)
print(ans)


Fixed submission:
n, k = map(int, input().split())
p = list(map(int, input().split()))
px = [(1 + p[i])/2 for i in range(n)]

ans = sum(px[0: 0 + k])
bef = sum(px[0: 0 + k])
for i in range(1, n - k + 1):
    bef = bef-px[i-1]+px[i+k-1]
    ans = max(ans, bef)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
p = list(map(int, input().split()))
px = [(1 + p[i])/2 for i in range(n)]

ans = 0

for i in range(0, n - k + 1):
    ans = max(ans, sum(px[i: i + k]))
print(ans)


Fixed submission:
n, k = map(int, input().split())
p = list(map(int, input().split()))
px = [(1 + p[i])/2 for i in range(n)]

ans = sum(px[0: 0 + k])
bef = sum(px[0: 0 + k])
for i in range(1, n - k + 1):
    bef = bef-px[i-1]+px[i+k-1]
    ans = max(ans, bef)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
p = list(map(int, input().split()))

ans = 0
for i in range(n):
    tp = p[0:i+1]
    if (min(tp) >= p[i]):
        ans += 1
print(ans)


Fixed submission:
n = int(input())
p = list(map(int, input().split()))

ans = 0
pmax = p[0]
for i in range(n):
    if (p[i] <= pmax):
        ans += 1
        pmax = p[i]

print(ans)
Buggy python submission (verdict: Runtime Error):
s, t = input().split()
printf(s+t)

Fixed submission:
s, t = input().split()
print(t+s)
Buggy python submission (verdict: Time Limit Exceeded):
a, b, k = map(int, input().split())

for i in range(k):
    if (a >= 1):
        a -= 1
    elif (b >= 1):
        b -= 1
print("{} {}".format(a, b))


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

"""
for i in range(k):
    if (a >= 1):
        a -= 1
    elif (b >= 1):
        b -= 1
print("{} {}".format(a, b))
"""

if (a > k):
    ax = a - k
    bx = b
else:
    ax = 0
    bx = max(a+b-k, 0)

print("{} {}".format(ax, bx))
Buggy python submission (verdict: Runtime Error):
import numpy as np
import math

n = int(input())
x = []
for i in range(1,math.floor(math.sqrt(n))+1):
    if(n%i == 0):
        x.append(i+n/i-2-0)
print(round(min(x)))

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

if(a<10 and b<10):
    print(a*b)
else:
    print(-1)
Buggy python submission (verdict: Runtime Error):
import math

a,b,x= map(int,input().split())

deg = 0
enp = a*a*b - x

if(enp < a*a*b/2):
    ans  = math.atan2(a*a*a,enp)
else:
    ans = math.atan(a,b)
    
print(math.degrees(ans))

Fixed submission:
import math

a,b,x= map(int,input().split())

deg = 0
enp = a*a*b - x

if(x == a*a*b/2): #半分
    ans = 45
elif(x > a*a*b/2): #多い
    ans = math.degrees(math.atan2(2*enp,a*a*a))
else: #少ない
    ans = math.degrees(math.atan2(a*b*b,2*x))
    
print(ans)
Buggy python submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!

a,b = map(int,input().split())

print(max(0,a-2b))

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

a,b = map(int,input().split())

print(max(0,a-2*b))
Buggy python submission (verdict: Runtime Error):
n,k,q = map(int,(input().split()))

an = [0] * n

for i in range(q):
    an[int(input())] += 1

ans = ["No","Yes"]

for j in range(n):
    print(ans[k-q+an[j]>0])

Fixed submission:
n,k,q = map(int,(input().split()))

an = [0] * n

for i in range(q):
    an[int(input())-1] += 1

ans = ["No","Yes"]
#print(an)
for j in range(n):
    print(ans[k-q+an[j]>0])
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))

tmp = 0
for i in a:
   tmp += 1/a 

print(1/tmp)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
     
tmp = 0
for i in a:
    tmp += 1/i

print(1/tmp)
Buggy python submission (verdict: Runtime Error):
 r = int(input())
 
 print(3*r*r)

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

r = int(input())
 
print(3*r*r)
Buggy python submission (verdict: Runtime Error):
 n,b = map(int,input().split())
 
 print(n //(b*2))
 
 

Fixed submission:
n,b = map(int,input().split())
 
print(-(-n//(b*2 +1)))
Buggy python submission (verdict: Runtime Error):
n = int(input())

li = [int(input()) for i in range(n)]
ls = sorted(li, reverse = True)

m1 = ls[0]

for i in range(1,n):
    if(ls[i] != m1):
        m2 = ls[i]
        break

for i in li:
    print(m1 if(i != m1) else m2)

Fixed submission:
n = int(input())

li = [int(input()) for i in range(n)]
ls = sorted(li, reverse = True)

m1 = ls[0]
m2 = ls[1]
"""
for i in range(0,n):
    if(ls[i] != m1):
        m2 = ls[i]
        break
"""

for i in li:
    print(m1 if(i != m1) else m2)

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

li = [int(input()) for i in range(n)]

for i in range(n):
    if(i != 0):
        p1 = max(li[0:i])
    else:
        p1 = 0
    if(i != n-1):
        p2 = max(li[i+1:n])
    else:
        p2 = 0
    
    #print("{}, {}, {}".format(p1,p2,max(p1,p2)))
    print(max(p1,p2))

Fixed submission:
n = int(input())

li = [int(input()) for i in range(n)]
ls = sorted(li, reverse = True)

m1 = ls[0]
m2 = ls[1]
"""
for i in range(0,n):
    if(ls[i] != m1):
        m2 = ls[i]
        break
"""

for i in li:
    print(m1 if(i != m1) else m2)
Buggy python submission (verdict: Runtime Error):
n, a, b = map(int(input().split()))

print(min(n*a,b))

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

print(min(n*a, b))
Buggy python submission (verdict: Runtime Error):
import math

l, r = map(int, input().split())

ls = l % 2019
rs = r % 2019

dif = r // 2019 - l // 2019

#print("dif = {}".format(dif))

if (dif != 0):
    print(0)
elif (r - l == 1):
    print(lr*rs % 2019)
else:
    mini = []
    for i in range(ls, rs):
        mini.append(min(i * j % 2019 for j in range(ls + 1, rs)))
    print(min(mini))


Fixed submission:
import math

l, r = map(int, input().split())

ls = l % 2019
rs = r % 2019

dif = r // 2019 - l // 2019

#print("dif = {}".format(dif))

if (dif != 0):
    print(0)
elif (r - l == 1):
    print(ls*rs % 2019)
else:
    mini = []
    for i in range(ls, rs):
        mini.append(min(i * j % 2019 for j in range(ls + 1, rs+1)))
    print(min(mini))
Buggy python submission (verdict: Runtime Error):
n = int(input())
s =list(input())
k = int(input())

chk = s[k]
for i in range(len(s)):
	if(s[i] != chk):
		s[i] = "*"
print("".join(s))


Fixed submission:
n = int(input())
s =list(input())
k = int(input())

chk = s[k-1]
for i in range(len(s)):
	if(s[i] != chk):
		s[i] = "*"
	print(s[i],end="")
print("")

Buggy python submission (verdict: Runtime Error):
n = int(input())
s =list(input())
k = int(input())

chk = s[k]
for i in range(len(s)):
	if(s[i] != chk):
		s[i] = "*"
print("".join(s))


Fixed submission:
n = int(input())
s =list(input())
k = int(input())

chk = s[k-1]
for i in range(len(s)):
	if(s[i] != chk):
		s[i] = "*"
	print(s[i],end="")
print("")
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input.split())
print(max(2a-1,2b-1,a+b))

Fixed submission:
a,b=map(int,input().split())
print(max(2*a-1,2*b-1,a+b))
Buggy python submission (verdict: Runtime Error):
n = int(input())
h = list(map(int,input().split()))
ans=1
for j in range(1,n):
    if(h[j]>=h[0]:
       ans+=1
print(ans)

Fixed submission:
n = int(input())
h = list(map(int,input().split()))
ans=1
tp=h[0]
for j in range(1,n):
    if(h[j]>=tp):
        tp=h[j]
        ans+=1
print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
h = [int(input()) for i in range(n)]
ans=1
for j in range(1,n):
    if(h[j]>=h[0]:
       ans+=1
print(ans)

Fixed submission:
n = int(input())
h = list(map(int,input().split()))
ans=1
tp=h[0]
for j in range(1,n):
    if(h[j]>=tp):
        tp=h[j]
        ans+=1
print(ans)
Buggy python submission (verdict: Runtime Error):
an = []
for i in range(5):
    an.append(int(input()))
k=int(input())+1
if(an[]-an[]<k and an[]-an[]<k and an[]-an[]<k and an[]-an[]<k):
    print("Yay!")
else:
    print(":(")

Fixed submission:
an = []
for i in range(5):
    an.append(int(input()))
k=int(input())+1
if(an[4]-an[0]<k):
    print("Yay!")
else:
    print(":(")
Buggy python submission (verdict: Runtime Error):
x = [int(input()) for i in range(5)]
y = []
for i in range(5):
    tmp = x[i]%10
    if(tmp!=0):
        y.append(tmp)
md = min(y)
print(sum(x[i]//10 for i in range(5))*10 + (len(y)-1)*10+md)

Fixed submission:
x = [int(input()) for i in range(5)]
y = []
for i in range(5):
    tmp = x[i]%10
    if(tmp!=0):
        y.append(tmp)
if (y==[]):
    y = [0]
md = min(y)
print(sum(x[i]//10 for i in range(5))*10 + (len(y)-1)*10+md)
Buggy python submission (verdict: Runtime Error):
X = input()

if (X == “A”):
    print(“T”)
elif (X ==“T”):
    print(“A”)
elif (X == “G”):
    print(“C”)
else:
    print(“G”)


Fixed submission:
X = input()

if (X == "A"):
    print("T")
elif (X =="T"):
    print("A")
elif (X == "G"):
    print("C")
else:
    print("G")

Buggy python submission (verdict: Runtime Error):
X = input()

if (X == A):
    print(“T”)
elif (X ==T):
    print(“A”)
elif (X == G):
    print(“C”)
else:
    print(“G”)

Fixed submission:
X = input()

if (X == "A"):
    print("T")
elif (X =="T"):
    print("A")
elif (X == "G"):
    print("C")
else:
    print("G")
Buggy python submission (verdict: Time Limit Exceeded):
lx = list(map(int,input().split(" ")))
#la = [li[0]][li[1]]
la = []
cnt = 0

for i in range(0, lx[0]):
    la.append(list(map(int,input().split(" "))))

print("setok")
coin = 0
bottle = 0
for i in range(1, 10 ** 9):
    for j in range(0, lx[0]):
        if (la[j][0] == i):
            while (bottle <= lx[1] and la[j][1] > 0):
                coin += la[j][0]
                bottle += 1
                la[j][1] - 1
    if (bottle == lx[1]):
        break


Fixed submission:
lx = list(map(int,input().split(" ")))
la = []
cnt = 0

for i in range(0, lx[0]):
    la.append(list(map(int,input().split(" "))))

la = sorted(la)

coin = 0
bottle = lx[1]
i = -1
while (bottle > 0 and i < lx[0]-1):
    i += 1
    while (bottle > 0 and la[i][1] > 0):
        coin += la[i][0]
        bottle -= 1
        la[i][1] -= 1

print(coin)
Buggy python submission (verdict: Runtime Error):
list = list(map(int,input().split(" ")))

X = []
cnt = 0
for i in range(1, 1 + int(min(list[0],list[1]))):
  if(list[0] % i == 0 and list[1] % i == 0):
    X.append(i)
    cnt = 1
X.sorted(reverse)
if (cnt == 1):
  print(X[list[2]-1])
else:
  print(1)

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

X = []
cnt = 0
for i in range(1, 1 + int(min(list[0],list[1]))):
  if(list[0] % i == 0 and list[1] % i == 0):
    X.append(i)
    cnt = 1
X.sort(reverse=True)
if (cnt == 1):
  print(X[list[2]-1])
else:
  print(1)

Buggy python submission (verdict: Runtime Error):
list = list(map(int,input().split(" ")))

olist = []
cnt = 0
for i in range(1, int(min(list[0],list[1]))):
  if(list[0] % i == 0 and list[1] % i == 0):
    olist.append(i)
    cnt = 1
if (cnt == 1):
  print(olist[len(olist) + 1 - list[2]])
else:
  print(1)

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

X = []
cnt = 0
for i in range(1, 1 + int(min(list[0],list[1]))):
  if(list[0] % i == 0 and list[1] % i == 0):
    X.append(i)
    cnt = 1
X.sort(reverse=True)
if (cnt == 1):
  print(X[list[2]-1])
else:
  print(1)

Buggy python submission (verdict: Runtime Error):
list = list(map(int,input().split(" ")))

olist = []
for i in range(1, int(min(list[0],list[1]) / 2)):
  if(list[0] % i == 0 and list[1] % i == 0):
    olist.append(i)
print(olist[len(olist) + 1 - list[2]])

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

X = []
cnt = 0
for i in range(1, 1 + int(min(list[0],list[1]))):
  if(list[0] % i == 0 and list[1] % i == 0):
    X.append(i)
    cnt = 1
X.sort(reverse=True)
if (cnt == 1):
  print(X[list[2]-1])
else:
  print(1)
Buggy python submission (verdict: Runtime Error):
A, B, C = int(input())

if (A*A+B*B==C*C):
    print(A*B/2)
elif (A*A+C*C==B*B):
    print(A*C/2)
else:
    print(B*C/2)


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

if (A*A+B*B==C*C):
    s = A*B/2
elif (A*A+C*C==B*B):
    s = A*C/2
else:
    s = B*C/2

print(int(s))
Buggy python submission (verdict: Runtime Error):
# coding: utf-8

n = int(input())
a,b = map(int,input().split())
p = list(map(int,input().split()))

p.sort()

sep = []
for i in range(0,n):
    if(p[i] > a):
        sep.append(i)
        break
for i in range(sep[0],n):
    if(p[i] > b):
        sep.append(i)
        break

q1 = len(p[0:sep[0]])
q2 = len(p[sep[0]:sep[1]])
q3 = len(p[sep[1]:n])


#print("{}, {}, {}".format(q1,q2,q3))
print(min(q1,q2,q3))

Fixed submission:
# coding: utf-8

n = int(input())
a,b = map(int,input().split())
p = list(map(int,input().split()))

p.sort()

cnt = [0,0,0]

for i in range(0,n):
    if(p[i] <= a):
        cnt[0]+=1
    elif(a < p[i] <= b):
        cnt[1]+=1
    else:
        cnt[2]+=1

#print(cnt)
print(min(cnt))

Buggy python submission (verdict: Runtime Error):
# coding: utf-8

n = int(input())
a,b = map(int,input().split())
p = list(map(int,input().split()))

p.sort()

sep = []
for i in range(0,n-1):
    if(p[i] > a):
        sep.append(i)
        break
for i in range(sep[0],n-1):
    if(p[i] > b):
        sep.append(i)
        break

q1 = len(p[0:sep[0]])
q2 = len(p[sep[0]:sep[1]])
q3 = len(p[sep[1]:n])


#print("{}, {}, {}".format(q1,q2,q3))
print(min(q1,q2,q3))

Fixed submission:
# coding: utf-8

n = int(input())
a,b = map(int,input().split())
p = list(map(int,input().split()))

p.sort()

cnt = [0,0,0]

for i in range(0,n):
    if(p[i] <= a):
        cnt[0]+=1
    elif(a < p[i] <= b):
        cnt[1]+=1
    else:
        cnt[2]+=1

#print(cnt)
print(min(cnt))
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
h = list(map(int, input().split()))

ans = [0] * n

for i in range(1, n):
    l = min(i, k)
    hs = h[i]
    ans[i] = min([abs(hs - h[i - j])+ans[i-j] for j in range(1, l+1)])
    # j : 戻り幅
#print(ans)
print(ans[-1])

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

ans = [0] * n

for i in range(1, n):
    l = min(i, k)
    hs = h[i]
    ans[i] = min([abs(hs - h[i - j])+ans[i-j] for j in range(1, l+1)])
    # j : 戻り幅
#print(ans)
print(ans[-1])

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
h = list(map(int, input().split()))

ans = [0] * n

for i in range(1, n):
    l  =min(i, k)
    ans[i] = min([abs(h[i] - h[i - j])+ans[i-j] for j in range(1, l+1)])

#print(ans)
print(ans[n-1])

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

ans = [0] * n

for i in range(1, n):
    l = min(i, k)
    hs = h[i]
    ans[i] = min([abs(hs - h[i - j])+ans[i-j] for j in range(1, l+1)])
    # j : 戻り幅
#print(ans)
print(ans[-1])
Buggy python submission (verdict: Runtime Error):
Num = []
Num = list(map(int,input().split(" "))) #0-all 1-pick
lists = []
for i in range(0,Num[0]):
    lists.append(int(input()))
lists.sort()
lists.reverse()
dist = lists[0] - lists[0+Num[1]-1]
for j in range(1,Num[0] - Num[1] + 1):
    tmp = lists[j] - lists[j+Num[1]-1]
    if (dist > tmp):
        dist = tmp
print(dist)

Fixed submission:
D = int(input())
if (D == 25):
    print("Christmas")
elif (D == 24):
    print("Christmas Eve")
elif (D == 23):
    print("Christmas Eve Eve")
else:
    print("Christmas Eve Eve Eve")

Buggy python submission (verdict: Runtime Error):
X = int(input())
if (D == 25):
    print("Christmas")
elif (D == 24):
    print("Christmas Eve")
elif (D == 23):
    print("Christmas Eve Eve")
else:
    print("Christmas Eve Eve Eve")

Fixed submission:
D = int(input())
if (D == 25):
    print("Christmas")
elif (D == 24):
    print("Christmas Eve")
elif (D == 23):
    print("Christmas Eve Eve")
else:
    print("Christmas Eve Eve Eve")
Buggy python submission (verdict: Runtime Error):
print(int(input())+int(input())/2)

Fixed submission:
X, Y = map(int, input().split())

print(int(X + Y/2))

Buggy python submission (verdict: Runtime Error):
print(int(input())+Int(input())/2)

Fixed submission:
X, Y = map(int, input().split())

print(int(X + Y/2))