Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N, k = [int(s) for s in input().split(' ')]
 
h = []
while len(h) != N:
    heapq.heappush(h, int(input()))
  
min_height = 1000000000
h.sort()
for start in range(0, N - k + 1):
    end = start + k - 1
    diff = h[end] - h[start]
    if diff < min_height:
        min_height = diff
print(min_height)

Fixed submission:
import heapq
 
N, k = [int(s) for s in input().split(' ')]
 
h = []
while len(h) != N:
    heapq.heappush(h, int(input()))
  
min_height = 1000000000
h = heapq.nsmallest(N, h)
for start in range(0, N - k + 1):
    end = start + k - 1
    diff = h[end] - h[start]
    if diff < min_height:
        min_height = diff
print(min_height)

Buggy python submission (verdict: Runtime Error):
import heapq

N, k = int(input()), int(input())

h = []
while N > 0:
  heapq.heappush(h, int(input()))
  N -= 1
  
trees = heapq.nlargest(k, h)
if len(trees) <= 1:
  print(0)
else:
  print(trees[-1] - trees[0])

Fixed submission:
import heapq
 
N, k = [int(s) for s in input().split(' ')]
 
h = []
while len(h) != N:
    heapq.heappush(h, int(input()))
  
min_height = 1000000000
h = heapq.nsmallest(N, h)
for start in range(0, N - k + 1):
    end = start + k - 1
    diff = h[end] - h[start]
    if diff < min_height:
        min_height = diff
print(min_height)
Buggy python submission (verdict: Runtime Error):
a, b, c, d = input().split(" ")
print(abs(a - c) >= d) || (abs(a - b) >= d && abs(b - c) >= d))

Fixed submission:
a, b, c, d = input().split(" ")
a = int(a)
b = int(b)
c = int(c)
d = int(d)
if abs(a - c) <= d or (abs(a - b) <= d and abs(b - c) <= d):
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
a, b, c, d = input().split(" ")
print(abs(a - c) >= d || (abs(a - b) >= d && abs(b - c) >= d))


Fixed submission:
a, b, c, d = input().split(" ")
a = int(a)
b = int(b)
c = int(c)
d = int(d)
if abs(a - c) <= d or (abs(a - b) <= d and abs(b - c) <= d):
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
a, b, c, d = input().split(" ")
return abs(a - c) >= d || (abs(a - b) >= d && abs(b - c) >= d)

Fixed submission:
a, b, c, d = input().split(" ")
a = int(a)
b = int(b)
c = int(c)
d = int(d)
if abs(a - c) <= d or (abs(a - b) <= d and abs(b - c) <= d):
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
a = input()
b = input()

for _a, _b in zip(a, b):
    print(_a, _b, sep='', end='')
if len(a) > len(b):
    print(a[-1])

Fixed submission:
numbers = list(map(int, input().split(' ')))
if numbers[2] - numbers[1] == numbers[1] - numbers[0]:
    print('YES')
else:
    print('NO')

Buggy python submission (verdict: Runtime Error):
numbers = map(int, input().split(' '))
if numbers[2] - numbers[1] == numbers[1] - numbers[0]:
    print('YES')
else:
    print('NO')

Fixed submission:
numbers = list(map(int, input().split(' ')))
if numbers[2] - numbers[1] == numbers[1] - numbers[0]:
    print('YES')
else:
    print('NO')
Buggy python submission (verdict: Runtime Error):
import math

i = input()

c = abs(i - 25)

s = "Christmas"

for _ in range(c)
	s += " Eve"

print(s)

Fixed submission:
i = input()

c = abs(int(i) - 25)

s = "Christmas"

for _ in range(c):
    s += " Eve"

print(s)
Buggy python submission (verdict: Runtime Error):
input_ = input()

m = 0
s = 0
for i in input_.splitlines():
    n = int(i)
    if i > max:
        max = i
    sum += n

print(sum - (max / 2))


Fixed submission:
n = input()
a = []
for i in range(int(n)):
    a.append(int(input()))

