Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
def chmin(a,b):
    if a > b:
        a = b
    else:
        pass
    return a    
N, K = map(int, input().split())    
H = list(map(int, input().split()))

dp = [float("inf") for _ in range(N)]
dp[0] = 0

for i in range(N-1):
    for j in range(1, min(K+1, N-i)):
        dp[i+j] = chmin(dp[i+j], dp[i]+abs(H[i+j]-H[i]))

print(dp[N-1])

Fixed submission:
N, K = map(int, input().split())
*h, = map(int, input().split())
dp = [float("inf") for _ in range(N)]
dp[0] = 0
for i in range(N - 1):
	for j in range(1, min(K + 1, N - i)):
		dp[i + j] = min(dp[i + j], dp[i] + abs(h[i + j] - h[i]))
print(dp[N - 1])

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
*h, = map(int, input().split())
dp = [float("inf") for _ in range(N)]
dp[0] = 0
for i in range(N - 1):
	for j in range(1, min(K + 1, N - i)):
		dp[i + j] = min(dp[i + j], dp[i] + abs(h[i + j] - h[i]))
print(dp[N - 1])

Fixed submission:
N, K = map(int, input().split())
*h, = map(int, input().split())
dp = [float("inf") for _ in range(N)]
dp[0] = 0
for i in range(N - 1):
	for j in range(1, min(K + 1, N - i)):
		dp[i + j] = min(dp[i + j], dp[i] + abs(h[i + j] - h[i]))
print(dp[N - 1])

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
H = list(map(int, input().split()))
dp = [float("inf") for _ in range(n)]  # 最小化問題なのでinfで初期化
dp[0] = 0  # 初期条件
 
dp[1] = dp[0] + abs(H[1] - H[0])  # 初期条件2
 
for i in range(n - 1):  # 配るDP
    for j in  range(1, min(k+1, n-i)):
        dp[i + j] = min(dp[i + j], dp[i] + abs(H[i + j] - H[i]))
print(dp[n - 1])

Fixed submission:
N, K = map(int, input().split())
*h, = map(int, input().split())
dp = [float("inf") for _ in range(N)]
dp[0] = 0
for i in range(N - 1):
	for j in range(1, min(K + 1, N - i)):
		dp[i + j] = min(dp[i + j], dp[i] + abs(h[i + j] - h[i]))
print(dp[N - 1])

Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
H = list(map(int, input().split()))
dp = [float("inf") for _ in range(n)]  # 最小化問題なのでinfで初期化
dp[0] = 0  # 初期条件

dp[1] = dp[0] + abs(H[1] - H[0])  # 初期条件2

for i in range(n - 1):  # 配るDP
    for j range(1, min(k+1, n-i))
        dp[i + j] = min(dp[i + j], dp[i] + abs(H[i + j] - H[i]))
print(dp[n - 1])


Fixed submission:
N, K = map(int, input().split())
*h, = map(int, input().split())
dp = [float("inf") for _ in range(N)]
dp[0] = 0
for i in range(N - 1):
	for j in range(1, min(K + 1, N - i)):
		dp[i + j] = min(dp[i + j], dp[i] + abs(h[i + j] - h[i]))
print(dp[N - 1])
Buggy python submission (verdict: Runtime Error):
N = 3
A=[[10, 40, 70], [20, 50, 80], [30, 60, 90]]
dp = [[0] * 3 for _ in range(N)]  # 初期化
dp[0] = A[0]  # 初期化
print(dp[0])
for i in range(N-1):
    for j in range(3):
        for k in range(3):
            if j == k:
                continue
            dp[i+1][k] = max(dp[i+1][k], dp[i][j] + A[i][k])
