Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
a = int(input())
def d(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors
s = 0
t = d(a)
#print(t)
for i in range(len(t)):
    if t[i]>=math.sqrt(a):break
    #print(t[i])
    s+=(a-t[i])//(t[i])
print(s)

Fixed submission:
a = int(input())
def d(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors
s = 0
t = d(a)
#print(t)
res = 0
for k in t:
    if k==1:
        continue
    m=k-1
    if (a//m)==(a%m):
        res+=m
print(res)

Buggy python submission (verdict: Runtime Error):
a = int(input())
def d(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors
s = 0
t = d(a)
#print(t)
for i in range(len(t)):
    if t[i]>=math.sqrt(a):break
    #print(t[i])
    s+=(a-t[i])//(t[i])
print(s)

Fixed submission:
a = int(input())
def d(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors
s = 0
t = d(a)
#print(t)
res = 0
for k in t:
    if k==1:
        continue
    m=k-1
    if (a//m)==(a%m):
        res+=m
print(res)

Buggy python submission (verdict: Runtime Error):
a = int(input())
def d(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors
s = 0
t = d(a)
#print(t)
for i in range(len(t)):
    if t[i]>=math.sqrt(a):break
    #print(t[i])
    s+=(a-t[i])//(t[i])
print(s)

Fixed submission:
a = int(input())
def d(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors
s = 0
t = d(a)
#print(t)
res = 0
for k in t:
    if k==1:
        continue
    m=k-1
    if (a//m)==(a%m):
        res+=m
print(res)
Buggy python submission (verdict: Runtime Error):
import numpy as np

H,W = map(int,input().split())
A = []
for i in range(H):
    A.append([0 if i == "#" else H+W for i in list(input())])
A = np.array(A)

for i in range(H-1):
  A[i+1, :] = np.minimum(A[i, :] + 1, A[i+1, :])
for i in range(H-1,0,-1):
  A[i-1,:] = np.minimum(A[i,:]+1,A[i-1,:])
for i in range(W-1):
  A[:,i+1] = np.minimum(A[:,i]+1,A[:,i+1])
for i in range(W-1,0,-1):
  A[:,i-1] = np.minimum(A[:,i]+1,A[:,i-1])
print(np.max(A))


Fixed submission:
import numpy as np

H,W = map(int,input().split())
A = []
for i in range(H):
    A.append([0 if i == "#" else H+W for i in list(input())])
A = np.array(A)

for i in range(H-1):
  A[i+1, :] = np.minimum(A[i, :] + 1, A[i+1, :])
for i in range(H-1,0,-1):
  A[i-1,:] = np.minimum(A[i,:]+1,A[i-1,:])
for i in range(W-1):
  A[:,i+1] = np.minimum(A[:,i]+1,A[:,i+1])
for i in range(W-1,0,-1):
  A[:,i-1] = np.minimum(A[:,i]+1,A[:,i-1])
print(np.max(A))
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
ma = []
pa = []
l =[]
t = 0
for i in a:
  if i < 0:
    ma.append(i)
    l.append(i*-1)
  elif i> 0:
    pa.append(i)
    l.append(i)
  else:
    t = 1
pa.sort()
ma.sort()
s = sum(l)
for i in [pa,ma]:
  if len(i)==0:i.append(0)
print(s  if t == 1 or len(b)%2==0 else s - 2*min(l))

Fixed submission:
s= 0
A,B,T=map(int,input().split())
for i in range(T//A):
  s+=B
print(s)
Buggy python submission (verdict: Runtime Error):
from fractions import*
N＝int(input())
a  = list(map(int,input().split()))
B=[0]
a=range(N)
for x in a:B+=[gcd(B[-1],A[x])]
w=M=0
for x in a[::-1]:M=max(M,gcd(w,B[x]));w=gcd(w,A[x])
print(M)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
L=[0]
R=[0]
def gcd(x,y):
    if x==0:return y
    else:return gcd(y%x,x)
for i in range(n-1):
    L.append(gcd(L[i],a[i]))
    R.append(gcd(R[i],a[-1-i]))
MAX=0
for i in range(n):
    MAX=max(MAX,gcd(L[i],R[-1-i]))
print(MAX)
Buggy python submission (verdict: Runtime Error):
a = int(input())
s = input()
k = int(input())

t = ["*"]*a
aa = s[k]
for f,i in enumerate(s):
  if i == aa:
    t[f] = i
print("".join(t))


Fixed submission:

a = int(input())
s = input()
k = int(input())

t = ["*"]*a
aa = s[k-1]
for f,i in enumerate(s):
  if i == aa:
    t[f] = i
print("".join(t))

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

t = ["*"]*a
aa = s[k]
for f,i in enumerate(s):
  if i == aa:
    t[f] = i
print("".join(t))


Fixed submission:

a = int(input())
s = input()
k = int(input())

t = ["*"]*a
aa = s[k-1]
for f,i in enumerate(s):
  if i == aa:
    t[f] = i
print("".join(t))

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

t = ["*"]*a
aa = s[k]
for f,i in enumerate(s):
  if i == aa:
    t[f] = i
print(" ".join(aa))


Fixed submission:

a = int(input())
s = input()
k = int(input())

t = ["*"]*a
aa = s[k-1]
for f,i in enumerate(s):
  if i == aa:
    t[f] = i
print("".join(t))
Buggy python submission (verdict: Runtime Error):
a = int(input())
l = input()
s = 0 
r = 0
for i in l :
  if i == "#":
    t +=1
  if t >= 1 and i == ".":
    s+=1
    r+=t
    t = 0
  
print(min(s,t))

Fixed submission:
input()
S=input()
dot=S.count(".")
ans=dot
count=0
for s in S:
    if s=="#":count+=1
    else:dot-=1
    ans=(min(ans,count+dot))
print(ans)

Buggy python submission (verdict: Runtime Error):

a = int(input())
l = input()
s = 0 
for i in l :
  if i == "#":
    t = 1
  if t and i == ".":
    s+=1
  
print(s)

Fixed submission:
input()
S=input()
dot=S.count(".")
ans=dot
count=0
for s in S:
    if s=="#":count+=1
    else:dot-=1
    ans=(min(ans,count+dot))
print(ans)

Buggy python submission (verdict: Runtime Error):
a = int(input())
l = list(map(int,input().split()))
s = 0 
for i ,j in zip(l,l[1:]):
  if i + j == "#.":s+=1
print(s)

Fixed submission:
input()
S=input()
dot=S.count(".")
ans=dot
count=0
for s in S:
    if s=="#":count+=1
    else:dot-=1
    ans=(min(ans,count+dot))
print(ans)
Buggy python submission (verdict: Runtime Error):
a  = input()
s = 0
t = 0
k = ["0","1"]
for n,i in enumerate(a):
  if i != k[(n%2)]:
    s+=1
  if i != k[(n%2)+1]:
    t+=1
print(min(s,t))
  
  

Fixed submission:
a  = input()
s = 0
t = 0
k = ["0","1"]
for n,i in enumerate(a):
  if i != k[(n%2)]:
    s+=1
  if i != k[(n+1)%2]:
    t+=1
print(min(s,t))
Buggy python submission (verdict: Time Limit Exceeded):
inf = float("INF")
x,y,z,k=map(int,input().split())
dp=[0]*3000
l =[]
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
for i in a:
  for j in b:
    l.append(i+j)
l.sort()
l = l[::-1]
t =[]
for i in l[:k]:
  for j in c:
    t.append(i+j)
t.sort()
t = t[::-1]
for i ,n in enumerate(t):
  print(n)
  if i == k-1:break

Fixed submission:
inf = float("INF")
x,y,z,k=map(int,input().split())
dp=[0]*3000
l =[]
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
for i in a:
  for j in b:
    l.append(i+j)
l.sort()
l = l[::-1]
t =[]
for i in l[:k]:
  for j in c:
    t.append(i+j)
t.sort()
t = t[::-1]
for i ,n in enumerate(t):
  print(n)
  if i == k-1:break
Buggy python submission (verdict: Runtime Error):
N,M=map(int,input().split())
a = input()
k = []
for i in range(M):
  ta,tb=map(str,input().split())
  k.append([ta,tb])
k = k[::-1]
s = 0
t = N-1
c=0
for i, j in k:
  if j == "R" and i == a[t]:
    t-=1
    c+=1
  elif j == "L" and i == a[s]:
    s+=1
  elif j == "R" and i == a[s]:
    s-=1
  elif j == "L" and i == a[t]:
    t+=1
    c-=1
  if s+c==N and N!=0:break
if N>1:print(N-s-c)
else: 
  if s+c>1:print(1)
  else:print(0)

Fixed submission:
N,M=map(int,input().split())
a = "a"+input()+"q"
k = []
for i in range(M):
  ta,tb=map(str,input().split())
  k.append([ta,tb])
k = k[::-1]
s = 1
t = N
c=0
for i, j in k:
  if j == "R" and i == a[t]:
    t-=1
    c+=1
  if j == "L" and i == a[s]:
    s+=1
  if j == "R" and i == a[s-1] and s!= 1:
    s-=1
  if j == "L" and i == a[t+1] and t!= N:
    t+=1
    c-=1
  if s+c-1==N and N!=0:break
if N>1:print(N-s-c-1+2)
else: 
  if s+c+1>1:print(1)
  else:print(0)

Buggy python submission (verdict: Runtime Error):
N,M=map(int,input().split())
a = input()
k = []
for i in range(M):
  ta,tb=map(str,input().split())
  k.append([ta,tb])
k = k[::-1]
s = 0
t = N-1
c=0
for i, j in k:
  if j == "R" and i == a[t]:
    t-=1
    c+=1
  elif j == "L" and i == a[s]:
    s+=1
print(s+c)


Fixed submission:
N,M=map(int,input().split())
a = "a"+input()+"q"
k = []
for i in range(M):
  ta,tb=map(str,input().split())
  k.append([ta,tb])
k = k[::-1]
s = 1
t = N
c=0
for i, j in k:
  if j == "R" and i == a[t]:
    t-=1
    c+=1
  if j == "L" and i == a[s]:
    s+=1
  if j == "R" and i == a[s-1] and s!= 1:
    s-=1
  if j == "L" and i == a[t+1] and t!= N:
    t+=1
    c-=1
  if s+c-1==N and N!=0:break
if N>1:print(N-s-c-1+2)
else: 
  if s+c+1>1:print(1)
  else:print(0)

Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int,input().split())
b = input()
k = [[]*26]
s = [0]+[1]*N+[0]
from collections import defaultdict as ddict
d = ddict(lambda: [])
for i,t in enumerate(b):
  d[t].append(i+1)
for i in range(M):
  ta,tb=map(str,input().split())
  r = 1 if tb == "R" else -1
  for j in d[ta]:
    s[j+r] += s[j]
    s[j]   -= s[j]
print(N-s[-1]-s[0])
    

  



Fixed submission:
N,M=map(int,input().split())
a = "a"+input()+"q"
k = []
for i in range(M):
  ta,tb=map(str,input().split())
  k.append([ta,tb])
k = k[::-1]
s = 1
t = N
c=0
for i, j in k:
  if j == "R" and i == a[t]:
    t-=1
    c+=1
  if j == "L" and i == a[s]:
    s+=1
  if j == "R" and i == a[s-1] and s!= 1:
    s-=1
  if j == "L" and i == a[t+1] and t!= N:
    t+=1
    c-=1
  if s+c-1==N and N!=0:break
if N>1:print(N-s-c-1+2)
else: 
  if s+c+1>1:print(1)
  else:print(0)
Buggy python submission (verdict: Runtime Error):
import math
o, b = map(int, input().split())
def pi(a):
    s= 0
    a+=1
    p = math.log2(a)
    p = int(p)
    b_q =1
    q = 2
    ans =0
    ans += (t//2)%2

    for i in range(1,p+1):
        b_q = q

        q*=2
        t = a%(q)
        ans += b_q*(max(0,t-b_1)%2)
    return ans
print((pi(b)^pi(o))^o)


Fixed submission:
import math
o, b = map(int, input().split())
def pi(a):
    s= 0
    a+=1
    p = math.log2(a)
    p = int(p)
    qq=1
    q = 2
    ans =0
    t = 0
    t = a//2
    ans += t%2

    for i in range(1,p+1):
        qq = q

        q*=2
        t = a%(q)
        ans += qq*(max(0,t-qq)%2)
    return ans
print((pi(b)^pi(o))^o)

Buggy python submission (verdict: Runtime Error):
import math
a, b = map(int, input().split())
def pi(a):
    s= 0
    a+=1
    n = int(math.log2(a))
    b_q=1
    q = 2
    ans =0
    ans += (t//2)%2

    for i in range(1,n+1):
        b_q = q

        q*=2
        t = a%(q)
        ans += b_q*(max(0,t-b_q)%2)
    return ans
print((pi(b)^pi(a))^a)

Fixed submission:
import math
o, b = map(int, input().split())
def pi(a):
    s= 0
    a+=1
    p = math.log2(a)
    p = int(p)
    qq=1
    q = 2
    ans =0
    t = 0
    t = a//2
    ans += t%2

    for i in range(1,p+1):
        qq = q

        q*=2
        t = a%(q)
        ans += qq*(max(0,t-qq)%2)
    return ans
print((pi(b)^pi(o))^o)
Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())
x=list(map(int,input().split()))
y=[]
x.sort()
for i in range(1,k):
    y.append(x[i]-x[i-1])
y.sort()
for k in range(n-1):
    y.pop()
print(sum(y))

Fixed submission:
n,k = map(int,input().split())
x=list(map(int,input().split()))
y=[]
x.sort()
for i in range(1,k):
    y.append(x[i]-x[i-1])
y.sort()
if n>k-1:
    print(0)
else:
    for k in range(n-1):
        y.pop()
    print(sum(y))
Buggy python submission (verdict: Runtime Error):
def a():return input()#s
def ai():return int(input())#a,n or k
def ma():return map(int, input().split())#a,b,c,d or n,k
def ms():return map(str, input().split())#,a,b,c,d
def lma():return list(map(int, input().split()))#x or y
def lms():return list(map(str, input().split()))#x or y
a = ai()
x = lma()
dp =[0]+[float("INF")]*(a-1)
def cal(i):
    res = float("INF")
    if dp[i]< float("INF"): return dp[i]
    if(i==0) :return 0
    res = min(res,cal(i-1)+abs(x[i]-x[i-1]))
    if i >1 :res = min(res,cal(i-2)+abs(x[i]-x[i-2])) # i=1の時の処理
    dp[i] = res
    return dp[i]
print(cal(a-1))

Fixed submission:
N = int(input())
a = list(map(int, input().split()))
dp = [0] + [10**10]*N
for i,h in enumerate(a):
    for j in range(i+1,min(i+3,N)):
        dp[j] = min(dp[j],dp[i]+abs(h-a[j]))
    #print(dp)
print(dp[N-1])
Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
H = list(map(int,input().split()))
inf = float('INF')
dp = [inf]*n
dp[0] = 0
for i in range(1,n):
    for j in range(1,min(i,k)+1):
        # print(j)
        dp[i]=min(dp[i],dp[i-j]+abs(H[i]-H[i-j]))
    # print(dp)

    # dp[i]=min(dp[i],dp[i-1]+abs(H[i]-H[i-1]))
# print(dp)
print(dp[-1])

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

Buggy python submission (verdict: Time Limit Exceeded):
a,b = map(int, input().split())
b+=1
x = list(map(int, input().split()))
dp = [0]+[10**10]*(a-1)
dp = [0]+[float("inf")]*(a-1)
dp[1] = abs(x[1]-x[0])
for i,h in enumerate(x):
    for j in range(i+1,min(i+b,a)):
        dp[j] = min(dp[j],dp[i]+abs(h-x[j]))
#print(dp)
print(dp[a-1])

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

Buggy python submission (verdict: Time Limit Exceeded):
a,b = map(int, input().split())
b+=1
x = list(map(int, input().split()))
dp = [0]+[10**10]*(a-1)
dp[1] = abs(x[1]-x[0])
for i,h in enumerate(x):
    for j in range(i+1,min(i+b,a)):
        dp[j] = min(dp[j],dp[i]+abs(h-x[j]))
#print(dp)
print(dp[a-1])

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

Buggy python submission (verdict: Runtime Error):
n,k = map(int, input().split())
dp = [0]+ [float("INF")]*(100010)

h = list(map(int, input().split()))
for i in range(n):
    for j in range(1,k+1):
        dp[i] = min(dp[i],dp[i-j]+abs(h[i]-h[i-j]))
        #print(1,dp[i],dp[i-j]+abs(h[i]-h[i-j]))
        #print(dp)
print(dp[n-1])

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

dp = [0]*(W+1)
L = []
for i in range(N):
    tb,ta = map(int,input().split())
    L.append([ta,tb])

for i in range(N):
    for w in range(W,-1,-1):
        if w-L[i][1]>=0 :dp[w] = max(dp[w],dp[w-L[i][1]]+L[i][0])
print(dp[-1])

Fixed submission:
n,k = map(int,input().split())
w=[]
v=[]
dp =[[0 for i in range(k+1)] for j in range(n+1)]

for i in range(n):
    a,b = map(int,input().split())
    w.append(a)
    v.append(b)
for i in range(n):
    for sum_w in range(k+1):
        if sum_w - w[i] >=0:
            dp[i+1][sum_w]=max(dp[i][sum_w],dp[i][sum_w - w[i]] + v[i])
        else:
            dp[i+1][sum_w]=dp[i][sum_w]

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

Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
w=[]
v=[]
dp =[[0 for i in range(k+1)] for j in range(n+1)]

for i in range(n):
    a,b = map(int,input().split())
    w.append(a)
    v.append(b)
for i in range(n):
    for sum_w in range(k+1):
        if sum_w - w[i] >=0:
            dp[i+1][sum_w]=max(dp[i][sum_w],dp[i][sum_w - w[i]] + v[i])
        else:
            dp[i+1][sum_w]=dp[i][sum_w]

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

Fixed submission:
n,k = map(int,input().split())
w=[]
v=[]
dp =[[0 for i in range(k+1)] for j in range(n+1)]

for i in range(n):
    a,b = map(int,input().split())
    w.append(a)
    v.append(b)
for i in range(n):
    for sum_w in range(k+1):
        if sum_w - w[i] >=0:
            dp[i+1][sum_w]=max(dp[i][sum_w],dp[i][sum_w - w[i]] + v[i])
        else:
            dp[i+1][sum_w]=dp[i][sum_w]

print(dp[-1][-1])
Buggy python submission (verdict: Runtime Error):
N,W = map(int,input().split())

dp = [0]*(W+1)
L = []
for i in range(N):
    w,v = map(int,input().split())
    L.append([v,w])

for i in range(N):
    for w in range(W+1):
        if w-L[i][1]>=0 :dp[w] = max(dp[w],dp[w-L[i][1]]+L[i][0])
print(dp[-1])

Fixed submission:
N, W = map(int, input().split())
a = []
for i in range(N):
    x,y = map(int,input().split())
    a.append([x,y])
max_v, inf = 10**5, float("inf")
dp = [0] + [inf]*max_v
 
for w, v in a:
    for i, j in zip(range(max_v-v, -1, -1), range(max_v, -1, -1)):
        if dp[i]+w <= W and dp[j] > dp[i]+w:
            dp[j] = dp[i]+w
 
for weight, value in zip(dp[::-1], range(max_v, -1, -1)):
    if weight != inf:
        print(value)
        break

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

dp = [0]*(W+1)
L = []
for i in range(N):
    v,w = map(int,input().split())
    L.append([w,v])

for i in range(N):
    for w in range(W+1):
        if w-L[i][1]>=0 :dp[w] = max(dp[w],dp[w-L[i][1]]+L[i][0])
print(dp[-1])

Fixed submission:
N, W = map(int, input().split())
a = []
for i in range(N):
    x,y = map(int,input().split())
    a.append([x,y])
max_v, inf = 10**5, float("inf")
dp = [0] + [inf]*max_v
 
for w, v in a:
    for i, j in zip(range(max_v-v, -1, -1), range(max_v, -1, -1)):
        if dp[i]+w <= W and dp[j] > dp[i]+w:
            dp[j] = dp[i]+w
 
for weight, value in zip(dp[::-1], range(max_v, -1, -1)):
    if weight != inf:
        print(value)
        break

Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
w=[]
v=[]
MAX_N = 110
MAX_V=100100
dp =[[float("inf") for i in range(MAX_V)] for j in range(MAX_N)]
dp[0][0] = 0

for i in range(n):
    a,b = map(int,input().split())
    w.append(a)
    v.append(b)
for i in range(n):
    for sum_v in range(MAX_V):
        if sum_v - v[i] >=0:
            dp[i+1][sum_v]=min(dp[i][sum_v],dp[i][sum_v - v[i]] + w[i])
        
        dp[i+1][sum_v]=min(dp[i][sum_v],dp[i+1][sum_v])
for sum_v in range(MAX_V):
    if dp[n][sum_v] <= k:
        res = sum_v
print(res)

Fixed submission:
N, W = map(int, input().split())
a = []
for i in range(N):
    x,y = map(int,input().split())
    a.append([x,y])
max_v, inf = 10**5, float("inf")
dp = [0] + [inf]*max_v
 
for w, v in a:
    for i, j in zip(range(max_v-v, -1, -1), range(max_v, -1, -1)):
        if dp[i]+w <= W and dp[j] > dp[i]+w:
            dp[j] = dp[i]+w
 
for weight, value in zip(dp[::-1], range(max_v, -1, -1)):
    if weight != inf:
        print(value)
        break
Buggy python submission (verdict: Runtime Error):
print(input().count(2))

Fixed submission:
print(input().count("2"))
Buggy python submission (verdict: Runtime Error):
s = input() + "lllllll"
n = len(s)
tt = 0
ts = 0
for i in range(n-3):
    #print(s[i])
    if s[i] == "B" and s[i+1] == "W":
        #print("Hello")
        tt+=1
        #if s[i+2] == "B" and s[i+3] == "W":tt+=1
        for j in range(1,n-i,2):
            if s[i+j+1] == "B" and s[i+j+2] == "W":tt+=1
        for k in range(1,i+1):
            #print(k,i)
            if i - k >= 0 and s[i-k] == "B":tt+=1
            else:break
        for j in range(1,n-i):
            #print(j,i)
            if i + j <= n-2 and s[i+j+1] == "W":tt+=1
            else:break
        i = i+j+1
print(tt)

Fixed submission:
a = input()
b = 0
bt = 0
w = 0
wt = 0
for i in range(len(a)):
    if a[i] == "B":bt = 1
    if bt == 1 and a[i] == "B":b+=1
    if a[i] =="W":
        w+=b
        wt +=1
print(w)

Buggy python submission (verdict: Time Limit Exceeded):
ts = input()
res = 0
while "BW" in ts:
    t = ""
    s = list(ts)
    for i in range(len(ts)-1):
        if s[i] == "B" and s[i+1] == "W":
            s[i] = "W"
            s[i+1] = "B"
            res += 1
        t += s[i]
    ts = t
print(res)

Fixed submission:
a = input()
b = 0
bt = 0
w = 0
wt = 0
for i in range(len(a)):
    if a[i] == "B":bt = 1
    if bt == 1 and a[i] == "B":b+=1
    if a[i] =="W":
        w+=b
        wt +=1
print(w)
Buggy python submission (verdict: Runtime Error):
a = int(input())
x = [3,5,7]
if a in x:
  pritn("YES")
else:
  print("NO")

Fixed submission:
n = int(input()) 
if (n%5 == 0 or n%3 == 0 or n%7 ==0) and n%9!=0 and n%6 !=0:
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Runtime Error):
s= input()
n = len(s)
for i in range(n-2):
    k = 100*int(s[i])+10*int(s[i+1])+int(s[i+2])
    if min > abs(753-k):
        min = abs(753-k)
    
print(min)

Fixed submission:
s= input()
n = len(s)
min = 1000
for i in range(n-2):
    k = 100*int(s[i])+10*int(s[i+1])+int(s[i+2])
    if min > abs(753-k):
        min = abs(753-k)
    
print(min)
Buggy python submission (verdict: Runtime Error):
a = list(map(int, input().split()))

print(inya[0]+a[1]/2)

Fixed submission:
a = list(map(int, input().split()))
 
print(int(a[0]+a[1]/2))
Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
m =1
for i in range(k//n+1)[::-1]:
    if k%i==0 and k//i>=n:
        m= i
        break
print(m)

Fixed submission:
n,k = map(int,input().split())
m =1
for i in range(k//n+1)[::-1]:
    if k%i==0 and k//i>=n:
        m= i
        break
print(m)

Buggy python submission (verdict: Time Limit Exceeded):
import math
n,k = map(int,input().split())
m =1
for i in range(k//n+1)[::-1]:
    if k%i==0 and k//i>=n:
        m= i
        break
print(m)

Fixed submission:
n,k = map(int,input().split())
m =1
for i in range(k//n+1)[::-1]:
    if k%i==0 and k//i>=n:
        m= i
        break
print(m)
Buggy python submission (verdict: Runtime Error):

def get_input(inp):
    li = inp.split("\n")

    def inner():
        return li.pop(0)
    return inner

INPUT = """azzel
apple
"""
input = get_input(INPUT)

#######################################################
a = input()
b = input()
k = []
l = []
np=0
nq=0
for i in range(0,len(a)):
    if a[i] not in k:
        k.append(a[i])
        np+=1
    if b[i] not in l:
        l.append(b[i])
        nq+=1
    if i != 0:
        if not (k.index(a[i])==l.index(b[i]) and ((a[i-1]==a[i] and b[i-1] == b[i]) or ( a[i-1] != a[i] and b[i-1]!= b[i])):
            np*=0
if np == nq:
    print("Yes")
else:
    print("No")

Fixed submission:
a = input()
b = input()
k = []
l = []
np=0
nq=0
for i in range(0,len(a)):
    if a[i] not in k:
        k.append(a[i])
        np+=1
    if b[i] not in l:
        l.append(b[i])
        nq+=1
    if i != 0:
        if not (k.index(a[i])==l.index(b[i]) and ((a[i-1]==a[i] and b[i-1] == b[i]) or ( a[i-1] != a[i] and b[i-1]!= b[i]))):
            np*=0
if np == nq:
    print("Yes")
else:
    print("No")