print(int(sum(a) - (max(a) / 2)))
Buggy python submission (verdict: Runtime Error):
import math
N,X=map(int,input().split(" "))
xl=list(map(int,input().split(" ")))
xl.append(X)
xl=sorted(xl)
xx=[xl[i+1]-xl[i] for i in range(len(xl)-1)]
ans=max(xx)
for i in range(len(xx)):
    ans=math.gcd(ans,xx[i])

print(ans)

Fixed submission:
def gcd(a, b):
	while b:
		a, b = b, a % b
	return a


N,X=map(int,input().split(" "))
xl=list(map(int,input().split(" ")))
xl.append(X)
xl=sorted(xl)

xx=[xl[i+1]-xl[i] for i in range(len(xl)-1)]

ans=max(xx)
for i in range(len(xx)):
    ans=gcd(ans,xx[i])

print(ans)

Buggy python submission (verdict: Runtime Error):
import math

N,X=map(int,input().split(" "))
xl=list(map(int,input().split(" ")))
xl.append(X)
xl=sorted(xl)

xy=[xl[i+1]-xl[i] for i in range(len(xl)-1)]

ans=max(xy)
for i in range(len(xy)):
    ans=math.gcd(ans,xy[i])

print(ans)

Fixed submission:
def gcd(a, b):
	while b:
		a, b = b, a % b
	return a


N,X=map(int,input().split(" "))
xl=list(map(int,input().split(" ")))
xl.append(X)
xl=sorted(xl)

xx=[xl[i+1]-xl[i] for i in range(len(xl)-1)]

ans=max(xx)
for i in range(len(xx)):
    ans=gcd(ans,xx[i])

print(ans)

Buggy python submission (verdict: Runtime Error):
import math

N,X=map(int,input().split(" "))
xl=list(map(int,input().split(" ")))
xl.append(X)
xl=sorted(xl)

xy=[xl[i+1]-xl[i] for i in range(len(xl)-1)]

ans=max(xy)
for i in range(len(xy)):
    ans=math.gcd(ans,xy[i])

print(ans)

Fixed submission:
def gcd(a, b):
	while b:
		a, b = b, a % b
	return a


N,X=map(int,input().split(" "))
xl=list(map(int,input().split(" ")))
xl.append(X)
xl=sorted(xl)

xx=[xl[i+1]-xl[i] for i in range(len(xl)-1)]

ans=max(xx)
for i in range(len(xx)):
    ans=gcd(ans,xx[i])

print(ans)
Buggy python submission (verdict: Runtime Error):
N,K=map(int,input().split(" "))
X=sorted(list(map(int,input().split(" "))))

ans=0
for i in range(N-K+1):
    tans=abs(X[i]-X[i+K])+abs(X[i])

    if i==0 or ans>tans:
        ans=tans
    
print(ans)

Fixed submission:
N,K=map(int,input().split(" "))
X=sorted(list(map(int,input().split(" "))))

ans=0
for i in range(N-K+1):
    tans=abs(X[i]-X[i+K-1])+abs(X[i])

    if i==0 or ans>tans:
        ans=tans

for i in range(N-K+1):
    tans=abs(X[i]-X[i+K-1])+abs(X[i+K-1])

    if ans>tans:
        ans=tans

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import itertools as ito
N,K=map(int,input().split(" "))
X=list(map(int,input().split(" ")))

Ex=list(ito.permutations(X,K))

ans=0
for i in range(len(Ex)):
    tans=0
    tx=0
    for j in range(len(Ex[i])):
        tans+=abs(tx-Ex[i][j])
        tx=Ex[i][j]
        
    if tans<ans or i==0:
        ans=tans
    
print(ans)

Fixed submission:
N,K=map(int,input().split(" "))
X=sorted(list(map(int,input().split(" "))))

ans=0
for i in range(N-K+1):
    tans=abs(X[i]-X[i+K-1])+abs(X[i])

    if i==0 or ans>tans:
        ans=tans

for i in range(N-K+1):
    tans=abs(X[i]-X[i+K-1])+abs(X[i+K-1])

    if ans>tans:
        ans=tans

print(ans)
Buggy python submission (verdict: Runtime Error):
A=int(input())
B=int(input())

print((A-1)*(B-1))

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

print((A-1)*(B-1))
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = input()
result = []

