Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N,K = map(int,input().split())
beki_2 = list()
for i in range(15):
    beki_2.append(2**i)
    # print(beki_2)
eachother = [0]*N
ind = 0
i = 0
# print(beki_2)
f =0
while all:
    if(i == 0):
        j = 0
        while all:
            if(1*beki_2[j] >= K):
                ind = j
                # print("i")
                eachother[i] = ind
                break
            # print(j,beki_2[j])
            j+=1
        i+=1
    else:
        # print(i+1,beki_2[ind],ind)
        
        if(ind == 0):
            if(i+1>=K):
                eachother[i] = 0
                # print("i+1>=K")
                ind = 0
            else:
                for l in range(len(beki_2)):
                    if((i+1)*beki_2[l]>=K):
                        eachother[i] = 1
                        break
                ind = 1
            i+=1

        if((i+1)*beki_2[ind]<K):
            eachother[i] = ind+1
            i +=1
        # print((i+1)*beki_2[ind],ind,i)

    ind -= 1

    if(i == N or ind == -1):
        # print(i,N)
        break
sum_each = 0.0

for i in range(len(eachother)):
    sum_each+=beki_2[eachother[0]]/beki_2[eachother[i]]

# print(eachother[0:10])
print((1/N)*sum_each/beki_2[eachother[0]])

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

two_beki = [1]*20
for i in range(1,20):
    two_beki[i] = 2**i
#[1,2,4,8,16,32,64,128,256,512,1024,2048,8192,16384]
n = N+1
list_index = list()
for I in range(1,n):
    for J in range(20):
        if(I*two_beki[J]>=K):
            list_index.append(J) 
            # print(J,I*two_beki[J])
            break
#print(list_index)
sum_harf = 0.0
for I in list_index:
    sum_harf += 1/two_beki[I]/N
print(sum_harf)

Buggy python submission (verdict: Runtime Error):
N,K = map(int,input().split())
beki_2 = list()
for i in range(16):
    beki_2.append(2**i)
    # print(beki_2)
eachother = [0]*N
ind = 0
i = 0
# print(beki_2)
f =0
while all:
    if(i == 0):
        j = 0
        while all:
            if(1*beki_2[j] >= K):
                ind = j
                # print("i")
                eachother[i] = ind
                break
            # print(j,beki_2[j])
            j+=1
        i+=1
    else:
        # print(i+1,beki_2[ind])
        if((i+1)*beki_2[ind]<K):
            eachother[i] = ind+1
            i +=1
        # print((i+1)*beki_2[ind],ind,i)
        if(ind == 0):
            i+=1
        ind -= 1


    if(i == N or ind == 0):
        # print(i,N)
        break
sum_each = 0.0

for i in range(len(eachother)):
    sum_each+=beki_2[eachother[0]]/beki_2[eachother[i]]
print((1/N)*sum_each/beki_2[eachother[0]])
# print(eachother)
# (1/N)*()

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

two_beki = [1]*20
for i in range(1,20):
    two_beki[i] = 2**i
#[1,2,4,8,16,32,64,128,256,512,1024,2048,8192,16384]
n = N+1
list_index = list()
for I in range(1,n):
    for J in range(20):
        if(I*two_beki[J]>=K):
            list_index.append(J) 
            # print(J,I*two_beki[J])
            break
#print(list_index)
sum_harf = 0.0
for I in list_index:
    sum_harf += 1/two_beki[I]/N