print(max(dp[N-1])            


Fixed submission:
N = int(input())
Y = []
for _ in range(N):
    Y.append(list(map(int, input().split())))  # Y = [[3, 9, 7], [10, 3, 2]]
dp = [[0] * 3 for _ in range(N)]  # 初期化
dp[0] = Y[0]  # 初期化

# A, B, C の3パターン以外にも対応
for i in range(N-1):
    for j in range(3):
        for k in range(3):
            if j == k:
                continue
            dp[i+1][j] = max(dp[i+1][j], dp[i][k] + Y[i+1][j])
print(max(dp[N-1]))
Buggy python submission (verdict: Runtime Error):
a, b, c, d = input() # 1114
print("Yes" if a==b==c or b==c==d else "No")

n=input()
print("Yes" if n[0]==n[1]==n[2] or n[0]==n[1]==n[2] else "No")

Fixed submission:
a, b, c, d = input() # 1114
print("Yes" if a==b==c or b==c==d else "No")
Buggy python submission (verdict: Runtime Error):
K = int(input())
X = int(input())

if K*500 > X:
  print('Yes')
else:
  print('No')

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

if K*500 >= X:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
import math

N = int(input())
X = math.log(N + 1, 2)
Y = math.ceil(X)

print(Y)

Fixed submission:
import math

N, R = map(int, input().split())
X = math.log(N + 0.000001, R)
Y = math.ceil(X)

print(Y)
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
P = list(map(int, input().split()))
A = []

for i in range (N - K + 1):
    x = 0
    for j in range (K):
        x += ((P[i+j]+1)/2)
        #print("i={} j={}".format(i,j))
    A.append(x)

print(max(A))

Fixed submission:
N, K = map(int, input().split())
P = list(map(int, input().split()))
L = [(x+1)/2 for x in P]

ans = tmp = sum(L[:K])

for i in range (N-K):
    nxt = tmp + L[K+i] - L[i]
    ans = max(ans, nxt)
    tmp = nxt

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
P = list(map(int, (input().split())))
count = 1
for i in range (1, n):
    if P[i] <= min(P[:i]):
        count += 1

print(count)

Fixed submission:
n = int(input())
P = list(map(int, (input().split())))
count = 1
tmp = P[0]
for i in range (1, n):
    if P[i] <= tmp:
        count += 1
        tmp = P[i]
print(count)
Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
N = int(input())

for i in range (a):
    for j in range (b):
        for k in range (c):
            if i * 50 + j * 100 + k * 500 == N:
                count += count

print(count)

Fixed submission:
a = int(input())
b = int(input())
c = int(input())
N = int(input())
count = 0

for i in range (a+1):
    for j in range (b+1):
        for k in range (c+1):
            if i*500 + j*100 + k*50 == N:
                count += 1
                #print("{} = 500:{} 100:{} 50:{}".format(N, i, j, k))
                

print(count)
Buggy python submission (verdict: Time Limit Exceeded):
hoge = int(input())
n = list(map(int,input().split()))
ans = "YES"
count = 0

for i in n :
    
    for j in n :
        if i == j :
            count += 1
    
    if count >= 2 :
        ans = "NO"
    
    count = 0

print(ans)

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

ans = "YES" if len(n) == len(set(n)) else "NO"
print(ans)
Buggy python submission (verdict: Runtime Error):
string = input()
lengch = len(string)
halfLengch = lengch // 2
  startString = list(string[:halfLengch + 1])
endString = list(string[halfLengch + 2::-1])
countHug = 0

for i in startString :
  for j in endString :
    if i != j :
      countHug += 1

print(countHug)

Fixed submission:
string = input()
lengch = len(string)
halfLengch = lengch // 2
startString = list(string[:halfLengch])
endString = list(string[:halfLengch - 1:-1])
countHug = 0
 
for i,j in zip(startString, endString) :
    if i != j :
      countHug += 1
 
print(countHug)
Buggy python submission (verdict: Runtime Error):
r = input()
print(r ** 2)

Fixed submission:
r = int(input())
print(r ** 2)
Buggy python submission (verdict: Runtime Error):
def inorderReplace(S , N): 
    S = list(S)
    cnt = 0
    for i in range(N - 1) : 
        nowChar = S[i]
        nextChar = S[i + 1]
        if nowChar == "#" and nextChar == "." : 
            cnt += 1
            S[i + 1] = "#"
    return cnt

def preorderReplace(S , N) : 
    S = list(S)
    cnt = 0
    for i in reversed(range(1, N)) : 
        nowChar = S[i]
        prevChar = S[i - 1]
        if prevChar == "#" and nowChar == "." : 
            cnt += 1
            S[i - 1] = "."
    return cnt


cnt = inorderReplace(S , N)
cnt2 = preorderReplace(S , N)
print(min(cnt , cnt2))

Fixed submission:
N = int(input())
S = input()
# . = しろ
# # = 黒
# #の横に.がないようにしたい
# #の横に.があったら#を.に変える
# or #の横に.があったら.を#に変える

# when do you replace now char to .
# 

# テストケース
"""
3
#..

3
##.
"""
# => .....# = 2

def inorderReplace(S , N): 
    S = list(S)
    cnt = 0
    for i in range(N - 1) : 
        nowChar = S[i]
        nextChar = S[i + 1]
        if nowChar == "#" and nextChar == "." : 
            cnt += 1
            S[i + 1] = "#"
    return cnt

def calcCount(S , N) : 
    countingChar = S[0]
    rst = []
    count = 1
    for s in S[1:] :
        if countingChar == s : 
            count += 1
        else : 
            rst.append((countingChar , count))
            count = 1
            countingChar = s
    rst.append((countingChar , count))
    return rst

def countRightChange(countingList) : 
    #全部を.に変えるコスト
    cnt = 0
    for elem in countingList : 
        if elem[0] == "#" : 
            cnt += elem[1]
    return cnt

def countLeftChange(countingList) : 
    # 全部を#に変えるコスト
    cnt = 0
    for elem in countingList : 
        if elem[0] == "." : 
            cnt += elem[1]
    return cnt

def calcPoint(countingList) : 
    a = 0
    b = countLeftChange(countingList)
    minVal = a + b
    for i in range(len(countingList)) : 
        elem = countingList[i]
        if elem[0] == "." : 
            a += 0
            b -= elem[1]
        elif elem[0] == "#" : 
            a += elem[1]
            b -= 0
        if minVal > a + b : 
            minVal = a + b
    return minVal

countingList = calcCount(S , N)
cnt2 = calcPoint(countingList)

print(cnt2)
Buggy python submission (verdict: Runtime Error):
"""

問題文

すぬけ君は最初、ビスケットを 1 枚持っており、日本円は持っていません。 すぬけ君は、以下の操作を好きな順に合計ちょうど K 回行います。

    持っているビスケットを叩き、1 枚増やす
    ビスケット A 枚を 1 円に交換する
    1 円をビスケット B 枚に交換する

K 回の操作の後、すぬけ君が持っているビスケットの枚数の最大値を求めてください。
制約

    1≤K,A,B≤109
    K,A,B は整数である
"""

def func(K , A , B) : 
    if B >= A + 3 :
        #売って買ってで(B - A)枚手に入る(ただし2回消費する)
        #まずは手持ちをAまいに持っていく必要がある。
        #売って買ってをn回繰り返す
        #最後に１回余ったら1叩く
        # K - (A - 1) = 2 * n + r
        # K - (A - 1)を計算し、偶数であれば n*(B - A) + A (n = (K - A + 1) / 2)
        # 奇数であれば n = (K - A) / 2として n*(B - A) + A + 1
        if (K - A + 1) % 2 == 0 : 
            n = int((K - A + 1) / 2)
            return n * (B - A) + A 
        else : 
            n = int((K - A) / 2)
            return n*(B - A) + A + 1
    else : 
        #叩き続けたほうがいい
        return K + 1

if not func(4 , 2 , 6) == 7 : 
    print("test 1 fail")

if not func(7 , 3, 4) == 8 : 
    print("test 2 fail")

if not func(314159265 , 35897932 , 384626433) == 48518828981938099 : 
    print(f"{int(func(314159265 , 35897932 , 384626433)) } != 48518828981938099")
    print("test 3 fail")

s = input().split(" ")
print( int(func( int(s[0]) , int(s[1]) , int(s[2]) )) )

Fixed submission:
def func(K , A , B) : 
    if B >= A + 3 :
        if (K - A + 1) % 2 == 0 : 
            n = int((K - A + 1) / 2)
            return n * (B - A) + A 
        else : 
            n = int((K - A) / 2)
            return n*(B - A) + A + 1
    else : 
        return K + 1


s = input().split(" ")
print( int(func( int(s[0]) , int(s[1]) , int(s[2]) )) )
Buggy python submission (verdict: Runtime Error):
h = []
for i in range(N) : 
    s = input()
    h.append(int(s))
    
h = sorted(h)
minDiff = h[len(h) - 1] - h[0]
for i in range(N) : 
    try : 
        diff = h[len(h) - K + i] - h[i]
        print(f"diff={h[len(h) - K + i]} - {h[i]} = {diff}")
        minDiff = min(minDiff , diff)
        
    except : 
        if i == 0 : minDiff = 0
        continue
print(minDiff)

Fixed submission:
s = input().split(" ")
N = int(s[0])
K = int(s[1])

h = []
for i in range(N) : 
    s = input()
    h.append(int(s))
    
h = sorted(h)
minDiff = h[len(h) - 1] - h[0]
for i in range(N) : 
    try : 
        diff = h[i + K - 1] - h[i]
        minDiff = min(minDiff , diff)
        
    except : 
        if i == 0 : minDiff = 0
        continue
print(minDiff)

Buggy python submission (verdict: Runtime Error):
h = []
for i in range(N) : 
    s = input()
    h.append(int(s))
    
h = sorted(h)
minDiff = h[len(h) - 1] - h[0]
for i in range(N) : 
    try : 
        diff = h[len(h) - K + i] - h[i]
        print(f"diff={h[len(h) - K + i]} - {h[i]} = {diff}")
        minDiff = min(minDiff , diff)
        
    except : 
        if i == 0 : minDiff = 0
        continue
print(minDiff)

Fixed submission:
s = input().split(" ")
N = int(s[0])
K = int(s[1])

h = []
for i in range(N) : 
    s = input()
    h.append(int(s))
    
h = sorted(h)
minDiff = h[len(h) - 1] - h[0]
for i in range(N) : 
    try : 
        diff = h[i + K - 1] - h[i]
        minDiff = min(minDiff , diff)
        
    except : 
        if i == 0 : minDiff = 0
        continue
print(minDiff)

Buggy python submission (verdict: Runtime Error):
s = input().split(" ")
N = int(s[0])
K = int(s[1])

h = []
for i in range(N) : 
    s = input()
    h.append(int(s))
    
h = sorted(h)
minDiff = h[len(h) - 1] - h[0]
for i in range(N) : 
    try : 
        diff = h[len(h) - K + i] - h[i]
        print(f"diff={h[len(h) - K + i]} - {h[i]} = {diff}")
        minDiff = min(minDiff , diff)
        
    except : 
        if i == 0 : minDiff = 0
        continue
print(minDiff)
    

Fixed submission:
s = input().split(" ")
N = int(s[0])
K = int(s[1])

h = []
for i in range(N) : 
    s = input()
    h.append(int(s))
    
h = sorted(h)
minDiff = h[len(h) - 1] - h[0]
for i in range(N) : 
    try : 
        diff = h[i + K - 1] - h[i]
        minDiff = min(minDiff , diff)
        
    except : 
        if i == 0 : minDiff = 0
        continue
print(minDiff)
Buggy python submission (verdict: Time Limit Exceeded):
s = input().split(" ")
s = [int(i) for i in s]
A = s[0]
B = s[1]
K = s[2]


for i , s in enumerate(range(A , B + 1) ):
    if (i < K) or (i > (B-A-K)) :
        print(s)
    

Fixed submission:
s = input().split(" ")
s = [int(i) for i in s]
A = s[0]
B = s[1]
K = s[2]

dic = {}
for i in range(K) : 
    if A+i <= B : 
        print(A + i)
        dic[A+i] = True

for i in reversed(range(K)):
    if B-i >= A:
        if not (B-i in dic):
            print(B-i)
Buggy python submission (verdict: Runtime Error):
    s = input().split(" ")
    s = [int(i) for i in s]
    x = s[0] * s[1]
    if x % 2 == 0 : 
        print("Even")
    else : 
        print("Odd")

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

s = input().split(" ")
s = [int(i) for i in s]
x = s[0] * s[1]
if x % 2 == 0 : 
    print("Even")
else : 
    print("Odd")
Buggy python submission (verdict: Runtime Error):
# coding: utf-8
# Here your code !
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
 
import numpy as np
import bisect

N , Z ,W = input().split()
N = int(N)
Z = int(Z)
W = int(W)
a = input().split()
a = [int(i) for i in reversed(a)]

rst = [ np.abs(W - a[0]) , np.abs(a[1] - a[0]) ]
print(np.max(rst))

Fixed submission:
# coding: utf-8
# Here your code !
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
 
import numpy as np
import bisect

N , Z ,W = input().split()
N = int(N)
Z = int(Z)
W = int(W)
a = input().split()
a = [int(i) for i in reversed(a)]

if N == 1 : 
    print(np.abs(W - a[0]))
else : 
    rst = [ np.abs(W - a[0]) , np.abs(a[1] - a[0]) ]
    print(np.max(rst))
Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
# Here your code !
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Oct  9 22:12:40 2017

@author: kitagenbakurou
"""
import numpy as np
import copy

def insert(pos, s, x):
  return x.join([s[:pos], s[pos:] ])

s = input()
N = len(s)

i = 0
cnt = 0
flag = True
while i < N - i - 1 : 
    if s[i] != s[N - i - 1] : 
        if s[i] == "x" : 
            cnt += 1
            s = insert(N - i  , s , "x")
        elif s[N - i - 1] == "x" : 
            cnt += 1
            s = insert(i , s , "x")
        else : 
            flag = False
            break
    N = len(s)
    i += 1

if flag : 
    print(cnt)
else : 
    print(-1)

Fixed submission:
# coding: utf-8
# Here your code !
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Oct  9 22:12:40 2017

@author: kitagenbakurou
"""
import numpy as np
import copy

def insert(pos, s, x):
  return x.join([s[:pos], s[pos:] ])

s = input()
N = len(s)

i = 0
j = N - 1
cnt = 0
flag = True
while i < j : 
    if s[i] != s[j] : 
        if s[i] == "x" : 
            cnt += 1
            #s = insert(N - i  , s , "x")
            i += 1
            j += 0
        elif s[j] == "x" : 
            cnt += 1
            #s = insert(i , s , "x")
            i +=0
            j -= 1
        else : 
            flag = False
            break
    else : 
        i += 1
        j -= 1

if flag : 
    print(cnt)
else : 
    print(-1)

Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
# Here your code !
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Oct  9 22:12:40 2017

@author: kitagenbakurou
"""
import numpy as np
import copy

def insert(pos, s, x):
  return x.join([s[:pos], s[pos:] ])

s = input()
N = len(s)

i = 0
cnt = 0
flag = True
while i < N - i - 1 : 
    if s[i] != s[N - i - 1] : 
        if s[i] == "x" : 
            cnt += 1
            s = insert(N - i  , s , "x")
            i = -1
        elif s[N - i - 1] == "x" : 
            cnt += 1
            s = insert(i , s , "x")
            i = -1
        else : 
            flag = False
            break
    N = len(s)
    i += 1

if flag : 
    print(cnt)
else : 
    print(-1)

Fixed submission:
# coding: utf-8
# Here your code !
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Oct  9 22:12:40 2017

@author: kitagenbakurou
"""
import numpy as np
import copy

def insert(pos, s, x):
  return x.join([s[:pos], s[pos:] ])

s = input()
N = len(s)

i = 0
j = N - 1
cnt = 0
flag = True
while i < j : 
    if s[i] != s[j] : 
        if s[i] == "x" : 
            cnt += 1
            #s = insert(N - i  , s , "x")
            i += 1
            j += 0
        elif s[j] == "x" : 
            cnt += 1
            #s = insert(i , s , "x")
            i +=0
            j -= 1
        else : 
            flag = False
            break
    else : 
        i += 1
        j -= 1

if flag : 
    print(cnt)
else : 
    print(-1)
Buggy python submission (verdict: Runtime Error):
# coding: utf-8
# Here your code !
N = int(input())

w = 0
for h in range(1 , 3501) : 
    if w != 0 : break
    x = 4 / N - 1 / h
    if x <= 0 : continue
    for n in range(1 , 3501) : 
        y = x - 1/n
        if y <= 0 : continue
        if n % (x*n - 1)  == 0 : 
            w = int(n / (n*x - 1))
            break
        
print(h - 1,n,w)

Fixed submission:
# coding: utf-8
# Here your code !
N = int(input())

w = 0
for h in range(1 , int(3*N/4 )+ 1) : 
    if w != 0 : 
        h -= 1
        break
    x = 4 / N - 1 / h
    if x <= 0 : continue
    for n in range(1 , int(2/(4/N - 1/h)) + 1) : 
        if (4*h*n - N*n - N*h)  <= 0 : continue
        if (N*h*n) % (4*h*n - N*n - N*h)  == 0 : 
            w = int((N*h*n) / (4*h*n - N*n - N*h) )
            break
        
print(h ,n,w)
Buggy python submission (verdict: Runtime Error):
1. 学部学科／研究科専攻の中身（大学の紹介ではなく、自分が大学で勉強していることの説明）
2. 自分の中心テーマ、素材、対象（専門家向けバージョンと、専門家以外でもわかるバージョンがあると便利）
3. その勉強を通じて得られる成果、結論、応用、実用（特に基礎系の専門の場合、「応用」を幅広くとらえることが欠かせない）
4. ユニークさ（独自の視点、手法、対象、成功率（失敗率））

Fixed submission:
# coding: utf-8
# Here your code !

s = input()
if(len(s) < 4) : print("No")
else:
    if(s[0:4] == "YAKI") : print("Yes")
    else:print("No")
Buggy python submission (verdict: Runtime Error):
s = input().split()
s = [int(i) for i in s]
N = s[0]

s = input().split()
a = [int(i) for i in s]

L = [0] * N
L[0] = a[0] - sum(a[1 : ])

if N == 2 : 
    print(abs(a[0] - a[1]))
else : 
    MIN = float("inf")
    for i in range(1 , N - 1 ) : 
        L[i] = L[i - 1] + 2 * a[i]
        if L[i] * L[i - 1] <= 0 : 
            if MIN > min( abs(L[i]) , abs(L[i - 1])) : MIN = min( abs(L[i]) , abs(L[i - 1]))

print(MIN)

Fixed submission:

s = input().split()
s = [int(i) for i in s]
N = s[0]

s = input().split()
a = [int(i) for i in s]

L = [0] * N
L[0] = a[0] - sum(a[1 : ])

if N == 2 : 
    print(abs(a[0] - a[1]))
else : 
    MIN = float("inf")
    for i in range(1 , N - 1 ) : 
        L[i] = L[i - 1] + 2 * a[i]
        if MIN > min( abs(L[i]) , abs(L[i - 1])) : MIN = min( abs(L[i]) , abs(L[i - 1]))
    print(MIN)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
s = input().split()
a = [int(i) for i in s]

b = []

for i in range(N) : 
    if i % 2 == 0 : b.append(a[i])
    if i % 2 == 1 : b.insert(0 , a[i])

if i % 2 == 0 : b.reverse()        

print(" ".join(map(str, b)))

Fixed submission:
from collections import deque
N = int(input())
s = input().split()
a = [int(i) for i in s]

b = deque()

for i in range(N) : 
    if i % 2 == 0 : b.append(a[i])
    if i % 2 == 1 : b.appendleft(a[i])

if i % 2 == 0 : b.reverse()        

print(" ".join(map(str, b)))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
s = input().split()
a = [int(i) for i in s]

b = []

for i in range(N) : 
    if i % 2 == 0 : b.append(a[i])
    if i % 2 == 1 : b.insert(0 , a[i])

if i % 2 == 0 : b.reverse()        

for i in range(N):
    print(b[i],end=" ")

Fixed submission:
from collections import deque
N = int(input())
s = input().split()
a = [int(i) for i in s]

b = deque()

for i in range(N) : 
    if i % 2 == 0 : b.append(a[i])
    if i % 2 == 1 : b.appendleft(a[i])

if i % 2 == 0 : b.reverse()        

print(" ".join(map(str, b)))

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
N = int(input())
s = input().split()
a = [int(i) for i in s]

b = deque()

for i in range(N) : 
    b.append(a[i])
    b.reverse()

ans = ""
for i in b : 
    ans += str(i) + " "
print(ans)

Fixed submission:
from collections import deque
N = int(input())
s = input().split()
a = [int(i) for i in s]

b = deque()

for i in range(N) : 
    if i % 2 == 0 : b.append(a[i])
    if i % 2 == 1 : b.appendleft(a[i])

if i % 2 == 0 : b.reverse()        

print(" ".join(map(str, b)))
Buggy python submission (verdict: Runtime Error):
n, a, b = map(int, input().split())
nca = len(list(itertools.combinations(range(n), a)))
ncb = len(list(itertools.combinations(range(n), b)))
# answer = 2**n - 1 - nca - ncb
# print(answer % (10**9 + 7))
print((2**n - 1 - nca - ncb) % (10**9 + 7))


Fixed submission:
mod = int(1e9 + 7)
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])
            result %= mod

    return result


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

base = 1
waru = 1000
syou = n // waru
amari = n % waru
kakeru = 2**waru % mod
for _ in range(syou):
    base = base * kakeru
    base %= mod
base = base * 2**amari
base %= mod

nca = cmb(n, a%mod)
ncb = cmb(n, b%mod)
answer = (base - 1 - nca - ncb) % mod
print(answer)
Buggy python submission (verdict: Runtime Error):
n, k = input().split()
print(int(n, int(k)))

Fixed submission:
n, k = input().split()
import math
def findNumberOfDigits(n, base):
    dig = (math.floor(math.log(n) /
                      math.log(base)) + 1)
    print(dig)

findNumberOfDigits(int(n), int(k))