for i in range(n):
    count = 0
    for j in range(n):
        if (i < j) and (s[j] == "E"):
            count += 1
        elif (i > j) and (s[j] == "W"):
            count += 1
    result.append(count)

pprint(min(result))


Fixed submission:
a, b = map(int, input().split())
print(max([a+b, a-b, a*b]))
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = input()
result = []
 
for i in range(n):
    count = 0
    for j in range(n):
        if (i < j) and (s[j] == "E"):
            count += 1
        elif (i > j) and (s[j] == "W"):
            count += 1
    result.append(count)
 
pprint(min(result))

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

tmp = 0
for i in range(1, n):
    if s[i] == "E":
        tmp += 1
count = tmp

for i in range(1, n):
    if s[i-1] == "W":
        tmp += 1
    if s[i] == "E":
        tmp -= 1
    count = min(count, tmp)
print(count)
Buggy python submission (verdict: Runtime Error):
n = int(input())

if (n[0] == n[1]) and (n[1] == n[2]):
  print('Yes')
elif (n[1] == n[2]) and (n[2] == n[4]):
  print('Yes')
else:
  print('No')

Fixed submission:
n = input()

if (n[0] == n[1]) and (n[1] == n[2]):
  print('Yes')
elif (n[1] == n[2]) and (n[2] == n[3]):
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
n = int(input())
if n[0] == n[1] and n[1] == n[2]:
  print('Yes')
elif n[1] == n[2] and n[2] == n[3]:
  print('Yes')
else:
  print('No')

Fixed submission:
n = input()

if (n[0] == n[1]) and (n[1] == n[2]):
  print('Yes')
elif (n[1] == n[2]) and (n[2] == n[3]):
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
n = input()
a = int(n[0])
b = int(n[1])
c = int(n[2])
d = int(n[3])

if a+b+c+d == 7:
    print('{}+{}+{}+{}=7'.format(a, b, c, d))