print(sum_harf)
Buggy python submission (verdict: Runtime Error):
N = int(input())
ans = 0
for i in range(1,1250000):
    if(((N-i)/i).is_integer() and N//((N-i)/i) == N%((N-i)/i)):
        # print((N-i)//i,i)
        ans += ((N-i)//i)
        # if(i == 800000):
        #     print(ans)
    # print(i)
print(ans)

Fixed submission:
N = int(input())
ans = 0
for i in range(1,min(N,1250000)):
    if(((N-i)/i).is_integer() and N//((N-i)/i) == N%((N-i)/i)):
        # print((N-i)//i,i)
        ans += ((N-i)//i)
        # if(i == 800000):
        #     print(ans)
    # print(i)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
INF = 10000
n,k = map(int,input().split())
stair = list(map(int,input().split()))
dp = [0] *n
for i in range(1,n):
    dp[i] = dp[i-1]+abs(stair[i]-stair[i-1])
    for j in range(1,k+1):
        if(i - j >= 0):
            # print(i,i-j)
            dp[i] = min(dp[i], dp[i-j]+abs(stair[i]-stair[i-j]))
        # print(dp)



print(dp[-1])

Fixed submission:
INF = 10000
n,k = map(int,input().split())
stair = list(map(int,input().split()))
dp = [0] *n
for i in range(1,n):
    dp[i] = dp[i-1]+abs(stair[i]-stair[i-1])
    for j in range(1,k+1):
        if(i - j >= 0):
            # print(i,i-j)
            dp[i] = min(dp[i], dp[i-j]+abs(stair[i]-stair[i-j]))
        # print(dp)



print(dp[-1])

Buggy python submission (verdict: Time Limit Exceeded):
INF = 10000
n,k = map(int,input().split())
stair = list(map(int,input().split()))
dp = [""]*n
for i in range(n):
    dp[i] = list()

for i in range(0,n):
    for j in range(i+1,min(i+k+1,n)):
        if(i == 0):
            cost = abs(stair[i]-stair[j])
        else:
            cost = abs(stair[i]-stair[j]) + dp[i]
        
        try:
            dp[j] = min(cost,dp[j])
        except:
            dp[j] = cost
        # print(cost,i,j)



# print(dp)
print(dp[-1])

Fixed submission:
INF = 10000
n,k = map(int,input().split())
stair = list(map(int,input().split()))
dp = [0] *n
for i in range(1,n):
    dp[i] = dp[i-1]+abs(stair[i]-stair[i-1])
    for j in range(1,k+1):
        if(i - j >= 0):
            # print(i,i-j)
            dp[i] = min(dp[i], dp[i-j]+abs(stair[i]-stair[i-j]))
        # print(dp)



print(dp[-1])
Buggy python submission (verdict: Runtime Error):
othello = input()
bef = 0
sumall = 0
sumelse = 0

for i in range(len(othello)):
    sumall += i
    if(othello[i] == 'B'):
        bef += i
        count += 1

count = 0
for i in range(len(othello)-count):
    sumelse += i

aft = sumall - sumelse

print(aft - bef)

Fixed submission:
othello = input()
bef = 0
sumall = 0
count = 0

for i in range(len(othello)):
    sumall += i
    if(othello[i] == 'B'):
        bef += i
        count += 1

sumelse = 0
for i in range(len(othello)-count):
    sumelse += i

aft = sumall - sumelse

print(aft - bef)
Buggy python submission (verdict: Runtime Error):
import copy
N = int(input())
X = list(map(int,input().split()))
length = len(X)
sortx = sorted(X)
bef = sortx[int(length//2)]
aft = sortx[int(length//2)+1]

for i in range(N):
    if(X[i]<=bef):
        print(aft)
    else:
        print(bef)

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

sortx = sorted(X)
bef = sortx[N//2-1]
aft = sortx[N//2]
for i in X:
        print(aft if i <= bef else bef)

Buggy python submission (verdict: Runtime Error):
import copy
N = int(input())
X = list(map(int,input().split()))
length = len(X)
sortx = sorted(X)
bef = sortx[int(length//2)]
aft = sortx[int(length//2)+1]

for i in range(N):
    if(X[i]<=bef):
        print(bef)
    else:
        print(aft)

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

sortx = sorted(X)
bef = sortx[N//2-1]
aft = sortx[N//2]
for i in X:
        print(aft if i <= bef else bef)

Buggy python submission (verdict: Runtime Error):
import copy
N = int(input())
X = list(map(int,input().split()))
length = len(X)
sortx = sorted(X)
bef = sortx[int(length/2)]
aft = sortx[int(length/2)+1]

for i in range(N):
    if(X[i]<=bef):
        print(bef)
    else:
        print(aft)

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

sortx = sorted(X)
bef = sortx[N//2-1]
aft = sortx[N//2]
for i in X:
        print(aft if i <= bef else bef)

Buggy python submission (verdict: Time Limit Exceeded):
import copy
N = int(input())
X = list(map(int,input().split()))
length = len(X)
 
 
for i in range(N):
    x = copy.copy(X) 
    x.pop(i)
    x.sort()
    print(x[int(length/2)-1])
    # print(x,X)

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

sortx = sorted(X)
bef = sortx[N//2-1]
aft = sortx[N//2]
for i in X:
        print(aft if i <= bef else bef)

Buggy python submission (verdict: Runtime Error):
import copy
N = int(input())
X = list(map(int,input().split()))
length = len(X)
X.sort()
bef = int(length/2)
aft = bef+1
for i in range(N):
    if(i<bef):
        print(X[bef])
    else:
        print(X[aft])

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

sortx = sorted(X)
bef = sortx[N//2-1]
aft = sortx[N//2]
for i in X:
        print(aft if i <= bef else bef)

Buggy python submission (verdict: Time Limit Exceeded):
import copy
N = int(input())
X = list(map(int,input().split()))
length = len(X)


for i in range(N):
    x = copy.copy(X) 
    x.pop(i)
    x.sort()
    print(x[int(length/2)-1])
    # print(x,X)

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

sortx = sorted(X)
bef = sortx[N//2-1]
aft = sortx[N//2]
for i in X:
        print(aft if i <= bef else bef)
Buggy python submission (verdict: Runtime Error):
n = int(input())
rate = list(map(int,input().split()))
ratecolor = 0
free = 0
ratecolor = 0
color = [0]*9
for i in range(n):
        if(rate[i] >= 3200):
            free += 1
            break
    for j in range(9):
        if(rate[i] < j*400 + 400):
            if(color[j] == 0):
                color[j] += 1
                ratecolor += 1
                break

print(ratecolor if ratecolor != 0 else 1,ratecolor+free)

Fixed submission:
n = int(input())
rate = list(map(int,input().split()))
ratecolor = 0
free = 0
ratecolor = 0
color = [0]*9
for i in range(n):
    if(rate[i] >= 3200):
        free += 1
    else:
        for j in range(9):
            if(rate[i] < j*400 + 400):
                if(color[j] == 0):
                    color[j] += 1
                    ratecolor += 1
                break
print(ratecolor if ratecolor != 0 else 1,ratecolor+free)

Buggy python submission (verdict: Runtime Error):
n = int(input())
rate = list(map(int,input().split()))
ratecolor = 0
free = 0
ratecolor = 0
color = [0]*9
for i in range(n):
    for j in range(13):
        if(rate[i] < j*400 + 400):
            if(rate[i] >= 3200):
                free += 1
                break
            if(color[j] == 0 and rate[i] < 3200):
                color[j] += 1
                ratecolor += 1
                break

print(ratecolor if ratecolor != 0 else 1,ratecolor+free)



Fixed submission:
n = int(input())
rate = list(map(int,input().split()))
ratecolor = 0
free = 0
ratecolor = 0
color = [0]*9
for i in range(n):
    if(rate[i] >= 3200):
        free += 1
    else:
        for j in range(9):
            if(rate[i] < j*400 + 400):
                if(color[j] == 0):
                    color[j] += 1
                    ratecolor += 1
                break
print(ratecolor if ratecolor != 0 else 1,ratecolor+free)
Buggy python submission (verdict: Runtime Error):
from itertools import chain
N,K = map(int,input().split())
numarray = list()
num_bool = [0]*(10**5)
numarray_ind = list()

for i in range(N):
    a,b = map(int,input().split())
    num_bool[a-1]+=1
    if(num_bool[a-1]>=2):
        numarray[numarray_ind.index(a)][1]+=b
        # print(numarray)    
        
    else:
        numarray.append([a,b])
        numarray_ind.append(a)

        # print(numarray)    
numarray.sort()
sum_c = 0
i= 0
while all:
    sum_c+=numarray[i][1]
    i+=1
    if(sum_c <=K):
        break
    # print(sum_c,i)
# print(numarray)
print(numarray[i-1][0])


Fixed submission:
from itertools import chain
N,K = map(int,input().split())
num_bool = [0]*(10**5)
numarray_ind = list()

for i in range(N):
    a,b = map(int,input().split())
    num_bool[a-1] += b
# print(num_bool)
sum_count = 0
k=1
for i in range(10**5):
    sum_count += num_bool[i]
    if(sum_count >= K):
        break
    k+=1
print(k)

Buggy python submission (verdict: Runtime Error):
from itertools import chain
N,K = map(int,input().split())
numarray = list()
num_bool = [0]*(10**5)


for i in range(N):
    a,b = map(int,input().split())
    num_bool[a-1]+=1
    if(num_bool[a-1]>=2):
        pos = divmod(    list(chain(*numarray)).index(a), len(numarray[0])
        )
        numarray[pos[0]][1]+=b
        # print(numarray)    
        
    else:
        numarray.append([a,b])
        # print(numarray)    
numarray.sort()
sum_c = 0
i= 0
while all:
    sum_c+=numarray[i][1]
    i+=1
    if(sum_c <=K):
        break
    # print(sum_c,i)
# print(numarray)
print(numarray[i-1][0])


Fixed submission:
from itertools import chain
N,K = map(int,input().split())
num_bool = [0]*(10**5)
numarray_ind = list()

for i in range(N):
    a,b = map(int,input().split())
    num_bool[a-1] += b
# print(num_bool)
sum_count = 0
k=1
for i in range(10**5):
    sum_count += num_bool[i]
    if(sum_count >= K):
        break
    k+=1
print(k)

Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int,input().split())
numarray = list()
for i in range(N):
    a,b = map(int,input().split())
    numarray.extend([a]*b)
# print(numarray)
numarray.sort()
print(numarray[K-1])

Fixed submission:
from itertools import chain
N,K = map(int,input().split())
num_bool = [0]*(10**5)
numarray_ind = list()

for i in range(N):
    a,b = map(int,input().split())
    num_bool[a-1] += b
# print(num_bool)
sum_count = 0
k=1
for i in range(10**5):
    sum_count += num_bool[i]
    if(sum_count >= K):
        break
    k+=1
print(k)
Buggy python submission (verdict: Runtime Error):
import math 
x = int(input())
xi = math.floor(x/5.5)
print(xi)
for i in range(xi,100000000000000):
    # print(6*i - math.floor(i/2))
    if(x < 6*i-math.floor(i/2)):
        xa = i
        break

print(xa)


Fixed submission:
import math 
x = int(input())
# x = 10**15
xi = math.floor(x/5.5)
# print(xi)
for i in range(xi,10000000000000000000000000000):
    # print(6*i - math.floor(i/2))
    if(x <= 6*i-math.floor(i/2)):
        xa = i
        break

print(xa)

Buggy python submission (verdict: Runtime Error):
import math 
x = int(input())
xi = math.floor(x/5.5)
print(xi)
for i in range(xi,100000000000000):
    print(6*i - math.floor(i/2))
    if(x < 6*i-math.floor(i/2)):
        xa = i
        break

print(xa)


Fixed submission:
import math 
x = int(input())
# x = 10**15
xi = math.floor(x/5.5)
# print(xi)
for i in range(xi,10000000000000000000000000000):
    # print(6*i - math.floor(i/2))
    if(x <= 6*i-math.floor(i/2)):
        xa = i
        break

print(xa)
Buggy python submission (verdict: Runtime Error):
n = int(input())

for x in (range(1,10)):
    for y in (range(1,10)):
        if x * y == n:
            flag = True
    else:
        continue
    break
    

if flag:
    print("Yes")
else:
    print("No")


Fixed submission:
n = int(input())
flag = False
for x in (range(1,10)):
    for y in (range(1,10)):
        if x * y == n:
            flag = True
    else:
        continue
    break
    

if flag:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
temp = 0
while(n!=0):
	temp += n%10
	n= n//10
if temp%9==0:
	print("Yes")
else:
	print("No")	


Fixed submission:
x = sum(list(map(int,input())))

if x%9==0:
	print("Yes")
else:
	print("No")
Buggy python submission (verdict: Runtime Error):

#include<bits/stdc++.h>
 
using namespace std;
typedef long long int ll;
 
int main() {
	ios::sync_with_stdio(0); 
	cin.tie(0);
 
ll n;
cin>>n;

n=n%1000;
if(n>0)n=1000-n;
cout<<n;


	
}
 

Fixed submission:
k = int(input())
n  =1000
t  =[]

for i in range(1,11):
	if n*i-k>=0:
		t.append(n*i-k)

print(min(t))
Buggy python submission (verdict: Runtime Error):
x,n = map(int,input().split())
if n ==0:
    print(x)
else:
    p = list(map(int,input().split()))
    l = {}
    for i in range(1,max(p)+1):
        if i not in p:
            l[i] = abs(x-i)

    min_value = min(l.values())
    val_list = list(l.values())
    key_list = list(l.keys())
    print(key_list[val_list.index(min_value)])


Fixed submission:
x,n = map(int,input().split())
if n==0:
    print(x)
else:
    p = list(map(int,input().split()))
    for i in range(100):
        if x-i not in p:
            print(x-i)
            break
        elif x+i not in p:
            print(x+i)
            break
Buggy python submission (verdict: Runtime Error):
n = int(input())
x = n//2
n =n%2 
print(x+y)

Fixed submission:
n = int(input())
x = n//2
n =n%2 
print(x+n)
Buggy python submission (verdict: Runtime Error):
k,x = map(int,input().split()))

if(k*500>=x):
	print("Yes")
else:
	print("No")

Fixed submission:
a = list(map(int,input().split()))
x = 500*a[0]
if x >=a[1]:print("Yes")
else:print("No")
Buggy python submission (verdict: Runtime Error):
a = list(map(int,input().split()))
   print(max((a[2]-(a[0]-a[1])),0))



Fixed submission:
a = list(map(int,input().split()))
if a[2]>(a[0]-a[1]):
    print(a[2]-(a[0]-a[1]))
else:print(0)

Buggy python submission (verdict: Runtime Error):
a = list(map(int,input().split()))
    print(max(a[2]-(a[0]-a[1]),0))


Fixed submission:
a = list(map(int,input().split()))
if a[2]>(a[0]-a[1]):
    print(a[2]-(a[0]-a[1]))
else:print(0)
Buggy python submission (verdict: Time Limit Exceeded):
inf = 10**9+5
n,k = map(int,input().split())
h = list( map(int,input().split()))

dp = [inf]*n
dp[0] = 0
for i in range(n):
    for j in range(i+1,i+k+1):
        if j<n:
            dp[j] = min(dp[j],dp[i]+abs(h[i]-h[j]))
print(dp[-1])


Fixed submission:
def main():
    
    n,k =map(int,input().split())
    x = list(map(int, input().split()))
    a = [0]*n
    for i in range (1,n):
        a[i]=(min([abs(x[i]-x[j])+a[j] for j in range(max(0,i-k),i)]))
    print (a[-1])
if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
n,k =map(int,input().split())
x = list(map(int, input().split()))
a = [0]*n
for i in range (1,n):
    a[i]=(min([abs(x[i]-x[j])+a[j] for j in range(max(0,i-k),i)]))
print (a[-1])

Fixed submission:
def main():
    
    n,k =map(int,input().split())
    x = list(map(int, input().split()))
    a = [0]*n
    for i in range (1,n):
        a[i]=(min([abs(x[i]-x[j])+a[j] for j in range(max(0,i-k),i)]))
    print (a[-1])
if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
n,k =map(int,input().split())
x = list(map(int, input().split()))
a = []
a.append(0)
a.append(abs(x[0]-x[1]))
for i in range (2,n):
    a.append(min([abs(x[i]-x[j])+a[j] for j in range(max(0,i-k),i)]))
print (a[-1])

Fixed submission:
def main():
    
    n,k =map(int,input().split())
    x = list(map(int, input().split()))
    a = [0]*n
    for i in range (1,n):
        a[i]=(min([abs(x[i]-x[j])+a[j] for j in range(max(0,i-k),i)]))
    print (a[-1])
if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
n,k =map(int,input().split())
x = list(map(int, input().split()))
a = [0] * n
a[1] = abs(x[0]-x[1])
for i in range (2,n):
    a[i] = min([abs(x[i]-x[j])+a[j] for j in range(max(0,i-k),i)])
print (a[-1])

Fixed submission:
def main():
    
    n,k =map(int,input().split())
    x = list(map(int, input().split()))
    a = [0]*n
    for i in range (1,n):
        a[i]=(min([abs(x[i]-x[j])+a[j] for j in range(max(0,i-k),i)]))
    print (a[-1])
if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
a = list(map(int,input().split()))
dp = [False]*(k+1)
for i in range(1,k+1):
    for j in range(n):
        if i-a[j]<0:
            break
        if dp[i-a[j]]==False:
            dp[i] = True
if dp[k]==True:
    print("First")
else:
    print("Second")


Fixed submission:
n,k = map(int,input().split())
a = list(map(int,input().split()))
dp = [False]*(k+1)
for i in range(1,k+1):
    for j in range(n):
        if i-a[j]<0:
            break
        if dp[i-a[j]]==False:
            dp[i] = True
            break
if dp[k]==True:
    print("First")
else:
    print("Second")
Buggy python submission (verdict: Runtime Error):
n = int(input)
if n<1200:
  print("ABC")
else:
  print("ARC")

Fixed submission:
x = int(input())
if x<1200:
	print("ABC")
elif x>=1200:
	print("ARC")

Buggy python submission (verdict: Runtime Error):
n = int(input)
if n<1200:
  print("ABC")
 else:
  print("ARC")

Fixed submission:
x = int(input())
if x<1200:
	print("ABC")
elif x>=1200:
	print("ARC")
Buggy python submission (verdict: Runtime Error):
n  =int(input())
s = input()
c = 0
t = []
t1 = []
for i in s:
	if i=='I':
		c+=1
		t.append(c)
	elif i=='D':
		c-=1
		t1.append(c)


if (max(max(t),max(t1)))<0:
	print(0)
else:
	print(max(max(t),max(t1)))

Fixed submission:
n  =int(input())
s = input()
x = 0
c = 0
x1 = 0
t = []
for i in s:
	if i=='I':
		c+=1
	if c>x:
		x =c
	elif i=='D':
		c-=1
	if c>x1:
		x1=c

	t.append(max(x1,x))
print(max(t))

Buggy python submission (verdict: Runtime Error):
n  =int(input())
s = input()
c = 0
t = []
t1 = []
for i in s:
	if i=='I':
		c+=1
		t.append(c)
	elif i=='D':
		c-=1
		t1.append(c)

print(max(max(t),max(t1)))

Fixed submission:
n  =int(input())
s = input()
x = 0
c = 0
x1 = 0
t = []
for i in s:
	if i=='I':
		c+=1
	if c>x:
		x =c
	elif i=='D':
		c-=1
	if c>x1:
		x1=c

	t.append(max(x1,x))
print(max(t))
Buggy python submission (verdict: Runtime Error):
n = input()
s = " "
for i in n:
    if i == '0':
        s+='0'
    elif i=='1':
        s+='1'
    if i=='B':
        s = s.replace(s[-1],'')

print(s)


Fixed submission:
n = input()
s = ''
for i in n:
    if i== '1' or i == '0':
        s+=i
    else:
        if len(s)>0:
            s =s[0:-1]
print(s)
Buggy python submission (verdict: Runtime Error):
"""
At Coder :: Beginner Contest 178 :: D - Redistribution 
https://atcoder.jp/contests/abc178/tasks/abc178_d
"""


MOD = pow(10, 9) + 7


def solve(S):
    """Solve problem."""
    A = [1 for _ in range(S+1)]
    A[0] = A[1] = A[2] = 0
    for i in range(3, S+1):
        k = 3
        while i - k >= 0:
            A[i] = A[i-k] + A[i] % MOD
            k += 1
    return A[-1]


def main():
    """Main program."""
    import sys
    S = int(sys.stdin.readline())
    print(solve(S))


if __name__ == '__main__':
    main()


Fixed submission:
"""
At Coder :: Beginner Contest 178 :: D - Redistribution 
https://atcoder.jp/contests/abc178/tasks/abc178_d
"""


MOD = pow(10, 9) + 7


def solve(S):
    """Solve problem."""
    if S < 3:
        return 0
    A = [1 for _ in range(S+1)]
    A[0] = A[1] = A[2] = 0
    for i in range(3, S+1):
        k = 3
        while i - k >= 0:
            A[i] = A[i-k] + A[i] % MOD
            k += 1
    return A[S]


def main():
    """Main program."""
    import sys
    S = int(sys.stdin.readline())
    print(solve(S))


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
"""
AtCoder :: M-Solutions Programming Contest 2020 :: Marks
https://atcoder.jp/contests/m-solutions2020/tasks/m_solutions2020_c
"""
import sys
from functools import reduce
from operator import mul


def solve(A, K):
    """Solve puzzle."""
    solns = []
    grade = reduce(mul, A[:K])
    for i in range(K, len(A)):
        grade0 = (grade // A[i-K]) * A[i]
        if grade0 > grade:
            solns.append('Yes')
        else:
            solns.append('No')
        grade = grade0
    return(solns)


def main():
    """Main program."""
    N, K = (int(i) for i in sys.stdin.readline().split())
    A = [int(i) for i in sys.stdin.readline().split()]
    print("\n".join(solve(A, K)))


if __name__ == '__main__':
    main()


Fixed submission:
"""
AtCoder :: M-Solutions Programming Contest 2020 :: Marks
https://atcoder.jp/contests/m-solutions2020/tasks/m_solutions2020_c
"""
import sys
from functools import reduce
from operator import add
from math import log


def solve(A, K):
    """Solve puzzle."""
    solns = []
    grade = reduce(add, A[:K])
    for i in range(K, len(A)):
        grade0 = (grade - A[i-K]) + A[i]
        if grade0 > grade:
            solns.append('Yes')
        else:
            solns.append('No')
        grade = grade0
    return(solns)


def main():
    """Main program."""
    N, K = (int(i) for i in sys.stdin.readline().split())
    A = [log(float(i)) for i in sys.stdin.readline().split()]
    print("\n".join(solve(A, K)))


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
N = int(input())
L0 = 2
L1 = 1
for i in range(N - 1):
    L2 = L1 + L0
    L0 = L1
    L1 = L2

print(L2)


Fixed submission:
N = int(input())
L0 = 2
L1 = 1
L2 = 1
for i in range(N - 1):
    L2 = L1 + L0
    L0 = L1
    L1 = L2

print(L2)