Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p02555 (python)

Fixed submission:
MOD = 10**9 + 7
dp = {0: 1}

S = int(input())
for s in range(3, S+1):
  for term in range(3, s+1):
    if s - term < 0:
      break
    else:
      dp[s] = dp.get(s-term, 0) + dp.get(s, 0) % MOD

print(dp.get(S, 0))

Buggy submission (verdict: Runtime Error):
MOD = 10**9 + 7
dp = {0: 1}

S = int(input())
for s in range(3, S+1):
  for term in range(3, s+1):
    if s - term < 0:
      break
    else:
      dp[s] = dp.get(s-term, 0) + dp.get(s, 0) % MOD

print(dp[S])
Problem p02612 (python)

Fixed submission:
_MULTITEST = False
##
def solve():
    n = int(input())
    k = (n // 1000) + (1 if n % 1000 != 0 else 0)
    print(k*1000 - n)

##
if __name__ == "__main__":
    t = (int(input()) if _MULTITEST else 1)
    for tt in range(t):
        solve()

Buggy submission (verdict: Runtime Error):
_MULTITEST = False
##
def solve():
    n, k = map(int, input().split())
    a = list(map(int, input().split()))
    a.sort()
    neg = sum(1 for x in a if x < 0)
    pos = sum(1 for x in a if x > 0)
    zeroes = a.count(0)
    
    ### Set lower bound for answer
    ans = 0
    if pos == 0:
        if zeroes == 0:
            ans = -1 * (10**16)
    
    ### Solve by window-sliding
    # set some initial vars
    prod = 1
    zero_counter = 0
    for i in range(n-1, n-1-k, -1):
        if a[i] == 0:
            zero_counter += 1
        else:
            prod *= a[i]
    if zero_counter > 0:
        ans = max(ans, 0)
    else:
        ans = max(ans, prod)
    
    # sliding
    p1 = 0
    p2 = (n-k)
    while p2 < n:
        if a[p1] == 0:
            zero_counter += 1
        else:
            prod *= a[p1]
        if a[p2] == 0:
            zero_counter -= 1
        else:
            prod //= a[p2]
        p1 += 1; p2 += 1;
        if zero_counter > 0:
            ans = max(ans, 0)
        else:
            ans = max(ans, prod)
    
    ###
    #print(ans)
    print(ans % (10**9 + 7))


##
if __name__ == "__main__":
    t = (int(input()) if _MULTITEST else 1)
    for tt in range(t):
        solve()
Problem p02657 (python)

Fixed submission:
print(eval(input().strip().replace(' ','*')))

Buggy submission (verdict: Runtime Error):
st = input().strip().split()

a = int(st[0])
b = 0

for x in st[1]:
  if x == '.':
  else: b = b*10 + x

print(a*b//100)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
a.sort()
 
ans = 1
for x in a:
  if ans <= 10**18:
    ans = ans * x

print(-1 if ans > limit else ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = sorted(list(map(int, input().split())))
 
ans, limit = 1, 10**18
for x in a:
  ans = (ans if ans > limit else ans * x)

print(-1 if ans > limit else ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = sorted(list(map(int, input().split())))
 
ans, limit = 1, 10**18
for x in a: ans = (ans if ans > limit else ans * x)
 
print(-1 if ans > limit else ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split())).sort()
 
ans = 1
for x in a:
  ans = (ans if ans > 10**18 else ans * x)
 
print(-1 if ans > 10**18 else ans)
Problem p02658 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
a.sort()
 
ans = 1
for x in a:
  if ans <= 10**18:
    ans = ans * x

print(-1 if ans > 10**18 else ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split())).sort()
 
ans = 1
limit = 10**18
for x in a:
  ans = (ans if ans > limit else ans * x)
 
print(-1 if ans > limit else ans)
Problem p03160 (python)

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

DP = [0] * N
DP[0] = 0
DP[1] = abs(H[1] - H[0])
##
for i in range(2, N):
    DP[i] = min( DP[i-1] + abs(H[i]-H[i-1]), DP[i-2] + abs(H[i]-H[i-2]) )
##
print(DP[N-1])

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

inf = int(1e9)

dp = [inf]*(n+3)
dp[0] = 0

for i in range(n):
  dp[i+1] = min(dp[i+1], dp[i] + abs(a[i+1] - a[i]))
  dp[i+2] = min(dp[i+2], dp[i] + abs(a[i+2] - a[i]))

print(dp[n-1])
Problem p03166 (python)

Fixed submission:
import sys

global N, M
global edgeList

global longestPathFrom

def dfs(x):
    if longestPathFrom[x] == -1:
        # get
        longest = -1
        for nextNode in edgeList[x]:
            longest = max(longest, dfs(nextNode))
        # set
        if longest == -1:
            longestPathFrom[x] = 0
        else:
            longestPathFrom[x] = longest + 1
    # -- longest path from x has been calculated
    return longestPathFrom[x]

# -- main
if __name__ == '__main__':
    # -- 
    sys.setrecursionlimit(1000001)

    # -- input
    N, M = map(int, input().split())
    edgeList = [[] for node in range(N)]

    for i in range(M):
        x, y = map(int, input().split())
        x -= 1; y -= 1;
        edgeList[x].append(y)

    # -- process
    longestPathFrom = [-1] * N

    for node in range(N):
        if longestPathFrom[node] == -1:
            dfs(node)

    # -- output
    print(max(longestPathFrom))

Buggy submission (verdict: Runtime Error):
global N, M
global edgeList

global longestPathFrom

def dfs(x):
    if longestPathFrom[x] == -1:
        # get
        longest = -1
        for nextNode in edgeList[x]:
            longest = max(longest, dfs(nextNode))
        # set
        if longest == -1:
            longestPathFrom[x] = 0
        else:
            longestPathFrom[x] = longest + 1
    # -- longest path from x has been calculated
    return longestPathFrom[x]

# -- main
if __name__ == '__main__':
    # -- input
    N, M = map(int, input().split())
    edgeList = [[] for node in range(N)]

    for i in range(M):
        x, y = map(int, input().split())
        x -= 1; y -= 1;
        edgeList[x].append(y)

    # -- process
    longestPathFrom = [-1] * N

    for node in range(N):
        if longestPathFrom[node] == -1:
            dfs(node)

    # -- output
    print(max(longestPathFrom))
Problem p02684 (python)

Fixed submission:
l=list(map(int,input().split()))
N=l[0]
K=l[1]
L=list(map(int,input().split()))
a=L[0]
v=0
X=[]
Y=[]
for i in range(N):
    X.append(0)
    Y.append(0)
X[0]=1
Y[0]=0
for i in range(K):
    b=a
    if X[b-1]==1:
        k1=Y[b-1]
        k2=i+1-k1
        v=1
        a=L[a-1]
        break
    X[a-1]+=1
    Y[a-1]=i+1
    a=L[a-1]
    
if v==1:
    K=(K-k1)%k2
    for i in range(K):
        b=a
        a=L[a-1]


print(b)

Buggy submission (verdict: Runtime Error):
import numpy as np
l=list(map(int,input().split()))
N=l[0]
K=l[1]
L=list(map(int,input().split()))
L=np.array(L)
a=L[0]
v=0
X=np.zeros(N, dtype = int)
Y=np.zeros(N, dtype = int)
X[0]=1
Y[0]=0
for i in range(K):
    b=a
    if X[b-1]==1:
        k1=Y[b-1]
        k2=i+1-k1
        v=1
        a=L[a-1]
        break
    X[a-1]+=1
    Y[a-1]=i+1
    a=L[a-1]
    
if v==1:
    K=(K-k1)%k2
    for i in range(K):
        b=a
        a=L[a-1]


print(b)

Buggy submission (verdict: Runtime Error):
import numpy as np
l=list(map(int,input().split()))
N=l[0]
K=l[1]
L=list(map(int,input().split()))
L=np.array(L)
a=L[0]
v=0
X=np.zeros(N, dtype = int)
Y=np.zeros(N, dtype = int)
X[0]=1
Y[0]=0
for i in range(K):
    b=a
    if X[b-1]==1:
        k1=Y[b-1]
        k2=i+1-k1
        v=1
        A=np.zeros(N, dtype = int)
        A[a-1]=1
        a=np.dot(L,A)
        break
    X[a-1]+=1
    Y[a-1]=i+1
    A=np.zeros(N, dtype = int)
    A[a-1]=1
    a=np.dot(L,A)
    
if v==1:
    K=(K-k1)%k2
    for i in range(K):
        b=a
        A=np.zeros(N, dtype = int)
        A[a-1]=1
        a=np.dot(L,A)


print(b)

Buggy submission (verdict: Runtime Error):
import numpy as np
l=list(map(int,input().split()))
N=l[0]
K=l[1]
L=list(map(int,input().split()))
L=np.array(L)
a=L[0]
v=0
X=np.zeros(N, dtype = int)
Y=np.zeros(N, dtype = int)
X[0]=1
Y[0]=0
for i in range(K):
    b=a
    if X[b-1]==1:
        k1=Y[b-1]
        k2=i+1-k1
        v=1
        A=np.zeros(N, dtype = int)
        A[a-1]=1
        a=np.dot(L,A)
        break
    X[a-1]+=1
    Y[a-1]=i+1
    A=np.zeros(N, dtype = int)
    A[a-1]=1
    a=np.dot(L,A)
    
if v==1:
    K=(K-k1)%k2
    for i in range(K):
        b=a
        A=np.zeros(N, dtype = int)
        A[a-1]=1
        a=np.dot(L,A)


print(b)
Problem p02690 (python)

Fixed submission:
import math
X=int(input())
x=1
while 1:
    if X<2*pow(x,5):
        break
    x+=1
while 1:
    M=pow(x,5)-X
    if M<0:
        M=-1*M
        if pow(M,0.2)-int(pow(M,0.2))<=pow(10,-6):
            print(x,-1*(int(pow(M,0.2))))
            break
    else:
        if pow(M,0.2)-int(pow(M,0.2))<=pow(10,-6):
            print(x,int(pow(M,0.2)))
            break
    x+=1

Buggy submission (verdict: Runtime Error):
import numpy as np
x=int(input())
v=0
count=1
while v==0:
    if x<=2*(count)**5:
        v=1
    else:
        count+=1
for i in range(-1*count,count):
    if i**5+x<0:
        m=np.power(-1*(i**5+x),0.2)
        m=-1*m
    else:
        m=np.power(i**5+x,0.2)
    M=int(m)
    if m-M<=10**(-5):
        b=i
        a=M
        break
print(a,b)

Buggy submission (verdict: Runtime Error):
import numpy as np
x=int(input())
v=0
count=1
while v==0:
    if x<=2*(count)**5:
        v=1
    else:
        count+=1
for i in range(-1*count,count):
    if i**5+x<0:
        m=np.power(-1*(i**5+x),0.2)
        m=-1*m
    else:
        m=np.power(i**5+x,0.2)
    M=int(m)
    if m-M<=10**(-5):
        b=i
        a=M
        break
print(a,b)
Problem p02696 (python)

Fixed submission:
L=list(map(int,input().split()))
A=L[0]
B=L[1]
N=L[2]
if N>=B-1:
    print(int(A*(B-1)/B))
else:
    print(int(A*N/B))

Buggy submission (verdict: Runtime Error):
L=list(map(int,input().split()))
A=L[0]
B=L[1]
N=L[2]
if N>=B-1:
    print(int(A*(B-1)/B))
else:
    print(int(A*N/B))
Problem p02786 (python)

Fixed submission:
import math
H = int(input())
N = int(math.log2(H))
x = int((2**(N+1)-1))
print(x)

Buggy submission (verdict: Runtime Error):
import math
H=int(input())
n=int(math.log2(H))+1
x=n
for i in range(n-1):
    x+=2**(i)*(n-i-1)
print(x)
Problem p02804 (python)

Fixed submission:
def power(a,n):
    x=1
    L=list(format(n,'b'))
    l=len(L)
    for i in range(l):
        if int(L[l-i-1])==1:        
            x=(x*a)%(10**9+7)
        a=(a*a)%(10**9+7)
    return x
N,K=map(int,input().split())
A=list(map(int,input().split()))
b=sorted(A)
c=sorted(A,reverse=True)
D=[]
M=0
x=1
y=1
for l in range(K-1):
    x=(x*(N-l-1))%(10**9+7)
    y=(y*(l+1))%(10**9+7)
y=power(y,10**9+5)
M+=(x*y*(c[0]-b[0]))%(10**9+7)
for i in range(1,N-K+1):
    y1=power(N-i,10**9+5)
    x=(x*y1)%(10**9+7)
    x=(x*(N-K-i+1))%(10**9+7)  
    m=(x*y*(c[i]-b[i]))
    if m>0:
        m=m%(10**9+7)
    M+=m
    M%(10**9+7)

print(M%(10**9+7))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Mon Jan 13 14:52:12 2020

@author: USER
"""
import math
l=list(map(int,input().split()))
N=l[0]
K=l[1]
A=list(map(int,input().split()))
X=0
A=sorted(A)
for i in range(len(A)-K+1):
    for j in range(i+K-1,len(A)):
        X=X+(A[j]-A[i])*math.factorial(j-i-1)/(math.factorial(K-2)*math.factorial(j-i-1-K+2))
        X=X%(10**9+7)
        
print(int(X))
Problem p02584 (python)

Fixed submission:
x, k, d = map(int, input().split())

lo = 0
hi = k

while (lo < hi) :
  mid = lo + (hi - lo) // 2 + 1
  if (x >= 0) :
    if (x - mid * d >= 0) : 
      lo = mid;
    else :
      hi = mid - 1
  else :
    if (x + mid * d <= 0) :
      lo = mid;
    else :
      hi = mid - 1;

if (x >= 0) :
  x -= d * hi
else :
  x += d * hi

k -= hi;

if ( (k % 2) == 0):
  if (k == 0) :
    print(abs(x))
  else :
    print(min(abs(x), abs(x - d - d), abs(x + d + d)));
else :
  if (k == 1) :
    print(min(abs(x - d), abs(x + d)))
  else :
    print(min(abs(x - d), abs(x + d), abs(x + d + d + d), abs(x - d - d - d)));

Buggy submission (verdict: Runtime Error):
x, k, d = map(int, input().split())

lo = 0
hi = k

while (lo < hi) :
  mid = lo + (hi - lo) // 2 + 1
  if (x >= 0) :
    if (x - mid * d >= 0) : 
      lo = mid;
    else :
      hi = mid - 1
  else :
    if (x + mid * d <= 0) :
      lo = mid;
    else :
      hi = mid - 1;

if (x >= 0) x -= d * hi;
else x += d * hi;

k -= hi;

if ( (k % 2) == 0):
  if (k == 0) :
    print(abs(x))
  else :
    print(min(abs(x), abs(x - d - d), abs(x + d + d)));
else :
  if (k == 1) :
    print(min(abs(x - d), abs(x + d)))
  else :
    print(min(abs(x - d), abs(x + d), abs(x + d + d + d), abs(x - d - d - d)));

Buggy submission (verdict: Runtime Error):
x, k, d = map(int, input().split())

lo = 0
hi = k

while (lo < hi) :
  mid = lo + (hi - lo) // 2 + 1
  if (x >= 0) :
    if (x - mid * d >= 0) : 
      lo = mid;
    else :
      hi = mid - 1
  else :
    if (x + mid * d <= 0) :
      lo = mid;
    else :
      hi = mid - 1;

x -= d * hi;
x = abs(x);
k -= hi;


if ( (k % 2) == 0):
  if (k == 0) :
    print(abs(x))
  else :
    print(min(abs(x), abs(x - d - d), abs(x + d + d));
else :
  print(min(abs(x - d), abs(x + d)))
Problem p02705 (python)

Fixed submission:
import math

R = float(input())

print(2*R*math.pi)

Buggy submission (verdict: Runtime Error):
R = float(input())

print(2*R*math.pi)
Problem p02727 (python)

Fixed submission:
X, Y, A, B, C = map(int,input().split())
P = list(map(int,input().split()))
Q = list(map(int,input().split()))
R = list(map(int,input().split()))
P.sort(reverse=True)
Q.sort(reverse=True)
R.sort(reverse=True)

ANS_list = P[:X]
ANS_list.extend(Q[:Y])
ANS_list.sort()
c = 0
for i in range(len(R)):
  if ANS_list[i] >= R[i]:
    break
  c+=1

if i!=0:
  ANS_list[:c] = R[:c]
print(sum(R[:c])+sum(ANS_list[c:]))

Buggy submission (verdict: Runtime Error):
X, Y, A, B, C = input().split()
P = list(map(int,input().split()))
Q = list(map(int,input().split()))
R = list(map(int,input().split()))
P.sort(reverse=True)
Q.sort(reverse=True)
R.sort(reverse=True)

ANS_list = P[:X]
ANS_list.extend(Q[:Y])
ANS_list.sort()
c = 0
for i in range(len(R)):
    if ANS_list[i] >= R[i]:
        break
    c+=1

if i!=0:
    ANS_list[:c] = R[:c]

print(sum(R[:c])+sum(ANS_list[c:]))
Problem p02747 (python)

Fixed submission:
S=input()
if S in ['hi','hihi','hihihi','hihihihi','hihihihihi']:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
S=input()
TF=1
if len(S)%2==0 and len(S)>=2:
    for i in range(len(S)/2):
        if S[2*i]!='h' or S[2*i+1]!='i':
            TF=0
        else:
            TF*=1
else:
    TF=0

if TF==0:
    print('No')
else:
    print('Yes')

Buggy submission (verdict: Runtime Error):
TF=1
if len(S)%2==0 and len(S)>=2:
    for i in range(len(S)/2):
        if S[2*i]!='h' or S[2*i+1]!='i':
            TF=0
        else:
            TF*=1
else:
    TF=0

if TF==0:
    print('No')
else:
    print('Yes')

Buggy submission (verdict: Runtime Error):
S=input()
TF=1
if len(S)%2==0:
    for i in range(len(S)/2):
        if S[2*i]!='h' or S[2*i+1]!='i':
            TF=0
        else:
            TF*=1
else:
    TF=0

if TF==0:
    print('No')
else:
    print('Yes')
Problem p02755 (python)

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

UE_8 = math.ceil((A+1)/0.08)-1
SHITA_8 = A/0.08
UE_10 = math.ceil((B+1)/0.10)-1
SHITA_10 = B/0.10

if UE_8 < math.ceil(SHITA_10) or UE_10 < math.ceil(SHITA_8):
    print(-1)
else:
    i = math.ceil(SHITA_8)
    j = math.floor(UE_8)
    for n in range(int(i),int(j+1),1):
        if i < UE_10 and i >= SHITA_10:
            print(i)
            break
        i+=1

Buggy submission (verdict: Runtime Error):
import math
A, B = map(int,input().split())

UE_8 = (A+1)/0.08
SHITA_8 = A/0.08
UE_10 = (B+1)/0.10
SHITA_10 = B/0.10

if UE_8 < SHITA_10 or UE_10 < SHITA_8:
    print(-1)
else:
    i = math.ceil(SHITA_8)
    j = math.floor(UE_8)
    for n in range(j-i+1,start=i):
        if i < UE_10 and i >= SHITA_10:
            print(i)
        i+=1
Problem p02606 (python)

Fixed submission:
L,R,d = map(int, input().split())
ans = 0
for n in range(L, R+1):
  if n % d == 0:
    ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
L,R = map(int, input().split())
d = int(input())
ans = 0
for n in range(L, R+1):
  if n % d == 0:
    ans += 1
print(ans)
Problem p02616 (python)

Fixed submission:
N,K = map(int,input().split())
MOD = 10**9 + 7
A = list(map(int,input().split()))
Ap = [a for a in A if a >= 0]
An = [-a for a in A if a < 0]
Ap.sort()
Ap.reverse()
An.sort()
An.reverse()

if len(Ap) == 0 and K % 2 == 1:
	ans = 1
	An.reverse()
	for i in range(K):
		ans = (ans * -An[i]) % MOD
	print(ans)
	exit()

B = [(a, 1) if a >= 0 else (-a, -1) for a in A]
B.sort()
B.reverse()
M = [0 if B[0][1] > 0 else 1]
for i in range(1, N):
	M.append(M[i-1] + (0 if B[i][1] > 0 else 1))

i = K-1
if M[i] % 2 == 0 or K == N:
	ans = 1
	v = 1 if (M[i] % 2 == 0) else -1
	for j in range(K):
		ans = (ans * B[j][0]) % MOD
	print((ans * v) % MOD)
else:
	n = M[i]
	p = K - n
	if len(An) == n or p == 0:
		n -= 1
		p += 1
	elif len(Ap) == p:
		n += 1
		p -= 1
	elif Ap[p-1] * Ap[p] >= An[n-1] * An[n]:
		n -= 1
		p += 1
	else:
		n += 1
		p -= 1
	ans = 1
	for i in range(p):
		ans = (ans * Ap[i]) % MOD
	for i in range(n):
		ans = (ans * An[i]) % MOD
	print(ans)

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
MOD = 10**9 + 7
A = list(map(int,input().split()))
Ap = [a for a in A if a >= 0]
An = [-a for a in A if a < 0]
Ap.sort()
Ap.reverse()
An.sort()
An.reverse()

if len(Ap) == 0 and K % 2 == 1:
	ans = 1
	An.reverse()
	for i in range(K):
		ans = (ans * -An[i]) % MOD
	print(ans)
	exit()

B = [(a, 1) if a >= 0 else (-a, -1) for a in A]
B.sort()
B.reverse()
M = [0 if B[0][1] > 0 else 1]
for i in range(1, N):
	M.append(M[i-1] + (0 if B[i][1] > 0 else 1))

i = K-1
if M[i] % 2 == 0 or K == N:
	ans = 1
	for j in range(K):
		ans = (ans * B[j][0]) % MOD
	print(ans)
else:
	n = M[i]
	p = K - M[i]
	if len(An) == M[i] or p == 0:
		n -= 1
		p += 1
	elif len(Ap) == p+1:
		n += 1
		p -= 1
	elif Ap[p-1] * Ap[p] >= An[n-1] * An[n]:
		n -= 1
		p += 1
	else:
		n += 1
		p -= 1
	ans = 1
	for i in range(p):
		ans = (ans * Ap[i]) % MOD
	for i in range(n):
		ans = (ans * An[i]) % MOD
	print(ans)
Problem p02721 (python)

Fixed submission:
N,K,C = map(int,input().split())
S = list(input())
L = [(0,-C) for i in range(N+1)]
R = [(0,N+C+1) for i in range(N+1)]
for i in range(N):
	l = L[i]
	s = S[i]
	if s == "o" and l[1] + C < i+1:
		L[i+1] = (l[0]+1, i+1)
	else:
		L[i+1] = L[i]

	r = R[N-i]
	s = S[N-1-i]
	if s == "o" and N-i + C < r[1]:
		R[N-i-1] = (r[0]+1, N-i)
	else:
		R[N-i-1] = R[N-i]

R = [(0,0)] + R

for n in range(N):
	d = n+1
	if d == 1:
		if R[2][0] < K:
			print(d)
		continue
	if d == N:
		if L[N-1][0] < K:
			print(d)
		continue
	l = L[d-1]
	r = R[d+1]
	w_l, w_r=0, 0
	if l[1] + C > N:
		w_l = l[0]
	else:
		w_l = l[0] + R[max(d+1, l[1]+C)][0]
	if r[1] - C <= 0:
		w_r = r[0]
	else:
		w_r = r[0] + L[min(d-1, r[1]-C)][0]
	if w_l < K and w_r < K:
		print(d)

Buggy submission (verdict: Runtime Error):
N,K,C = map(int,input().split())
S = list(input())
L = [(0,-C) for i in range(N+1)]
R = [(0,N+C+1) for i in range(N+1)]
for i in range(N):
	l = L[i]
	s = S[i]
	if s == "o" and l[1] + C < i+1:
		L[i+1] = (l[0]+1, i+1)
	else:
		L[i+1] = L[i]

	r = R[N-i]
	s = S[N-1-i]
	if s == "o" and N-i + C < r[1]:
		R[N-i-1] = (r[0]+1, N-i)
	else:
		R[N-i-1] = R[N-i]

R = [(0,0)] + R

for n in range(N):
	d = n+1
	if d == 1:
		if R[2][0] < K:
			print(d)
		continue
	if d == N:
		if L[N-1][0] < K:
			print(d)
		continue
	l = L[d-1]
	r = R[d+1]
	if l[0] + R[max(d+1, l[1]+C)][0] < K and r[0] + L[min(d-1, r[1]-C)][0]:
		print(d)
Problem p02722 (python)

Fixed submission:
N = int(input())

if N == 2:
	print(1)
	exit()
if N == 3:
	print(2)
	exit()
def yakusu(n):
	rn = int(n ** 0.5)
	ret = 2
	for i in range(2, rn+1):
		if n % i == 0:
			ret += 2
	if rn*rn == n:
		ret -= 1
	return ret

#A = [True for i in range(10**6 + 1)]
ans = 1 # K = N
rn = int(N ** 0.5)
for i in range(2, rn+1):
	if N % i > 0:
		continue
	n = N
	while n % i == 0:
		n = n // i
	if n % i == 1:
		ans += 1
	n = N
	j = N // i
	if j <= i:
		continue
	while n % j == 0:
		n = n // j
	if n % j == 1:
		ans += 1
print(ans + yakusu(N-1) - 1)

Buggy submission (verdict: Runtime Error):
N = int(input())

def yakusu(n):
	rn = int(n ** 0.5)
	ans = 0
	for i in range(1, int(n**0.5)):
		if n % i == 0:
			ans += 2
	if rn*rn == n:
		ret += 1
	return ret

#A = [True for i in range(10**6 + 1)]
ans = 1 # K = N
for i in range(2, min(N, 10**6+1)):
	if N % i > 0:
		continue
	if i == 2:
		ans += 1
		continue
	n = N
	while n % i == 0:
		n = n // i
	if n % i == 1:
		ans += 1
print(ans + yakusu(N-1) - 1)
Problem p02789 (python)

Fixed submission:
N,M = map(int,input().split())
if N == M:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
N,M = map(int,input())
if N == M:
  print("Yes")
else:
  print("No")
Problem p02830 (python)

Fixed submission:
N = int(input())
S,T = map(list, input().split())
ans = ""
for i in range(N):
  ans += S[i] + T[i]
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = list(input())
T = list(input())
ans = ""
for i in range(N):
  ans += S[i] + T[i]
print(ans)
Problem p02839 (python)

Fixed submission:
H,W = map(int,input().split())
A = [[] for i in range(H)]
B = [[] for i in range(H)]

for i in range(H):
	a = list(map(int,input().split()))
	A[i] = a
for i in range(H):
	b = list(map(int,input().split()))
	B[i] = b

D = [[abs(A[i][j] - B[i][j]) for j in range(W)] for i in range(H)]
R = 160*80
"""
dp = [[[False for k in range(R)] for j in range(W)] for i in range(H)]
dp[0][0][D[0][0]] = True
for i in range(H):
	for j in range(W):
		r = 80 * (i+j+2)
		for n in range(r):
			if not dp[i][j][n]:
				continue
			if j != W-1:
				d = D[i][j+1]
				dp[i][j+1][n+d] = True
				dp[i][j+1][abs(n-d)] = True
			if i != H-1:
				d = D[i+1][j]
				dp[i+1][j][n+d] = True
				dp[i+1][j][abs(n-d)] = True

"""
dp = [[0 for j in range(W)] for i in range(H)]
dp[0][0] = 2**(R + D[0][0]) | 2**(R - D[0][0])
for i in range(H):
	for j in range(W):
		if j != W-1:
			d = D[i][j+1]
			dp[i][j+1] |= (dp[i][j] << d | dp[i][j] >> d)
		if i != H-1:
			d = D[i+1][j]
			dp[i+1][j] |= (dp[i][j] << d | dp[i][j] >> d)
h,w = H-1, W-1
for i in range(R):
	mask = 2 ** (R+i) | 2 ** (R-i)
	if dp[h][w] & mask > 0:
		print(i)
		exit()

Buggy submission (verdict: Runtime Error):
H,W = map(int,input().split())
A = [[] for i in range(H)]
B = [[] for i in range(H)]

for i in range(H):
	a = list(map(int,input().split()))
	A[i] = a
for i in range(H):
	b = list(map(int,input().split()))
	B[i] = b

D = [[abs(A[i][j]) - abs(B[i][j]) for j in range(W)] for i in range(H)]
R = 160*80
dp = [[[False for k in range(R)] for j in range(W)] for i in range(H)]
dp[0][0][D[0][0]] = True
for i in range(H):
	for j in range(W):
		for n in range(R):
			if not dp[i][j][n]:
				continue
			if j != W-1:
				d = D[i][j+1]
				dp[i][j+1][n+d] = True
				dp[i][j+1][abs(n-d)] = True
			if i != H-1:
				d = D[i+1][j]
				dp[i+1][j][n+d] = True
				dp[i+1][j][abs(n-d)] = True

h,w = H-1, W-1
for i in range(160*80):
	if dp[h][w][i]:
		print(i)
		exit()
Problem p02898 (python)

Fixed submission:
N,K = map(int,input().split())
h = list(map(int,input().split()))
ans = 0
for x in h:
  if x >= K:
    ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
h = list(map(int,input().split()))
ans = 0
for x in h:
  if h >= K:
    ans += 1
print(ans)