elif a+b+c-d == 7:
    print(('{}+{}+{}-{}=7'.format(a, b, c, d))
elif a+b-c+d == 7:
    print('{}+{}-{}+{}=7'.format(a, b, c, d))
elif a+b-c-d == 7:
    print('{}+{}-{}-{}=7'.format(a, b, c, d))
elif a-b+c+d == 7:
    print('{}-{}+{}+{}=7'.format(a, b, c, d))
elif a-b+c-d == 7:
    print('{}-{}+{}-{}=7'.format(a, b, c, d))
elif a-b-c+d == 7:
    print('{}-{}-{}+{}=7'.format(a, b, c, d))
elif a-b-c-d == 7:
    print('{}-{}-{}-{}=7'.format(a, b, c, d))

Fixed submission:
n = input()
a = int(n[0])
b = int(n[1])
c = int(n[2])
d = int(n[3])

if a+b+c+d == 7:
    print('{}+{}+{}+{}=7'.format(a, b, c, d))
elif a+b+c-d == 7:
    print('{}+{}+{}-{}=7'.format(a, b, c, d))
elif a+b-c+d == 7:
    print('{}+{}-{}+{}=7'.format(a, b, c, d))
elif a+b-c-d == 7:
    print('{}+{}-{}-{}=7'.format(a, b, c, d))
elif a-b+c+d == 7:
    print('{}-{}+{}+{}=7'.format(a, b, c, d))
elif a-b+c-d == 7:
    print('{}-{}+{}-{}=7'.format(a, b, c, d))
elif a-b-c+d == 7:
    print('{}-{}-{}+{}=7'.format(a, b, c, d))
elif a-b-c-d == 7:
    print('{}-{}-{}-{}=7'.format(a, b, c, d))
Buggy python submission (verdict: Runtime Error):
print('Christmas' + *' Eve'(25-int(input())))

Fixed submission:
print('Christmas' + ' Eve' * (25 - int(input())))
Buggy python submission (verdict: Runtime Error):
l= input().split
X = int(l[0])
Y = int(l[1])
x = X + Y/2
print(x)

Fixed submission:
l = input().split()
X = int(l[0])
Y = int(l[1])
x = int(X + Y/2)
print(x)
Buggy python submission (verdict: Runtime Error):
S = input()
ans = 0
for i in S:
  if i == "+":
    ans++
  else:
    ans--
print(ans)


Fixed submission:
S = input()
ans = 0
for i in S:
  if i == "+":
    ans += 1
  else:
    ans -= 1
print(ans)
Buggy python submission (verdict: Runtime Error):
S = input()
ans = 700
for i in range S:
  if i == "o":
    ans += 100
  if i == "x":
    ans += 0
print(ans)


Fixed submission:
S = input()
ans = 700
for i in S:
  if i == "o":
    ans += 100
  if i == "x":
    ans += 0
print(ans)

Buggy python submission (verdict: Runtime Error):
S = input()
for i in S:
  if i == "o":
    ans += 100
  if i == "x":
    ans += 0
print(ans)


Fixed submission:
S = input()
ans = 700
for i in S:
  if i == "o":
    ans += 100
  if i == "x":
    ans += 0
print(ans)

Buggy python submission (verdict: Runtime Error):
S = input()
for i in range S:
  if i == "o":
    ans += 100
  if i == "x":
    ans += 0
print(ans)


Fixed submission:
S = input()
ans = 700
for i in S:
  if i == "o":
    ans += 100
  if i == "x":
    ans += 0
print(ans)

Buggy python submission (verdict: Runtime Error):
S = input()
for i in range S:
  if i == "o":
    ans += 100
  else:
    ans += 0
print(ans)

Fixed submission:
S = input()
ans = 700
for i in S:
  if i == "o":
    ans += 100
  if i == "x":
    ans += 0
print(ans)
Buggy python submission (verdict: Runtime Error):
A,B,C,D = map(int,input().split())
ans = min(A,B) + min(C, D)
print(ans)

Fixed submission:
A = int(input())
B = int(input())
C = int(input())
D = int(input())
ans = min(A,B) + min(C,D)
print(ans)
Buggy python submission (verdict: Runtime Error):
A,B,C = map(int,input().split())
if A + 2B <= C:
  print("Yes")
else:
  print("No")
  

Fixed submission:
A,B,C = map(int,input().split())
if A + B >= C:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
N = input()
A = input()
if (N % 500) <= A:
  print("Yes")
else:
  print("No")

Fixed submission:
N = int(input())
A = int(input())
if (N % 500) <= A:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
a,b = int(input())
average = (a + b) / 2
if (a + b) % 2 == 0:
  print(ans)
else:
  print(ans + 1)

Fixed submission:
a,b = map(int,input().split())
average = int((a + b) / 2)
if (a + b) % 2 == 0:
  print(average)
else:
  print(average + 1)
Buggy python submission (verdict: Runtime Error):
X,Y = input.split()
if X > Y :
  print(">")
elif X < Y:
  print("<")
else:
  print("=")
  

Fixed submission:
X,Y = input().split()
if X > Y :
  print(">")
elif X < Y:
  print("<")
else:
  print("=")

Buggy python submission (verdict: Runtime Error):
X,Y = input()
A = 11
B = 12
C = 13
D = 14
E = 15
F = 16
if X > Y:
  print >
elif X = Y:
  print =
else:
  print <

Fixed submission:
X,Y = input().split()
if X > Y :
  print(">")
elif X < Y:
  print("<")
else:
  print("=")
Buggy python submission (verdict: Runtime Error):
R = int.input()
G = int.input()
ans = 2 * G - R
print(ans)

Fixed submission:
R = int(input())
G = int(input())
ans = 2 * G - R
print(ans)
Buggy python submission (verdict: Runtime Error):
X,t = map(int,input.split())
snd = X - t
if X > t:
  print(snd)
else:
  print(0)

Fixed submission:
X,t = map(int,input().split())
snd = X - t
if X > t:
  print(snd)
else:
  print(0)
Buggy python submission (verdict: Runtime Error):
n,m = int(input())
ans = (n - 1) * (m - 1)
print(ans)

Fixed submission:
n,m = map(int,input().split())
ans = (n - 1) * (m - 1)
print(ans)
Buggy python submission (verdict: Runtime Error):
A,B = map(int,input().split())
if A % 3 == 0 or B % 3 == 0or A + B % 3 == 0:
  print("Possible")
else:
  print("Impossible")


Fixed submission:
A,B = map(int,input().split())
if A % 3 == 0 or B % 3 == 0 or (A + B) % 3 == 0:
  print("Possible")
else:
  print("Impossible")
Buggy python submission (verdict: Runtime Error):
a = list(map(int,input()split())
a.sort()
print(a[0] + a[1])


Fixed submission:
a = list(map(int,input().split()))
a.sort()
print(a[0] + a[1])

Buggy python submission (verdict: Runtime Error):
lines = list(str.split())
a = int(lines[0])
b = int(lines[1])
c = int(lines[2])
sum_list = [a+b, a+c, b+c]
print(min(sum_list))

Fixed submission:
lines = list(input().split())
a = int(lines[0])
b = int(lines[1])
c = int(lines[2])
sum_list = [a+b, a+c, b+c]
print(min(sum_list))
Buggy python submission (verdict: Time Limit Exceeded):
N, X = map(int, input(). split())
ban = [0]
patty = [1]

B = [1]
for i in range(N):
    B = ban + B + patty + B + ban

print(sum(B[:X]))

Fixed submission:
N, X = map(int, input(). split())
a, p = [1], [1]

for n in range(N):
    a.append(a[n]*2 + 3)
    p.append(p[n]*2 + 1)

def xmas(N, X):
    if N == 0:
        return 0 if X <= 0 else 1
    elif X <= 1 + a[N-1]:
        return xmas(N-1, X-1)
    else :
        return p[N-1] + 1 + xmas(N-1, X-(a[N-1]+2))

print(xmas(N, X))
Buggy python submission (verdict: Runtime Error):
import bisect

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

ans = 0

for b in B:
   ans += (bisect.bisect_left(A,b)) *(N - bisect.bisect_right(C,b))

print(ans)

Fixed submission:
A = list(input())
B = list(input())

if (A[0] == B[2] and A[1] == B[1] and A[2] == B[0]):
    print('YES')
else:
    print('NO')
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
Ai = list(map(int, input(). split()))
Bi = list(map(int, input(). split()))
Ci = list(map(int, input(). split()))

Ai.sort()
Bi.sort()
Ci.sort()
count = 0

for k in range(N):
    for j in range(N):
        for i in range(N):
            if (Ci[k] > Bi[j]):
                if (Bi[j] > Ai[i]):
                    count += 1
                else:
                    break
            else:
                break
            
print(count)

Fixed submission:
import bisect

N = int(input())
A = sorted(list(map(int, input(). split())))
B = list(map(int, input(). split()))
C = sorted(list(map(int, input(). split())))

ans = 0

for b in B:
   ans += (bisect.bisect_left(A,b)) *(N - bisect.bisect_right(C,b))

print(ans)
Buggy python submission (verdict: Runtime Error):
N = input()
p = [int(input()) for i in range(N)]
print(sum(p) - max(p) // 2)


Fixed submission:
N = int(input())
p = [int(input()) for i in range(N)]
print(sum(p) - max(p) // 2)
Buggy python submission (verdict: Runtime Error):
n = int(input())
if n < 105:
    print(0)
else:
    print(1)

Fixed submission:
i = input()
A = i.split(" ")[0]
B = i.split(" ")[1]
print((int(A)-1)*(int(B)-1))

Buggy python submission (verdict: Runtime Error):
A = input()
B = input()
print((int(A)-1)*(int(B)-1))

Fixed submission:
i = input()
A = i.split(" ")[0]
B = i.split(" ")[1]
print((int(A)-1)*(int(B)-1))
Buggy python submission (verdict: Time Limit Exceeded):
s = 0
answer = 1
d = {}
N = int(input())
n = N

if n < 105:
    print("0")
else:
    if n == 105 or n == 106:
        print("1")
    for i in range(107,N+1,2):
        for j in range(2,i+1):
            s = 0
            while s == 0:
                if i % j == 0:
                    if str(j) in d:
                        d[str(j)] += 1
                    else:
                        d[str(j)] = 1
                else:
                    s = 1
        r = 1
        for k in d:
            r *= (k+1)
        if r == 8:
            answer += 1
        
        print(answer)

Fixed submission:
N = int(input())
s = 0
for i in range(1,N+1,2):
    st = 0
    for j in range(1,i+1):
        if i% j == 0:
            st += 1
    if st == 8:
        s += 1
print(s)
Buggy python submission (verdict: Runtime Error):
S = input()
S = S.split()
N = int(S[0])
K = int(S[1])
h = [int(input()) for i in range(N)]
h.sort()
ans = 10**9 + 1
for i in range(N - K + 1):
    tmp = h[i + 3 - 1] - h[i]
    if(tmp < ans):
        ans = tmp
print(ans)


Fixed submission:
S = input()
S = S.split()
N = int(S[0])
K = int(S[1])
h = [int(input()) for i in range(N)]
h.sort()
ans = 10**9 + 1
for i in range(N - K + 1):
    tmp = h[i + K - 1] - h[i]
    if(tmp < ans):
        ans = tmp
print(ans)
Buggy python submission (verdict: Runtime Error):
N, T = map(int, input().split())
l = []
for i in range(N):
    c, t = map(int, input().split())
    if T >= t:
        l.append(c)
print(min(l))


Fixed submission:
N, T = map(int, input().split())
l = []
for i in range(N):
    c, t = map(int, input().split())
    if T >= t:
        l.append(c)
if len(l) == 0:
    print('TLE')
else:
    print(min(l))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = list(map(int, input().split()))
X = sum(a)
ans = abs(X - 2*a[0])
for i in range(2, N):
    tmp = abs(X-2*sum(a[:i]))
    if (ans > tmp):
        ans = tmp
print(ans)


Fixed submission:
N = int(input())
a = list(map(int, input().split()))
X = sum(a)
x = a[0]
ans = abs(X - 2*x)
for i in range(1, N-1):
    x += a[i]
    tmp = abs(X-2*x)
    if (ans > tmp):
        ans = tmp
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = list(map(int, input().split()))
ans = abs(a[0] - (sum(a) - a[0]))
for i in range(2, N):
    tmp = abs(sum(a[i:]) - sum(a[:i]))
    if (ans > tmp):
        ans = tmp
print(ans)


Fixed submission:
N = int(input())
a = list(map(int, input().split()))
X = sum(a)
x = a[0]
ans = abs(X - 2*x)
for i in range(1, N-1):
    x += a[i]
    tmp = abs(X-2*x)
    if (ans > tmp):
        ans = tmp
print(ans)
Buggy python submission (verdict: Runtime Error):
N, X = map(int, input().split())

a, p = [1], [1]
for i in range(N):
a.append(a[i] * 2 + 3)
p.append(p[i] * 2 + 1)

def f(N, X): # X <= 0 や X > a_N を許容し解説本文から簡略化
  if N == 0:
    return 0 if X <= 0 else 1
  elif X <= 1 + a[N-1]:
    return f(N-1, X-1)
  elif X == 2 + a[N-1]:
    return p[N-1] + 1
  elif X == 3 + 2 * a[N-1]:
    return 2 * p[N-1] + 1
  else:
    return p[N-1] + 1 + f(N-1, X-2-a[N-1])
print(f(N, X))

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

a, p = [1], [1]
for i in range(N):
  a.append(a[i] * 2 + 3)
  p.append(p[i] * 2 + 1)

def f(N, X): # X <= 0 や X > a_N を許容し解説本文から簡略化
  if N == 0:
    return 0 if X <= 0 else 1
  elif X <= 1 + a[N-1]:
    return f(N-1, X-1)
  else:
    return p[N-1] + 1 + f(N-1, X-2-a[N-1])

print(f(N, X))

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

a, p = [1], [1]
for i in range(N):
　a.append(a[i] * 2 + 3)
　p.append(p[i] * 2 + 1)

def f(N, X): # X <= 0 や X > a_N を許容し解説本文から簡略化
　if N == 0:
　　return 0 if X <= 0 else 1
　elif X <= 1 + a[N-1]:
　　return f(N-1, X-1)
　else:
　　return p[N-1] + 1 + f(N-1, X-2-a[N-1])

print(f(N, X))

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

a, p = [1], [1]
for i in range(N):
  a.append(a[i] * 2 + 3)
  p.append(p[i] * 2 + 1)

def f(N, X): # X <= 0 や X > a_N を許容し解説本文から簡略化
  if N == 0:
    return 0 if X <= 0 else 1
  elif X <= 1 + a[N-1]:
    return f(N-1, X-1)
  else:
    return p[N-1] + 1 + f(N-1, X-2-a[N-1])

print(f(N, X))
Buggy python submission (verdict: Runtime Error):
C11,C12,C13 = map(str,input().split())
C21,C22,C23 = map(str,input().split())

if C11 == C23 and C12 == C22 and C13 == C21:
    print('YES')
else:
    print('NO')

Fixed submission:
c1 = input()
c2 = input()

if c1 == c2[::-1]:
    print('YES')
else:
    print('NO')
Buggy python submission (verdict: Runtime Error):
N, K = (int(x) for x in input().split())
h = [int(input()) for i in range(K)]
h.sort()
print(min(h[i+K-1] - h[i] for i in range(N-K+1)))

Fixed submission:
N, K = (int(x) for x in input().split())
h = [int(input()) for i in range(N)]
h.sort()
print(min(h[i+K-1] - h[i] for i in range(N-K+1)))
Buggy python submission (verdict: Runtime Error):
X, Y =(int(i),for i in input().split())
print(X+(Y/2))

Fixed submission:
X, Y =(int(i) for i in input().split())
print(int(X+Y/2))
Buggy python submission (verdict: Runtime Error):
N = int(input())
if N == 1:
	print("Hello World")
else:
	A = int(input())
	B = int(input())
	print(A + B)
N = int(input())
if N == 1:
	print("Hello World")
else:
	A = int(input())
	B = int(input())
	print(A + B)


Fixed submission:
N = int(input())
if N == 1:
	print("Hello World")
else:
	A = int(input())
	B = int(input())
	print(A + B)
Buggy python submission (verdict: Runtime Error):
#! /usr/bin/env python3
# -*- coding: utf-8 -*-


nnk = input().split(" ")
n = int(nnk[0])
k = int(nnk[1])

hs = [int(input()) for l in range(n)]
hs.sort()

hmmm = []
for l in range(n-k+1):
    hmmm.append(hs[k+l-1] - hs[l])

hmmm.sort()
print(hmmm[0])

Fixed submission:
#! /usr/bin/env python3
# -*- coding: utf-8 -*-


d = input()

if d == "22":
    print("Christmas Eve Eve Eve")
elif d == "23":
    print("Christmas Eve Eve")
elif d == "24":
    print("Christmas Eve")
elif d == "25":
    print("Christmas")

Buggy python submission (verdict: Runtime Error):
nnk = list(map(lambda x: int(x), input().split(" ")))
n = nnk[0]
k = nnk[1]

hs = [int(input()) for l in range(n)]
hs.sort()

hmmm = []
for l in range(n-k+1):
    hmmm.append(hs[k+l-1] - hs[l])

hmmm.sort()
print(hmmm[0])

Fixed submission:
#! /usr/bin/env python3
# -*- coding: utf-8 -*-


d = input()

if d == "22":
    print("Christmas Eve Eve Eve")
elif d == "23":
    print("Christmas Eve Eve")
elif d == "24":
    print("Christmas Eve")
elif d == "25":
    print("Christmas")

Buggy python submission (verdict: Runtime Error):
#! /usr/bin/env python3
# -*- coding: utf-8 -*-


nnk = list(map(lambda x: int(x), input().split(" ")))
n = nnk[0]
k = nnk[1]

hs = [int(input()) for l in range(n)]
hs.sort()

num = n - k + 1

hmmm = []
for l in range(num):
    hmmm.append(hs[k+l-1] - hs[l])

hmmm.sort()
print(hmmm[0])

Fixed submission:
#! /usr/bin/env python3
# -*- coding: utf-8 -*-


d = input()

if d == "22":
    print("Christmas Eve Eve Eve")
elif d == "23":
    print("Christmas Eve Eve")
elif d == "24":
    print("Christmas Eve")
elif d == "25":
    print("Christmas")