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

Fixed submission:
y,m,d=map(int,input().split("/"))
if y<=2018 :
    print("Heisei")
elif y==2019 :
    if m<=4 :
        print("Heisei")
    else:
        print("TBD")
else :
    print("TBD")

Buggy submission (verdict: Runtime Error):
y,m,d=map(int,input().split("/"))
if y<=2018 :
    print(Heisei)
elif y==2019 :
    if m<=4 :
        print(Heisei)
    else:
        print(TBD)
else :
    print(TBD)

Buggy submission (verdict: Runtime Error):
y,m,d=map(int,input().split(/))
if y<=2018 :
    print(Heisei)
else:
    if m<=4 :
        print(Heisei)
    else:
        print(TBD)
Problem p03324 (python)

Fixed submission:
D,N=map(int,input().split())
if N<100 :
    print(N*100**D)
else :
    print((N+1)*100**D)

Buggy submission (verdict: Runtime Error):
D,N=map(int,input().split())
if N=100 :
    print((N+1)*100**D)
else :
    print(N*100**D)

Buggy submission (verdict: Runtime Error):
D,N=map(int,input().split())
if N=100 :
    print((N+1)*100*D)
else :    
    print(N*100**D)
Problem p02995 (python)

Fixed submission:
from fractions import gcd
from decimal import Decimal
A, B, C, D = map(Decimal, input().split())
_A = A-1
print(int(B - _A - (B//C - _A//C + B//D - _A//D - B//(C*D/gcd(C, D)) + _A//int(C*D/gcd(C, D)))))

Buggy submission (verdict: Runtime Error):
import math
A, B, C, D = map(int, input().split())
print(int(B - A + 1 - (B//C - (A-1)//C + B//D - (A-1)//D - B//(C*D/math.gcd(C, D)) + (A-1)//(C*D/math.gcd(C, D)))))
Problem p02700 (python)

Fixed submission:
a,b,c,d,=map(int,input().split())
def func(a,b,c,d):
    while a>0 and c>0:
        c-=b
        if c<=0:
            return "Yes"
        a-=d
        if a<=0:
            return "No" 
print(func(a,b,c,d))

Buggy submission (verdict: Runtime Error):
,c,d,=map(int,input().split())
def func(a,b,c,d):
    while a>=0 and c>=0:
        c-=b
        a-=d
    return "Yes" if a>=c else "No"
print(func(a,b,c,d))
Problem p02705 (python)

Fixed submission:
import math
n=int(input())
def func(n):
    return math.pi*n*2
print(func(n))

Buggy submission (verdict: Runtime Error):
import math 
n=input()
def d(n):
    return math.pi*2*n
  
print(d(n))

Buggy submission (verdict: Runtime Error):

import math 
n=input()
def d (n):
    return math.pi*2*n
  
print(d(n))

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=[b for b in int(input())]
def func(n,a):
    if n< sum(a):return -1
    else: 
        return n-sum(a)

Buggy submission (verdict: Runtime Error):
import math
n=int(input())
def func(n)
    return math.pi*n*2
print(func(n))

Buggy submission (verdict: Runtime Error):
import math
n=int(input())
def func(n)
    return math.pi*n*2
print(n)

Buggy submission (verdict: Runtime Error):
import math
def func(x):
    return math.pi*2*x
x=R  
print(func(x))

Buggy submission (verdict: Runtime Error):
import math
def func(x):
    return math.pi*2*x
  
x=R
print(func(x))

Buggy submission (verdict: Runtime Error):
import math
def func(x):
    return math.pi*2*x
  
x=R

Buggy submission (verdict: Runtime Error):
import math
def circle(x):
    return pi**(2*x)
  
 x=R
Problem p02706 (python)

Fixed submission:
n,m=map(int,input().split())
a=[int(b) for b in input().split()]
def func(n,a):
    if n< sum(a):return "-1"
    else: 
        return n-sum(a)
print(func(n,a))

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=[b for b in int(input().split())]
def func(n,a):
    if n< sum(a):return "-1"
    else: 
        return n-sum(a)
print(func(n,a))

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=[int(b) for b in input()]
def func(n,a):
    if n< sum(a):return "-1"
    else: 
        return n-sum(a)
print(func(n,a))
Problem p02885 (python)

Fixed submission:
A, B = map(int, input().split())
if A - 2*B >= 0:
    print(A - 2*B)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()
for i in range(N-1):
    if S[i] == S[i+1]:
        i += 1
        N -= 1
print(N)
Problem p02898 (python)

Fixed submission:
N, K = map(int, input().split())
lis = list(map(int, input().split()))
count = 0
for i in range(N):
    if lis[i] >= K:
        count += 1
print(count)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
lis = list(map(int, input().split()), N)
count = 0
for i in range(N):
    if lis[i] >= K:
        count += 1
print(count)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
lis = list(map(int, input().split()))
count = 0
for i in range(1, N + 1):
    if lis[i] >= K:
        count += 1
print(count)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
lis = list(map(int, input().split()))
count = 0
for i in range(1, N + 1):
    if lis[i] >= K:
        count += 1
print(count)
Problem p02921 (python)

Fixed submission:
S = input()
T = input()
count = 0
for i in range(3):
    if S[i] == T[i]:
        count = count + 1
print(count)

Buggy submission (verdict: Runtime Error):
S = input().split()
T = input().split()
count = 0
for i in range(3):
    if S[i] == T[i]:
        ++count
print(count)

Buggy submission (verdict: Runtime Error):
S = input().split
T = input().split
count = 0
for i in range(3):
    if S[i] == T[i]:
        ++count
print(count)
Problem p02945 (python)

Fixed submission:
A, B = map(int, input().split())
print(max([A + B, A - B, A * B]))

Buggy submission (verdict: Runtime Error):
A, B = map(int, input().split())
print(max[A + B, A - B, A * B])
Problem p02982 (python)

Fixed submission:
import math
N, D = map(int, input().split())
t = []
for i in range(N):
    t.append(list(map(int, input().split())))
count = 0
sum = 0
for i in range(0, N-1):
    for j in range(i + 1, N):
      for d in range(D):
        sum += pow(t[i][d] - t[j][d], 2)
        sqrt = math.sqrt(sum)
      if sqrt == int(sqrt):
        count += 1
      sum = 0
      sqrt = 0
print(count)

Buggy submission (verdict: Runtime Error):
N, D = map(int, input().split())
t = []
count = 0
sum = 0
for i in range(N):
    t.append(list(map(int, input().split())))
for i in range(0, N-1):
    for j in range(i + 1, N):
      for d in range(D):
        sum += pow(t[i][d] - t[j][d], 2)
        sqrt = math.sqrt(sum)
      print(sum)
      print(sqrt)
      if sqrt == int(sqrt):
        count += 1
      sum = 0
      sqrt = 0
print(count)
Problem p02909 (python)

Fixed submission:
S = input()
if S == "Sunny":
    print("Cloudy")
elif S == "Cloudy":
    print("Rainy")
else:
    print("Sunny")

Buggy submission (verdict: Runtime Error):
S = input()
if S == "Sunny":
  print("Cloudy")
else if S == "Rainy":
  print("Sunny")
else:
  print("Rainy")
Problem p02953 (python)

Fixed submission:
n=int(input())
h=list(map(int,input().split()))
for i in range(n-1):
    if i==0:
        if h[i]>h[i+1]+1:
            print("No")
            exit(0)
        else:
          	h[i]-=1
    elif h[i]<=h[i+1]:
        if h[i]-1>=h[i-1]:
            h[i]-=1
    elif h[i]==h[i+1]+1:
        if h[i]-1>=h[i-1]:
            h[i]-=1
        else:
            print("No")
            exit(0)
    else:
        print("No")
        exit(0)

print("Yes")

Buggy submission (verdict: Runtime Error):
N=int(input())
H=list(map(int,input().split()))
count=0
if N==1:
    print("Yes")
elif N==2:
    if H[0]<=H[1]+1:
        print("Yes")
    else:
        print("No")
else:
    for i in range(N-1):
        if H[i]=<H[i+1]:
            H[i]-=1
            count+=1
        elif H[i]==H[i+1]+1:
            H[i]-=1
            if i==0:
                count+=1
            elif H[i]<H[i-1]:
                print("No")
                break
            else:
                count+=1
        else:
            print("No")
            break
    if count==N-1:
        print("Yes")

Buggy submission (verdict: Runtime Error):
N=int(input())
H=list(map(int,input().split()))
count=0
if len(H)==1:
    print("Yes")
if len(H)==2:
    if H[0]<=H[1]+1:
        print("Yes")
    else:
        print("No")
elif H[0]<=H[1]+1:
    for i in range(1,N-1):
        if H[i]<=H[i+1]:
            count+=1
            continue
        elif H[i]==H[i+1]+1:
            H[i]-=1
            if H[i]<H[i-1]:
                print("No")
                break
            else:
                count+=1
                continue
        else:
            print("No")
            break
else:
    print("No")
if count==N-2:
    print("Yes")
Problem p02957 (python)

Fixed submission:
a,b=sorted(map(int,input().split()))
print((b+a)//2 if (b+a)%2==0 else "IMPOSSIBLE" )

Buggy submission (verdict: Runtime Error):
S=input()
x={}
x_v=0
count=0
for i,j in enumerate(S):
    if j=="?":
        continue
    else:
        x[len(S)-i-1]=j
for m in x.keys():
    x_v+=int(x[m])*(10**m)
for k in range(10**(len(S))):
    k_l=list(str(k))
    a=0
    b=[]
    c=[]
    for key in x.keys():
        if key>=len(k_l):
            continue
        else:
            b.append( k_l[-key-1]=="0" )
            c.append(1)
    if b==c:
        for n in range(len(k_l)):
            a+=int(k_l[-n-1])*(10**n)
        a+=x_v
        if a%13==5:
            count+=1
    else:
        continue
print(count%(7+10**9))
Problem p03160 (python)

Fixed submission:
N=int(input())
h=list(map(int,input().split()))
a=[0]*N
for j in range(1,N):
    if j==1:
        a[1]=a[0]+abs(h[1]-h[0])
    else:
        a[j]=min(a[j-1]+abs(h[j]-h[j-1]),a[j-2]+abs(h[j]-h[j-2]))
print(a[-1])

Buggy submission (verdict: Runtime Error):
N=int(input())
h=list(map(int,input().split()))
memo=[-1]*(N+1)
def a(j):
    if j==0:
        return 0
    elif j==1:
        return abs(h[1]-h[0])
    else:
        if memo[j]==-1:
            memo[j]=min(a(j-1)+abs(h[j]-h[j-1]),a(j-2)+abs(h[j]-h[j-2]))
        return memo[j]
print(a(N-1))

Buggy submission (verdict: Runtime Error):
N=int(input())
h=list(map(int,input().split()))
memo=[-1]*N
def a(j):
    if j==0:
        return 0
    elif j==1:
        return abs(h[1]-h[0])
    else:
        if memo[j]==-1:
            memo[j]=min(a(j-1)+abs(h[j]-h[j-1]),a(j-2)+abs(h[j]-h[j-2]))
        return memo[j]
print(a(N-1))
Problem p03643 (python)

Fixed submission:
N=str(input())
print("ABC"+N)

Buggy submission (verdict: Runtime Error):
NN=str(input())
print("ABC"+N)
Problem p03719 (python)

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

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input(),split())
if a<=c and c<=b:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input(),split())
if a<=c and c<=b:
  print("YES")
else:
  print("NO")
Problem p02694 (python)

Fixed submission:
from math import floor,ceil
x = int(input())
c = 0
p = 100
while p<x:
    p = floor(p*1.01)
    c+=1
print(c)

Buggy submission (verdict: Runtime Error):
from math import log
x = int(input())
x = x/100
return int(log(x)/log(1.01))
Problem p02705 (python)

Fixed submission:
x = int(input())
pi = 3.14159

print(2 * x * pi)

Buggy submission (verdict: Runtime Error):
n, k  = map(int, input().split())
x = 0
for k in range(k, n+2):
  a =k * (k-1)//2
  b = k * (2*n+1-k)//2

  x += b- a +1
  
  
  
print(x%(10^9+7))
Problem p03264 (python)

Fixed submission:
N = int(input())
 
if N % 2 == 0:
  print(int((N/2)**2))
  
else:
  print(int((N // 2)*((N // 2) + 1)))

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

if N % 2 == 0:
  print(int((N/2)**2))
  
else:
  print(int((N // 2)((N // 2) + 1)))

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

if N % 2 == 0:
  print((N/2)**2)
  
else:
  print((N // 2)((N // 2) + 1))

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

if N % 2 == 0:
  print((N/2)**2)
  
else:
  print( (N // 2)(N // 2 + 1)
Problem p03288 (python)

Fixed submission:
R = int(input())

if R < 1200:
  print("ABC")
  
elif R < 2800:
  print("ARC")
  
else:
  print("AGC")

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

if R < 1200:
  pritn("ABC")
  
elif R < 2800:
  print("ARC")
  
else:
  print("AGC")
Problem p03337 (python)

Fixed submission:
a, b = map(int,input().split())

print(max(a + b, a - b, a * b))

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

print(max(a + b, a - b, a * b)
Problem p03407 (python)

Fixed submission:
a, b, c = map(int,input().split())

if (a + b) >= c:
  print("Yes")
  
else:
  print("No")

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

if　(a + b) >= c:
  print("Yes")
  
else:
  print("No")

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

if　(a + b) >= C:
  print("Yes")
  
else:
  print("No")

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

if　(a + b) <= C:
  print("Yes")
  
else:
  print("No")
Problem p03415 (python)

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

print(A[0] + B[1] + C[2])

Buggy submission (verdict: Runtime Error):
A = input()
B = input()
C = input()

print(N[0] + N[1] + N[2])
Problem p03433 (python)

Fixed submission:
N = int(input())
A = int(input())

B = N % 500

if B > A:
  print("No")
        
else:
        print("Yes")

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

B = N % 500

if B > A:
  print("No')
        
else:
        print("Yes")
Problem p03485 (python)

Fixed submission:
a, b = map(int,input().split())

if (a + b) % 2 == 0:
  print(int((a + b)/2))
  
else:
  print(int((a + b) // 2) +1)

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

print(int(((a + b) // 2)+1))

Buggy submission (verdict: Runtime Error):
a,b = int(inout().split())

print(int((a + b) // 2 + 1))

Buggy submission (verdict: Runtime Error):
a,b = int(inout().split())

print(int((a + b) / 2))
Problem p03605 (python)

Fixed submission:
N = str(input())
li = [N[0], N[1]]

if '9' in li :
  print("Yes")
  
else:
  print('No')

Buggy submission (verdict: Runtime Error):
N = str(input())
li = [N[0], N[1]]

if li in '9':
  print("Yes")
  
else:
  print('N0')
Problem p03623 (python)

Fixed submission:
x, a, b = map(int,input().split())

if abs(x - b) > abs(x - a):
  print("A")
  
else:
  print("B")

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

if |x - b| > |x - a|:
  print("A")
  
else:
  print("B")
Problem p03635 (python)

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

print(int((n - 1) * (m - 1)))

Buggy submission (verdict: Runtime Error):
n, m = int(input().split())

print(int((n - 1) * (m - 1)))
Problem p03671 (python)

Fixed submission:
a,b,c = sorted(map(int,input().split()))

print(a+b)

Buggy submission (verdict: Runtime Error):
a,b,c = sort(map(int,input().split()))

print(a+b)
Problem p03737 (python)

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

a = A.upper()
b = B.upper()
c = C.upper()

print(a[0] + b[0] + c[0])

Buggy submission (verdict: Runtime Error):
A, B, C= input().split().upper()

print(A[0] + B[0] + c[0])
Problem p03759 (python)

Fixed submission:
a, b, c = map(int,input().split())

d = b - c
e = a - b

if d == e:
  print("YES")

else:
  print("NO")

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

d = b - c
e = a - b

if d = e:
  print("Yes")

else:
  print("No")
Problem p03773 (python)

Fixed submission:
a, b = map(int,input().split())

print((a + b) % 24)

Buggy submission (verdict: Runtime Error):
a, b = map(int,input())

if (a + b) < 25:
  print(a + b)

else:
  print((a + b) - 24)

Buggy submission (verdict: Runtime Error):
a, b = map(int,input())

if (a + b) < 25:
  print(a + b)

else:
  print(24 - (a + b))
Problem p03777 (python)

Fixed submission:
a, b = input().split()

if (a == "H" and b == "H") or (a == "D" and b == "D"):
    print("H")

elif (a == "H" and b == "D") or (a == "D" and b == "H"):
    print("D")

Buggy submission (verdict: Runtime Error):
a, b = input().split()

if (a = "H" and b = "H") or (a = "D" and b = "D":
    print("H")

elif (a = "H" and b = "D") or (a = "D" and b = "H"):
    print("D")
Problem p03813 (python)

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

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

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

if x, 1200:
  print(ABC)
  
else:
  print(ARC)
Problem p03943 (python)

Fixed submission:
li = sorted(list(map(int,input().split())))

a = li[0]
b = li[1]
c = li[2]

if a + b == c:
  print('Yes')

else:
  print('No')

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

sum = a + b + c

if sum % 2 == 0:
  print(Yes)

else:
  print(No)

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

sum = a + b + c

if sum % 2 = 0:
  print(Yes)

else:
  print(No)
Problem p04043 (python)

Fixed submission:
a, b, c = map(int,input().split())

if a == 5 and b == 5 and c == 7:
  print('YES')

elif a == 5 and b == 7 and c == 5:
  print('YES')

elif a == 7 and b == 5 and c == 5:
  print('YES')

else:
  print('NO')

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

if a == 5 and b == 5 and c == 7:
  print(YES)

elif a == 5 and b == 7 and c == 5:
  print(YES)

elif a == 7 and b == 5 and c == 5:
  print(YES)

else:
  print(NO)
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)

l = p[:x] + q[:y]
l.sort()

i = 0
while i < len(l) and i < len(r):
  if l[i] < r[i]:
    l[i] = r[i]
    i += 1
  else:
    break

print(sum(l))

Buggy submission (verdict: Runtime Error):
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)

l = p[:x] + q[:y]
l.sort()

i = 0
while l[i] < r[i] and i < len(l) and i < len(r):
    l[i] = r[i]
    i += 1

print(sum(l))
Problem p02882 (python)

Fixed submission:
a, b, x = map(int,input().split())
s = x/a
import math
if s == a * b:
  print(0)
elif (a*b / 2 >= s):
  h = 2*s/b
  rad = math.atan(h/b)
  print(90.0 - math.degrees(rad))
else:
  l = 2*(b - s/a)
  rad = math.atan(a/l)
  print(90.0 - math.degrees(rad))

Buggy submission (verdict: Runtime Error):
a, b, x = map(int,input().split())
s = x/a
import math
if (a*b / 2 >= s):
  h = 2*s/b
  rad = math.atan(h/b)
  print(90.0 - math.degrees(rad))
else:
  l = 2*(b - s/a)
  rad = math.atan(a/l)
  print(90.0 - math.degrees(rad))

Buggy submission (verdict: Runtime Error):
a, b, x = map(int,input().split())
s = x/a
import math
if (a*b / 2 >= s):
  h = 2*s/b
  rad = math.atan(h/b)
  print(90.0 - math.degrees(rad))
else:
  rest = a*b - s
  l = 2*rest/a
  rad = math.atan(a/l)
  print(90.0 - math.degrees(rad))

Buggy submission (verdict: Runtime Error):
a, b, x = map(int,input().split())
s = x/a
import math
if (a*b / 2 >= s):
  h = 2*s/b
  rad = math.atan(h/b)
  print(90.0 - math.degrees(rad))
else:
  rest = a*b - s
  l = 2*rest/a
  rad = math.atan(a/l)
  print(90.0 - math.degrees(rad))
Problem p02922 (python)

Fixed submission:
a, b = map(int,input().split())
ans = 0
plug = 1
while (plug < b):
  plug += a-1
  ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
a, b = map(int,input().split())
ans = 0
while ((a-1)*ans < b):
  ans++
print(ans)
Problem p03200 (python)

Fixed submission:
s = input()
w = 0
b = 0
wa = 0
ba = 0
l = len(s)
 
for i in range(l):
  if s[i] == 'W':
    wa += i - w
    w += 1
  if s[-1-i] == 'B':
    ba += i - b
    b += 1
    
print(min(ba, wa))

Buggy submission (verdict: Runtime Error):
BWBWBW

Buggy submission (verdict: Runtime Error):
s = input()
ans = 0

def reverse(s,i):
  if s[i] == 'B' and s[i+1] == 'W':
	s[i] = 'W'
	s[i+1] = 'B'
    ans += 1
  
while True:
  s = ans
  for i in range(len(s) - 1):
    reverse(s,i)
  if s == ans:
    print(ans)
    break

Buggy submission (verdict: Runtime Error):
s = input()
ans = 0

def reverse(s,i):
  if s[i] == 'B' and s[i+1] == 'B':
	s[i] = 'W'
	s[i+1] = 'B'
    ans += 1
  
while True:
  s = ans
  for i in range(len(s) - 1):
    reverse(s,i)
  if s == ans:
    print(ans)
    break
Problem p03160 (python)

Fixed submission:
N = int(input())
h = [int(i) for i in input().split()]
minToatalCostList = [0 for i in range(N)]

for i in range(N) :
	if i > 1 :
		minToatalCostList[i] = min( abs(h[i] - h[i-1]) + minToatalCostList[i-1], abs(h[i] - h[i-2]) + minToatalCostList[i-2] )
	elif i == 1:
		minToatalCostList[i] = abs(h[i] - h[i-1])
	else :
		minToatalCostList[i] = 0

print(minToatalCostList[N-1])

Buggy submission (verdict: Runtime Error):
N,K = [int(i) for i in input().split()]
h = [int(i) for i in input().split()]
minTotalCostList = [0 for i in range(N)]
minTotalCostList[0] = 0
for i in range(1,N) :
	for j in range(1,K+1) :
		if j == 1 :
			minTotalCostList[i] = (abs(h[i] - h[i-j]) + minTotalCostList[i-j] )
		elif j > i or minTotalCostList[i] == 0 :
			break
		else :
			minTotalCostList[i] = min(minTotalCostList[i], (abs(h[i] - h[i-j]) + minTotalCostList[i-j] ))

print(minTotalCostList[N-1])

Buggy submission (verdict: Runtime Error):
N,K = [int(i) for i in input().split()]
h = [int(i) for i in input().split()]
minTotalCostList = [0 for i in range(N)]
minTotalCostList[0] = 0
for i in range(1,N) :
	for j in range(1,K+1) :
		if j <= i and minTotalCostList[i] != 0 and j != 1 :
			minTotalCostList[i] = min(minTotalCostList[i], (abs(h[i] - h[i-j]) + minTotalCostList[i-j] ))
		elif j > i or minTotalCostList[i] == 0 :
			break
		elif j == 1 :
			minTotalCostList[i] = (abs(h[i] - h[i-j]) + minTotalCostList[i-j] )

print(minTotalCostList[N-1])


N = int(input())
h = [int(i) for i in input().split()]
minTotalCostList = [0 for i in range(N)]

for i in range(N) :
	if i > 1 :
		minTotalCostList[i] = min( abs(h[i] - h[i-1]) + minTotalCostList[i-1], abs(h[i] - h[i-2]) + minTotalCostList[i-2] )
	elif i == 1:
		minTotalCostList[i] = abs(h[i] - h[i-1])
	else :
		minTotalCostList[i] = 0

print(minTotalCostList[N-1])

Buggy submission (verdict: Runtime Error):
N,K = [int(i) for i in input().split()]
h = [int(i) for i in input().split()]
minToatalCostList = [0 for i in range(N)]
minToatalCostList[0] = 0

for i in range(1,N) :
	for j in range(1,K+1) :
		if j <= i and minTotalCostList[i] != 0 and j != 1 :
			minToatalCostList[i] = min(minToatalCostList[i], (abs(h[i] - h[i-j]) + minToatalCostList[i-j] ))
		elif j > i or minToatalCostList[i] == 0 :
			break
		elif j == 1 :
			minToatalCostList[i] = (abs(h[i] - h[i-j]) + minToatalCostList[i-j] )

print(minToatalCostList[N-1])

Buggy submission (verdict: Runtime Error):
N,K = [int(i) for i in input().split()]
h = [int(i) for i in input().split()]
minToatalCostList = [10000 for i in range(N)]
minToatalCostList[0] = 0

for i in range(1,N) :
	for j in range(1,K+1) :
		if j > i or minToatalCostList[i] == 0 :
			break
		else :
			minToatalCostList[i] = min(minToatalCostList[i], abs(h[i] - h[i-j]) + minToatalCostList[i-j] )

print(int(minToatalCostList[N-1]))
Problem p03163 (python)

Fixed submission:
N, W = [int(i) for i in input().split()]
noWeight = [[0 for j in range(W+1)] for i in range(N)]
wv = [[] for i in range(N)]
for i in range(N) :
	wv = [int(i) for i in input().split()]
	for j in range(1,W+1) :
		if i != 0 :
			if j < wv[0]  :
				noWeight[i][j] = noWeight[i-1][j]
			else :
				noWeight[i][j] = max(noWeight[i-1][j - wv[0]] + wv[1], noWeight[i-1][j])
		else :
			if j >= wv[0] :
				noWeight[i][j] = wv[1]
			else :
				noWeight[i][j] = 0
	
print(noWeight[N-1][W])

Buggy submission (verdict: Runtime Error):
noWeight = [[0 for j in range(W+1)] for i in range(N)]
wv = [[] for i in range(N)]
for i in range(N) :
	wv = [int(i) for i in input().split()]
	for j in range(1,W+1) :
		if i != 0 :
			if j < wv[0]  :
				noWeight[i][j] = noWeight[i-1][j]
			else :
				noWeight[i][j] = max(noWeight[i-1][j - wv[0]] + wv[1], noWeight[i-1][j])
		else :
			if j >= wv[0] :
				noWeight[i][j] = wv[1]
			else :
				noWeight[i][j] = 0
	
print(noWeight[N-1][W])